metaborg / spt

Apache License 2.0
0 stars 8 forks source link

Support specification of multiple files in a single SPT test case #40

Open loekgugten opened 2 years ago

loekgugten commented 2 years ago

Many languages allow programs to import programs from other files. To test things related to importing other files, you need to be able to specify multiple files in a single test case. However, currently you can specify at most one full program (file) in a single SPT test case. So, testing the import feature of languages is not possible with SPT.

A current workaround is adding a language construct to your language that replicates the start of a new file in a single file, but that workaround changes the grammar of a language purely for testing which is not tenable.

AZWN commented 2 years ago

We should especially be careful about the interaction between multifile tests and fixtures. I can think of at least three scenario's:

Additionally, I guess we should not allow custom start symbols, as that will likely trip up any analysis strategy anyway.

AZWN commented 2 years ago

That said, we should think about the syntax for such a feature. Something I'd like is the following:

module test

multifile test my test name
  file foo.ext [[
    // foo contents
  ]]
  file bar.ext [[
    // bar contents
  ]]
  // etc.

I think that should be unambiguous, as file entries are properly delimited, and multifile test suites end at the start of another test (indicated by multifile test or test), while rather clean and concise.