(t *testing.T)
| 941 | } |
| 942 | |
| 943 | func TestNodeChaining(t *testing.T) { |
| 944 | // Test that sibling nodes are correctly chained via Next() |
| 945 | // This exercises the internal PushAndChain functionality through public APIs |
| 946 | doc := `a.b.c = 1` |
| 947 | p := Parser{} |
| 948 | p.Reset([]byte(doc)) |
| 949 | p.NextExpression() |
| 950 | |
| 951 | e := p.Expression() |
| 952 | // KeyValue has children: value, then key parts (a, b, c) |
| 953 | keyIt := e.Key() |
| 954 | |
| 955 | // Collect all key parts by following the iterator |
| 956 | var keys []string |
| 957 | for keyIt.Next() { |
| 958 | keys = append(keys, string(keyIt.Node().Data)) |
| 959 | } |
| 960 | |
| 961 | assert.Equal(t, []string{"a", "b", "c"}, keys) |
| 962 | } |
| 963 | |
| 964 | func TestMultipleExpressions(t *testing.T) { |
| 965 | // Test parsing multiple top-level expressions |
nothing calls this directly
no test coverage detected
searching dependent graphs…