Skip to content

Commit

Permalink
[REVIEW] Compiletime test corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
haxscramper committed Nov 8, 2021
1 parent 35f52bc commit 4911131
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
5 changes: 2 additions & 3 deletions tests/lang/s01_basics/s00_atoms/t00_builtins.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ block built_integer_operations:
doAssert value == 0

block assert_type_of_the_expression:
## Nim is a statically typed programming language, which means every
## expression has a type. This can be checked for using `is` operator (or it's
## reverse `isnot`).
## Every expression has a type. This can be checked for using `is` operator
## (or it's reverse `isnot`).

## Declare variable of type `int` and check if expression `value` has this
## type.
Expand Down
5 changes: 5 additions & 0 deletions tests/lang/s01_basics/s00_atoms/t03_compiletime.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ compiletimeGetter()
const canAccessAtRuntime = globalCompiletimeInt

doAssert canAccessAtRuntime == 12
doAssert globalCompiletimeInt == 12

## Note that subsequent modifications of the compiletime variable will not
## affect value of the constant after it has been declared.

static:
globalCompiletimeInt = 24

const newConst = globalCompiletimeInt

doAssert newConst == 24
doAssert canAccessAtRuntime == 12
doAssert globalCompiletimeInt == 12
16 changes: 13 additions & 3 deletions tests/lang/s05_pragmas/s01_interop/t01_c_interop.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{.compile("t01_c_implementation.c", "-DNIM_DEFINED_FLAG").}
discard """
description: '''
Pragmas for wrapping C code in nim.
'''
targets: "c"
cmd: "nim c -r $options $file"
const h = "t01_c_header.h"
joinable: false
"""

{.compile("t01_c_interop.nim.c", "-DNIM_DEFINED_FLAG").}

const h = "t01_c_interop.nim.h"


block wrap_void_proc:
proc cVoid() {.importc: "c_void", header: "t01_c_header.h".}
proc cVoid() {.importc: "c_void", header: "t01_c_interop.nim.h".}

block wrap_prec_with_value:
proc c_return_int(): cint {.importc, header: h.}
Expand Down
5 changes: 3 additions & 2 deletions tests/lang/s05_pragmas/s01_interop/t02_cxx_interop.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ discard """
description: '''
Pragmas for wrapping C++ code in nim.
'''
#targets: "cpp"
targets: "cpp"
#specifying target does not work when I do `testament run`
cmd: "nim cpp -r $options $file"
joinable: false
"""

const h = "t02_cxx_header.hpp"
const h = "t02_cxx_interop.nim.hpp"

block complete_struct:
## If C or C++ type has been mapped *exactly*, 1:1, it is possible to annotate
Expand Down

0 comments on commit 4911131

Please sign in to comment.