diff --git a/.travis.yml b/.travis.yml index 59a15b6215..d9ab35ad9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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} diff --git a/.travis_test.sh b/.travis_test.sh index aa814e528a..c41cf6b61e 100755 --- a/.travis_test.sh +++ b/.travis_test.sh @@ -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 diff --git a/Makefile b/Makefile index 832194e934..cdbaa7c372 100644 --- 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 diff --git a/dart/step9_try.dart b/dart/step9_try.dart index 8d0483759f..76cd752393 100644 --- a/dart/step9_try.dart +++ b/dart/step9_try.dart @@ -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) { diff --git a/dart/stepA_mal.dart b/dart/stepA_mal.dart index aee59590d8..72ff326a41 100644 --- a/dart/stepA_mal.dart +++ b/dart/stepA_mal.dart @@ -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) { diff --git a/factor/stepA_mal/stepA_mal.factor b/factor/stepA_mal/stepA_mal.factor index 622bc88938..25c91d8ccc 100755 --- a/factor/stepA_mal/stepA_mal.factor +++ b/factor/stepA_mal/stepA_mal.factor @@ -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 diff --git a/tests/step1_read_print.mal b/tests/step1_read_print.mal index 11dc4bfb48..7480596e25 100644 --- a/tests/step1_read_print.mal +++ b/tests/step1_read_print.mal @@ -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 diff --git a/tests/step2_eval.mal b/tests/step2_eval.mal index 16a3589a3a..4514592459 100644 --- a/tests/step2_eval.mal +++ b/tests/step2_eval.mal @@ -29,9 +29,8 @@ ;=>() ;>>> deferrable=True -;>>> optional=True ;; -;; -------- Deferrable/Optional Functionality -------- +;; -------- Deferrable Functionality -------- ;; Testing evaluation within collection literals [1 2 (+ 1 2)] diff --git a/tests/step3_env.mal b/tests/step3_env.mal index cc8270d87f..6711b11a06 100644 --- a/tests/step3_env.mal +++ b/tests/step3_env.mal @@ -64,9 +64,8 @@ y ;=>4 ;>>> deferrable=True -;>>> optional=True ;; -;; -------- Deferrable/Optional Functionality -------- +;; -------- Deferrable Functionality -------- ;; Testing let* with vector bindings (let* [z 9] z) diff --git a/tests/step4_if_fn_do.mal b/tests/step4_if_fn_do.mal index 2d37b57d8d..13eb8b49cf 100644 --- a/tests/step4_if_fn_do.mal +++ b/tests/step4_if_fn_do.mal @@ -420,9 +420,6 @@ nil ;/\(1 2 abc "\) def ;=>nil -;>>> optional=True -;; -;; -------- Optional Functionality -------- ;; Testing keywords (= :abc :abc) diff --git a/tests/step6_file.mal b/tests/step6_file.mal index 17ba8d7fee..dd3bd66101 100644 --- a/tests/step6_file.mal +++ b/tests/step6_file.mal @@ -101,6 +101,28 @@ (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 -------- @@ -119,35 +141,12 @@ 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 diff --git a/tests/step7_quote.mal b/tests/step7_quote.mal index b36835e559..c1c07f5cb6 100644 --- a/tests/step7_quote.mal +++ b/tests/step7_quote.mal @@ -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 diff --git a/tests/step8_macros.mal b/tests/step8_macros.mal index 79f332abca..2dcc2c34f4 100644 --- a/tests/step8_macros.mal +++ b/tests/step8_macros.mal @@ -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)