Sha256: c1df8b092cb7649660e60c117bf6da3b6e700417e4d8030143d46026648efe27
Contents?: true
Size: 843 Bytes
Versions: 1
Compression:
Stored size: 843 Bytes
Contents
require "test_helper" module Whitespace::ISA describe Return do before do @vm = Whitespace::VM.new end describe "#execute" do describe "when the call stack is empty" do it "raises Whitespace::EmptyError" do expect { Return.new(@vm).execute }.must_raise Whitespace::EmptyError end end describe "when the call stack has at least 1 element" do it "changes the current value of the pc to the value taken from the " \ "top of the call stack" do @vm.cstack.push 4 @vm.cstack.push 5 expect(@vm.pc.to_int).must_equal 0 Return.new(@vm).execute expect(@vm.pc.to_int).must_equal 5 expect(@vm.cstack.top).must_equal 4 expect(@vm.cstack.size).must_equal 1 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whitespace-ruby-1.0.0 | test/whitespace/instructions/flow_control/return_test.rb |