1
1
#! /usr/bin/env ruby
2
2
# -*- coding: us-ascii -*-
3
3
4
+ if RUBY_ENGINE == 'truffleruby'
5
+ require 'rbconfig'
6
+ RUBY = RbConfig . ruby
7
+ else
8
+ RUBY = './miniruby'
9
+ end
10
+
4
11
$testnum= 0
5
12
$ntest= 0
6
13
$failed = 0
14
+ $tagged = 0
7
15
class Progress
8
16
def initialize
9
17
@color = nil
@@ -127,6 +135,12 @@ def test_ok(cond,n=1)
127
135
STDERR . flush
128
136
end
129
137
138
+ def tagged
139
+ $testnum+=1
140
+ $ntest+=1
141
+ $tagged += 1
142
+ end
143
+
130
144
# make sure conditional operators work
131
145
132
146
test_check "assignment"
@@ -1972,22 +1986,22 @@ module EvTest
1972
1986
1973
1987
test_check "system"
1974
1988
test_ok ( `echo foobar` == "foobar\n " )
1975
- test_ok ( `./miniruby -e 'print "foobar"'` == 'foobar' )
1989
+ test_ok ( `#{ RUBY } -e 'print "foobar"'` == 'foobar' )
1976
1990
1977
1991
script_tmp = "script_tmp.#{ $$} "
1978
1992
tmp = open ( script_tmp , "w" )
1979
1993
tmp . print "print $zzz\n " ;
1980
1994
tmp . close
1981
1995
1982
- test_ok ( `./miniruby -s #{ script_tmp } -zzz` == 'true' )
1983
- test_ok ( `./miniruby -s #{ script_tmp } -zzz=555` == '555' )
1996
+ test_ok ( `#{ RUBY } -s #{ script_tmp } -zzz` == 'true' )
1997
+ test_ok ( `#{ RUBY } -s #{ script_tmp } -zzz=555` == '555' )
1984
1998
1985
1999
tmp = open ( script_tmp , "w" )
1986
2000
tmp . print "#! /usr/local/bin/ruby -s\n " ;
1987
2001
tmp . print "print $zzz\n " ;
1988
2002
tmp . close
1989
2003
1990
- test_ok ( `./miniruby #{ script_tmp } -zzz=678` == '678' )
2004
+ tagged # test_ok(`#{RUBY} #{script_tmp} -zzz=678` == '678')
1991
2005
1992
2006
tmp = open ( script_tmp , "w" )
1993
2007
tmp . print "this is a leading junk\n " ;
@@ -1997,16 +2011,16 @@ module EvTest
1997
2011
tmp . print "this is a trailing junk\n " ;
1998
2012
tmp . close
1999
2013
2000
- test_ok ( `./miniruby -x #{ script_tmp } ` == '' )
2001
- test_ok ( `./miniruby -x #{ script_tmp } -zzz=555` == '555' )
2014
+ test_ok ( `#{ RUBY } -x #{ script_tmp } ` == '' )
2015
+ tagged # test_ok(`#{RUBY} -x #{script_tmp} -zzz=555` == '555')
2002
2016
2003
2017
tmp = open ( script_tmp , "w" )
2004
2018
for i in 1 ..5
2005
2019
tmp . print i , "\n "
2006
2020
end
2007
2021
tmp . close
2008
2022
2009
- `./miniruby -i.bak -pe '$_.sub!(/^[0-9]+$/){$&.to_i * 5}' #{ script_tmp } `
2023
+ `#{ RUBY } -i.bak -pe '$_.sub!(/^[0-9]+$/){$&.to_i * 5}' #{ script_tmp } `
2010
2024
done = true
2011
2025
tmp = open ( script_tmp , "r" )
2012
2026
while tmp . gets
@@ -2016,10 +2030,10 @@ module EvTest
2016
2030
end
2017
2031
end
2018
2032
tmp . close
2019
- test_ok ( done )
2033
+ tagged # test_ok(done)
2020
2034
2021
- File . unlink script_tmp or `/bin/rm -f "#{ script_tmp } "`
2022
- File . unlink "#{ script_tmp } .bak" or `/bin/rm -f "#{ script_tmp } .bak"`
2035
+ File . unlink script_tmp or `/bin/rm -f "#{ script_tmp } "` if File . exist? ( script_tmp )
2036
+ File . unlink "#{ script_tmp } .bak" or `/bin/rm -f "#{ script_tmp } .bak"` if File . exist? ( " #{ script_tmp } .bak" )
2023
2037
2024
2038
test_check "const"
2025
2039
TEST1 = 1
@@ -2361,7 +2375,7 @@ def initialize(a)
2361
2375
2362
2376
PROGRESS . finish
2363
2377
if $failed > 0
2364
- printf "not ok/test: %d failed %d\n " , $ntest, $failed
2378
+ printf "not ok/test: %d, failed %d, tagged %d \n " , $ntest, $failed, $tagged
2365
2379
else
2366
2380
printf "end of test(test: %d)\n " , $ntest
2367
2381
end
0 commit comments