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 | 1c05712d435bdb5e9a8ee469238eb2f5a39c3ee3 (patch) | |
tree | 6766f4909c0f8a9b4899a29bcd91560816a5baa9 /sample/test.rb | |
parent | 57b83a5191be20c49d5d4cff77582170a507cf88 (diff) | |
download | ruby-1c05712d435bdb5e9a8ee469238eb2f5a39c3ee3.tar.gz |
* sample/test.rb (valid_syntax?): defaults to us-ascii.
git-svn-id: svn+ssh://ci.ruby-lang.org/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 03ab435e00..b0475c89f6 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 |