From a2dfa2e8fdd77ac959036ca44447c48bce312387 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 1 Feb 2024 19:00:37 +0000 Subject: [PATCH] Test IRB's behaviour with empty input --- test/irb/test_irb.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/irb/test_irb.rb b/test/irb/test_irb.rb index fb8b5c2bf..e47fbe1d1 100644 --- a/test/irb/test_irb.rb +++ b/test/irb/test_irb.rb @@ -58,6 +58,25 @@ def test_symbol_aliases_dont_affect_ruby_syntax assert_include output, "=> \"It's a foo\"" assert_include output, "=> \"It's a bar\"" end + + def test_empty_input_echoing_behaviour + write_ruby <<~'RUBY' + binding.irb + RUBY + + output = run_ruby_file do + type "" + type "\n" + type " " + type "exit" + end + + # Input cramped together due to how Reline's Reline::GeneralIO works + assert_include( + output, + "irb(main):001> irb(main):002> irb(main):003> irb(main):003> irb(main):003> => nil\r\n" + ) + end end class IrbIOConfigurationTest < TestCase