FallenAngel97 / tree-sitter-rego

https://decodeapps.pp.ua/blog/post/rego-treesitter
MIT License
11 stars 6 forks source link

Added test suite #4

Closed krzykli closed 1 year ago

krzykli commented 1 year ago

Added a bunch of test cases. There are a few that are failing, to highlight them in the suite I just appended (broken) at the end of the expected output copied from treesitter parse to show the current state.

I ❱ tree-sitter test
  iteration:
    ✗ for all
    ✓ any match
  rules:
    ✗ union
    ✗ boolean conditionals
    ✓ conditionals
    ✓ incremental
    ✓ ordered (else)
    ✓ functions (boolean)
    ✓ functions (conditionals)
    ✗ reference heads
  lookup:
    ✓ array - index
    ✗ array - last value
    ✓ array - some...in
    ✓ object - initialization
    ✓ object - key lookup
    ✓ object - path
    ✓ object - check key value
    ✓ set - initialization
    ✓ set - lookup
  assignment_and_equality:
    ✓ assignment
    ✗ comparison
    ✗ unification
  aliases:
    ✓ Rego alias for package
shaded-enmity commented 1 year ago

This is looking great! Appreciate the time to put all of these together and organise them nicely. I think that some of the test cases are failing because they're "free standing" expressions and Rego requires expressions to be part of rules:

x == y # should fail

result := x == y # should work
krzykli commented 1 year ago

@shaded-enmity that's a good point, I fixed the two tests that needed to be wrapped in rules :)

I think tomorrow I'll remove failing tests and log issues instead to keep better track of them (now that we have CI working) :)

krzykli commented 1 year ago

Alrighty, updated the tests with the new grammar. Tests are passing, but I left ERROR or MISSING nodes in. Will log issues against them now to track them.

FallenAngel97 commented 1 year ago

Okay. Thanks. Merged