lua: scoreboard iteration — rawget/rawset/raweq/rawlen + loadstring/load + select/assert + _G/_VERSION
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -1340,3 +1340,104 @@
|
||||
(else (error (str "lua: module '" name "' not found"))))))
|
||||
|
||||
(define require lua-require)
|
||||
|
||||
;; ── raw operations + loadstring ───────────────────────────────
|
||||
(define
|
||||
lua-rawget
|
||||
(fn (t k)
|
||||
(cond
|
||||
((not (= (type-of t) "dict")) nil)
|
||||
((has-key? t (str k)) (get t (str k)))
|
||||
(else nil))))
|
||||
|
||||
(define
|
||||
lua-rawset
|
||||
(fn (t k v)
|
||||
(begin (dict-set! t (str k) v) t)))
|
||||
|
||||
(define
|
||||
lua-rawequal
|
||||
(fn (a b)
|
||||
(cond
|
||||
((and (= a nil) (= b nil)) true)
|
||||
((or (= a nil) (= b nil)) false)
|
||||
((and (= (type-of a) (type-of b)) (= a b)) true)
|
||||
(else false))))
|
||||
|
||||
(define
|
||||
lua-rawlen
|
||||
(fn (v)
|
||||
(cond
|
||||
((= (type-of v) "string") (len v))
|
||||
((= (type-of v) "dict")
|
||||
(let ((n 0))
|
||||
(begin
|
||||
(define
|
||||
rl-count
|
||||
(fn (i)
|
||||
(if (has-key? v (str i))
|
||||
(begin (set! n i) (rl-count (+ i 1)))
|
||||
n)))
|
||||
(rl-count 1)
|
||||
n)))
|
||||
(else 0))))
|
||||
|
||||
(define rawget lua-rawget)
|
||||
(define rawset lua-rawset)
|
||||
(define rawequal lua-rawequal)
|
||||
(define rawlen lua-rawlen)
|
||||
|
||||
;; loadstring(src) returns a function that, when called, evaluates src.
|
||||
(define
|
||||
lua-loadstring
|
||||
(fn (src)
|
||||
(fn (&rest args) (lua-eval-ast src))))
|
||||
|
||||
(define loadstring lua-loadstring)
|
||||
(define load lua-loadstring)
|
||||
|
||||
;; select(n, ...) — Lua 5.1 built-in. select("#", ...) is arg count; select(i, ...) returns args from i on.
|
||||
(define
|
||||
lua-select
|
||||
(fn (&rest args)
|
||||
(let ((n (first args)) (rest-args (rest args)))
|
||||
(cond
|
||||
((= n "#") (len rest-args))
|
||||
((= (type-of n) "number")
|
||||
(let ((i (- n 1)))
|
||||
(cond
|
||||
((< i 0) (error "lua: bad argument to select"))
|
||||
((>= i (len rest-args)) nil)
|
||||
(else
|
||||
(let ((out (list (quote lua-multi))))
|
||||
(begin
|
||||
(define
|
||||
sel-loop
|
||||
(fn (j)
|
||||
(when (< j (len rest-args))
|
||||
(begin
|
||||
(set! out (append out (list (nth rest-args j))))
|
||||
(sel-loop (+ j 1))))))
|
||||
(sel-loop i)
|
||||
out))))))
|
||||
(else (error "lua: bad argument to select"))))))
|
||||
|
||||
(define select lua-select)
|
||||
|
||||
;; assert(v, msg) — errors with msg if v is falsy.
|
||||
(define
|
||||
lua-assert
|
||||
(fn (&rest args)
|
||||
(let ((v (first args)))
|
||||
(cond
|
||||
((lua-truthy? v)
|
||||
(cond
|
||||
((= (len args) 1) v)
|
||||
(else (cons (quote lua-multi) args))))
|
||||
(else
|
||||
(error (if (> (len args) 1) (nth args 1) "assertion failed!")))))))
|
||||
|
||||
(define assert lua-assert)
|
||||
|
||||
(define _G {})
|
||||
(define _VERSION "Lua 5.1")
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
{
|
||||
"totals": {
|
||||
"pass": 0,
|
||||
"fail": 16,
|
||||
"timeout": 0,
|
||||
"fail": 15,
|
||||
"timeout": 1,
|
||||
"skip": 8,
|
||||
"total": 24,
|
||||
"runnable": 16,
|
||||
"pass_rate": 0.0
|
||||
},
|
||||
"top_failure_modes": [
|
||||
[
|
||||
"parse error",
|
||||
14
|
||||
],
|
||||
[
|
||||
"undefined symbol: print\\",
|
||||
1
|
||||
],
|
||||
[
|
||||
"transpile: unsupported node",
|
||||
6
|
||||
],
|
||||
[
|
||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
4
|
||||
],
|
||||
[
|
||||
"parse error",
|
||||
3
|
||||
],
|
||||
[
|
||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||
2
|
||||
],
|
||||
[
|
||||
"timeout",
|
||||
1
|
||||
]
|
||||
],
|
||||
@@ -38,20 +46,20 @@
|
||||
{
|
||||
"name": "attrib.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 3243
|
||||
"reason": "transpile: unsupported node",
|
||||
"ms": 5378
|
||||
},
|
||||
{
|
||||
"name": "big.lua",
|
||||
"status": "fail",
|
||||
"reason": "undefined symbol: print\\",
|
||||
"ms": 4383
|
||||
"status": "timeout",
|
||||
"reason": "per-test timeout",
|
||||
"ms": 8007
|
||||
},
|
||||
{
|
||||
"name": "calls.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 3565
|
||||
"reason": "transpile: unsupported node",
|
||||
"ms": 4393
|
||||
},
|
||||
{
|
||||
"name": "checktable.lua",
|
||||
@@ -62,8 +70,8 @@
|
||||
{
|
||||
"name": "closure.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 3465
|
||||
"reason": "transpile: unsupported node",
|
||||
"ms": 5425
|
||||
},
|
||||
{
|
||||
"name": "code.lua",
|
||||
@@ -75,7 +83,7 @@
|
||||
"name": "constructs.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 2522
|
||||
"ms": 2509
|
||||
},
|
||||
{
|
||||
"name": "db.lua",
|
||||
@@ -86,14 +94,14 @@
|
||||
{
|
||||
"name": "errors.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 2371
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 2934
|
||||
},
|
||||
{
|
||||
"name": "events.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 5133
|
||||
"reason": "transpile: unsupported node",
|
||||
"ms": 6455
|
||||
},
|
||||
{
|
||||
"name": "files.lua",
|
||||
@@ -111,13 +119,13 @@
|
||||
"name": "literals.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 1434
|
||||
"ms": 1786
|
||||
},
|
||||
{
|
||||
"name": "locals.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 1386
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 1554
|
||||
},
|
||||
{
|
||||
"name": "main.lua",
|
||||
@@ -129,43 +137,43 @@
|
||||
"name": "math.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 2427
|
||||
"ms": 2378
|
||||
},
|
||||
{
|
||||
"name": "nextvar.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 4241
|
||||
"reason": "transpile: unsupported node",
|
||||
"ms": 5918
|
||||
},
|
||||
{
|
||||
"name": "pm.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 5026
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 5658
|
||||
},
|
||||
{
|
||||
"name": "sort.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 930
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||
"ms": 1145
|
||||
},
|
||||
{
|
||||
"name": "strings.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 3424
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 3696
|
||||
},
|
||||
{
|
||||
"name": "vararg.lua",
|
||||
"status": "fail",
|
||||
"reason": "transpile: unsupported node",
|
||||
"ms": 1931
|
||||
"ms": 1901
|
||||
},
|
||||
{
|
||||
"name": "verybig.lua",
|
||||
"status": "fail",
|
||||
"reason": "parse error",
|
||||
"ms": 450
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||
"ms": 533
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
# Lua-on-SX conformance scoreboard
|
||||
|
||||
**Pass rate:** 0/16 runnable (0.0%)
|
||||
fail=16 timeout=0 skip=8 total=24
|
||||
fail=15 timeout=1 skip=8 total=24
|
||||
|
||||
## Top failure modes
|
||||
|
||||
- **14x** parse error
|
||||
- **1x** undefined symbol: print\
|
||||
- **1x** transpile: unsupported node
|
||||
- **6x** transpile: unsupported node
|
||||
- **4x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
||||
- **3x** parse error
|
||||
- **2x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
|
||||
- **1x** timeout
|
||||
|
||||
## Per-test results
|
||||
|
||||
@@ -15,25 +17,25 @@ fail=16 timeout=0 skip=8 total=24
|
||||
|---|---|---|---:|
|
||||
| all.lua | skip | driver uses dofile to chain other tests | 0 |
|
||||
| api.lua | skip | requires testC (C debug library) | 0 |
|
||||
| attrib.lua | fail | parse error | 3243 |
|
||||
| big.lua | fail | undefined symbol: print\ | 4383 |
|
||||
| calls.lua | fail | parse error | 3565 |
|
||||
| attrib.lua | fail | transpile: unsupported node | 5378 |
|
||||
| big.lua | timeout | per-test timeout | 8007 |
|
||||
| calls.lua | fail | transpile: unsupported node | 4393 |
|
||||
| checktable.lua | skip | internal debug helpers | 0 |
|
||||
| closure.lua | fail | parse error | 3465 |
|
||||
| closure.lua | fail | transpile: unsupported node | 5425 |
|
||||
| code.lua | skip | bytecode inspection via debug library | 0 |
|
||||
| constructs.lua | fail | parse error | 2522 |
|
||||
| constructs.lua | fail | parse error | 2509 |
|
||||
| db.lua | skip | debug library | 0 |
|
||||
| errors.lua | fail | parse error | 2371 |
|
||||
| events.lua | fail | parse error | 5133 |
|
||||
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2934 |
|
||||
| events.lua | fail | transpile: unsupported node | 6455 |
|
||||
| files.lua | skip | io library | 0 |
|
||||
| gc.lua | skip | collectgarbage / finalisers | 0 |
|
||||
| literals.lua | fail | parse error | 1434 |
|
||||
| locals.lua | fail | parse error | 1386 |
|
||||
| literals.lua | fail | parse error | 1786 |
|
||||
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1554 |
|
||||
| main.lua | skip | standalone interpreter driver | 0 |
|
||||
| math.lua | fail | parse error | 2427 |
|
||||
| nextvar.lua | fail | parse error | 4241 |
|
||||
| pm.lua | fail | parse error | 5026 |
|
||||
| sort.lua | fail | parse error | 930 |
|
||||
| strings.lua | fail | parse error | 3424 |
|
||||
| vararg.lua | fail | transpile: unsupported node | 1931 |
|
||||
| verybig.lua | fail | parse error | 450 |
|
||||
| math.lua | fail | parse error | 2378 |
|
||||
| nextvar.lua | fail | transpile: unsupported node | 5918 |
|
||||
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5658 |
|
||||
| sort.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1145 |
|
||||
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3696 |
|
||||
| vararg.lua | fail | transpile: unsupported node | 1901 |
|
||||
| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 533 |
|
||||
|
||||
Reference in New Issue
Block a user