Skip to content

Commit

Permalink
Add another test case and TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzojive committed Oct 12, 2023
1 parent 6487760 commit 80d3113
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions gazelle/kotlin/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (p *treeSitterParser) Parse(filePath, source string) (*ParseResult, []error
} else if nodeI.Type() == "package_header" {
if result.Package != "" {
fmt.Printf("Multiple package declarations found in %s\n", filePath)
// TODO: Don't exit here and return an error instead?
os.Exit(1)
}

Expand Down
14 changes: 14 additions & 0 deletions gazelle/kotlin/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ import /* fdsa */ d/* asdf */.* // w
pkg: "x",
imports: []string{"a", "c", "d"},
},
{
desc: "value class",
kt: `
import a.b.C
import c.d.E as EEE
// Maybe xyz.numbers should be an import?
@JvmInline
value class Energy(val kwh: xyz.numbers.Double) { fun thing(): Unit {}}
`,
filename: "simple.kt",
pkg: "",
imports: []string{"a.b", "c.d"},
},
}

func TestTreesitterParser(t *testing.T) {
Expand Down

0 comments on commit 80d3113

Please # to comment.