Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Flipez <code@brauser.io>
  • Loading branch information
Flipez committed Feb 3, 2022
1 parent c2c94ee commit acff0ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion evaluator/evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestErrorHandling(t *testing.T) {
{`"Hello" - "World"`, "unknown operator: STRING - STRING"},
{`{"name": "Monkey"}[def(x) { x }];`, "unusable as hash key: FUNCTION"},
{"🔥 != 👍", "identifier not found: IDENT"},
{"5 % 0", "devision by zero not allowed"},
{"5 % 0", "division by zero not allowed"},
}

for _, tt := range tests {
Expand Down
6 changes: 3 additions & 3 deletions evaluator/infix.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ func evalIntegerInfix(operator string, left, right object.Object) object.Object
return object.NewInteger(leftVal * rightVal)
case "/":
if rightVal == 0 {
return object.NewErrorFormat("devision by zero not allowed")
return object.NewErrorFormat("division by zero not allowed")
}
return object.NewInteger(leftVal / rightVal)
case "%":
if rightVal == 0 {
return object.NewErrorFormat("devision by zero not allowed")
return object.NewErrorFormat("division by zero not allowed")
}
return object.NewInteger(leftVal % rightVal)
case "<":
Expand Down Expand Up @@ -53,7 +53,7 @@ func evalFloatInfix(operator string, left, right object.Object) object.Object {
return object.NewFloat(leftVal * rightVal)
case "/":
if rightVal == 0 {
return object.NewErrorFormat("devision by zero not allowed")
return object.NewErrorFormat("division by zero not allowed")
}
return object.NewFloat(leftVal / rightVal)
case "<":
Expand Down
8 changes: 4 additions & 4 deletions object/number_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ func TestNumberObjects(t *testing.T) {
{"a = 2; a = a/1.0; a", 2.0},

// division by zero
{"1.0 / 0", "devision by zero not allowed"},
{"1.0 / 0.0", "devision by zero not allowed"},
{"1 / 0", "devision by zero not allowed"},
{"1 / 0.0", "devision by zero not allowed"},
{"1.0 / 0", "division by zero not allowed"},
{"1.0 / 0.0", "division by zero not allowed"},
{"1 / 0", "division by zero not allowed"},
{"1 / 0.0", "division by zero not allowed"},
}

testInput(t, tests)
Expand Down

0 comments on commit acff0ee

Please sign in to comment.