Skip to content

Commit 9a18307

Browse files
committed
Remove things that confuse 1.8
1 parent 1b40b20 commit 9a18307

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

test/test_rdoc_parser_ruby.rb

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def test_parse_meta_attr_writer
471471
def test_parse_class
472472
comment = "##\n# my method\n"
473473

474-
util_parser 'class Foo; end'
474+
util_parser "class Foo\nend"
475475

476476
tk = @parser.get_tk
477477

@@ -520,7 +520,7 @@ def test_parse_class_nested_superclass
520520
def test_parse_module
521521
comment = "##\n# my module\n"
522522

523-
util_parser 'module Foo; end'
523+
util_parser "module Foo\nend"
524524

525525
tk = @parser.get_tk
526526

@@ -604,7 +604,7 @@ def test_parse_class_mistaken_for_module
604604
# before Foo::Bar is encountered), but RDoc might encounter Foo::Bar
605605
# before Foo if they live in different files.
606606

607-
code = <<-EOF
607+
code = <<-RUBY
608608
class Foo::Bar
609609
end
610610
@@ -613,7 +613,7 @@ module Foo::Baz
613613
614614
class Foo
615615
end
616-
EOF
616+
RUBY
617617

618618
util_parser code
619619

@@ -1183,6 +1183,8 @@ def test_parse_method_true
11831183
end
11841184

11851185
def test_parse_method_utf8
1186+
skip "Encoding not implemented" unless Object.const_defined? :Encoding
1187+
11861188
klass = RDoc::NormalClass.new 'Foo'
11871189
klass.parent = @top_level
11881190

@@ -1256,7 +1258,12 @@ class Foo
12561258
end
12571259

12581260
def test_parse_statements_identifier_alias_method
1259-
content = "class Foo def foo() end; alias_method :foo2, :foo end"
1261+
content = <<-RUBY
1262+
class Foo
1263+
def foo() end
1264+
alias_method :foo2, :foo
1265+
end
1266+
RUBY
12601267

12611268
util_parser content
12621269

@@ -1399,11 +1406,10 @@ class Foo
13991406
assert_equal 'SEVENTH_CONSTANT', constant.name
14001407
assert_equal "proc { |i| begin i end }", constant.value
14011408
assert_equal @top_level, constant.file
1402-
14031409
end
14041410

14051411
def test_parse_statements_identifier_attr
1406-
content = "class Foo; attr :foo; end"
1412+
content = "class Foo\nattr :foo\nend"
14071413

14081414
util_parser content
14091415

@@ -1415,7 +1421,7 @@ def test_parse_statements_identifier_attr
14151421
end
14161422

14171423
def test_parse_statements_identifier_attr_accessor
1418-
content = "class Foo; attr_accessor :foo; end"
1424+
content = "class Foo\nattr_accessor :foo\nend"
14191425

14201426
util_parser content
14211427

@@ -1427,7 +1433,7 @@ def test_parse_statements_identifier_attr_accessor
14271433
end
14281434

14291435
def test_parse_statements_identifier_include
1430-
content = "class Foo; include Bar; end"
1436+
content = "class Foo\ninclude Bar\nend"
14311437

14321438
util_parser content
14331439

@@ -1439,24 +1445,24 @@ def test_parse_statements_identifier_include
14391445
end
14401446

14411447
def test_parse_statements_identifier_module_function
1442-
content = "module Foo def foo() end; module_function :foo; end"
1448+
content = "module Foo\ndef foo() end\nmodule_function :foo\nend"
14431449

14441450
util_parser content
14451451

14461452
@parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
14471453

14481454
foo, s_foo = @top_level.modules.first.method_list
1449-
assert_equal 'foo', foo.name, 'instance method name'
1455+
assert_equal 'foo', foo.name, 'instance method name'
14501456
assert_equal :private, foo.visibility, 'instance method visibility'
1451-
assert_equal false, foo.singleton, 'instance method singleton'
1457+
assert_equal false, foo.singleton, 'instance method singleton'
14521458

1453-
assert_equal 'foo', s_foo.name, 'module function name'
1459+
assert_equal 'foo', s_foo.name, 'module function name'
14541460
assert_equal :public, s_foo.visibility, 'module function visibility'
1455-
assert_equal true, s_foo.singleton, 'module function singleton'
1461+
assert_equal true, s_foo.singleton, 'module function singleton'
14561462
end
14571463

14581464
def test_parse_statements_identifier_private
1459-
content = "class Foo private; def foo() end end"
1465+
content = "class Foo\nprivate\ndef foo() end\nend"
14601466

14611467
util_parser content
14621468

0 commit comments

Comments
 (0)