Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
loekgugten opened this issue May 11, 2022 · 2 comments
Open

Comments

@loekgugten
Copy link

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
Copy link
Contributor

AZWN commented May 11, 2022

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

  • Not allowing multifile tests and fixtures in a single module.
  • Having a particular file in the test use the fixture (e.g. the first one).
  • Having all files use the fixture.

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

@AZWN
Copy link
Contributor

AZWN commented May 11, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants