"Fossies" - the Fresh Open Source Software Archive

Member "bas-2.6/test/test55" (2 Jul 2019, 751 Bytes) of package /linux/privat/bas-2.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 echo -n $0: 'RENUM... '
    4 
    5 cat >test.bas <<'eof'
    6 100 for i=1 to 10
    7 130 gosub 180 
    8 131 next
    9 132 goto 200
   10 180 print "foo"
   11 190 return
   12 200 k=1
   13 210 restore 300
   14 220 read a,b,c
   15 230 print using 400;a,b,c
   16 240 k=k+1:if k<5 then goto 210
   17 250 end
   18 300 data 1,2,3
   19 400 image "## ## ##"
   20 eof
   21 
   22 cat >test.input <<'eof'
   23 load "test.bas"
   24 renum 1000,50
   25 save "test.bas"
   26 eof
   27 cat >test.ref <<'eof'
   28 1000 for i=1 to 10
   29 1050   gosub 1200
   30 1100 next
   31 1150 goto 1300
   32 1200 print "foo"
   33 1250 return
   34 1300 k=1
   35 1350 restore 1600
   36 1400 read a,b,c
   37 1450 print using 1650;a,b,c
   38 1500 k=k+1 : if k<5 then goto 1350
   39 1550 end
   40 1600 data 1,2,3
   41 1650 image "## ## ##"
   42 eof
   43 
   44 sh ./test/runbas <test.input
   45 
   46 if cmp test.ref test.bas
   47 then
   48   rm -f test.*
   49   echo passed
   50 else
   51   echo failed
   52   exit 1
   53 fi
   54