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

Print an alert when trying to test a non-test file #2506

Closed
emmakatherina opened this issue Jun 3, 2018 · 7 comments · Fixed by #2519
Closed

Print an alert when trying to test a non-test file #2506

emmakatherina opened this issue Jun 3, 2018 · 7 comments · Fixed by #2519
Labels
kind: discussion discussions, questions, requests for comments, and so on kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements

Comments

@emmakatherina
Copy link
Contributor

While working on a GAP package I tried to test a file called testparallel.g which itself already calls TestDirectory(). As a GAP beginner I didn't know that this file should be called by writing Read("testparallel.g") and wouldn't have found out if I wasn't explicitely told about it.
Maybe we could make this part easier for beginners by printing a warning when a non-test file is called by Test()?
Me and @ssiccha where thinking about something like The tested file is not a test file and should preferably be called with Read().

Would it be easy to distinguish between test files and non-test files? What do you think about this suggestion?

@ssiccha
Copy link
Contributor

ssiccha commented Jun 3, 2018

The reason for Emma 's confusion was that testing testparallel.g returned true. From the pov of Test, it contains no gap > input lines but contains “output“ lines. So it just returns true.

Wrt Emma's suggestion: I don't think it is necessary to talk about what a test file or non-test file is. If I read the proposed warning, I would then have to look into the documentation to find out the exact definition of when a file is considered a test file.

I think Test could alternatively give a warning message like The test file contains no input lines to execute. This should be easy to implement and is sufficient to let the user know they Tested the wrong file, IMO.

Alternatively, one could let testing a file which contains no gap > input lines but contains “output“ lines return false.

@ssiccha ssiccha added kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements request for comments labels Jun 3, 2018
@ChrisJefferson
Copy link
Contributor

I agree we should do something better. I often run Read on tests and Test and gap files.

I think we should:

  1. report if a tested file didn't have any tests in it.
  2. (maybe more controversial) warn if a file ending .tst is Read, or a file ending .g/.hi/.gd is Tested.

@olexandr-konovalov
Copy link
Member

+1. Maybe a warning when Test called on a file not having a .tst extension?

@ssiccha
Copy link
Contributor

ssiccha commented Jun 3, 2018

@ChrisJefferson

  1. +1
  2. I think printing a warning if Test is called with a .g* file is fine since this doesn't not change behavior when actually testing .tst files.
    For Read being called on .tst files: This should anyways throw Syntax errors when it encounters gap> . We could give a special error message in this situation.

@fingolfin
Copy link
Member

Clearly Test should produce an error if it see lines that neither start with gap> nor are comments nor are outputs to previous commands. If we manage that, I'd prefer if it did not check the file extensions.

As to Read, I think the output one gets now when reading a .tst file is "good enough",

@fingolfin
Copy link
Member

@emmakatherina Thanks for your report. This is now improved in the master branch, and this shall be in GAP 4.10.

@fingolfin
Copy link
Member

This will also be further improved by #2524

ChrisJefferson pushed a commit to ChrisJefferson/gap that referenced this issue Jun 14, 2018
@fingolfin fingolfin added kind: discussion discussions, questions, requests for comments, and so on and removed kind: request for comments labels Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: discussion discussions, questions, requests for comments, and so on kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants