MCPcopy
hub / github.com/pelletier/go-toml / TestNodeChaining

Function TestNodeChaining

unstable/parser_test.go:943–962  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

941}
942
943func 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
964func TestMultipleExpressions(t *testing.T) {
965 // Test parsing multiple top-level expressions

Callers

nothing calls this directly

Calls 7

ResetMethod · 0.95
NextExpressionMethod · 0.95
ExpressionMethod · 0.95
EqualFunction · 0.92
NodeMethod · 0.80
KeyMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…