-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't echo an experssion result when it ends with a semicolon
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
require "tempfile" | ||
|
||
require_relative "helper" | ||
|
||
module TestIRB | ||
class EchoingTest < IntegrationTestCase | ||
def test_irb_echos_by_default | ||
write_ruby <<~'RUBY' | ||
binding.irb | ||
RUBY | ||
|
||
output = run_ruby_file do | ||
type "123123" | ||
type "exit" | ||
end | ||
|
||
assert_include(output, "001:0> 123123") | ||
assert_include(output, "=> 123123") | ||
end | ||
|
||
def test_irb_doesnt_echo_line_with_semicolon | ||
write_ruby <<~'RUBY' | ||
binding.irb | ||
RUBY | ||
|
||
output = run_ruby_file do | ||
type "123123;" | ||
type "123123 ;" | ||
type "123123; " | ||
type <<~RUBY | ||
if true | ||
123123 | ||
end; | ||
RUBY | ||
type "exit" | ||
end | ||
|
||
assert_include(output, "001:0> 123123;") | ||
assert_not_include(output, "=> 123123") | ||
end | ||
end | ||
end |