overflow_probe/crawler/crawler_map_convert_test.go

20 lines
264 B
Go
Raw Normal View History

2017-08-04 02:27:37 +00:00
package crawler
import (
"fmt"
"testing"
)
func TestInterfaceValueToTypeCast(t *testing.T) {
m := make(map[string]interface{})
m["a"] = "1"
m["b"] = 2
m["c"] = false
fmt.Println(m["a"].(string))
fmt.Println(m["b"].(int))
fmt.Println(m["c"].(bool))
}