diff --git a/lib/language/program.rb b/lib/language/program.rb index 42b89f4..1e3eb54 100644 --- a/lib/language/program.rb +++ b/lib/language/program.rb @@ -10,8 +10,9 @@ module Rpn # we trim enclosing «» parsed_input = Rpn::Parser.new.parse_input( args[0][:value][1..-2] ) - stack, dictionary = Rpn::Runner.new.run_input( stack, dictionary, parsed_input ) + stack, _dictionary = Rpn::Runner.new.run_input( stack, dictionary, parsed_input ) # TODO: check that STO actually updates dictionary + stack end end diff --git a/spec/language_program_spec.rb b/spec/language_program_spec.rb index bbb9255..51b548d 100644 --- a/spec/language_program_spec.rb +++ b/spec/language_program_spec.rb @@ -10,8 +10,10 @@ require_relative '../lib/runner' class TestParser < Test::Unit::TestCase def test_eval - stack, _dico = Rpn::Core::Program.eval( [{ value: '« 2 dup * »', type: :program }], Rpn::Dictionary.new ) - assert_equal [{ value: 4, type: :numeric }], + stack = Rpn::Core::Program.eval( [{ value: '« 2 dup * dup »', type: :program }], Rpn::Dictionary.new ) + + assert_equal [{ value: 4, type: :numeric }, + { value: 4, type: :numeric }], stack end end