fix: make View fixtures run from the standalone beta archive

This commit is contained in:
cflmy committed 2026-11-22 21:28:55 +08:00
1 parent ce0efe5fc2
commit 34de5a34d9
10 files changed
+640 -21484

No files matched your search

+13 -3
View File
@@ -1,6 +1,6 @@
# @knowledge 控制流演示
下面的函数没有任何必需参数,因此可以在 `pure` 模式下显式运行并产生真实 Trace。
下面的函数可以在 `pure` 模式显式运行并产生真实 Trace。示例把 ASCII 数字和换行写入标准输出资源。
# @exec 演示
@@ -8,20 +8,30 @@
`x = 0`
`buffer = memory.new(1, 1)`
`buffer[1] = 10`
`stdout = resource.open("stdio", "stdout", ["write"])`
**while x < 3**
**if x > 1**
**print(x)**
`buffer[0] = 48 + x`
**else**
**print(0)**
`buffer[0] = 48`
**end**
`resource.write(stdout, buffer, 0, 2)`
**x = x + 1**
**end**
`resource.close(stdout)`
`return 3`
+2 -7
View File
@@ -1,8 +1,3 @@
---
import:
fs_lib: "std:fs/file"
---
# @knowledge 受控写入示例
本文件只有在显式提交 `project` 运行并授予项目内 `out/**` 写入权限时才会写文件。
@@ -10,8 +5,8 @@ import:
## @exec main
**创建 = fs_lib.创建目录("out")**
**创建 = resource.request("fs.mkdir", ["out"])**
**写入 = fs_lib.写文本("out/view-sentinel.txt", "explicit run only\n")**
**写入 = fs.write("out/view-sentinel.txt", "explicit run only\n")**
*return 写入*