feat: 添加内置函数支持(len, typeof, push, pop),更新相关错误处理和测试用例
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Quick smoke test for new builtins
|
||||
print("--- len ---")
|
||||
print(len("hello"))
|
||||
print(len([1, 2, 3]))
|
||||
print(len({a: 1, b: 2, c: 3}))
|
||||
|
||||
print("--- typeof ---")
|
||||
print(typeof(42))
|
||||
print(typeof("hi"))
|
||||
print(typeof(true))
|
||||
print(typeof(nil))
|
||||
print(typeof([1, 2]))
|
||||
print(typeof({a: 1}))
|
||||
print(typeof(print))
|
||||
|
||||
print("--- push/pop ---")
|
||||
let arr = [1, 2]
|
||||
print("push:", push(arr, 3))
|
||||
print("arr:", arr)
|
||||
print("pop:", pop(arr))
|
||||
print("arr:", arr)
|
||||
Reference in New Issue
Block a user