From f071dc5ed92aa963c9353ef1a4d41919b51c051f Mon Sep 17 00:00:00 2001 From: CrossNox Date: Mon, 28 Nov 2022 15:01:39 -0300 Subject: [PATCH] add test --- test/rustint/core_test.clj | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/rustint/core_test.clj b/test/rustint/core_test.clj index c8c4ed8..c918e0b 100644 --- a/test/rustint/core_test.clj +++ b/test/rustint/core_test.clj @@ -760,3 +760,32 @@ )) ) ) + +(deftest test-restaurar-contexto-anterior-02 + (testing "Test 02 restaurar-contexto-anterior" + (is (= + (restaurar-contexto-anterior + [ + 'EOF + () + ['fn 'main (symbol "(") (symbol ")") (symbol "{") 'let 'x (symbol ":") 'i64 (symbol "=") 10 (symbol ";") 'let 'y (symbol ":") 'i64 (symbol "=") 20 (symbol ";") 'println! (symbol "(") "{}" (symbol ",") 'x '+ 'y (symbol ")") (symbol "}")] + :sin-errores + [[0 1] [['main ['fn [() ()]] 2] ['x ['var-inmut 'i64] 0] ['y ['var-inmut 'i64] 1]]] + 2 + [['CAL 2] 'HLT ['PUSHFI 10] ['POP 0] ['PUSHFI 20] ['POP 1] ['PUSHFI "{}"] ['PUSHFM 0] ['PUSHFM 1] 'ADD ['PUSHFI 2] 'OUT 'NL] + [[2 ['i64 nil] ['i64 nil]]] + ] + ) + [ + 'EOF + () + ['fn 'main (symbol "(") (symbol ")") (symbol "{") 'let 'x (symbol ":") 'i64 (symbol "=") 10 (symbol ";") 'let 'y (symbol ":") 'i64 (symbol "=") 20 (symbol ";") 'println! (symbol "(") "{}" (symbol ",") 'x '+ 'y (symbol ")") (symbol "}")] + :sin-errores + [[0] [['main ['fn [() ()]] 2]]] + 2 + [['CAL 2] 'HLT ['PUSHFI 10] ['POP 0] ['PUSHFI 20] ['POP 1] ['PUSHFI "{}"] ['PUSHFM 0] ['PUSHFM 1] 'ADD ['PUSHFI 2] 'OUT 'NL] + [[2 ['i64 nil] ['i64 nil]]] + ] + )) + ) +)