[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / test / irb / test_evaluation.rb
blobadb69b20677af005161e745f67d2fa5630e131e4
1 # frozen_string_literal: true
3 require "tempfile"
5 require_relative "helper"
7 module TestIRB
8   class EchoingTest < IntegrationTestCase
9     def test_irb_echos_by_default
10       write_ruby <<~'RUBY'
11         binding.irb
12       RUBY
14       output = run_ruby_file do
15         type "123123"
16         type "exit"
17       end
19       assert_include(output, "=> 123123")
20     end
22     def test_irb_doesnt_echo_line_with_semicolon
23       write_ruby <<~'RUBY'
24         binding.irb
25       RUBY
27       output = run_ruby_file do
28         type "123123;"
29         type "123123   ;"
30         type "123123;   "
31         type <<~RUBY
32           if true
33             123123
34           end;
35         RUBY
36         type "'evaluation ends'"
37         type "exit"
38       end
40       assert_include(output, "=> \"evaluation ends\"")
41       assert_not_include(output, "=> 123123")
42     end
43   end
44 end