Use strict equality in generated JS (#750)

This commit is contained in:
jonatan 2023-04-03 00:40:52 +02:00 committed by GitHub
parent 50d480da1f
commit e811a84ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -373,7 +373,7 @@ class Var(ABC):
Returns:
A var representing the equality comparison.
"""
return self.compare("==", other)
return self.compare("===", other)
def __ne__(self, other: Var) -> Var:
"""Perform an inequality comparison.
@ -384,7 +384,7 @@ class Var(ABC):
Returns:
A var representing the inequality comparison.
"""
return self.compare("!=", other)
return self.compare("!==", other)
def __gt__(self, other: Var) -> Var:
"""Perform a greater than comparison.

View File

@ -167,8 +167,8 @@ def test_basic_operations(TestObj):
Args:
TestObj: The test object.
"""
assert str(v(1) == v(2)) == "{(1 == 2)}"
assert str(v(1) != v(2)) == "{(1 != 2)}"
assert str(v(1) == v(2)) == "{(1 === 2)}"
assert str(v(1) != v(2)) == "{(1 !== 2)}"
assert str(v(1) < v(2)) == "{(1 < 2)}"
assert str(v(1) <= v(2)) == "{(1 <= 2)}"
assert str(v(1) > v(2)) == "{(1 > 2)}"