mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
25 lines
430 B
ChaiScript
25 lines
430 B
ChaiScript
auto x = [1, 2, 3]
|
|
x.erase_at(1)
|
|
assert_equal([1,3], x);
|
|
|
|
try {
|
|
// We expect this to throw because of erasing an out of bounds index
|
|
x.erase_at(2)
|
|
assert_true(false)
|
|
} catch (e) {
|
|
assert_true(true)
|
|
}
|
|
|
|
try {
|
|
// We expect this to throw because of erasing an out of bounds index
|
|
x.erase_at(-1)
|
|
assert_true(false)
|
|
} catch (e) {
|
|
assert_true(true)
|
|
}
|
|
|
|
x.erase_at(0)
|
|
assert_equal([3], x)
|
|
x.erase_at(0)
|
|
assert_equal([], x)
|