Merge pull request #35 from ellerh/implement-require
authorPhil Burk <philburk@mobileer.com>
Thu, 12 Jan 2017 17:37:44 +0000 (09:37 -0800)
committerGitHub <noreply@github.com>
Thu, 12 Jan 2017 17:37:44 +0000 (09:37 -0800)
Implement REQUIRE (Forth 2012)

1  2 
fth/t_file.fth

diff --combined fth/t_file.fth
@@@ -60,7 -60,7 +60,7 @@@ include? }T{  t_tools.ft
  
  true fp-require-e !
  
 -true value verbose
 +false value verbose
  
  : testing
      verbose IF
@@@ -73,6 -73,9 +73,6 @@@
  : s= compare 0= ;
  : $" state IF postpone s" else ['] s" execute THEN ; immediate
  
 -\ FIXME: stubs for missing definitions
 -: file-status 2drop 0 -1 ;
 -
  TESTING File Access word set
  
  DECIMAL
@@@ -243,6 -246,21 +243,21 @@@ T{ FID1 @ CLOSE-FILE -> 0 }
  \ Tidy the test folder
  T{ fn3 DELETE-FILE DROP -> }T
  
+ \ ------------------------------------------------------------------------------
+ TESTING REQUIRED REQUIRE INCLUDED
+ \ Tests taken from Forth 2012 RfD
+ T{ 0 S" t_required_helper1.fth" REQUIRED
+      REQUIRE t_required_helper1.fth
+      INCLUDE t_required_helper1.fth
+      -> 2 }T
+ T{ 0 INCLUDE t_required_helper2.fth
+      S" t_required_helper2.fth" REQUIRED
+      REQUIRE t_required_helper2.fth
+      S" t_required_helper2.fth" INCLUDED
+      -> 2 }T
  \ ----------------------------------------------------------------------------
  TESTING two buffers available for S" and/or S\" (Forth 2012)