Compiler-Tests.js 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. smalltalk.addPackage('Compiler-Tests', {});
  2. smalltalk.addClass('ImporterTest', smalltalk.TestCase, [], 'Compiler-Tests');
  3. smalltalk.addMethod(
  4. unescape('_chunkString'),
  5. smalltalk.method({
  6. selector: unescape('chunkString'),
  7. category: 'private',
  8. fn: function (){
  9. var self=this;
  10. return unescape("%21Object%20methodsFor%3A%20%27importer%20test%20method%27%21%0A%0AimporterTestMethod%0A%0A%09%5E%27success%27%0A%21%20%21%0A");
  11. return self;},
  12. args: [],
  13. source: unescape('chunkString%0A%0A%09%5E%27%21Object%20methodsFor%3A%20%27%27importer%20test%20method%27%27%21%0A%0AimporterTestMethod%0A%0A%09%5E%27%27success%27%27%0A%21%20%21%0A%27'),
  14. messageSends: [],
  15. referencedClasses: []
  16. }),
  17. smalltalk.ImporterTest);
  18. smalltalk.addMethod(
  19. unescape('_testImporterBug'),
  20. smalltalk.method({
  21. selector: unescape('testImporterBug'),
  22. category: 'tests',
  23. fn: function (){
  24. var self=this;
  25. smalltalk.send(smalltalk.send((smalltalk.Importer || Importer), "_new", []), "_import_", [smalltalk.send(smalltalk.send(self, "_chunkString", []), "_readStream", [])]);
  26. (function($rec){smalltalk.send($rec, "_cr", []);return smalltalk.send($rec, "_show_", [unescape("testImporterBug%20%5B1%5D")]);})((smalltalk.Transcript || Transcript));
  27. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_methodDictionary", []), "_includesKey_", ["importerTestMethod"])]);
  28. (function($rec){smalltalk.send($rec, "_cr", []);return smalltalk.send($rec, "_show_", [unescape("testImporterBug%20%5B2%5D")]);})((smalltalk.Transcript || Transcript));
  29. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_importerTestMethod", []), "__eq", ["success"])]);
  30. (function($rec){smalltalk.send($rec, "_cr", []);return smalltalk.send($rec, "_show_", [unescape("testImporterBug%20%5B3%5D")]);})((smalltalk.Transcript || Transcript));
  31. return self;},
  32. args: [],
  33. source: unescape('testImporterBug%0A%09%22importer%20does%20not%20correctly%20add%20extension%20methods%22%0A%0A%09Importer%20new%20import%3A%20self%20chunkString%20readStream.%0ATranscript%20cr%3B%20show%3A%20%27testImporterBug%20%5B1%5D%27.%20%22cannot%20debug%20test%20methods%20very%20easily%3F%22%0A%09self%20assert%3A%20%28Object%20methodDictionary%20includesKey%3A%20%27importerTestMethod%27%29.%0ATranscript%20cr%3B%20show%3A%20%27testImporterBug%20%5B2%5D%27.%0A%09self%20assert%3A%20%28Object%20new%20importerTestMethod%20%3D%20%27success%27%29.%0ATranscript%20cr%3B%20show%3A%20%27testImporterBug%20%5B3%5D%27.%0A'),
  34. messageSends: ["import:", "new", "readStream", "chunkString", "cr", "show:", "assert:", "includesKey:", "methodDictionary", unescape("%3D"), "importerTestMethod"],
  35. referencedClasses: ["Importer", "Transcript", "Object"]
  36. }),
  37. smalltalk.ImporterTest);
  38. smalltalk.addMethod(
  39. unescape('_setUp'),
  40. smalltalk.method({
  41. selector: unescape('setUp'),
  42. category: 'running',
  43. fn: function (){
  44. var self=this;
  45. smalltalk.send(self, "_setUp", [], smalltalk.TestCase);
  46. smalltalk.send(self, "_cleanUp", []);
  47. return self;},
  48. args: [],
  49. source: unescape('setUp%0A%0A%09super%20setUp.%0A%09self%20cleanUp'),
  50. messageSends: ["setUp", "cleanUp"],
  51. referencedClasses: []
  52. }),
  53. smalltalk.ImporterTest);
  54. smalltalk.addMethod(
  55. unescape('_tearDown'),
  56. smalltalk.method({
  57. selector: unescape('tearDown'),
  58. category: 'running',
  59. fn: function (){
  60. var self=this;
  61. smalltalk.send(self, "_tearDown", [], smalltalk.TestCase);
  62. smalltalk.send(self, "_cleanUp", []);
  63. return self;},
  64. args: [],
  65. source: unescape('tearDown%0A%0A%09super%20tearDown.%0A%09self%20cleanUp'),
  66. messageSends: ["tearDown", "cleanUp"],
  67. referencedClasses: []
  68. }),
  69. smalltalk.ImporterTest);
  70. smalltalk.addMethod(
  71. unescape('_cleanUp'),
  72. smalltalk.method({
  73. selector: unescape('cleanUp'),
  74. category: 'running',
  75. fn: function (){
  76. var self=this;
  77. ((($receiver = smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_methodDictionary", []), "_includesKey_", [smalltalk.symbolFor("importerTestMethod")])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send((smalltalk.Object || Object), "_removeCompiledMethod_", [smalltalk.send((smalltalk.Object || Object), "_methodAt_", [smalltalk.symbolFor("importerTestMethod")])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send((smalltalk.Object || Object), "_removeCompiledMethod_", [smalltalk.send((smalltalk.Object || Object), "_methodAt_", [smalltalk.symbolFor("importerTestMethod")])]);})]));
  78. return self;},
  79. args: [],
  80. source: unescape('cleanUp%0A%0A%09%28Object%20methodDictionary%20includesKey%3A%20%23importerTestMethod%29%0A%09%09ifTrue%3A%20%5B%20Object%20removeCompiledMethod%3A%20%28Object%20methodAt%3A%20%23importerTestMethod%29%5D.'),
  81. messageSends: ["ifTrue:", "includesKey:", "methodDictionary", "removeCompiledMethod:", "methodAt:"],
  82. referencedClasses: ["Object"]
  83. }),
  84. smalltalk.ImporterTest);