mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Add tests for `--language'.
* test-suite/standalone/Makefile.am (top_srcdir): Add `top_srcdir'. (check_SCRIPTS, TESTS): Add `test-language'. (EXTRA_DIST): Add `test-language.el' and `test-language.js'. * test-suite/standalone/test-language, test-suite/standalone/test-language.el, test-suite/standalone/test-language.js: New files.
This commit is contained in:
parent
ed7c4a5d77
commit
13ff681c33
4 changed files with 54 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
##
|
##
|
||||||
## Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
## Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
## 2011, 2012 Free Software Foundation, Inc.
|
## 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This file is part of GUILE.
|
## This file is part of GUILE.
|
||||||
##
|
##
|
||||||
|
@ -31,6 +31,7 @@ BUILT_SOURCES =
|
||||||
EXTRA_DIST =
|
EXTRA_DIST =
|
||||||
|
|
||||||
TESTS_ENVIRONMENT = \
|
TESTS_ENVIRONMENT = \
|
||||||
|
top_srcdir="$(top_srcdir)" \
|
||||||
srcdir="$(srcdir)" \
|
srcdir="$(srcdir)" \
|
||||||
builddir="$(builddir)" \
|
builddir="$(builddir)" \
|
||||||
@LOCALCHARSET_TESTS_ENVIRONMENT@ \
|
@LOCALCHARSET_TESTS_ENVIRONMENT@ \
|
||||||
|
@ -88,6 +89,10 @@ TESTS += test-command-line-encoding
|
||||||
check_SCRIPTS += test-command-line-encoding2
|
check_SCRIPTS += test-command-line-encoding2
|
||||||
TESTS += test-command-line-encoding2
|
TESTS += test-command-line-encoding2
|
||||||
|
|
||||||
|
check_SCRIPTS += test-language
|
||||||
|
TESTS += test-language
|
||||||
|
EXTRA_DIST += test-language.el test-language.js
|
||||||
|
|
||||||
# test-num2integral
|
# test-num2integral
|
||||||
test_num2integral_SOURCES = test-num2integral.c
|
test_num2integral_SOURCES = test-num2integral.c
|
||||||
test_num2integral_CFLAGS = ${test_cflags}
|
test_num2integral_CFLAGS = ${test_cflags}
|
||||||
|
|
25
test-suite/standalone/test-language
Executable file
25
test-suite/standalone/test-language
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Make sure that code passed as `-c' or `-l' is evaluted using the
|
||||||
|
# right language.
|
||||||
|
|
||||||
|
# The default language in effect until `--language' is encountered is
|
||||||
|
# Scheme.
|
||||||
|
guile -c "(exit (= 3 (apply + '(1 2))))" --language=elisp
|
||||||
|
! guile -c "(= (funcall (symbol-function '+) 1 2) 3)" 2> /dev/null
|
||||||
|
|
||||||
|
guile --language=elisp -c "(= (funcall (symbol-function '+) 1 2) 3)"
|
||||||
|
guile --language=ecmascript -c '(function (x) { return x * x; })(2);'
|
||||||
|
|
||||||
|
# Same with `-l'.
|
||||||
|
guile --no-auto-compile -l "$top_srcdir/module/ice-9/q.scm" -c 1
|
||||||
|
guile --no-auto-compile \
|
||||||
|
-l "$top_srcdir/module/ice-9/q.scm" \
|
||||||
|
--language=elisp \
|
||||||
|
-l "$srcdir/test-language.el" \
|
||||||
|
--language=ecmascript \
|
||||||
|
-l "$srcdir/test-language.js" \
|
||||||
|
--language=scheme \
|
||||||
|
-c 1
|
11
test-suite/standalone/test-language.el
Normal file
11
test-suite/standalone/test-language.el
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
;; Sample Elisp code for `test-language'.
|
||||||
|
|
||||||
|
(defun fib (n)
|
||||||
|
"Anything but a fib."
|
||||||
|
(if (<= n 1)
|
||||||
|
n
|
||||||
|
(+ (fib (- n 1))
|
||||||
|
(fib (- n 2)))))
|
||||||
|
|
||||||
|
(or (= 13 (fib 7))
|
||||||
|
(error "Something's wrong!"))
|
12
test-suite/standalone/test-language.js
Normal file
12
test-suite/standalone/test-language.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* Sample ECMAscript code for `test-language'. */
|
||||||
|
|
||||||
|
function fib (n)
|
||||||
|
{
|
||||||
|
if (n <= 1)
|
||||||
|
return n;
|
||||||
|
else
|
||||||
|
return fib (n - 1) + fib (n - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fib (7) != 13)
|
||||||
|
error ("Something's wrong!");
|
Loading…
Add table
Add a link
Reference in a new issue