diff options
author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-05-17 07:29:47 +0000 |
---|---|---|
committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-05-17 07:29:47 +0000 |
commit | 562ebd8e3d0c4441a21008d404ad503755d7e79f (patch) | |
tree | 00bdf3b2637cd061348c74dff1638209933a3f54 | |
parent | 1d17c19d74384f8b25905f05a1074fc5fad7bd6c (diff) | |
download | ruby-562ebd8e3d0c4441a21008d404ad503755d7e79f.tar.gz ruby-562ebd8e3d0c4441a21008d404ad503755d7e79f.tar.xz ruby-562ebd8e3d0c4441a21008d404ad503755d7e79f.zip |
* sampl/test.rb: use eval instead of './miniruby -c',
in order to check a syntax error.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sample/test.rb | 11 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Fri May 17 16:16:19 2002 WATANABE Hirofumi <eban@ruby-lang.org> + + * sampl/test.rb: use eval instead of './miniruby -c', + in order to check a syntax error. + Thu May 16 14:46:34 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net> * eval.c (rb_thread_select): cleanup conditional compilation. diff --git a/sample/test.rb b/sample/test.rb index 30a02dd24..2c4f99f1e 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 |