From 555ea8334451c5ccd881e68b8b7ddc15745e66e3 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 19 Sep 2020 04:25:59 +0900 Subject: [ruby/irb] Drop OMIT_ON_ASSIGNMENT and add :truncate option for ECHO_ON_ASSIGNMENT https://github.com/ruby/irb/commit/4c89b0775b --- test/irb/test_context.rb | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'test/irb') diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb index fa628bba46..a57557af94 100644 --- a/test/irb/test_context.rb +++ b/test/irb/test_context.rb @@ -228,7 +228,6 @@ module TestIRB irb.context.echo = true irb.context.echo_on_assignment = false - irb.context.omit_on_assignment = true out, err = capture_io do irb.eval_input end @@ -237,8 +236,7 @@ module TestIRB input.reset irb.context.echo = true - irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = true + irb.context.echo_on_assignment = :truncate out, err = capture_io do irb.eval_input end @@ -248,7 +246,6 @@ module TestIRB input.reset irb.context.echo = true irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = false out, err = capture_io do irb.eval_input end @@ -258,7 +255,6 @@ module TestIRB input.reset irb.context.echo = false irb.context.echo_on_assignment = false - irb.context.omit_on_assignment = true out, err = capture_io do irb.eval_input end @@ -267,8 +263,7 @@ module TestIRB input.reset irb.context.echo = false - irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = true + irb.context.echo_on_assignment = :truncate out, err = capture_io do irb.eval_input end @@ -278,7 +273,6 @@ module TestIRB input.reset irb.context.echo = false irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = false out, err = capture_io do irb.eval_input end @@ -298,7 +292,6 @@ module TestIRB irb.context.echo = true irb.context.echo_on_assignment = false - irb.context.omit_on_assignment = true out, err = capture_io do irb.eval_input end @@ -308,8 +301,7 @@ module TestIRB input.reset irb.context.echo = true - irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = true + irb.context.echo_on_assignment = :truncate out, err = capture_io do irb.eval_input end @@ -320,7 +312,6 @@ module TestIRB input.reset irb.context.echo = true irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = false out, err = capture_io do irb.eval_input end @@ -331,7 +322,6 @@ module TestIRB input.reset irb.context.echo = false irb.context.echo_on_assignment = false - irb.context.omit_on_assignment = true out, err = capture_io do irb.eval_input end @@ -341,8 +331,7 @@ module TestIRB input.reset irb.context.echo = false - irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = true + irb.context.echo_on_assignment = :truncate out, err = capture_io do irb.eval_input end @@ -353,7 +342,6 @@ module TestIRB input.reset irb.context.echo = false irb.context.echo_on_assignment = true - irb.context.omit_on_assignment = false out, err = capture_io do irb.eval_input end @@ -370,26 +358,22 @@ module TestIRB irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) assert(irb.context.echo?, "echo? should be true by default") - assert(irb.context.echo_on_assignment?, "echo_on_assignment? should be true by default") - assert(irb.context.omit_on_assignment?, "omit_on_assignment? should be true by default") + assert_equal(:truncate, irb.context.echo_on_assignment?, "echo_on_assignment? should be :truncate by default") # Explicitly set :ECHO to false IRB.conf[:ECHO] = false irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) refute(irb.context.echo?, "echo? should be false when IRB.conf[:ECHO] is set to false") - assert(irb.context.echo_on_assignment?, "echo_on_assignment? should be true by default") - assert(irb.context.omit_on_assignment?, "omit_on_assignment? should be true by default") + assert_equal(:truncate, irb.context.echo_on_assignment?, "echo_on_assignment? should be :truncate by default") # Explicitly set :ECHO_ON_ASSIGNMENT to true IRB.conf[:ECHO] = nil IRB.conf[:ECHO_ON_ASSIGNMENT] = false - IRB.conf[:OMIT_ON_ASSIGNMENT] = false irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) assert(irb.context.echo?, "echo? should be true by default") refute(irb.context.echo_on_assignment?, "echo_on_assignment? should be false when IRB.conf[:ECHO_ON_ASSIGNMENT] is set to false") - refute(irb.context.omit_on_assignment?, "omit_on_assignment? should be false when IRB.conf[:OMIT_ON_ASSIGNMENT] is set to false") end def test_multiline_output_on_default_inspector -- cgit v1.2.3