From: Alexis Laferrière Date: Mon, 18 Apr 2016 17:48:14 +0000 (-0400) Subject: tests: add test for the interpreter interpreting the interpreter with its FFI X-Git-Url: http://nitlanguage.org tests: add test for the interpreter interpreting the interpreter with its FFI Signed-off-by: Alexis Laferrière --- 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)