@@ -77,6 +77,36 @@ def test_constant_entry
7777 assert_equal 'method/-foo/c/-a-a-a.html' , e [ :path ]
7878 end
7979
80+ def test_special_variable_keeps_its_sigil_in_name
81+ # A special variable's "$" is part of how it is written and is the only
82+ # thing distinguishing it (there is no owning class to qualify it), so it
83+ # must stay in +name+ for a "$;"-style query to match. See issue #194.
84+ #
85+ # The +name+/+type+ assertions below are what issue #194 is about. The
86+ # +path+ assertion is secondary and filesystem-dependent: @gen defaults to
87+ # fs_casesensitive: false, so the path is built by encodename_fs ("Kernel"
88+ # -> "-kernel", ";" -> "=3b"). It is fine to ignore ONLY the path failure if
89+ # it broke because the fs encoding scheme changed or a case-sensitive build
90+ # (fs_casesensitive: true, giving "method/Kernel/v/...") is in use -- as long
91+ # as name/type still hold. A name/type failure is a real regression.
92+ index = @gen . build_index ( @db )
93+ e = find_entry ( index , '$;' )
94+ assert_not_nil e
95+ assert_equal '$;' , e [ :name ]
96+ assert_equal 'variable' , e [ :type ]
97+ assert_equal 'method/-kernel/v/=3b.html' , e [ :path ] ,
98+ 'filesystem-encoded path (fs_casesensitive: false); ' \
99+ 'ignore only this failure if just the fs encoding/casing changed'
100+ end
101+
102+ def test_special_variable_word_name_keeps_its_sigil
103+ index = @gen . build_index ( @db )
104+ e = find_entry ( index , '$stdout' )
105+ assert_not_nil e
106+ assert_equal '$stdout' , e [ :name ]
107+ assert_equal 'variable' , e [ :type ]
108+ end
109+
80110 def test_same_method_name_in_two_classes
81111 index = @gen . build_index ( @db )
82112 assert_not_nil find_entry ( index , 'Foo#foo' )
@@ -135,6 +165,11 @@ def setup_files
135165== Module Functions
136166--- at_exit{ ... } -> Proc
137167aaa
168+ == Special Variables
169+ --- $; -> String | nil
170+ 区切り文字。
171+ --- $stdout -> IO
172+ 標準出力。
138173
139174HERE
140175 end
0 commit comments