summary refs log tree commit diff stats
path: root/tests/niminaction/Chapter8
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-01-15 15:17:52 -0800
committerGitHub <noreply@github.com>2019-01-15 15:17:52 -0800
commitfbd6743ea1db89eef3dd89ceb7c0cdcb648c8055 (patch)
tree9551f706b2f7690f9396563b80aa0ea941d4412b /tests/niminaction/Chapter8
parent1d7e3a84fd8ebaf183a231c9f8e0159f243ee25a (diff)
downloadNim-fbd6743ea1db89eef3dd89ceb7c0cdcb648c8055.tar.gz
fix sdl_test test that failed in CI cpp mode (#10314)
* fix sdl_test test that failed in CI cpp mode

* preserve old code for NimInAction in `nim c` mode
Diffstat (limited to 'tests/niminaction/Chapter8')
-rw-r--r--tests/niminaction/Chapter8/sdl/sdl_test.nim24
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/niminaction/Chapter8/sdl/sdl_test.nim b/tests/niminaction/Chapter8/sdl/sdl_test.nim
index a49e08911..1c4d258fb 100644
--- a/tests/niminaction/Chapter8/sdl/sdl_test.nim
+++ b/tests/niminaction/Chapter8/sdl/sdl_test.nim
@@ -17,12 +17,24 @@ discard pollEvent(nil)
 renderer.setDrawColor 29, 64, 153, 255
 renderer.clear
 renderer.setDrawColor 255, 255, 255, 255
-var points = [
-  (260'i32, 320'i32),
-  (260'i32, 110'i32),
-  (360'i32, 320'i32),
-  (360'i32, 110'i32)
-]
+
+when defined(c):
+  # just to ensure code from NimInAction still works, but
+  # the `else` branch would work as well in C mode
+  var points = [
+    (260'i32, 320'i32),
+    (260'i32, 110'i32),
+    (360'i32, 320'i32),
+    (360'i32, 110'i32)
+  ]
+else:
+  var points = [
+    (260.cint, 320.cint),
+    (260.cint, 110.cint),
+    (360.cint, 320.cint),
+    (360.cint, 110.cint)
+  ]
+
 renderer.drawLines(addr points[0], points.len.cint)
 
 renderer.present