#DOCUMENTATION by cg
class: RegressionTests::DictionaryTest
class definition
added:
#testAddAll
#testAssociationsSelect
#testComma
#testIncludesAssociation
#testRemoveAllDeclareAll
#version
--- a/RegressionTests__DictionaryTest.st Thu Dec 08 04:53:03 2016 +0000
+++ b/RegressionTests__DictionaryTest.st Mon Feb 06 12:31:27 2017 +0100
@@ -80,6 +80,41 @@
self assert: (d includesAssociation: (#five -> 6)) not.
"Modified: / 06-12-2016 / 14:19:15 / cg"
+!
+
+testRemoveAllDeclareAll
+ "self debug: #testRemoveAllDeclareAll"
+
+ "/ verifies that we can restore a dictionaries original contents
+ "/ by making a copy of it, then redeclaring from the copy.
+ "/ (needed by the refactorybrowser)
+
+ | d copyOfIt |
+
+ d := Dictionary new
+ at: #five put: (5@5);
+ at: #givemefive put: (55@55);
+ at: #six put: (6@6);
+ yourself.
+
+ copyOfIt := d copy.
+ d keysAndValuesDo:[:k :v |
+ self assert: (copyOfIt at:k) == v.
+ ].
+
+ "/ add something
+ d at:#seven put:(7@7).
+
+ "/ removeall - redeclare
+ d removeAll; declareAllFrom:copyOfIt.
+
+ self assert: (d size = copyOfIt size).
+ self assert: (d keys = copyOfIt keys).
+ d keysAndValuesDo:[:k :v |
+ self assert: (copyOfIt at:k) == v.
+ ].
+
+ "Created: / 06-02-2017 / 12:26:22 / cg"
! !
!DictionaryTest class methodsFor:'documentation'!