diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-14 01:17:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-14 01:17:49 +0000 |
commit | 321539774a067beca19988c64a34a4d843ad845d (patch) | |
tree | 6766f4909c0f8a9b4899a29bcd91560816a5baa9 /sample/test.rb | |
parent | 729e0a25d383e35dcf2a41ea9c46555f3b539457 (diff) | |
download | ruby-321539774a067beca19988c64a34a4d843ad845d.tar.gz ruby-321539774a067beca19988c64a34a4d843ad845d.tar.xz ruby-321539774a067beca19988c64a34a4d843ad845d.zip |
* sample/test.rb (valid_syntax?): defaults to us-ascii.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/test.rb')
-rw-r--r-- | sample/test.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sample/test.rb b/sample/test.rb index 03ab435e0..b0475c89f 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1,4 +1,5 @@ #! /usr/bin/env ruby +# -*- coding: us-ascii -*- $testnum=0 $ntest=0 @@ -1932,7 +1933,7 @@ def valid_syntax?(code, fname) code.force_encoding("ascii-8bit") code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) { "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" - } + }.force_encoding("us-ascii") catch {|tag| eval(code, binding, fname, 0)} rescue Exception STDERR.puts $!.message |