132132 showerror (buff, MethodError (convert, Tuple{Type, Float64}))
133133 showerror (buff, MethodError (convert, Tuple{DataType, Float64}))
134134end
135+
136+ # Issue #13032
137+ let
138+ # Make sure editor doesn't error when no ENV editor is set.
139+ pop! (ENV , " JULIA_EDITOR" , " " )
140+ pop! (ENV , " VISUAL" , " " )
141+ pop! (ENV , " EDITOR" , " " )
142+ @test isa (Base. editor (), Array)
143+
144+ # Invalid editors
145+ ENV [" JULIA_EDITOR" ] = " "
146+ @test_throws ErrorException Base. editor ()
147+
148+ # Note: The following testcases should work regardless of whether these editors are
149+ # installed or not.
150+
151+ # Editor on the path.
152+ ENV [" JULIA_EDITOR" ] = " vim"
153+ @test Base. editor () == [" vim" ]
154+
155+ # Absolute path to editor.
156+ ENV [" JULIA_EDITOR" ] = " /usr/bin/vim"
157+ @test Base. editor () == [" /usr/bin/vim" ]
158+
159+ # Editor on the path using arguments.
160+ ENV [" JULIA_EDITOR" ] = " subl -w"
161+ @test Base. editor () == [" subl" , " -w" ]
162+
163+ # Absolute path to editor with spaces.
164+ ENV [" JULIA_EDITOR" ] = " /Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl"
165+ @test Base. editor () == [" /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ]
166+
167+ # Paths with spaces and arguments (#13032).
168+ ENV [" JULIA_EDITOR" ] = " /Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl -w"
169+ @test Base. editor () == [" /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" , " -w" ]
170+
171+ ENV [" JULIA_EDITOR" ] = " '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -w"
172+ @test Base. editor () == [" /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" , " -w" ]
173+
174+ ENV [" JULIA_EDITOR" ] = " \" /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl\" -w"
175+ @test Base. editor () == [" /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" , " -w" ]
176+ end
0 commit comments