Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Add tests for command line arguments #498

Open
hdamron17 opened this issue Aug 9, 2020 · 4 comments
Open

Add tests for command line arguments #498

hdamron17 opened this issue Aug 9, 2020 · 4 comments
Labels
binary Related to the swcc binary good first issue Good for newcomers testing More tests for the compiler!

Comments

@hdamron17
Copy link
Collaborator

Currently there are no tests to ensure command line arguments work as expected. It may also be good to check that the help message stays up to date with the accepted flags. Tests could either be runner tests or unit tests of parse_args (or both!).

@hdamron17 hdamron17 added good first issue Good for newcomers testing More tests for the compiler! binary Related to the swcc binary labels Aug 9, 2020
@jyn514
Copy link
Owner

jyn514 commented Aug 9, 2020

Rust has ui-tests which let you add additional arguments at the top:

// compile-flags: -Coverflow-checks=off
fn main() {
    let x = 0 - 1;
}

Maybe we could do something similar for runner tests?

@hdamron17
Copy link
Collaborator Author

I think unit tests would be preferred where possible (and I think they would be since parse_args is its own function). But having some runner tests of that sort would also be helpful to check that the functionality of the command line args is used properly and not just that the flag is read in right. (e.g. the include directory is actually included).

@hdamron17
Copy link
Collaborator Author

Also, a lot of the flags require external files which may be complicated for the runner tests (not sure).

@jyn514
Copy link
Owner

jyn514 commented Aug 9, 2020

That part shouldn't be too bad - see for example https://github.com/jyn514/saltwater/tree/master/tests/runner-tests/cpp/include which keeps the external files in the same directory.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
binary Related to the swcc binary good first issue Good for newcomers testing More tests for the compiler!
Projects
None yet
Development

No branches or pull requests

2 participants