diff --git a/ChangeLog b/ChangeLog index 018bb7bf59..71f4a7c5f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri May 17 16:16:19 2002 WATANABE Hirofumi + + * 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 * eval.c (rb_thread_select): cleanup conditional compilation. diff --git a/sample/test.rb b/sample/test.rb index 30a02dd24d..2c4f99f1e4 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