Skip to content

Commit 04481e8

Browse files
committed
Add test
1 parent 6ad72b8 commit 04481e8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

vars_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,11 @@ func TestVarToContext(t *testing.T) {
8888
ctx = shared.VarToContext(pCtx, "$quux", true)
8989
assert.Equal(t, map[string]interface{}{"$foo": "bar", "$baz": "qux", "$quux": true}, shared.VarsFromContext(ctx))
9090
}
91+
92+
func TestDecodeJSONNumber(t *testing.T) {
93+
assert.Equal(t, int64(1), shared.DecodeJSONNumber("1"))
94+
assert.Equal(t, int64(-1), shared.DecodeJSONNumber("-1"))
95+
assert.Equal(t, 1.0, shared.DecodeJSONNumber("1.0"))
96+
assert.Equal(t, 1.23, shared.DecodeJSONNumber("1.23"))
97+
assert.Equal(t, uint64(17294094973108486143), shared.DecodeJSONNumber("17294094973108486143"))
98+
}

0 commit comments

Comments
 (0)