mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
31 lines
520 B
ChaiScript
31 lines
520 B
ChaiScript
|
|
try {
|
|
eval("to_string(5) = \"some string\"")
|
|
assert_true(false)
|
|
} catch (e) {
|
|
print("Caught Error: " + e.what());
|
|
}
|
|
|
|
def get_value()
|
|
{
|
|
var i = 5;
|
|
return i;
|
|
}
|
|
|
|
def get_value_2()
|
|
{
|
|
return 5;
|
|
}
|
|
|
|
// TODO these should be fixed somehow
|
|
//assert_throws("Cannot assign to temporary", fun[](){ get_value() = 3; });
|
|
//assert_throws("Cannot assign to temporary", fun[](){ get_value_2() = 3; });
|
|
|
|
|
|
try {
|
|
eval("var v = [1,2,3]; v.size() = 3")
|
|
assert_true(false)
|
|
} catch (e) {
|
|
print("Caught Error: " + e.what());
|
|
}
|