Update the test for string/length

Changes the test for the `string/length` instruction to check for an `:ignore-instruction` when the string is empty.
This commit is contained in:
Erik Rauer 2021-03-23 22:47:46 -05:00
parent 7aad934b96
commit da117c2f08

View File

@ -241,8 +241,13 @@
(let [start-state (state/push-to-stack state/empty-state :string value)
end-state ((:string_last @core/instruction-table) start-state)
expected-result (last value)]
(or
(and (empty? value)
(state/empty-stack? end-state :char)
(= value (state/peek-stack end-state :string)))
(and (state/empty-stack? end-state :string)
(= expected-result
(state/peek-stack end-state :char))))
(state/peek-stack end-state :char))))))
(defspec last-spec 100
(prop/for-all [str gen/string]