Skip to content

Commit

Permalink
disable, re-enable some tests on windows to see if #18011 is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Oct 3, 2024
1 parent c195665 commit 6460ffe
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -5169,7 +5169,7 @@ It is possible to raise/catch imported C++ exceptions. Types imported using
`importcpp` can be raised or caught. Exceptions are raised by value and
caught by reference. Example:

```nim test = "nim cpp -r $1"
```nim
type
CStdException {.importcpp: "std::exception", header: "<exception>", inheritable.} = object
## does not inherit from `RootObj`, so we use `inheritable` instead
Expand All @@ -5187,7 +5187,7 @@ caught by reference. Example:
except CStdException as e:
doAssert e is CStdException
b = e.what()
doAssert $b == "foo2", $b
doAssert $b == "foo2"
try: raise initStdException()
except CStdException: discard
Expand Down
4 changes: 3 additions & 1 deletion testament/important_packages.nim
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ pkg "netty"
pkg "nico", allowFailure = true
pkg "nicy", "nim c -r src/nicy.nim"
when defined(osx):
pkg "nigui", "nim c --clibdir:/usr/local/lib -o:niguii -r src/nigui.nim"
# gives "could not load: libgtk-3.0.dylib" on macos 13
# just test compiling instead of running
pkg "nigui", "nim c -o:niguii src/nigui.nim"
else:
pkg "nigui", "nim c -o:niguii -r src/nigui.nim"
pkg "nimcrypto", "nim r --path:. tests/testall.nim" # `--path:.` workaround needed, see D20210308T165435
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/temitlist.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ discard """
output: '''
6.0
0'''
disabled: "windows" # pending bug #18011
#disabled: "windows" # pending bug #18011
"""

# bug #4730
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/tempty_generic_obj.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ discard """
output: '''
int
float'''
disabled: "windows" # pending bug #18011
#disabled: "windows" # pending bug #18011
"""

import typetraits
Expand Down
38 changes: 38 additions & 0 deletions tests/cpp/tmanual_exception.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
discard """
# doesn't work on macos 13 seemingly due to libc++ linking issue https://stackoverflow.com/a/77375947
disabled: osx
targets: cpp
"""

# manual example

type
CStdException {.importcpp: "std::exception", header: "<exception>", inheritable.} = object
## does not inherit from `RootObj`, so we use `inheritable` instead
CRuntimeError {.requiresInit, importcpp: "std::runtime_error", header: "<stdexcept>".} = object of CStdException
## `CRuntimeError` has no default constructor => `requiresInit`
proc what(s: CStdException): cstring {.importcpp: "((char *)#.what())".}
proc initRuntimeError(a: cstring): CRuntimeError {.importcpp: "std::runtime_error(@)", constructor.}
proc initStdException(): CStdException {.importcpp: "std::exception()", constructor.}

proc fn() =
let a = initRuntimeError("foo")
doAssert $a.what == "foo"
var b: cstring
try: raise initRuntimeError("foo2")
except CStdException as e:
doAssert e is CStdException
b = e.what()
doAssert $b == "foo2"

try: raise initStdException()
except CStdException: discard

try: raise initRuntimeError("foo3")
except CRuntimeError as e:
b = e.what()
except CStdException:
doAssert false
doAssert $b == "foo3"

fn()
3 changes: 2 additions & 1 deletion tests/exception/tcpp_imported_exc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ finally 2
expected
cpp exception caught
'''
disabled: "windows" # pending bug #18011
# doesn't work on macos 13 seemingly due to libc++ linking issue https://stackoverflow.com/a/77375947
disabled: osx
"""

type
Expand Down

0 comments on commit 6460ffe

Please sign in to comment.