Skip to content

Commit 060a06d

Browse files
authored
[214_14] 升级 goldfix 到 v2026.04.07.23 (#688)
1 parent 92db8ad commit 060a06d

32 files changed

Lines changed: 202 additions & 75 deletions

devel/200_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
## 2026/03/20 Goldfish Scheme v17.11.30
2121
### 🔧 基础设施改进
22-
- 引入goldfix v2026.3.20
22+
- 引入 goldfix,当前内嵌快照已更新到 `fc4afe7`(2026/04/07)
2323

2424
## 2026/03/02 Goldfish Scheme v17.11.29
2525
### 🔧 基础设施改进

devel/214_14.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# [214_14]
22

3-
## 2026/03/20 goldfish新增goldfix v2026.3.20
3+
## 2026/04/07 goldfish内嵌goldfix更新到快照 fc4afe7

goldfish/liii/string.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
((char? sep) (string sep))
8080
(else (type-error "string-split: second parameter must be string or char"))
8181
) ;cond
82-
)
82+
) ;
8383
(str-len (string-length str))
8484
(sep-len (string-length sep-str)))
8585
(if (zero? sep-len)

tests/liii/case-test.scm

Lines changed: 73 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,74 +56,85 @@
5656
(check (case* 'yes
5757
((yes no) 'boolean)
5858
(else 'unknown))
59-
=> 'boolean)
59+
=> 'boolean
60+
) ;check
6061

6162
(check (case* 'no
6263
((yes no) 'boolean)
6364
(else 'unknown))
64-
=> 'boolean)
65+
=> 'boolean
66+
) ;check
6567

6668
(check (case* 'maybe
6769
((yes no) 'boolean)
6870
(else 'unknown))
69-
=> 'unknown)
71+
=> 'unknown
72+
) ;check
7073

7174
;; 数字匹配
7275
(check (case* 42
7376
((1 2 3) 'small)
7477
((42 100) 'big)
7578
(else 'other))
76-
=> 'big)
79+
=> 'big
80+
) ;check
7781

7882
;; 字符串匹配
7983
(check (case* "hello"
8084
(("hi" "hello") 'greeting)
8185
(else 'other))
82-
=> 'greeting)
86+
=> 'greeting
87+
) ;check
8388

8489
;; 混合类型匹配
8590
(check (case* 3.14
8691
((1 2 3) 'integer)
8792
((3.14 2.71) 'float)
8893
(else 'other))
89-
=> 'float)
94+
=> 'float
95+
) ;check
9096

9197
;; ========== 列表字面量模式匹配测试 ==========
9298

9399
;; 注意:case* 的列表模式需要完全匹配字面量
94100
(check (case* '(1 2 3)
95101
(((1 2 3)) 'matched)
96102
(else 'not-matched))
97-
=> 'matched)
103+
=> 'matched
104+
) ;check
98105

99106
;; 不匹配的情况
100107
(check (case* '(1 2 3)
101108
(((1 2)) 'two)
102109
(((1 2 3)) 'three)
103110
(else 'other))
104-
=> 'three)
111+
=> 'three
112+
) ;check
105113

106114
;; ========== 标签绑定测试 ==========
107115

108116
;; 简单标签捕获 - 注意:结果中用 #<x> 而非 x 引用
109117
(check (case* '(1 2)
110118
(((#<x:> #<y:>)) (+ #<x> #<y>))
111119
(else 0))
112-
=> 3)
120+
=> 3
121+
) ;check
113122

114123
;; 在结果中使用标签 - 标签引用语法 #<label>
115124
;; 注意:'#<label> 中的引号 ' 是 quote 的简写,表示返回符号本身
116125
;; 这里 '#<second> 和 '#<first> 分别被替换为捕获的值 'world 和 'hello
117126
(check (case* '(hello world)
118127
(((#<first:> #<second:>)) (list '#<second> '#<first>))
119128
(else '()))
120-
=> '(world hello))
129+
=> '(world hello)
130+
) ;check
121131

122132
;; 标签值比较
123133
(check (case* '(5 5)
124134
(((#<x:> #<y:>)) (if (= #<x> #<y>) 'same 'different))
125135
(else 'unknown))
126-
=> 'same)
136+
=> 'same
137+
) ;check
127138

128139
;; ========== 谓词匹配测试 ==========
129140

@@ -132,46 +143,53 @@
132143
((#<integer?>) 'integer)
133144
((#<string?>) 'string)
134145
(else 'other))
135-
=> 'integer)
146+
=> 'integer
147+
) ;check
136148

137149
(check (case* "hello"
138150
((#<integer?>) 'integer)
139151
((#<string?>) 'string)
140152
(else 'other))
141-
=> 'string)
153+
=> 'string
154+
) ;check
142155

143156
;; 带标签的谓词匹配 - 使用 #<label:predicate?> 语法,结果中用 #<label>
144157
(check (case* 42
145158
((#<x:integer?>) (* #<x> 2))
146159
(else 0))
147-
=> 84)
160+
=> 84
161+
) ;check
148162

149163
;; 自定义谓词函数
150164
(check (case* 10
151165
((#<even?>) 'even)
152166
((#<odd?>) 'odd)
153167
(else 'unknown))
154-
=> 'even)
168+
=> 'even
169+
) ;check
155170

156171
(check (case* 7
157172
((#<even?>) 'even)
158173
((#<odd?>) 'odd)
159174
(else 'unknown))
160-
=> 'odd)
175+
=> 'odd
176+
) ;check
161177

162178
;; ========== 向量模式匹配测试 ==========
163179

164180
;; 基本向量匹配
165181
(check (case* #(1 2 3)
166182
((#(1 2 3)) 'matched)
167183
(else 'no))
168-
=> 'matched)
184+
=> 'matched
185+
) ;check
169186

170187
;; 向量中的标签捕获
171188
(check (case* #(10 20 30)
172189
((#(#<x:> 20 #<y:>)) (list #<x> #<y>))
173190
(else '()))
174-
=> '(10 30))
191+
=> '(10 30)
192+
) ;check
175193

176194
;; ========== else 子句测试 ==========
177195

@@ -180,27 +198,31 @@
180198
((a b c) 'abc)
181199
((x y z) 'xyz)
182200
(else 'default))
183-
=> 'default)
201+
=> 'default
202+
) ;check
184203

185204
;; ========== 边界情况测试 ==========
186205

187206
;; 空列表匹配
188207
(check (case* '()
189208
((()) 'empty)
190209
(else 'not-empty))
191-
=> 'empty)
210+
=> 'empty
211+
) ;check
192212

193213
;; 单元素列表
194214
(check (case* '(only)
195215
((#<x:>) '#<x>)
196216
(else 'none))
197-
=> '(only))
217+
=> '(only)
218+
) ;check
198219

199220
;; 单元素向量
200221
(check (case* #(42)
201222
((#(42)) 'forty-two)
202223
(else 'none))
203-
=> 'forty-two)
224+
=> 'forty-two
225+
) ;check
204226

205227
;; ========== 实际应用示例测试 ==========
206228

@@ -226,7 +248,9 @@
226248
(((* 1 #<x:>)) '#<x>) ; (* 1 x) => x
227249
(((* #<x:> 1)) '#<x>) ; (* x 1) => x
228250
(((* 0 #<...>)) 0) ; (* 0 ...) => 0
229-
(else expr)))
251+
(else expr)
252+
) ;case*
253+
) ;define
230254

231255
(check (simplify '(+ 0 x)) => 'x)
232256
(check (simplify '(+ x 0)) => 'x)
@@ -262,7 +286,9 @@
262286
(((#<op:symbol?> #<args:...>)) 'application)
263287
((#<x:integer?>) 'integer-literal)
264288
((#<x:symbol?>) 'variable)
265-
(else 'unknown)))
289+
(else 'unknown)
290+
) ;case*
291+
) ;define
266292

267293
(check (expr-type '(lambda (x) x)) => 'lambda)
268294
(check (expr-type '(if a b c)) => 'conditional)
@@ -297,7 +323,9 @@
297323
((()) 'empty)
298324
(((#<x:>)) (list 'single '#<x>))
299325
(((#<a:> #<b:> #<rest:...>)) (list 'multiple #<a> #<b> #<rest>))
300-
(else 'other)))
326+
(else 'other)
327+
) ;case*
328+
) ;define
301329

302330
(check (list-info '()) => 'empty)
303331
(check (list-info '(one)) => '(single one))
@@ -311,7 +339,9 @@
311339
(((- #<a:integer?> #<b:integer?>)) (- #<a> #<b>))
312340
(((#<op:> #<args:...>)) (list 'unhandled-op '#<op> #<args>))
313341
((#<x:integer?>) #<x>)
314-
(else 'invalid)))
342+
(else 'invalid)
343+
) ;case*
344+
) ;define
315345

316346
(check (calc '(+ 3 4)) => 7)
317347
(check (calc '(- 10 3)) => 7)
@@ -322,8 +352,11 @@
322352
(define (validate-user data)
323353
(case* data
324354
(((user (name #<n:string?>) (age #<a:integer?>)))
325-
(and (> #<a> 0) (< #<a> 150)))
326-
(else #f)))
355+
(and (> #<a> 0) (< #<a> 150))
356+
) ;
357+
(else #f)
358+
) ;case*
359+
) ;define
327360

328361
(check (validate-user '(user (name "Alice") (age 30))) => #t)
329362
(check (validate-user '(user (name "Bob") (age 200))) => #f)
@@ -336,8 +369,11 @@
336369
(define (binop-expr? expr)
337370
(case* expr
338371
(((#<op:symbol?> #<left:> #<right:>))
339-
(list 'binop '#<op> '#<left> '#<right>))
340-
(else #f)))
372+
(list 'binop '#<op> '#<left> '#<right>)
373+
) ;
374+
(else #f)
375+
) ;case*
376+
) ;define
341377

342378
(check (binop-expr? '(+ 1 2)) => '(binop + 1 2))
343379
(check (binop-expr? '(* x y)) => '(binop * x y))
@@ -348,11 +384,15 @@
348384
(define (if-expr? expr)
349385
(case* expr
350386
(((if #<cond:> #<then:> #<else:>))
351-
(list 'if-expr '#<cond> '#<then> '#<else>))
352-
(else #f)))
387+
(list 'if-expr '#<cond> '#<then> '#<else>)
388+
) ;
389+
(else #f)
390+
) ;case*
391+
) ;define
353392

354393
(check (if-expr? '(if (> x 0) x (- x)))
355-
=> '(if-expr (> x 0) x (- x)))
394+
=> '(if-expr (> x 0) x (- x))
395+
) ;check
356396
(check (if-expr? '(if flag then)) => #f) ; 缺少 else 分支
357397

358398
(check-report)

tests/liii/check/check-approx-test.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(import (liii check)) ;import
1+
(import (liii check))
22

33
(check-set-mode! 'report-failed)
44

tests/liii/check/check-catch-test.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(import (liii check)) ;import
1+
(import (liii check))
22

33
(check-set-mode! 'report-failed)
44

tests/liii/check/check-false-test.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(import (liii check)) ;import
1+
(import (liii check))
22

33
(check-set-mode! 'report-failed)
44

tests/liii/check/check-test.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(import (liii check)) ;import
1+
(import (liii check))
22

33
(check-set-mode! 'report-failed)
44

tests/liii/check/check-true-test.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(import (liii check)) ;import
1+
(import (liii check))
22

33
(check-set-mode! 'report-failed)
44

tests/liii/check/test-test.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(import (liii check)) ;import
1+
(import (liii check))
22

33
(check-set-mode! 'report-failed)
44

0 commit comments

Comments
 (0)