Sha256: 8fcf77acd93d4bc76feac81c034a96bde6410031a645dca4e2ba2dd645ecb0e0
Contents?: true
Size: 727 Bytes
Versions: 1
Compression:
Stored size: 727 Bytes
Contents
require "test_helper" module Whitespace::ISA describe Discard do before do @vm = Whitespace::VM.new end describe "#execute" do describe "when the value stack is empty" do it "raises Whitespace::EmptyError" do expect { Discard.new(@vm).execute }.must_raise Whitespace::EmptyError end end describe "when the value stack is not empty" do it "discards the top element on the value stack" do @vm.vstack.push 1 @vm.vstack.push 2 @vm.vstack.size.must_equal 2 Discard.new(@vm).execute expect(@vm.vstack.pop).must_equal 1 expect(@vm.vstack.size).must_equal 0 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/stack_manipulation/discard_test.rb |