-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package util | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/goccy/go-yaml/lexer" | ||
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, ubuntu-latest)
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, ubuntu-latest)
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, ubuntu-latest)
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, macos-latest)
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, macos-latest)
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, macos-latest)
Check failure on line 6 in internal/util/goccy_yaml_test.go GitHub Actions / tests (1.22.4, windows-2022)
|
||
"github.com/goccy/go-yaml/parser" | ||
) | ||
|
||
var brokenYaml = ` | ||
this: isSomeYmal | ||
imCurrentlyTypinghere: dsa | ||
baz: | ||
imCurrentlyTypinghere | ||
isNested: Yaml | ||
baz2: | ||
with: Brokf | ||
` | ||
|
||
func TestLexer(t *testing.T) { | ||
got := lexer.Tokenize(brokenYaml) | ||
|
||
for _, token := range got { | ||
t.Log(token.Type, token.Position.String()) | ||
} | ||
|
||
t.Log(got) | ||
t.Fail() | ||
} | ||
|
||
func TestParser(t *testing.T) { | ||
tokens := lexer.Tokenize(brokenYaml) | ||
got, err := parser.Parse(tokens, parser.ParseComments) | ||
if got == nil { | ||
t.Fatal(err) | ||
} | ||
|
||
nodes := got.Docs | ||
|
||
for _, node := range nodes { | ||
t.Log(node.Type(), node.String()) | ||
} | ||
|
||
t.Fail() | ||
} |