MCPcopy Create free account
hub / github.com/expr-lang/expr / TestParse

Function TestParse

parser/parser_test.go:16–978  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestParse(t *testing.T) {
17 tests := []struct {
18 input string
19 want Node
20 }{
21 {
22 "a",
23 &IdentifierNode{Value: "a"},
24 },
25 {
26 `"str"`,
27 &StringNode{Value: "str"},
28 },
29 {
30 "`hello\nworld`",
31 &StringNode{Value: `hello
32world`},
33 },
34 {
35 "3",
36 &IntegerNode{Value: 3},
37 },
38 {
39 "0xFF",
40 &IntegerNode{Value: 255},
41 },
42 {
43 "0x6E",
44 &IntegerNode{Value: 110},
45 },
46 {
47 "0X63",
48 &IntegerNode{Value: 99},
49 },
50 {
51 "0o600",
52 &IntegerNode{Value: 384},
53 },
54 {
55 "0O45",
56 &IntegerNode{Value: 37},
57 },
58 {
59 "0b10",
60 &IntegerNode{Value: 2},
61 },
62 {
63 "0B101011",
64 &IntegerNode{Value: 43},
65 },
66 {
67 "10_000_000",
68 &IntegerNode{Value: 10_000_000},
69 },
70 {
71 "2.5",
72 &FloatNode{Value: 2.5},
73 },

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92
RunMethod · 0.80
DumpFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…