diff options
author | Summer ☀️ <[email protected]> | 2023-08-20 11:21:57 -0600 |
---|---|---|
committer | git <[email protected]> | 2023-08-20 17:22:01 +0000 |
commit | 725ca2f9d808d180c57eaf49c2dd6bfcb9f701e4 (patch) | |
tree | 8ae57c283278d0a0b83170817583a4729c20d6a8 /test/irb/test_cmd.rb | |
parent | 5c75dc51b7ea956d94db8123f4501e5e7f5957ae (diff) |
[ruby/irb] Support `VISUAL` env var, and prefer it over `EDITOR`
(https://github.com/ruby/irb/pull/686)
* Support `VISUAL` env var, and prefer it over `EDITOR`
* Update test/irb/test_cmd.rb
---------
https://github.com/ruby/irb/commit/399b872c31
Co-authored-by: Stan Lo <[email protected]>
Diffstat (limited to 'test/irb/test_cmd.rb')
-rw-r--r-- | test/irb/test_cmd.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index dcea020b1e..272f6d3ace 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -920,12 +920,15 @@ module TestIRB class EditTest < CommandTestCase def setup + @original_visual = ENV["VISUAL"] @original_editor = ENV["EDITOR"] # noop the command so nothing gets executed - ENV["EDITOR"] = ": code" + ENV["VISUAL"] = ": code" + ENV["EDITOR"] = ": code2" end def teardown + ENV["VISUAL"] = @original_visual ENV["EDITOR"] = @original_editor end @@ -988,5 +991,18 @@ module TestIRB assert_match(/path: .*\/lib\/irb\.rb/, out) assert_match("command: ': code'", out) end + + def test_edit_with_editor_env_var + ENV.delete("VISUAL") + + out, err = execute_lines( + "edit", + irb_path: __FILE__ + ) + + assert_empty err + assert_match("path: #{__FILE__}", out) + assert_match("command: ': code2'", out) + end end end |