Regress test of deferrables. Fix dart, factor.
authorJoel Martin <github@martintribe.org>
Wed, 24 Jul 2019 06:29:40 +0000 (01:29 -0500)
committerJoel Martin <github@martintribe.org>
Thu, 25 Jul 2019 04:48:29 +0000 (23:48 -0500)
Add a regression run to Travis that enables hard deferrables but
omits optionals so that we can test to make sure that all the
requirements are met for self-hosting in stepA.

Cleanup up some of the soft/deferrable/optional markings.
Deferrables are what will be needed eventually to self host but aren't
needed for the immediate next steps. Optional aren't even needed for
self-hosting but are nice things to have.

Also:
- Sync dart step9 and stepA with step8. Do not eval macroexpanded
  forms in macroexpand form.
- Fix stepA of factor which was missing some fixes from step9.
- Increase test timeouts in top-level Makefile for guile and io.

13 files changed:
.travis.yml
.travis_test.sh
Makefile
dart/step9_try.dart
dart/stepA_mal.dart
factor/stepA_mal/stepA_mal.factor
tests/step1_read_print.mal
tests/step2_eval.mal
tests/step3_env.mal
tests/step4_if_fn_do.mal
tests/step6_file.mal
tests/step7_quote.mal
tests/step8_macros.mal

index 59a15b6..d9ab35a 100644 (file)
@@ -109,4 +109,5 @@ script:
   # Build, test, perf
   - ./.travis_test.sh build ${IMPL}
   - ./.travis_test.sh test ${IMPL}
+  - STEP=stepA REGRESS=1 HARD=1 OPTIONAL=0 ./.travis_test.sh test ${IMPL}
   - ./.travis_test.sh perf ${IMPL}
index aa814e5..c41cf6b 100755 (executable)
@@ -61,6 +61,9 @@ test|perf)
     if ! ${MAKE} TEST_OPTS="${TEST_OPTS}" \
             ${MAL_IMPL:+MAL_IMPL=${MAL_IMPL}} \
             ${REGRESS:+REGRESS=${REGRESS}} \
+            ${HARD:+HARD=${HARD}} \
+            ${DEFERRABLE:+DEFERRABLE=${DEFERRABLE}} \
+            ${OPTIONAL:+OPTIONAL=${OPTIONAL}} \
             ${ACTION}^${IMPL}${STEP:+^${STEP}}; then
         # print debug-file on error
         cat ${ACTION}.err
index 832194e..cdbaa7c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,7 @@ TEST_OPTS =
 # later steps.
 REGRESS =
 
+HARD=
 DEFERRABLE=1
 OPTIONAL=1
 
@@ -142,6 +143,8 @@ dist_EXCLUDES += guile io julia matlab swift
 
 # Extra options to pass to runtest.py
 bbc-basic_TEST_OPTS = --test-timeout 60
+guile_TEST_OPTS = --test-timeout 120
+io_TEST_OPTS = --test-timeout 120
 logo_TEST_OPTS = --start-timeout 60 --test-timeout 120
 mal_TEST_OPTS = --start-timeout 60 --test-timeout 120
 miniMAL_TEST_OPTS = --start-timeout 60 --test-timeout 120
@@ -270,6 +273,7 @@ noop =
 SPACE = $(noop) $(noop)
 export FACTOR_ROOTS := .
 
+opt_HARD            = $(if $(strip $(HARD)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(HARD)),--hard,),)
 opt_DEFERRABLE      = $(if $(strip $(DEFERRABLE)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(DEFERRABLE)),--deferrable,--no-deferrable),--no-deferrable)
 opt_OPTIONAL        = $(if $(strip $(OPTIONAL)),$(if $(filter t true T True TRUE 1 y yes Yes YES,$(OPTIONAL)),--optional,--no-optional),--no-optional)
 
@@ -328,7 +332,7 @@ get_run_prefix = $(strip $(foreach mode,$(call actual_impl,$(1))_MODE, \
 # Takes impl and step
 # Returns the runtest command prefix (with runtest options) for testing the given step
 get_runtest_cmd = $(call get_run_prefix,$(1),$(2),$(if $(filter cs fsharp mal tcl vb,$(1)),RAW=1,)) \
-                   ../runtest.py $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(1)_TEST_OPTS) $(TEST_OPTS)
+                   ../runtest.py $(opt_HARD) $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(1)_TEST_OPTS) $(TEST_OPTS)
 
 # Takes impl and step
 # Returns the runtest command prefix (with runtest options) for testing the given step
index 8d04837..76cd752 100644 (file)
@@ -188,8 +188,7 @@ MalType EVAL(MalType ast, Env env) {
             ast = quasiquote(args.first);
             continue;
           } else if (symbol.value == 'macroexpand') {
-            ast = macroexpand(args.first, env);
-            continue;
+            return macroexpand(args.first, env);
           } else if (symbol.value == 'try*') {
             var body = args.first;
             if (args.length < 2) {
index aee5959..72ff326 100644 (file)
@@ -190,8 +190,7 @@ MalType EVAL(MalType ast, Env env) {
             ast = quasiquote(args.first);
             continue;
           } else if (symbol.value == 'macroexpand') {
-            ast = macroexpand(args.first, env);
-            continue;
+            return macroexpand(args.first, env);
           } else if (symbol.value == 'try*') {
             var body = args.first;
             if (args.length < 2) {
index 622bc88..25c91d8 100755 (executable)
@@ -50,8 +50,12 @@ DEFER: EVAL
 :: eval-try* ( params env -- maltype )
     [ params first env EVAL ]
     [
-        params second second env new-env [ env-set ] keep
-        params second third swap EVAL
+        params length 1 > [
+            params second second env new-env [ env-set ] keep
+            params second third swap EVAL
+        ] [
+            throw
+        ] if
     ] recover ;
 
 : args-split ( bindlist -- bindlist restbinding/f )
@@ -121,7 +125,11 @@ M: callable apply call( x -- y ) f ;
 : PRINT ( maltype -- str ) pr-str ;
 
 : REP ( str -- str )
-    [ READ repl-env get EVAL ] [ nip ] recover PRINT ;
+    [
+        READ repl-env get EVAL PRINT
+    ] [
+        nip pr-str "Error: " swap append
+    ] recover ;
 
 : REPL ( -- )
     "(println (str \"Mal [\" *host-language* \"]\"))" REP drop
index 11dc4bf..7480596 100644 (file)
@@ -164,10 +164,6 @@ false
 ;=>(splice-unquote (1 2 3))
 
 
-;>>> optional=True
-;;
-;; -------- Optional Functionality --------
-
 ;; Testing keywords
 :kw
 ;=>:kw
@@ -221,16 +217,19 @@ false
 1; comment after expression
 ;=>1
 
-;; Testing read of ^/metadata
-^{"a" 1} [1 2 3]
-;=>(with-meta [1 2 3] {"a" 1})
-
-
 ;; Testing read of @/deref
 @a
 ;=>(deref a)
 
 ;>>> soft=True
+;>>> optional=True
+;;
+;; -------- Optional Functionality --------
+
+;; Testing read of ^/metadata
+^{"a" 1} [1 2 3]
+;=>(with-meta [1 2 3] {"a" 1})
+
 
 ;; Non alphanumerice characters in strings
 ;;; \t is not specified enough to be tested
index 16a3589..4514592 100644 (file)
@@ -29,9 +29,8 @@
 ;=>()
 
 ;>>> deferrable=True
-;>>> optional=True
 ;;
-;; -------- Deferrable/Optional Functionality --------
+;; -------- Deferrable Functionality --------
 
 ;; Testing evaluation within collection literals
 [1 2 (+ 1 2)]
index cc8270d..6711b11 100644 (file)
@@ -64,9 +64,8 @@ y
 ;=>4
 
 ;>>> deferrable=True
-;>>> optional=True
 ;;
-;; -------- Deferrable/Optional Functionality --------
+;; -------- Deferrable Functionality --------
 
 ;; Testing let* with vector bindings
 (let* [z 9] z)
index 2d37b57..13eb8b4 100644 (file)
@@ -420,9 +420,6 @@ nil
 ;/\(1 2 abc "\) def
 ;=>nil
 
-;>>> optional=True
-;;
-;; -------- Optional Functionality --------
 
 ;; Testing keywords
 (= :abc :abc)
index 17ba8d7..dd3bd66 100644 (file)
 (fib 2)
 ;=>1
 
+;; Testing `@` reader macro (short for `deref`)
+(def! atm (atom 9))
+@atm
+;=>9
+
+;;; TODO: really a step5 test
+;; Testing that vector params not broken by TCO
+(def! g (fn* [] 78))
+(g)
+;=>78
+(def! g (fn* [a] (+ a 78)))
+(g 3)
+;=>81
+
+;;
+;; Testing that *ARGV* exists and is an empty list
+(list? *ARGV*)
+;=>true
+*ARGV*
+;=>()
+
+;>>> soft=True
 ;>>> optional=True
 ;;
 ;; -------- Optional Functionality --------
 mymap
 ;=>{"a" 1}
 
-;; Testing `@` reader macro (short for `deref`)
-(def! atm (atom 9))
-@atm
-;=>9
-
-;;; TODO: really a step5 test
-;; Testing that vector params not broken by TCO
-(def! g (fn* [] 78))
-(g)
-;=>78
-(def! g (fn* [a] (+ a 78)))
-(g 3)
-;=>81
-
 ;; Checking that eval does not use local environments.
 (def! a 1)
 ;=>1
 (let* (a 2) (eval (read-string "a")))
 ;=>1
 
-;;
-;; Testing that *ARGV* exists and is an empty list
-(list? *ARGV*)
-;=>true
-*ARGV*
-;=>()
-
-;>>> soft=True
-
 ;; Non alphanumeric characters in comments in read-string
 (read-string "1;!")
 ;=>1
index b36835e..c1c07f5 100644 (file)
@@ -119,6 +119,22 @@ b
 '(1 2 (3 4))
 ;=>(1 2 (3 4))
 
+;; Testing cons and concat with vectors
+
+(cons [1] [2 3])
+;=>([1] 2 3)
+(cons 1 [2 3])
+;=>(1 2 3)
+(concat [1 2] (list 3 4) [5 6])
+;=>(1 2 3 4 5 6)
+(concat [1 2])
+;=>(1 2)
+
+
+;>>> optional=True
+;;
+;; -------- Optional Functionality --------
+
 ;; Testing ` (quasiquote) reader macro
 `7
 ;=>7
@@ -151,22 +167,6 @@ b
 `(1 ~@c 3)
 ;=>(1 1 "b" "d" 3)
 
-
-;>>> optional=True
-;;
-;; -------- Optional Functionality --------
-
-;; Testing cons and concat with vectors
-
-(cons [1] [2 3])
-;=>([1] 2 3)
-(cons 1 [2 3])
-;=>(1 2 3)
-(concat [1 2] (list 3 4) [5 6])
-;=>(1 2 3 4 5 6)
-(concat [1 2])
-;=>(1 2)
-
 ;; Testing unquote with vectors
 (def! a 8)
 ;=>8
index 79f332a..2dcc2c3 100644 (file)
@@ -92,10 +92,6 @@ x
 ;=>"yes"
 
 
-;>>> optional=True
-;;
-;; -------- Optional Functionality --------
-
 ;; Testing nth, first, rest with vectors
 
 (nth [1] 0)
@@ -132,6 +128,10 @@ x
 ;=>"yes"
 
 ;>>> soft=True
+;>>> optional=True
+;;
+;; ------- Optional Functionality --------------
+;; ------- (Not needed for self-hosting) -------
 
 ;; Test that macros use closures
 (def! x 2)