(t *testing.T)
| 38 | var noUser = map[string]interface{}{"name": nil, "channels": []string{}} |
| 39 | |
| 40 | func TestOttoValueToStringArray(t *testing.T) { |
| 41 | ctx := base.TestCtx(t) |
| 42 | // Test for https://github.com/robertkrimen/otto/issues/24 |
| 43 | value, _ := otto.New().ToValue([]string{"foo", "bar", "baz"}) |
| 44 | strings := ottoValueToStringArray(ctx, value) |
| 45 | assert.Equal(t, []string{"foo", "bar", "baz"}, strings) |
| 46 | |
| 47 | // Test for https://issues.couchbase.com/browse/CBG-714 |
| 48 | value, _ = otto.New().ToValue([]interface{}{"a", []interface{}{"b", "g"}, "c", 4}) |
| 49 | strings = ottoValueToStringArray(ctx, value) |
| 50 | assert.Equal(t, []string{"a", "c"}, strings) |
| 51 | } |
| 52 | |
| 53 | // verify that our version of Otto treats JSON parsed arrays like real arrays |
| 54 | func TestJavaScriptWorks(t *testing.T) { |
nothing calls this directly
no test coverage detected