add test and fix solution

This commit is contained in:
Pavel 2023-02-24 23:10:53 +04:00
parent 9149658ce3
commit b244a3d653

View file

@ -244,6 +244,11 @@ var testCases = []testCase{
input: []string{": SWAP DUP Dup dup ;", "1 swap"}, input: []string{": SWAP DUP Dup dup ;", "1 swap"},
expected: []int{1, 1, 1, 1}, expected: []int{1, 1, 1, 1},
}, },
{
description: "redefine of builtin after define user function on it",
input: []string{": foo dup ;", ": dup 1 ;", "2 foo"},
expected: []int{2, 2},
},
} }
func TestEval(t *testing.T) { func TestEval(t *testing.T) {