tokay-lang / tokay

Tokay is a programming language designed for ad-hoc parsing, inspired by awk.
https://tokay.dev
MIT License
236 stars 7 forks source link

Improving test facilities to new format #99

Open phorward opened 1 year ago

phorward commented 1 year ago

It might be worth to change the current implementation of testmode:repl tests into a different notation, which can also be used for examples or explanations.

Current notation (Tokay v0.6)

#testmode:repl
print("a")
print("b" Int)
#---
#23
#---
#a
#b23

Improved notation (proposal by this issue):

#testmode:repl
print("a")  # a
print("b" Int)  # b23
#---
#23

The reason for this proposal:

  1. Better readability, especially for huger testcases. See dict.tok, for example. It isn't obvious to which input the output lines refer to.
  2. Testcases can also be used for documentation, to quickly show which result a given command produces when typed into the REPL
phorward commented 7 months ago

After some further development on Logics and its test suite, it became clearer and more convenient to provide a test-format as described here: https://github.com/viur-framework/logics#shared-test-cases