-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix partially #13115 (now works for cpp; but still fails for js on openbsd) #16167
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
Changes from all commits
1cceff6
0765ed7
f623ea1
38b8e0e
7f83b11
d394231
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,38 @@ | ||
| discard """ | ||
| exitcode: 1 | ||
| targets: "c" | ||
| matrix: "-d:debug; -d:release" | ||
| outputsub: ''' and works fine! [Exception]''' | ||
| """ | ||
| const msg = "This char is `" & '\0' & "` and works fine!" | ||
|
|
||
| # bug #13115 | ||
| # xxx bug: doesn't yet work for cpp | ||
| when defined nim_t13115: | ||
| # bug #13115 | ||
| template fn = | ||
| raise newException(Exception, msg) | ||
| when defined nim_t13115_static: | ||
| static: fn() | ||
| fn() | ||
| else: | ||
| import std/[osproc,strformat,os,strutils] | ||
| proc main = | ||
| const nim = getCurrentCompilerExe() | ||
| const file = currentSourcePath | ||
| for b in "c js cpp".split: | ||
| when defined(openbsd): | ||
| if b == "js": | ||
| # xxx bug: pending #13115 | ||
| # remove special case once nodejs updated >= 12.16.2 | ||
| # refs https://github.com/nim-lang/Nim/pull/16167#issuecomment-738270751 | ||
| continue | ||
|
|
||
| var msg = "This char is `" & '\0' & "` and works fine!" | ||
| raise newException(Exception, msg) | ||
| # save CI time by avoiding mostly redundant combinations as far as this bug is concerned | ||
| var opts = case b | ||
| of "c": @["", "-d:nim_t13115_static", "-d:danger", "-d:debug"] | ||
| of "js": @["", "-d:nim_t13115_static"] | ||
| else: @[""] | ||
|
|
||
| for opt in opts: | ||
| let cmd = fmt"{nim} r -b:{b} -d:nim_t13115 {opt} --hints:off {file}" | ||
| let (outp, exitCode) = execCmdEx(cmd) | ||
| when defined windows: | ||
| # `\0` not preserved on windows | ||
| doAssert "` and works fine!" in outp, cmd & "\n" & msg | ||
| else: | ||
| doAssert msg in outp, cmd & "\n" & msg | ||
| doAssert exitCode == 1 | ||
| main() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please get rid of this abomination and use testament to accomplish what you want.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. testament spec DSL isn't flexible enough for this test, sorry. If you disagree, please show a complete example that tests VM, openbsd (for non-js case), the '\0' being part of the output message, allows avoiding combinatorial explosion (as i do in this PR) etc, while also avoiding generating N different test files (not DRY nor desirable). testament spec may be good for the general case, but you'll always have special cases, which need things like:
|
||
Uh oh!
There was an error while loading. Please reload this page.