RegressionTests__MiscArithmeticTests.st
changeset 2294 99ef141514a1
parent 2286 ea0092d86b52
child 2295 2594ca29dbf2
--- a/RegressionTests__MiscArithmeticTests.st	Sun Jun 09 14:21:28 2019 +0200
+++ b/RegressionTests__MiscArithmeticTests.st	Sun Jun 09 15:36:43 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'stx:goodies/regression' }"
 
 "{ NameSpace: RegressionTests }"
@@ -86,6 +88,44 @@
 
     "Created: / 09-06-2019 / 10:35:16 / Claus Gittinger"
     "Modified: / 09-06-2019 / 14:20:16 / Claus Gittinger"
+!
+
+test02_unboxedArrays
+    <pragma: +STXExtendedArrayLiterals>
+    <pragma: +arraysAreImmutable>
+
+    |arr arr2|
+
+    arr := #[1 2 3 4].
+    self assert:(arr isImmutable).  "/ because it comes from a literal
+    self should:[arr at:1 put:10] raise:Error.
+
+    arr2 := arr copy.
+    self assert:(arr2 isImmutable not). 
+    self shouldnt:[arr2 at:1 put:10] raise:Error.
+
+    arr := #s8(1 2 3 4).
+    self assert:(arr isImmutable).  "/ because it comes from a literal
+    self should:[arr at:1 put:10] raise:Error.
+
+    arr2 := arr copy.
+    self assert:(arr2 isImmutable not). 
+    self shouldnt:[arr2 at:1 put:10] raise:Error.
+
+    arr := #s16(1 2 3 4).
+    self assert:(arr isImmutable).  "/ because it comes from a literal
+    self should:[arr at:1 put:10] raise:Error.
+
+    arr2 := arr copy.
+    self assert:(arr2 isImmutable not). 
+    self shouldnt:[arr2 at:1 put:10] raise:Error.
+
+    "
+     self run:#test02_unboxedArrays
+     self new test02_unboxedArrays
+    "
+
+    "Created: / 09-06-2019 / 15:02:17 / Claus Gittinger"
 ! !
 
 !MiscArithmeticTests class methodsFor:'documentation'!