From 08538f7f2675814436c60de3316323c7991692ef Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 16 Jun 2017 16:45:06 +0200 Subject: [PATCH] move parseInt to jstrutils.nim to avoid conflicts; introduce travis testing --- .travis.yml | 18 ++++++++++++++++++ src/jstrutils.nim | 1 + src/kdom.nim | 3 --- tests/tester.nim | 15 +++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .travis.yml create mode 100644 tests/tester.nim diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0c60bd2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +sudo: false +language: c +os: linux +install: + - git clone https://github.com/nim-lang/nim + - cd nim + - git clone --depth 1 https://github.com/nim-lang/csources.git + - cd csources + - sh build.sh + - cd ../ + - bin/nim c koch + - ./koch boot -d:release + - cd .. +before_script: + - set -e + - export PATH=$(pwd)/nim/bin:$(pwd):$PATH +script: + - nim c -r tests/tester.nim diff --git a/src/jstrutils.nim b/src/jstrutils.nim index 0be4076..a16473d 100644 --- a/src/jstrutils.nim +++ b/src/jstrutils.nim @@ -23,3 +23,4 @@ proc isInt*(s: cstring): bool {.asmNoStackFrame.} = """ proc parseInt*(s: cstring): int {.importcpp: "parseInt(#, 10)", nodecl.} +proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.} diff --git a/src/kdom.nim b/src/kdom.nim index 0adb1dd..f933b87 100644 --- a/src/kdom.nim +++ b/src/kdom.nim @@ -547,9 +547,6 @@ proc decodeURIComponent*(uri: cstring): cstring {.importc, nodecl.} proc encodeURIComponent*(uri: cstring): cstring {.importc, nodecl.} proc isFinite*(x: BiggestFloat): bool {.importc, nodecl.} proc isNaN*(x: BiggestFloat): bool {.importc, nodecl.} -proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.} -proc parseInt*(s: cstring): int {.importc, nodecl.} -proc parseInt*(s: cstring, radix: int):int {.importc, nodecl.} proc id*(n: Node): cstring {.importcpp: "#.id", nodecl.} diff --git a/tests/tester.nim b/tests/tester.nim new file mode 100644 index 0000000..5dc7426 --- /dev/null +++ b/tests/tester.nim @@ -0,0 +1,15 @@ +# For now we only test that the things still compile. + +import os + +proc exec(cmd: string) = + if os.execShellCmd(cmd) != 0: + quit "command failed " & cmd + +proc main = + exec("nim js tests/diffDomTests.nim") + exec("nim js examples/todoapp/todoapp.nim") + exec("nim js examples/scrollapp/scrollapp.nim") + exec("nim js examples/mediaplayer/playerapp.nim") + +main()