summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-05-17 07:29:47 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-05-17 07:29:47 +0000
commit7ee0812aee77599f963379040aea38052080e76c (patch)
tree00bdf3b2637cd061348c74dff1638209933a3f54 /sample
parentd8a615ed3d9a87656ad2bc4f4b03ade5d8da5a6e (diff)
* sampl/test.rb: use eval instead of './miniruby -c',
in order to check a syntax error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/sample/test.rb b/sample/test.rb
index 30a02dd..2c4f99f 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -1208,9 +1208,16 @@ if (dir = File.dirname(File.dirname($0))) == '.'
else
dir << "/"
end
+
+def valid_syntax?(code)
+ eval("BEGIN {return true}\n#{code}")
+rescue Exception
+ensure
+ false
+end
+
for script in Dir["#{dir}{lib,sample,ext}/**/*.rb"]
- `./miniruby -c #{script}`
- unless $?
+ unless valid_syntax? IO::read(script)
$bad = true
end
end