From 97abc8b05d6d1f768a7c04f7dd56544bd82ead35 Mon Sep 17 00:00:00 2001 From: buty4649 Date: Sat, 3 Jun 2023 12:49:03 +0900 Subject: [PATCH] wip --- spec/special_variables_spec.rb | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 spec/special_variables_spec.rb diff --git a/spec/special_variables_spec.rb b/spec/special_variables_spec.rb new file mode 100644 index 0000000..f13c491 --- /dev/null +++ b/spec/special_variables_spec.rb @@ -0,0 +1,36 @@ +describe 'Special Variables' do + describe '$_' do + let(:input) { 'foo' } + let(:output) { input } + + before { run_rf('-q "puts $_"', input) } + + it { expect(last_command_started).to be_successfully_executed } + it { expect(last_command_started).to have_output output_string_eq output } + end + + describe '_' do + let(:input) { 'foo' } + let(:output) { input } + + before { run_rf('-q "puts _"', input) } + + it { expect(last_command_started).to be_successfully_executed } + it { expect(last_command_started).to have_output output_string_eq output } + end + + describe '$F' do + let(:input) { 'foo bar baz' } + let(:output) do + <<~OUTPUT + Array + 3 + OUTPUT + end + + before { run_rf('-q "puts $F.class,$F.size"', input) } + + it { expect(last_command_started).to be_successfully_executed } + it { expect(last_command_started).to have_output output_string_eq output } + end +end