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

fix #16256: nimout: <empty> should give error (vacuously true); improve a few tests #18089

Merged
merged 8 commits into from
May 31, 2021

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented May 25, 2021

eg:

  • targets: "c" is bad (prevents honoring $target which can be cpp in CI via NIM_COMPILE_TO_CPP for eg)
  • things like action: "compile" whereas the test should actually run
  • things like exitcode: 0 or action: "run" which are the default
  • things like timeout: 60.0 which are there for no valid reason
  • super non-DRY tests which makes it impossible to spot if there's anything interesting/unusual in the test going on
  • things like nimout: "" which is vacuously true (ie testament: nimout: <empty> should give error (vacuously true) #16256, which i'm fixing in this PR)
  • random flags like --styleCheck:hint --panics:on which have no effect as far as the test is concerned
  • tests that don't actually test anything (output: with action: "compile") or don't check the results
  • misplaced tests (eg tests/stdlib/t9710.nim); tests/stdlib should be for things like tos.nim
  • tests using cmd instead of matrix
  • tests made gratiously non-joinable for no valid reason
  • (in most cases) things like output: "test AObj" which should be replaced by doAssert / check
  • etc...

(also fixes #13952 (comment), #13952 (comment))

(not that there are exceptions to above rules but they're rare and don't apply in this PR)

future work

  • testament should give doAssert/spec error when it detects bad combinations instead of silently accepting and succeeding with some arbitrary resolution, eg:

    • action: "compile" + output should error
    • targets: "c cpp" + cmd: "nim c ..." should error
  • ideally, it would also give error under some --specCheck testament flag for vacuously true spec flags or suspicious combinations of flags to help users improve their tests

@timotheecour timotheecour mentioned this pull request May 25, 2021
@timotheecour timotheecour added the Ready For Review (please take another look): ready for next review round label May 25, 2021
@timotheecour timotheecour changed the title fix #16256: nimout: <empty> should give error (vacuously true); improve a number of bad tests fix #16256: nimout: <empty> should give error (vacuously true); improve a few tests May 26, 2021
@@ -401,6 +403,9 @@ proc parseSpec*(filename: string): TSpec =
if skips.anyIt(it in result.file):
result.err = reDisabled

if nimoutFound and result.nimout.len == 0 and not result.nimoutFull:
doAssert false, "empty `nimout` is vacuously true, use `nimoutFull:true` if intentional"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Report spec errors as errors, doAssert is not a mechanism for reporting errors. Errors are not bugs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@timotheecour timotheecour force-pushed the pr_fix_16256_testament_nimout_empty branch from be3162a to 1994128 Compare May 26, 2021 08:19
@Varriount
Copy link
Contributor

I can't comment on the testament changes, but the test changed look good (it's a big improvement!).

@Araq Araq merged commit a36efb5 into nim-lang:devel May 31, 2021
@timotheecour timotheecour deleted the pr_fix_16256_testament_nimout_empty branch May 31, 2021 18:48
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
…); improve a few tests (nim-lang#18089)

* fix nim-lang#16256: nimout: <empty> should give error (vacuously true); improve some tests

* renamed:    tests/stdlib/t9710.nim -> tests/misc/t9710.nim

* improve tests

* fix non-DRY tests

* improve $nim_prs_D/tests/stdlib/t9091.nim

* renamed:    tests/stdlib/t9091.nim -> tests/misc/t9091.nim

* fixup

* address comment: doAssert => result.parseErrors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review (please take another look): ready for next review round
Projects
None yet
Development

Successfully merging this pull request may close these issues.

testament: nimout: <empty> should give error (vacuously true)
3 participants