From 4d7a5d430ad1b564d1f9ea1da8b1dca04aefb0b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 18 Apr 2016 13:48:14 -0400 Subject: [PATCH] tests: add test for the interpreter interpreting the interpreter with its FFI MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- tests/nit.args | 1 + tests/sav/nit_args7.res | 4 ++++ tests/sav/test_ffi_c_interpreter.res | 4 ++++ tests/test_ffi_c_interpreter.nit | 23 +++++++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 tests/sav/nit_args7.res create mode 100644 tests/sav/test_ffi_c_interpreter.res create mode 100644 tests/test_ffi_c_interpreter.nit diff --git a/tests/nit.args b/tests/nit.args index 9327c80..cbaafd9 100644 --- a/tests/nit.args +++ b/tests/nit.args @@ -4,3 +4,4 @@ base_simple3.nit -D text=hello -D num=42 -D flag test_define.nit -e 'print "hello world"' -n -e 'print line' test_prog/README.md test_prog/test_prog.nit +test_ffi_c_interpreter.nit diff --git a/tests/sav/nit_args7.res b/tests/sav/nit_args7.res new file mode 100644 index 0000000..1d55c4e --- /dev/null +++ b/tests/sav/nit_args7.res @@ -0,0 +1,4 @@ +FOO +BAR 1 +BAZ +BAR 43 diff --git a/tests/sav/test_ffi_c_interpreter.res b/tests/sav/test_ffi_c_interpreter.res new file mode 100644 index 0000000..1d55c4e --- /dev/null +++ b/tests/sav/test_ffi_c_interpreter.res @@ -0,0 +1,4 @@ +FOO +BAR 1 +BAZ +BAR 43 diff --git a/tests/test_ffi_c_interpreter.nit b/tests/test_ffi_c_interpreter.nit new file mode 100644 index 0000000..f3dd600 --- /dev/null +++ b/tests/test_ffi_c_interpreter.nit @@ -0,0 +1,23 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import core::kernel + +fun foo `{ printf("FOO\n"); `} +fun bar(i: Int) `{ printf("BAR %ld\n", i); `} +fun baz: Int `{ printf("BAZ\n"); return 42; `} + +foo +bar(1) +bar(baz+1) -- 1.7.9.5