Diff for /gforth/regexp-test.fs between versions 1.6 and 1.10

version 1.6, 2009/12/31 15:32:35 version 1.10, 2010/09/04 21:39:29
Line 118  s" fofoofoofofooofoobarbar" ?foos1 Line 118  s" fofoofoofofooofoobarbar" ?foos1
 s" bla baz bar" ?foos1  s" bla baz bar" ?foos1
 s" foofoofoo" ?foos1  s" foofoofoo" ?foos1
   
   \ simple replacement test
    
   ." --- delnum test ---" cr
   
   : delnum  ( addr u -- addr' u' )   s// \d s" " //g ;
   : test-delnum  ( addr u addr' u' -- )
      2swap delnum 2over 2over str= 0= IF
         ." test-delnum: got '" type ." ', expected '" type ." '"
      ELSE  2drop 2drop  THEN ;
   s" 0"  s" " test-delnum
   s" 00"  s" " test-delnum
   s" 0a"  s" a" test-delnum
   s" a0"  s" a" test-delnum
   s" aa"  s" aa" test-delnum
   
   \ replacement tests
   
   ." --- replacement tests ---" cr
   
   : hms>s ( addr u -- addr' u' )
     s// \( \d \d \) ` : \( \d \d \) ` : \( \d \d \)
     \1 s>number drop 60 *
     \2 s>number drop + 60 *
     \3 s>number drop + 0 <# 's' hold #s #> //g ;
   
   s" bla 12:34:56 fasel 00:01:57 blubber" 2dup type hms>s
   ."  replaced by " 2dup type
   s" bla 45296s fasel 117s blubber" str= [IF] .(  ok) [ELSE] .(  failed) [THEN] cr
   
 script? [IF] bye [THEN]  script? [IF] bye [THEN]

Removed from v.1.6  
changed lines
  Added in v.1.10


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>