omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / host / tests / chdir.om
| 1 | note chdir: create a directory, enter it, create a relative file there, return, and refuse a missing path. |
| 2 | text dsub "sub" |
| 3 | text dfile "inside" |
| 4 | text dup ".." |
| 5 | text dno "nope" |
| 6 | fn main to int |
| 7 | r = makedir dsub 0 len dsub 493 |
| 8 | if ne r 0 |
| 9 | ret 1 |
| 10 | end |
| 11 | r = chdir dsub 0 len dsub |
| 12 | if ne r 0 |
| 13 | ret 2 |
| 14 | end |
| 15 | fd = int fopen dfile 0 len dfile 577 420 |
| 16 | if lt fd 0 |
| 17 | ret 3 |
| 18 | end |
| 19 | r = fclose fd |
| 20 | if ne r 0 |
| 21 | ret 4 |
| 22 | end |
| 23 | r = chdir dup 0 len dup |
| 24 | if ne r 0 |
| 25 | ret 5 |
| 26 | end |
| 27 | r = chdir dno 0 len dno |
| 28 | if ge r 0 |
| 29 | ret 6 |
| 30 | end |
| 31 | ret 0 |
| 32 | end |