blob: e0b65a04d8948adce68623e67f09250cb08d491e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# frozen_string_literal: false
begin
require 'ripper'
require 'test/unit'
ripper_test = true
module TestRipper; end
rescue LoadError
end
class TestRipper::Ripper < Test::Unit::TestCase
def setup
@ripper = Ripper.new '1 + 1'
end
def test_column
assert_nil @ripper.column
end
def test_encoding
assert_equal Encoding::UTF_8, @ripper.encoding
ripper = Ripper.new('# coding: iso-8859-15')
ripper.parse
assert_equal Encoding::ISO_8859_15, ripper.encoding
ripper = Ripper.new('# -*- coding: iso-8859-15 -*-')
ripper.parse
assert_equal Encoding::ISO_8859_15, ripper.encoding
end
def test_end_seen_eh
@ripper.parse
assert_not_predicate @ripper, :end_seen?
ripper = Ripper.new('__END__')
ripper.parse
assert_predicate ripper, :end_seen?
end
def test_filename
assert_equal '(ripper)', @ripper.filename
filename = "ripper"
ripper = Ripper.new("", filename)
filename.clear
assert_equal "ripper", ripper.filename
end
def test_lineno
assert_nil @ripper.lineno
end
def test_parse
assert_nil @ripper.parse
end
def test_yydebug
assert_not_predicate @ripper, :yydebug
end
def test_yydebug_equals
@ripper.yydebug = true
assert_predicate @ripper, :yydebug
end
end if ripper_test
|