Compiler-Tests.st 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Smalltalk current createPackage: 'Compiler-Tests' properties: #{}!
  2. TestCase subclass: #ImporterTest
  3. instanceVariableNames: ''
  4. category: 'Compiler-Tests'!
  5. !ImporterTest methodsFor: 'private'!
  6. chunkString
  7. ^'!!Object methodsFor: ''importer test method''!!
  8. importerTestMethod
  9. ^''success''
  10. !! !!
  11. '
  12. ! !
  13. !ImporterTest methodsFor: 'running'!
  14. setUp
  15. super setUp.
  16. self cleanUp
  17. !
  18. tearDown
  19. super tearDown.
  20. self cleanUp
  21. !
  22. cleanUp
  23. (Object methodDictionary includesKey: #importerTestMethod)
  24. ifTrue: [ Object removeCompiledMethod: (Object methodAt: #importerTestMethod)].
  25. ! !
  26. !ImporterTest methodsFor: 'tests'!
  27. testImporterBug
  28. "importer does not correctly add extension methods"
  29. Importer new import: self chunkString readStream.
  30. Transcript cr; show: 'testImporterBug [1]'. "cannot debug test methods very easily?"
  31. self assert: (Object methodDictionary includesKey: 'importerTestMethod').
  32. Transcript cr; show: 'testImporterBug [2]'.
  33. self assert: (Object new importerTestMethod = 'success').
  34. Transcript cr; show: 'testImporterBug [3]'.
  35. ! !