anderseknert/rego-test-assertions

assert.contains causing `rego_parse_error` with opa 0.43

aflmp opened this issue · 3 comments

aflmp commented

Hello Anders,
Just wanted to report this - running opa test with this library on opa 0.43.0 is erroring

1 error occurred during loading: hello/assert.rego:52: rego_parse_error: unexpected else keyword
        } else = false {
          ^

I'm guessing this is because of

import future.keywords
which imports contains keyword that was introduced in 0.42.0 and makes a syntax err.

my temporary fix is to replace
import future.keywords line with

import future.keywords.in
import future.keywords.every

Thanks Alam! You're absolutely right.

Renaming would be a "breaking" change, but I think it's probably worth doing. This isn't really a library that you'd "upgrade" automatically anyway, and since it's only used for tests, there would be no impact to speak of.

Just thinking of what name to use instead.. in would have been nice, but is taken as well. has and not_has, maybe? Technically, we could just keep the name, since we don't (yet) make use of the contains keyword here, but I'd rather avoid the conflict either way, especially since users likely will use it. So, a rename it is :)

Have pushed the change suggested above. Thanks for bringing it to my attention!

aflmp commented

perfect, thank you Anders!