Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

encoding_test cleanup

  • Loading branch information...
commit bbb497334f030ff936e79c83b596ea1dad6f9f7b 1 parent a6cb839
@quix authored
Showing with 8 additions and 17 deletions.
  1. +8 −17 test/encoding_test.rb
View
25 test/encoding_test.rb
@@ -1,34 +1,23 @@
require_relative 'main'
-require_relative 'encoding_test/default.rb'
-require_relative 'encoding_test/usascii.rb'
-require_relative 'encoding_test/utf8.rb'
-require_relative 'encoding_test/utf8bom.rb'
-require_relative 'encoding_test/utf8bom_only.rb'
-require_relative 'encoding_test/usascii_with_utf8bom.rb'
-require_relative 'encoding_test/koi8_with_utf8bom.rb'
-require_relative 'encoding_test/cp932.rb'
-require_relative 'encoding_test/eucjp.rb'
-require_relative 'encoding_test/koi8.rb'
-require_relative 'encoding_test/koi8_shebang.rb'
-
class AllEncodingTest < RegularTest
- include EncodingTest
-
- %w[
-
+ ENC_TESTS = Hash[*%w[
default US-ASCII
usascii US-ASCII
utf8 UTF-8
utf8bom UTF-8
+ utf8bom_only UTF-8
usascii_with_utf8bom US-ASCII
koi8_with_utf8bom KOI8-R
cp932 Windows-31J
eucjp EUC-JP
koi8 KOI8-R
koi8_shebang KOI8-R
+ ]]
+
+ ENC_TESTS.each_pair do |abbr, name|
+ require_relative "encoding_test/#{abbr}"
- ].each_slice(2) do |abbr, name|
define_method "test_#{abbr}" do
str = send("#{abbr}_string")
assert_equal name, str.encoding.to_s
@@ -43,6 +32,8 @@ class AllEncodingTest < RegularTest
end
end
+ include EncodingTest
+
def test_bad
orig = assert_raises ArgumentError do
live_ast_original_load "./test/encoding_test/bad.rb"
Please sign in to comment.
Something went wrong with that request. Please try again.