smalltalk: SUnit port (TestCase/TestSuite/TestResult/TestFailure) + 19 tests
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:
@@ -482,6 +482,25 @@
|
||||
;; (no asString here — Symbol/String have their own primitive
|
||||
;; impls; SequenceableCollection-level fallback would overwrite
|
||||
;; the bare-name-for-Symbol behaviour.)
|
||||
;; Array class-side constructors for small fixed-arity literals.
|
||||
(st-class-add-class-method! "Array" "with:"
|
||||
(st-parse-method
|
||||
"with: x | a | a := Array new: 1. a at: 1 put: x. ^ a"))
|
||||
(st-class-add-class-method! "Array" "with:with:"
|
||||
(st-parse-method
|
||||
"with: a with: b
|
||||
| r | r := Array new: 2.
|
||||
r at: 1 put: a. r at: 2 put: b. ^ r"))
|
||||
(st-class-add-class-method! "Array" "with:with:with:"
|
||||
(st-parse-method
|
||||
"with: a with: b with: c
|
||||
| r | r := Array new: 3.
|
||||
r at: 1 put: a. r at: 2 put: b. r at: 3 put: c. ^ r"))
|
||||
(st-class-add-class-method! "Array" "with:with:with:with:"
|
||||
(st-parse-method
|
||||
"with: a with: b with: c with: d
|
||||
| r | r := Array new: 4.
|
||||
r at: 1 put: a. r at: 2 put: b. r at: 3 put: c. r at: 4 put: d. ^ r"))
|
||||
;; ── HashedCollection / Set / Dictionary ──
|
||||
;; Implemented as user instances with array-backed storage. Sets
|
||||
;; use a single `array` ivar; Dictionaries use parallel `keys`/
|
||||
|
||||
Reference in New Issue
Block a user