optimizations
This commit is contained in:
@@ -713,12 +713,10 @@ func TestBuiltinFunctions(t *testing.T) {
|
||||
{`len("hello world")`, 11},
|
||||
{
|
||||
`len(1)`,
|
||||
&object.Error{
|
||||
Message: "TypeError: object of type 'int' has no len()",
|
||||
},
|
||||
fmt.Errorf("TypeError: object of type 'int' has no len()"),
|
||||
},
|
||||
{`len("one", "two")`,
|
||||
&object.Error{
|
||||
object.Error{
|
||||
Message: "TypeError: len() takes exactly 1 argument (2 given)",
|
||||
},
|
||||
},
|
||||
@@ -728,14 +726,14 @@ func TestBuiltinFunctions(t *testing.T) {
|
||||
{`first([1, 2, 3])`, 1},
|
||||
{`first([])`, object.NULL},
|
||||
{`first(1)`,
|
||||
&object.Error{
|
||||
object.Error{
|
||||
Message: "TypeError: first() expected argument #1 to be `array` got `int`",
|
||||
},
|
||||
},
|
||||
{`last([1, 2, 3])`, 3},
|
||||
{`last([])`, object.NULL},
|
||||
{`last(1)`,
|
||||
&object.Error{
|
||||
object.Error{
|
||||
Message: "TypeError: last() expected argument #1 to be `array` got `int`",
|
||||
},
|
||||
},
|
||||
@@ -743,12 +741,12 @@ func TestBuiltinFunctions(t *testing.T) {
|
||||
{`rest([])`, []int{}},
|
||||
{`push([], 1)`, []int{1}},
|
||||
{`push(1, 1)`,
|
||||
&object.Error{
|
||||
object.Error{
|
||||
Message: "TypeError: push() expected argument #1 to be `array` got `int`",
|
||||
},
|
||||
},
|
||||
{`input()`, ""},
|
||||
{`pop([])`, &object.Error{
|
||||
{`pop([])`, object.Error{
|
||||
Message: "IndexError: pop from an empty array",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user