summaryrefslogtreecommitdiff
path: root/test-suite/tests
diff options
context:
space:
mode:
authorPhil <theseaisinhere+git@gmail.com>2011-05-07 16:15:11 -0500
committerIan Price <ianprice90@googlemail.com>2013-09-09 17:01:24 +0100
commitf4c44a3ba7f88e8171e1e2bd14b82d00b5912977 (patch)
tree53895bbda10c0c7771e3f82261dbd4acb75877c4 /test-suite/tests
parentfaa16f99898a329eba0eaff0ab520eb0f9adbecb (diff)
downloadguile-f4c44a3ba7f88e8171e1e2bd14b82d00b5912977.tar.gz
Add some documentation. Function calls now properly handle multiple
values resulting from a function call as the last argument. doc/ref/api-languages.texi: Add a small blurb about Lua. module/language/lua/compile-tree-il.scm: Function calls now properly handle multiple values resulting from a function call as the last argument.
Diffstat (limited to 'test-suite/tests')
-rw-r--r--test-suite/tests/lua-eval-2.test5
-rw-r--r--test-suite/tests/lua-eval-3.test16
-rw-r--r--test-suite/tests/lua-eval.test3
-rw-r--r--test-suite/tests/lua-lexer.test8
4 files changed, 18 insertions, 14 deletions
diff --git a/test-suite/tests/lua-eval-2.test b/test-suite/tests/lua-eval-2.test
index 928cebe86..0787a3f94 100644
--- a/test-suite/tests/lua-eval-2.test
+++ b/test-suite/tests/lua-eval-2.test
@@ -18,9 +18,6 @@
(define-module (test-lua)
#:use-module (ice-9 format)
- #:use-module (language tree-il)
- #:use-module (srfi srfi-1)
- #:use-module (srfi srfi-8)
#:use-module (system base compile)
#:use-module (test-suite lib)
@@ -102,7 +99,7 @@
(test "print \"hello world\"; return true")
;; variable arguments
- #;(test "function test(...) print(...) end test(1,2)")
+ (test "function test(...) print(...) end test(1,2)")
;; numeric for loop
(test "for x = 1,2,1 do print(true) end return true")
diff --git a/test-suite/tests/lua-eval-3.test b/test-suite/tests/lua-eval-3.test
index 533d4a85b..16a4935b3 100644
--- a/test-suite/tests/lua-eval-3.test
+++ b/test-suite/tests/lua-eval-3.test
@@ -18,9 +18,6 @@
(define-module (test-lua)
#:use-module (ice-9 format)
- #:use-module (language tree-il)
- #:use-module (srfi srfi-1)
- #:use-module (srfi srfi-8)
#:use-module (system base compile)
#:use-module (test-suite lib)
@@ -41,9 +38,22 @@
((_ string)
(test string #t)))))
+#|
;; make sure logical expressions don't evaluate expressions twice
;;; y will equal 2 in case of extra eval
(test "y = 0 function tmp() y = y + 1 return true end assert(tmp() or tmp()) return y == 1")
;;; y will equal 4 in case of extra eval
(test "y = 0 function void(x) end function tmp() y = y + 2 return false end; function tmp2() y = y + 1 return true end; void(tmp() and tmp2()) return y == 2")
+|#
+ 1
))
+
+
+(define (from-string string)
+ (compile ((make-parser (open-input-string string)))
+ #:from 'lua
+ #:to 'value))
+
+;(format #t "~a\n" (from-string "function tmp() return 4,5 end print(1,2,3,tmp())"))
+
+(format #t "~a\n" (from-string "function tmp(...) print(1,2,3,...) end tmp(4,5)"))
diff --git a/test-suite/tests/lua-eval.test b/test-suite/tests/lua-eval.test
index 7008314aa..96bff7285 100644
--- a/test-suite/tests/lua-eval.test
+++ b/test-suite/tests/lua-eval.test
@@ -18,9 +18,6 @@
(define-module (test-lua)
#:use-module (ice-9 format)
- #:use-module (language tree-il)
- #:use-module (srfi srfi-1)
- #:use-module (srfi srfi-8)
#:use-module (system base compile)
#:use-module (test-suite lib)
diff --git a/test-suite/tests/lua-lexer.test b/test-suite/tests/lua-lexer.test
index 77094a0df..51e9efabf 100644
--- a/test-suite/tests/lua-lexer.test
+++ b/test-suite/tests/lua-lexer.test
@@ -6,12 +6,12 @@
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
-;;;;
+;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
-;;;;
+;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -29,7 +29,7 @@
(call-with-input-string string make-lexer))
(lambda (get-source-info lex)
(lex))))
-
+
(let-syntax
((test
(syntax-rules (eof)
@@ -62,7 +62,7 @@ comment]]"))
(test "name" 'name)
(test "return" #:return)
(test ".." #:concat)
- (test "..." #:dots)
+ (test "..." #:vararg)
(test ";" #\;)
(test "-" #\-)
(test "+" #\+)