diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb
index dc195cc6ac..21aa2b09f5 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -150,8 +150,7 @@ def comment=(comment)
else
# HACK correct fix is to have #initialize create @comment
# with the correct encoding
- if String === @comment and
- Object.const_defined? :Encoding and @comment.empty? then
+ if String === @comment and @comment.empty? then
@comment.force_encoding comment.encoding
end
@comment
@@ -427,4 +426,3 @@ def suppressed?
end
end
-
diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb
index ebff742233..c655763b3e 100644
--- a/lib/rdoc/comment.rb
+++ b/lib/rdoc/comment.rb
@@ -200,7 +200,7 @@ def parse
def remove_private
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
empty = ''
- empty.force_encoding @text.encoding if Object.const_defined? :Encoding
+ empty.force_encoding @text.encoding
@text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
@text = @text.sub(%r%^\s*[#*]?--.*%m, '')
@@ -227,4 +227,3 @@ def tomdoc?
end
end
-
diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb
index 1056827937..44881d043c 100644
--- a/lib/rdoc/encoding.rb
+++ b/lib/rdoc/encoding.rb
@@ -25,43 +25,41 @@ def self.read_file filename, encoding, force_transcode = false
RDoc::Encoding.set_encoding content
- if Object.const_defined? :Encoding then
- begin
- encoding ||= Encoding.default_external
- orig_encoding = content.encoding
-
- if not orig_encoding.ascii_compatible? then
- content.encode! encoding
- elsif utf8 then
- content.force_encoding Encoding::UTF_8
- content.encode! encoding
- else
- # assume the content is in our output encoding
- content.force_encoding encoding
- end
-
- unless content.valid_encoding? then
- # revert and try to transcode
- content.force_encoding orig_encoding
- content.encode! encoding
- end
-
- unless content.valid_encoding? then
- warn "unable to convert #{filename} to #{encoding}, skipping"
- content = nil
- end
- rescue Encoding::InvalidByteSequenceError,
- Encoding::UndefinedConversionError => e
- if force_transcode then
- content.force_encoding orig_encoding
- content.encode!(encoding,
- :invalid => :replace, :undef => :replace,
- :replace => '?')
- return content
- else
- warn "unable to convert #{e.message} for #{filename}, skipping"
- return nil
- end
+ begin
+ encoding ||= Encoding.default_external
+ orig_encoding = content.encoding
+
+ if not orig_encoding.ascii_compatible? then
+ content.encode! encoding
+ elsif utf8 then
+ content.force_encoding Encoding::UTF_8
+ content.encode! encoding
+ else
+ # assume the content is in our output encoding
+ content.force_encoding encoding
+ end
+
+ unless content.valid_encoding? then
+ # revert and try to transcode
+ content.force_encoding orig_encoding
+ content.encode! encoding
+ end
+
+ unless content.valid_encoding? then
+ warn "unable to convert #{filename} to #{encoding}, skipping"
+ content = nil
+ end
+ rescue Encoding::InvalidByteSequenceError,
+ Encoding::UndefinedConversionError => e
+ if force_transcode then
+ content.force_encoding orig_encoding
+ content.encode!(encoding,
+ :invalid => :replace, :undef => :replace,
+ :replace => '?')
+ return content
+ else
+ warn "unable to convert #{e.message} for #{filename}, skipping"
+ return nil
end
end
@@ -103,11 +101,8 @@ def self.set_encoding string
remove_frozen_string_literal string
- return unless Object.const_defined? :Encoding
-
enc = Encoding.find name
string.force_encoding enc if enc
end
end
-
diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb
index 18394a2c34..e961518fcc 100644
--- a/lib/rdoc/generator/darkfish.rb
+++ b/lib/rdoc/generator/darkfish.rb
@@ -698,7 +698,7 @@ def render_template template_file, out_file = nil # :yield: io
out_file.dirname.mkpath
out_file.open 'w', 0644 do |io|
- io.set_encoding @options.encoding if Object.const_defined? :Encoding
+ io.set_encoding @options.encoding
@context = yield io
@@ -744,8 +744,7 @@ def template_for file, page = true, klass = ERB
erbout = 'io'
else
template = file.read
- template = template.encode @options.encoding if
- Object.const_defined? :Encoding
+ template = template.encode @options.encoding
file_var = File.basename(file).sub(/\..*/, '')
@@ -758,4 +757,3 @@ def template_for file, page = true, klass = ERB
end
end
-
diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb
index 624a2e512e..931438b3c3 100644
--- a/lib/rdoc/generator/json_index.rb
+++ b/lib/rdoc/generator/json_index.rb
@@ -142,7 +142,7 @@ def generate
FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC
index_file.open 'w', 0644 do |io|
- io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
+ io.set_encoding Encoding::UTF_8
io.write 'var search_data = '
JSON.dump data, io, 0
@@ -295,4 +295,3 @@ def search_string string
end
end
-
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index 2f8b7628e2..22cca20420 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -79,8 +79,6 @@ def initialize
@binary_input = nil
@current_token = nil
@debug = false
- @have_encoding = Object.const_defined? :Encoding
- @have_byteslice = ''.respond_to? :byteslice
@input = nil
@input_encoding = nil
@line = 0
@@ -324,15 +322,7 @@ def build_verbatim margin
# The character offset for the input string at the given +byte_offset+
def char_pos byte_offset
- if @have_byteslice then
- @input.byteslice(0, byte_offset).length
- elsif @have_encoding then
- matched = @binary_input[0, byte_offset]
- matched.force_encoding @input_encoding
- matched.length
- else
- byte_offset
- end
+ @input.byteslice(0, byte_offset).length
end
##
@@ -430,11 +420,6 @@ def setup_scanner input
@line_pos = 0
@input = input.dup
- if @have_encoding and not @have_byteslice then
- @input_encoding = @input.encoding
- @binary_input = @input.force_encoding Encoding::BINARY
- end
-
@s = StringScanner.new input
end
@@ -556,4 +541,3 @@ def unget
end
end
-
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 17b0bb105d..2bc7474eb0 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -379,23 +379,15 @@ def init_ivars # :nodoc:
@visibility = :protected
@webcvs = nil
@write_options = false
-
- if Object.const_defined? :Encoding then
- @encoding = Encoding::UTF_8
- @charset = @encoding.name
- else
- @encoding = nil
- @charset = 'UTF-8'
- end
+ @encoding = Encoding::UTF_8
+ @charset = @encoding.name
end
def init_with map # :nodoc:
init_ivars
encoding = map['encoding']
- @encoding = if Object.const_defined? :Encoding then
- encoding ? Encoding.find(encoding) : encoding
- end
+ @encoding = encoding ? Encoding.find(encoding) : encoding
@charset = map['charset']
@exclude = map['exclude']
@@ -689,19 +681,16 @@ def parse argv
opt.separator "Parsing options:"
opt.separator nil
- if Object.const_defined? :Encoding then
- opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
- "Specifies the output encoding. All files",
- "read will be converted to this encoding.",
- "The default encoding is UTF-8.",
- "--encoding is preferred over --charset") do |value|
- @encoding = Encoding.find value
- @charset = @encoding.name # may not be valid value
- end
-
- opt.separator nil
- end
+ opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
+ "Specifies the output encoding. All files",
+ "read will be converted to this encoding.",
+ "The default encoding is UTF-8.",
+ "--encoding is preferred over --charset") do |value|
+ @encoding = Encoding.find value
+ @charset = @encoding.name # may not be valid value
+ end
+ opt.separator nil
opt.on("--locale=NAME",
"Specifies the output locale.") do |value|
@@ -1242,11 +1231,10 @@ def write_options
RDoc.load_yaml
open '.rdoc_options', 'w' do |io|
- io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
+ io.set_encoding Encoding::UTF_8
YAML.dump self, io
end
end
end
-
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index ac7094f488..c30dbf0f4e 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -170,9 +170,7 @@ def initialize(top_level, file_name, content, options, stats)
@prev_seek = nil
@markup = @options.markup
@track_visibility = :nodoc != @options.visibility
-
- @encoding = nil
- @encoding = @options.encoding if Object.const_defined? :Encoding
+ @encoding = @options.encoding
reset
end
@@ -2158,4 +2156,3 @@ def warn message
end
end
-
diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb
index 73bb7bdffb..f2ab27a92e 100644
--- a/lib/rdoc/parser/simple.rb
+++ b/lib/rdoc/parser/simple.rb
@@ -52,11 +52,10 @@ def remove_coding_comment text
def remove_private_comment comment
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
empty = ''
- empty.force_encoding comment.encoding if Object.const_defined? :Encoding
+ empty.force_encoding comment.encoding
comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty)
comment.sub(%r%^--\n.*%m, empty)
end
end
-
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 65680c863d..db2e5a48f5 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -340,10 +340,8 @@ def list_files_in_directory dir
# Parses +filename+ and returns an RDoc::TopLevel
def parse_file filename
- if Object.const_defined? :Encoding then
- encoding = @options.encoding
- filename = filename.encode encoding
- end
+ encoding = @options.encoding
+ filename = filename.encode encoding
@stats.add_file filename
diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb
index 59f807ec09..7c80ecdf9c 100644
--- a/lib/rdoc/test_case.rb
+++ b/lib/rdoc/test_case.rb
@@ -39,8 +39,6 @@ def setup
@top_level = nil
- @have_encoding = Object.const_defined? :Encoding
-
@RM = RDoc::Markup
RDoc::Markup::PreProcess.reset
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index b40c89806a..a38bb921ad 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -52,7 +52,7 @@ module RDoc::Text
:open_squote => encode_fallback('‘', encoding, '\''),
:trademark => encode_fallback('®', encoding, '(r)'),
}
- end if Object.const_defined? :Encoding
+ end
##
# Transcodes +character+ to +encoding+ with a +fallback+ character.
@@ -71,7 +71,7 @@ def expand_tabs text
text.each_line do |line|
nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
r = "#{$1}#{$2}#{' ' * (8 - $2.size)}"
- r.force_encoding text.encoding if Object.const_defined? :Encoding
+ r.force_encoding text.encoding
r
end
@@ -93,7 +93,7 @@ def flush_left text
end
empty = ''
- empty.force_encoding text.encoding if Object.const_defined? :Encoding
+ empty.force_encoding text.encoding
text.gsub(/^ {0,#{indent}}/, empty)
end
@@ -160,7 +160,7 @@ def strip_hashes text
return text if text =~ /^(?>\s*)[^\#]/
empty = ''
- empty.force_encoding text.encoding if Object.const_defined? :Encoding
+ empty.force_encoding text.encoding
text.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\s+$/, empty)
end
@@ -178,7 +178,7 @@ def strip_newlines text
def strip_stars text
return text unless text =~ %r%/\*.*\*/%m
- encoding = text.encoding if Object.const_defined? :Encoding
+ encoding = text.encoding
text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, ''
@@ -199,24 +199,9 @@ def strip_stars text
# trademark symbols in +text+ to properly encoded characters.
def to_html text
- if Object.const_defined? :Encoding then
- html = ''.encode text.encoding
+ html = ''.encode text.encoding
- encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
- else
- html = ''
- encoded = {
- :close_dquote => '”',
- :close_squote => '’',
- :copyright => '©',
- :ellipsis => '…',
- :em_dash => '—',
- :en_dash => '–',
- :open_dquote => '“',
- :open_squote => '‘',
- :trademark => '®',
- }
- end
+ encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
s = StringScanner.new text
insquotes = false
diff --git a/test/test_rdoc_code_object.rb b/test/test_rdoc_code_object.rb
index 74b88557e0..e0d89e4e67 100644
--- a/test/test_rdoc_code_object.rb
+++ b/test/test_rdoc_code_object.rb
@@ -50,8 +50,6 @@ def test_comment_equals_document
end
def test_comment_equals_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
refute_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check'
input = 'text'
@@ -64,8 +62,6 @@ def test_comment_equals_encoding
end
def test_comment_equals_encoding_blank
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
refute_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check'
input = ''
@@ -448,4 +444,3 @@ def test_suppress_eh
end
end
-
diff --git a/test/test_rdoc_comment.rb b/test/test_rdoc_comment.rb
index 178c579ea7..3b0927212f 100644
--- a/test/test_rdoc_comment.rb
+++ b/test/test_rdoc_comment.rb
@@ -207,8 +207,6 @@ def test_extract_call_seq_c_separator
end
def test_force_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@comment.force_encoding Encoding::UTF_8
assert_equal Encoding::UTF_8, @comment.text.encoding
@@ -343,8 +341,6 @@ def test_parse_rd
end
def test_remove_private_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
comment = RDoc::Comment.new <<-EOS, @top_level
# This is text
#--
@@ -467,8 +463,6 @@ def test_remove_private_toggle
end
def test_remove_private_toggle_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
comment = RDoc::Comment.new <<-EOS, @top_level
# This is text
#--
@@ -485,8 +479,6 @@ def test_remove_private_toggle_encoding
end
def test_remove_private_toggle_encoding_ruby_bug?
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
comment = RDoc::Comment.new <<-EOS, @top_level
#--
# this is private
@@ -502,4 +494,3 @@ def test_remove_private_toggle_encoding_ruby_bug?
end
end
-
diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb
index 74d2a2668a..915f3ce5ec 100644
--- a/test/test_rdoc_encoding.rb
+++ b/test/test_rdoc_encoding.rb
@@ -25,8 +25,6 @@ def test_class_read_file
end
def test_class_read_file_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
expected = "# coding: utf-8\nhi everybody"
@tempfile.write expected
@@ -38,8 +36,6 @@ def test_class_read_file_encoding
end
def test_class_read_file_encoding_convert
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
content = ""
content.encode! 'ISO-8859-1'
content << "# coding: ISO-8859-1\nhi \xE9verybody"
@@ -53,8 +49,6 @@ def test_class_read_file_encoding_convert
end
def test_class_read_file_encoding_fail
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@tempfile.write "# coding: utf-8\n\317\200" # pi
@tempfile.flush
@@ -70,8 +64,6 @@ def test_class_read_file_encoding_fail
end
def test_class_read_file_encoding_fancy
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
expected = "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody"
expected.encode! Encoding::UTF_8
@@ -84,8 +76,6 @@ def test_class_read_file_encoding_fancy
end
def test_class_read_file_encoding_force_transcode
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@tempfile.write "# coding: utf-8\n\317\200" # pi
@tempfile.flush
@@ -96,8 +86,6 @@ def test_class_read_file_encoding_force_transcode
end
def test_class_read_file_encoding_guess
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
path = File.expand_path '../test.ja.txt', __FILE__
content = RDoc::Encoding.read_file path, Encoding::UTF_8
@@ -105,8 +93,6 @@ def test_class_read_file_encoding_guess
end
def test_class_read_file_encoding_invalid
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@tempfile.write "# coding: ascii\nM\xE4r"
@tempfile.flush
@@ -121,8 +107,6 @@ def test_class_read_file_encoding_invalid
end
def test_class_read_file_encoding_with_signature
- skip "Encoding not implemented" unless defined? ::Encoding
-
@tempfile.write "\xEF\xBB\xBFhi everybody"
@tempfile.flush
@@ -133,8 +117,6 @@ def test_class_read_file_encoding_with_signature
end
def test_class_read_file_encoding_iso_2022_jp
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
input = "# coding: ISO-2022-JP\n:\e$B%3%^%s%I\e(B:"
@tempfile.write input
@@ -155,8 +137,6 @@ def test_class_set_encoding
# sanity check for 1.8
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
assert_equal Encoding::UTF_8, s.encoding
s = "#!/bin/ruby\n# coding: UTF-8\n"
@@ -192,8 +172,6 @@ def test_class_set_encoding_strip
end
def test_class_set_encoding_bad
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
s = ""
expected = s.encoding
RDoc::Encoding.set_encoding s
@@ -218,8 +196,6 @@ def test_class_set_encoding_bad
end
def test_skip_frozen_string_literal
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
expected = "# frozen_string_literal: false\nhi everybody"
@tempfile.write expected
@@ -231,8 +207,6 @@ def test_skip_frozen_string_literal
end
def test_skip_frozen_string_literal_after_coding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
expected = "# coding: utf-8\n# frozen-string-literal: false\nhi everybody"
@tempfile.write expected
@@ -244,8 +218,6 @@ def test_skip_frozen_string_literal_after_coding
end
def test_skip_frozen_string_literal_before_coding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
expected = "# frozen_string_literal: false\n# coding: utf-8\nhi everybody"
@tempfile.write expected
@@ -257,11 +229,8 @@ def test_skip_frozen_string_literal_before_coding
end
def test_sanity
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
assert_equal Encoding::US_ASCII, ''.encoding,
'If this file is not ASCII tests may incorrectly pass'
end
end
-
diff --git a/test/test_rdoc_generator_darkfish.rb b/test/test_rdoc_generator_darkfish.rb
index 894acbd4f2..6a3e7038e1 100644
--- a/test/test_rdoc_generator_darkfish.rb
+++ b/test/test_rdoc_generator_darkfish.rb
@@ -83,11 +83,7 @@ def test_generate
assert_hard_link 'fonts/SourceCodePro-Bold.ttf'
assert_hard_link 'fonts/SourceCodePro-Regular.ttf'
- encoding = if Object.const_defined? :Encoding then
- Regexp.escape Encoding::UTF_8.name
- else
- Regexp.escape 'UTF-8'
- end
+ encoding = Regexp.escape Encoding::UTF_8.name
assert_match %r%%, File.read('index.html')
assert_match %r%%, File.read('Object.html')
@@ -227,4 +223,3 @@ def assert_hard_link filename
end
end
-
diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb
index 864d1134e4..52c35a564d 100644
--- a/test/test_rdoc_generator_json_index.rb
+++ b/test/test_rdoc_generator_json_index.rb
@@ -198,8 +198,6 @@ def test_generate_gzipped
end
def test_generate_utf_8
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
text = "5\xB0"
text.force_encoding Encoding::ISO_8859_1
@klass.add_comment comment(text), @top_level
@@ -322,4 +320,3 @@ def test_search_string
end
end
-
diff --git a/test/test_rdoc_generator_ri.rb b/test/test_rdoc_generator_ri.rb
index 1e18e13b10..d9f7b7ebc6 100644
--- a/test/test_rdoc_generator_ri.rb
+++ b/test/test_rdoc_generator_ri.rb
@@ -7,10 +7,8 @@ def setup
super
@options = RDoc::Options.new
- if Object.const_defined? :Encoding then
- @options.encoding = Encoding::UTF_8
- @store.encoding = Encoding::UTF_8
- end
+ @options.encoding = Encoding::UTF_8
+ @store.encoding = Encoding::UTF_8
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_ri_#{$$}"
FileUtils.mkdir_p @tmpdir
@@ -57,7 +55,7 @@ def test_generate
store = RDoc::RI::Store.new @tmpdir
store.load_cache
- encoding = Object.const_defined?(:Encoding) ? Encoding::UTF_8 : nil
+ encoding = Encoding::UTF_8
assert_equal encoding, store.encoding
end
@@ -76,4 +74,3 @@ def test_generate_dry_run
end
end
-
diff --git a/test/test_rdoc_markup_parser.rb b/test/test_rdoc_markup_parser.rb
index e9986553c0..849d19f8c7 100644
--- a/test/test_rdoc_markup_parser.rb
+++ b/test/test_rdoc_markup_parser.rb
@@ -8,8 +8,6 @@ class TestRDocMarkupParser < RDoc::TestCase
def setup
super
- @have_byteslice = ''.respond_to? :byteslice
-
@RMP = @RM::Parser
end
@@ -30,11 +28,7 @@ def test_char_pos
s.scan(/\S+/)
- if @have_byteslice or @have_encoding then
- assert_equal 3, parser.char_pos(s.pos)
- else
- assert_equal 4, parser.char_pos(s.pos)
- end
+ assert_equal 3, parser.char_pos(s.pos)
end
def test_get
@@ -1360,8 +1354,6 @@ def test_tokenize_note_newline
end
def test_tokenize_note_utf_8
- skip 'Encoding not implemented' unless @have_encoding
-
str = <<-STR
cät:: l1a
l1b
@@ -1626,11 +1618,7 @@ def test_token_pos
s.scan(/\S+/)
- if @have_encoding or @have_byteslice then
- assert_equal [3, 0], parser.token_pos(s.pos)
- else
- assert_equal [4, 0], parser.token_pos(s.pos)
- end
+ assert_equal [3, 0], parser.token_pos(s.pos)
end
# HACK move to Verbatim test case
@@ -1678,4 +1666,3 @@ def util_parser
end
end
-
diff --git a/test/test_rdoc_markup_pre_process.rb b/test/test_rdoc_markup_pre_process.rb
index 8bc474a8fc..ceb411c745 100644
--- a/test/test_rdoc_markup_pre_process.rb
+++ b/test/test_rdoc_markup_pre_process.rb
@@ -55,8 +55,6 @@ def test_include_file
end
def test_include_file_encoding_incompatible
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@tempfile.write <<-INCLUDE
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
@@ -471,4 +469,3 @@ def test_handle_directive_yields
end
end
-
diff --git a/test/test_rdoc_options.rb b/test/test_rdoc_options.rb
index 5d79432f94..eef37b44b4 100644
--- a/test/test_rdoc_options.rb
+++ b/test/test_rdoc_options.rb
@@ -60,7 +60,7 @@ class << coder; alias add []=; end
@options.encode_with coder
- encoding = Object.const_defined?(:Encoding) ? 'UTF-8' : nil
+ encoding = 'UTF-8'
expected = {
'charset' => 'UTF-8',
@@ -122,8 +122,6 @@ class << coder; alias add []=; end
end
def test_encoding_default
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
assert_equal Encoding::UTF_8, @options.encoding
end
@@ -142,7 +140,6 @@ def test_generator_descriptions
end
def test_init_with_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
RDoc.load_yaml
@options.encoding = Encoding::IBM437
@@ -273,8 +270,6 @@ def test_parse_dry_run
end
def test_parse_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@options.parse %w[--encoding Big5]
assert_equal Encoding::Big5, @options.encoding
@@ -282,8 +277,6 @@ def test_parse_encoding
end
def test_parse_encoding_invalid
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
out, err = capture_io do
@options.parse %w[--encoding invalid]
end
@@ -764,4 +757,3 @@ def test_visibility
assert_equal :private, @options.visibility
end
end
-
diff --git a/test/test_rdoc_parser.rb b/test/test_rdoc_parser.rb
index ee2865ce02..732beb6629 100644
--- a/test/test_rdoc_parser.rb
+++ b/test/test_rdoc_parser.rb
@@ -47,8 +47,6 @@ def test_class_binary_japanese_text
end
def test_class_binary_large_japanese_rdoc
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
capture_io do
begin
extenc, Encoding.default_external =
@@ -62,8 +60,6 @@ def test_class_binary_large_japanese_rdoc
end
def test_class_binary_japanese_rdoc
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
file_name = File.expand_path '../test.ja.rdoc', __FILE__
refute @RP.binary?(file_name)
end
@@ -325,4 +321,3 @@ def test_initialize
end
end
-
diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb
index 2befa87542..44b38c28aa 100644
--- a/test/test_rdoc_parser_ruby.rb
+++ b/test/test_rdoc_parser_ruby.rb
@@ -48,8 +48,6 @@ class C; end
end
def test_collect_first_comment_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
@options.encoding = Encoding::CP852
p = util_parser <<-CONTENT
@@ -1928,8 +1926,7 @@ def test_parse_method_utf8
method = "def ω() end"
- assert_equal Encoding::UTF_8, method.encoding if
- Object.const_defined? :Encoding
+ assert_equal Encoding::UTF_8, method.encoding
util_parser method
@@ -2023,7 +2020,6 @@ def test_parse_statements_def_percent_string_pound
end
def test_parse_statements_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
@options.encoding = Encoding::CP852
content = <<-EOF
@@ -3320,4 +3316,3 @@ def util_two_parsers(first_file_content, second_file_content)
end
end
-
diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb
index b87f44b652..55096d394e 100644
--- a/test/test_rdoc_rdoc.rb
+++ b/test/test_rdoc_rdoc.rb
@@ -249,7 +249,6 @@ def test_parse_file_relative
end
def test_parse_file_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
@rdoc.options.encoding = Encoding::ISO_8859_1
@rdoc.store = RDoc::Store.new
@@ -454,4 +453,3 @@ def test_normalized_file_list_removes_created_rid_dir
end
end
end
-
diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb
index c1717549c6..2c988aaea4 100644
--- a/test/test_rdoc_store.rb
+++ b/test/test_rdoc_store.rb
@@ -429,8 +429,6 @@ def test_load_cache
end
def test_load_cache_encoding_differs
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
cache = {
:c_class_variables => {},
:c_singleton_class_variables => {},
@@ -991,4 +989,3 @@ def test_title
end
end
-
diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb
index 3945b6e718..2eb5ad69c7 100644
--- a/test/test_rdoc_text.rb
+++ b/test/test_rdoc_text.rb
@@ -16,8 +16,6 @@ def setup
end
def test_self_encode_fallback
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
assert_equal '…',
RDoc::Text::encode_fallback('…', Encoding::UTF_8, '...')
assert_equal '...',
@@ -63,8 +61,6 @@ def test_expand_tabs
end
def test_expand_tabs_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
inn = "hello\ns\tdave"
inn.force_encoding Encoding::BINARY
@@ -93,8 +89,6 @@ def test_flush_left
end
def test_flush_left_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
text = <<-TEXT
we don't worry too much.
@@ -303,8 +297,6 @@ def test_strip_hashes
end
def test_strip_hashes_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
text = <<-TEXT
##
# we don't worry too much.
@@ -338,8 +330,6 @@ def test_strip_newlines
end
def test_strip_newlines_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
assert_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check'
text = " \n"
@@ -389,8 +379,6 @@ def test_strip_stars_document_method
end
def test_strip_stars_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
text = <<-TEXT
/*
* * we don't worry too much.
@@ -415,8 +403,6 @@ def test_strip_stars_encoding
end
def test_strip_stars_encoding2
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
text = <<-TEXT
/*
* * we don't worry too much.
@@ -511,8 +497,6 @@ def test_to_html_ellipsis
end
def test_to_html_encoding
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
-
s = '...(c)'.encode Encoding::Shift_JIS
html = to_html s
@@ -555,4 +539,3 @@ def options
end
end
-