Kernel-Tests.st 1001 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. TestCase subclass: #StringTest
  2. instanceVariableNames: ''
  3. category: 'Kernel-Tests'!
  4. !StringTest methodsFor: 'tests'!
  5. testJoin
  6. self assert: 'hello,world' equals: (',' join: #('hello' 'world'))
  7. !
  8. testStreamContents
  9. self
  10. assert: 'hello world'
  11. equals: (String streamContents: [:aStream| aStream
  12. nextPutAll: 'hello'; space;
  13. nextPutAll: 'world'])
  14. !
  15. testIncludesSubString
  16. self assert: ('jtalk' includesSubString: 'alk').
  17. self deny: ('jtalk' includesSubString: 'zork').
  18. ! !
  19. TestCase subclass: #DictionaryTest
  20. instanceVariableNames: ''
  21. category: 'Kernel-Tests'!
  22. !DictionaryTest methodsFor: 'tests'!
  23. testPrintString
  24. self
  25. assert: 'a Dictionary(''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'
  26. equals: (Dictionary new
  27. at:'firstname' put: 'James';
  28. at:'lastname' put: 'Bond';
  29. printString)
  30. ! !