github.com/goki/ki@v1.1.11/kit/maps_test.go (about)

     1  // Copyright (c) 2018, The GoKi Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package kit
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  // test map type functions
    12  func TestMapType(t *testing.T) {
    13  	var mp map[string]int
    14  
    15  	ts := MapValueType(mp).String()
    16  	if ts != "int" {
    17  		t.Errorf("map val type should be int, not: %v\n", ts)
    18  	}
    19  
    20  	ts = MapValueType(&mp).String()
    21  	if ts != "int" {
    22  		t.Errorf("map val type should be int, not: %v\n", ts)
    23  	}
    24  
    25  	ts = MapKeyType(mp).String()
    26  	if ts != "string" {
    27  		t.Errorf("map key type should be string, not: %v\n", ts)
    28  	}
    29  
    30  	ts = MapKeyType(&mp).String()
    31  	if ts != "string" {
    32  		t.Errorf("map key type should be string, not: %v\n", ts)
    33  	}
    34  
    35  }