mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Add unit test exposing how scope can leak into operator calls
This commit is contained in:
parent
349425fe8a
commit
654f7e6b01
14
unittests/operator_scoping.chai
Normal file
14
unittests/operator_scoping.chai
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
def `+`(x, y)
|
||||||
|
{
|
||||||
|
print(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto i = 10;
|
||||||
|
|
||||||
|
|
||||||
|
// It should fail because `+` should not be able to see the i
|
||||||
|
|
||||||
|
"1" + 1;
|
||||||
|
assert_false(true);
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user