From da117c2f08b51925df5431a5867318862861bee0 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Tue, 23 Mar 2021 22:47:46 -0500 Subject: [PATCH] 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. --- test/propeller/push/instructions/string_spec.clj | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/propeller/push/instructions/string_spec.clj b/test/propeller/push/instructions/string_spec.clj index 0a52ecf..622f530 100644 --- a/test/propeller/push/instructions/string_spec.clj +++ b/test/propeller/push/instructions/string_spec.clj @@ -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)] - (= expected-result - (state/peek-stack end-state :char)))) + (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)))))) (defspec last-spec 100 (prop/for-all [str gen/string]