mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix issue #829 "Compiler crashes when declaring maps with procedure"
Inits `o->value` in `check_expr_base_internal()` so doesn't accidentally use last (the proc lit was being set to that of previous string) Adds test to "tests/issues" and changes CI to use new "run" shells
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// Tests issue #829 https://github.com/odin-lang/Odin/issues/829
|
||||
package test_issues
|
||||
|
||||
import "core:fmt"
|
||||
import "core:testing"
|
||||
import tc "tests:common"
|
||||
|
||||
/* Original issue #829 example */
|
||||
|
||||
env : map[string]proc(a, b : int) -> int = {
|
||||
"+" = proc(a, b : int) -> int {
|
||||
return a + b
|
||||
},
|
||||
}
|
||||
|
||||
test_orig :: proc() {
|
||||
fmt.println(env["+"](1, 2))
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
t := testing.T{}
|
||||
|
||||
test_orig()
|
||||
|
||||
test_orig_ret(&t)
|
||||
|
||||
tc.report(&t)
|
||||
}
|
||||
|
||||
test_orig_ret :: proc(t: ^testing.T) {
|
||||
r := fmt.tprint(env["+"](1, 2))
|
||||
tc.expect(t, r == "3", fmt.tprintf("%s: \"%s\" != \"3\"\n", #procedure, r))
|
||||
}
|
||||
Reference in New Issue
Block a user