MCPcopy Create free account
hub / github.com/RedisGraph/redisgraph-go / TestUtils

Function TestUtils

client_test.go:407–431  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

405}
406
407func TestUtils(t *testing.T) {
408 res := RandomString(10)
409 assert.Equal(t, len(res), 10)
410
411 res = ToString("test_string")
412 assert.Equal(t, res, "\"test_string\"")
413
414 res = ToString(10)
415 assert.Equal(t, res, "10")
416
417 res = ToString(1.2)
418 assert.Equal(t, res, "1.2")
419
420 res = ToString(true)
421 assert.Equal(t, res, "true")
422
423 var arr = []interface{}{1,2,3,"boom"}
424 res = ToString(arr)
425 assert.Equal(t, res, "[1,2,3,\"boom\"]")
426
427 jsonMap := make(map[string]interface{})
428 jsonMap["object"] = map[string]interface{} {"foo": 1}
429 res = ToString(jsonMap)
430 assert.Equal(t, res, "{object: {foo: 1}}")
431}
432
433func TestNodeMapDatatype(t *testing.T) {
434 graph.Flush()

Callers

nothing calls this directly

Calls 2

RandomStringFunction · 0.85
ToStringFunction · 0.85

Tested by

no test coverage detected