MCPcopy Create free account
hub / github.com/araddon/qlbridge / TestExprRoundTrip

Function TestExprRoundTrip

expr/node_test.go:43–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestExprRoundTrip(t *testing.T) {
44 t.Parallel()
45 for _, et := range exprTests {
46 exp, err := expr.ParseExpression(et.qlText)
47 if et.ok {
48 assert.Equal(t, err, nil, "Should not error parse expr but got %v for %s", err, et.qlText)
49 by, err := json.MarshalIndent(exp.Expr(), "", " ")
50 assert.Equal(t, err, nil)
51 u.Debugf("%s", string(by))
52 en := &expr.Expr{}
53 err = json.Unmarshal(by, en)
54 assert.Equal(t, err, nil)
55 _, err = expr.NodeFromExpr(en)
56 assert.Equal(t, err, nil, et.qlText)
57
58 // by, _ = json.MarshalIndent(nn.Expr(), "", " ")
59 // u.Debugf("%s", string(by))
60
61 // TODO: Fixme
62 // u.Debugf("%s", nn)
63 //assert.True(t, nn.Equal(exp), "%s doesn't match %s", et.qlText, nn.String())
64
65 } else {
66 assert.NotEqual(t, nil, err)
67 }
68
69 }
70}
71
72func TestNodeJson(t *testing.T) {
73 t.Parallel()

Callers

nothing calls this directly

Calls 5

ParseExpressionFunction · 0.92
NodeFromExprFunction · 0.92
EqualMethod · 0.65
ExprMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected