diff options
author | Phil <theseaisinhere+git@gmail.com> | 2011-04-21 18:05:48 -0500 |
---|---|---|
committer | Ian Price <ianprice90@googlemail.com> | 2013-09-09 17:01:24 +0100 |
commit | becaec9a4e7042a98c2dfa5fd3af9d7c30f71f44 (patch) | |
tree | 94f4ed7ffe76db22904f085ea9c3717e43875962 /test-suite/tests/lua-eval-3.test | |
parent | 8c91ae59f97200208962d845dbe972ad7c3cda3c (diff) | |
download | guile-becaec9a4e7042a98c2dfa5fd3af9d7c30f71f44.tar.gz |
Fix and/or double evaluation. Add math.modf, math.fmod.
* module/language/lua/compile-tree-il.scm: Fix and/or double evaluation.
* module/language/lua/notes.org: Add file describing known issues.
* module/language/lua/parser.scm: (token-type): Recognize and/or.
* module/language/lua/standard/math.scm: Add modf, fmod implementations.
* test-suite/tests/lua-eval-3.test: Add another test file for basic
language features.
Diffstat (limited to 'test-suite/tests/lua-eval-3.test')
-rw-r--r-- | test-suite/tests/lua-eval-3.test | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test-suite/tests/lua-eval-3.test b/test-suite/tests/lua-eval-3.test new file mode 100644 index 000000000..881389c32 --- /dev/null +++ b/test-suite/tests/lua-eval-3.test @@ -0,0 +1,49 @@ +;;;; lua-eval-2.test --- basic tests for builtin lua constructs, act III -*- mode: scheme -*- +;;;; +;;;; Copyright (C) 2010 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; 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 + +(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) + + #:use-module (language lua parser) + + ) + +(with-test-prefix "lua-eval" + (define (from-string string) + (compile ((make-parser (open-input-string string))) + #:from 'lua + #:to 'value)) + (letrec-syntax + ((test + (syntax-rules () + ((_ string expect) + (pass-if (format #f "~S => ~S" string expect) (equal? (from-string string) expect))) + ((_ 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 tmp() y = y + 2 return false end; function tmp2() y = y + 1 return true end; print(tmp() and tmp2()) print(y) return y == 2") + )) |