Examples of assertion failures comparing objects

This is a page with example snippets that raise AssertionFailure Error subclass: #AssertionFailure instanceVariableNames: '' classVariableNames: '' package: 'Kernel-Exceptions' when comparing various objects.

String

self 
	assert: 'I am a string object' 
	equals: 'I am another string object'
  
self 
	assert: GtExampleComparisonExceptionWithDebuggingViews new
		expectedStringForTest
	equals: GtExampleComparisonExceptionWithDebuggingViews new
		computedStringForTest
  

Array

self 
	assert: #(1 2 3)
	equals: #(1 2 4)
  
self 
	assert: #(#(1 2) #(1 2 3) #(1 2 #(3 4) ))
	equals: #(#(1 2) #(1 2 2 3) #(1 2 #(3 4 5) ))
  

Set

self 
	assert: #(7 1 2 3) asSet
	equals: #(1 7 2 4) asSet
  

Dictionary

self 
	assert: {1 -> 'a'. 2 -> 'b'. 3 -> 'c'} asDictionary
	equals: {1 -> 'a'. 3 -> 'c'. 2 -> 'q'} asDictionary
  

Object

self 
	assert: Object new
	equals: Object new