1
0

Kernel-Tests.js 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. unescape('_testJoin'),
  5. smalltalk.method({
  6. selector: unescape('testJoin'),
  7. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
  11. return self;},
  12. args: [],
  13. source: unescape('testJoin%0A%09self%20assert%3A%20%27hello%2Cworld%27%20equals%3A%20%28%27%2C%27%20join%3A%20%23%28%27hello%27%20%27world%27%29%29'),
  14. messageSends: ["assert:equals:", "join:"],
  15. referencedClasses: []
  16. }),
  17. smalltalk.StringTest);
  18. smalltalk.addMethod(
  19. unescape('_testStreamContents'),
  20. smalltalk.method({
  21. selector: unescape('testStreamContents'),
  22. category: 'tests',
  23. fn: function (){
  24. var self=this;
  25. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  26. return self;},
  27. args: [],
  28. source: unescape('testStreamContents%0A%09self%20%0A%09%09assert%3A%20%27hello%20world%27%20%0A%09%09equals%3A%20%28String%20streamContents%3A%20%5B%3AaStream%7C%20aStream%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27hello%27%3B%20space%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27world%27%5D%29'),
  29. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  30. referencedClasses: ["String"]
  31. }),
  32. smalltalk.StringTest);
  33. smalltalk.addMethod(
  34. unescape('_testIncludesSubString'),
  35. smalltalk.method({
  36. selector: unescape('testIncludesSubString'),
  37. category: 'tests',
  38. fn: function (){
  39. var self=this;
  40. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  41. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  42. return self;},
  43. args: [],
  44. source: unescape('testIncludesSubString%0A%09self%20assert%3A%20%28%27amber%27%20includesSubString%3A%20%27ber%27%29.%0A%09self%20deny%3A%20%28%27amber%27%20includesSubString%3A%20%27zork%27%29.'),
  45. messageSends: ["assert:", "includesSubString:", "deny:"],
  46. referencedClasses: []
  47. }),
  48. smalltalk.StringTest);
  49. smalltalk.addMethod(
  50. unescape('_testEquality'),
  51. smalltalk.method({
  52. selector: unescape('testEquality'),
  53. category: 'tests',
  54. fn: function (){
  55. var self=this;
  56. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  57. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  58. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  59. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  60. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  61. return self;},
  62. args: [],
  63. source: unescape('testEquality%0A%09self%20assert%3A%20%27hello%27%20%3D%20%27hello%27.%0A%09self%20deny%3A%20%27hello%27%20%3D%20%27world%27.%0A%0A%09self%20assert%3A%20%27hello%27%20%20%3D%20%27hello%27%20yourself.%0A%09self%20assert%3A%20%27hello%27%20yourself%20%3D%20%27hello%27.%0A%0A%09%22test%20JS%20falsy%20value%22%0A%09self%20deny%3A%20%27%27%20%3D%200'),
  64. messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
  65. referencedClasses: []
  66. }),
  67. smalltalk.StringTest);
  68. smalltalk.addMethod(
  69. unescape('_testCopyWithoutAll'),
  70. smalltalk.method({
  71. selector: unescape('testCopyWithoutAll'),
  72. category: 'tests',
  73. fn: function (){
  74. var self=this;
  75. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(unescape("*hello*%20*world*"), "_copyWithoutAll_", [unescape("*")])]);
  76. return self;},
  77. args: [],
  78. source: unescape('testCopyWithoutAll%0A%09self%20%0A%09%09assert%3A%20%27hello%20world%27%20%0A%09%09equals%3A%20%28%27*hello*%20*world*%27%20copyWithoutAll%3A%20%27*%27%29'),
  79. messageSends: ["assert:equals:", "copyWithoutAll:"],
  80. referencedClasses: []
  81. }),
  82. smalltalk.StringTest);
  83. smalltalk.addMethod(
  84. unescape('_testAt'),
  85. smalltalk.method({
  86. selector: unescape('testAt'),
  87. category: 'tests',
  88. fn: function (){
  89. var self=this;
  90. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  91. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  92. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  93. return self;},
  94. args: [],
  95. source: unescape('testAt%0A%09self%20assert%3A%20%28%27hello%27%20at%3A%201%29%20%3D%20%27h%27.%0A%09self%20assert%3A%20%28%27hello%27%20at%3A%205%29%20%3D%20%27o%27.%0A%09self%20assert%3A%20%28%27hello%27%20at%3A%206%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20nil'),
  96. messageSends: ["assert:", unescape("%3D"), "at:", "at:ifAbsent:"],
  97. referencedClasses: []
  98. }),
  99. smalltalk.StringTest);
  100. smalltalk.addMethod(
  101. unescape('_testAtPut'),
  102. smalltalk.method({
  103. selector: unescape('testAtPut'),
  104. category: 'tests',
  105. fn: function (){
  106. var self=this;
  107. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  108. return self;},
  109. args: [],
  110. source: unescape('testAtPut%0A%09%22String%20instances%20are%20read-only%22%0A%09self%20should%3A%20%5B%27hello%27%20at%3A%201%20put%3A%20%27a%27%5D%20raise%3A%20Error'),
  111. messageSends: ["should:raise:", "at:put:"],
  112. referencedClasses: ["Error"]
  113. }),
  114. smalltalk.StringTest);
  115. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  116. smalltalk.addMethod(
  117. unescape('_testPrintString'),
  118. smalltalk.method({
  119. selector: unescape('testPrintString'),
  120. category: 'tests',
  121. fn: function (){
  122. var self=this;
  123. smalltalk.send(self, "_assert_equals_", [unescape("a%20Dictionary%28%27firstname%27%20-%3E%20%27James%27%20%2C%20%27lastname%27%20-%3E%20%27Bond%27%29"), (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []))]);
  124. return self;},
  125. args: [],
  126. source: unescape('testPrintString%0A%09self%0A%09%09assert%3A%20%27a%20Dictionary%28%27%27firstname%27%27%20-%3E%20%27%27James%27%27%20%2C%20%27%27lastname%27%27%20-%3E%20%27%27Bond%27%27%29%27%20%0A%09%09equals%3A%20%28Dictionary%20new%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09at%3A%27firstname%27%20put%3A%20%27James%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09at%3A%27lastname%27%20put%3A%20%27Bond%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09printString%29'),
  127. messageSends: ["assert:equals:", "at:put:", "printString", "new"],
  128. referencedClasses: ["Dictionary"]
  129. }),
  130. smalltalk.DictionaryTest);
  131. smalltalk.addMethod(
  132. unescape('_testEquality'),
  133. smalltalk.method({
  134. selector: unescape('testEquality'),
  135. category: 'tests',
  136. fn: function (){
  137. var self=this;
  138. var d1=nil;
  139. var d2=nil;
  140. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  141. d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  142. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  143. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  144. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  145. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  146. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  147. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  148. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  149. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  150. return self;},
  151. args: [],
  152. source: unescape('testEquality%0A%09%7C%20d1%20d2%20%7C%0A%0A%09self%20assert%3A%20Dictionary%20new%20%3D%20Dictionary%20new.%0A%09%09%0A%09d1%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20yourself.%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20yourself.%0A%09self%20assert%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%203%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%202%20put%3A%202%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20at%3A%203%20put%3A%204%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.'),
  153. messageSends: ["assert:", unescape("%3D"), "new", "at:put:", "yourself", "deny:"],
  154. referencedClasses: ["Dictionary"]
  155. }),
  156. smalltalk.DictionaryTest);
  157. smalltalk.addMethod(
  158. unescape('_testDynamicDictionaries'),
  159. smalltalk.method({
  160. selector: unescape('testDynamicDictionaries'),
  161. category: 'tests',
  162. fn: function (){
  163. var self=this;
  164. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.Dictionary._fromPairs_([smalltalk.send((1), "__minus_gt", ["hello"]),smalltalk.send((2), "__minus_gt", ["world"])]), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_with_", [smalltalk.send((1), "__minus_gt", ["hello"]), smalltalk.send((2), "__minus_gt", ["world"])])])]);
  165. return self;},
  166. args: [],
  167. source: unescape('testDynamicDictionaries%0A%09self%20assert%3A%20%23%7B1%20-%3E%20%27hello%27.%202%20-%3E%20%27world%27%7D%20%3D%20%28Dictionary%20with%3A%201%20-%3E%20%27hello%27%20with%3A%202%20-%3E%20%27world%27%29'),
  168. messageSends: ["assert:", unescape("%3D"), unescape("-%3E"), "with:with:"],
  169. referencedClasses: ["Dictionary"]
  170. }),
  171. smalltalk.DictionaryTest);
  172. smalltalk.addMethod(
  173. unescape('_testAccessing'),
  174. smalltalk.method({
  175. selector: unescape('testAccessing'),
  176. category: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var d=nil;
  180. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  181. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  182. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  183. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  184. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  185. smalltalk.send(d, "_at_put_", [(1), (2)]);
  186. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  187. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  188. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  189. return self;},
  190. args: [],
  191. source: unescape('testAccessing%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%0A%09d%20at%3A%20%27hello%27%20put%3A%20%27world%27.%0A%09self%20assert%3A%20%28d%20at%3A%20%27hello%27%29%20%3D%20%27world%27.%0A%09self%20assert%3A%20%28d%20at%3A%20%27hello%27%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20%27world%27.%0A%09self%20deny%3A%20%28d%20at%3A%20%27foo%27%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20%27world%27.%0A%0A%09d%20at%3A%201%20put%3A%202.%0A%09self%20assert%3A%20%28d%20at%3A%201%29%20%3D%202.%0A%0A%09d%20at%3A%201@3%20put%3A%203.%0A%09self%20assert%3A%20%28d%20at%3A%201@3%29%20%3D%203'),
  192. messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "at:", "at:ifAbsent:", "deny:", unescape("@")],
  193. referencedClasses: ["Dictionary"]
  194. }),
  195. smalltalk.DictionaryTest);
  196. smalltalk.addMethod(
  197. unescape('_testSize'),
  198. smalltalk.method({
  199. selector: unescape('testSize'),
  200. category: 'tests',
  201. fn: function (){
  202. var self=this;
  203. var d=nil;
  204. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  205. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  206. smalltalk.send(d, "_at_put_", [(1), (2)]);
  207. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  208. smalltalk.send(d, "_at_put_", [(2), (3)]);
  209. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  210. return self;},
  211. args: [],
  212. source: unescape('testSize%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09self%20assert%3A%20d%20size%20%3D%200.%0A%0A%09d%20at%3A%201%20put%3A%202.%0A%09self%20assert%3A%20d%20size%20%3D%201.%0A%0A%09d%20at%3A%202%20put%3A%203.%0A%09self%20assert%3A%20d%20size%20%3D%202.'),
  213. messageSends: ["new", "assert:", unescape("%3D"), "size", "at:put:"],
  214. referencedClasses: ["Dictionary"]
  215. }),
  216. smalltalk.DictionaryTest);
  217. smalltalk.addMethod(
  218. unescape('_testValues'),
  219. smalltalk.method({
  220. selector: unescape('testValues'),
  221. category: 'tests',
  222. fn: function (){
  223. var self=this;
  224. var d=nil;
  225. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  226. smalltalk.send(d, "_at_put_", [(1), (2)]);
  227. smalltalk.send(d, "_at_put_", [(2), (3)]);
  228. smalltalk.send(d, "_at_put_", [(3), (4)]);
  229. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  230. return self;},
  231. args: [],
  232. source: unescape('testValues%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09d%20at%3A%201%20put%3A%202.%0A%09d%20at%3A%202%20put%3A%203.%0A%09d%20at%3A%203%20put%3A%204.%0A%0A%09self%20assert%3A%20d%20values%20%3D%20%23%282%203%204%29'),
  233. messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "values"],
  234. referencedClasses: ["Dictionary"]
  235. }),
  236. smalltalk.DictionaryTest);
  237. smalltalk.addMethod(
  238. unescape('_testKeys'),
  239. smalltalk.method({
  240. selector: unescape('testKeys'),
  241. category: 'tests',
  242. fn: function (){
  243. var self=this;
  244. var d=nil;
  245. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  246. smalltalk.send(d, "_at_put_", [(1), (2)]);
  247. smalltalk.send(d, "_at_put_", [(2), (3)]);
  248. smalltalk.send(d, "_at_put_", [(3), (4)]);
  249. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  250. return self;},
  251. args: [],
  252. source: unescape('testKeys%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09d%20at%3A%201%20put%3A%202.%0A%09d%20at%3A%202%20put%3A%203.%0A%09d%20at%3A%203%20put%3A%204.%0A%0A%09self%20assert%3A%20d%20keys%20%3D%20%23%281%202%203%29'),
  253. messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "keys"],
  254. referencedClasses: ["Dictionary"]
  255. }),
  256. smalltalk.DictionaryTest);
  257. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  258. smalltalk.addMethod(
  259. unescape('_testLogic'),
  260. smalltalk.method({
  261. selector: unescape('testLogic'),
  262. category: 'tests',
  263. fn: function (){
  264. var self=this;
  265. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
  266. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
  267. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
  268. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
  269. return self;},
  270. args: [],
  271. source: unescape('testLogic%0A%20%0A%09%22Trivial%20logic%20table%22%0A%09self%20assert%3A%20%28true%20%26%20true%29%3B%20deny%3A%20%28true%20%26%20false%29%3B%20deny%3A%20%28false%20%26%20true%29%3B%20deny%3A%20%28false%20%26%20false%29.%0A%09self%20assert%3A%20%28true%20%7C%20true%29%3B%20assert%3A%20%28true%20%7C%20false%29%3B%20assert%3A%20%28false%20%7C%20true%29%3B%20deny%3A%20%28false%20%7C%20false%29.%0A%20%20%20%20%20%20%20%20%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20assert%3A%20%28true%20%26%20%281%20%3E%200%29%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20false%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20%281%20%3E%202%29%29.%0A%20%20%20%20%20%20%20%20self%20assert%3A%20%28false%20%7C%20%281%20%3E%200%29%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20false%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20%281%20%3E%202%29%29'),
  272. messageSends: ["assert:", unescape("%26"), "deny:", unescape("%7C"), unescape("%3E")],
  273. referencedClasses: []
  274. }),
  275. smalltalk.BooleanTest);
  276. smalltalk.addMethod(
  277. unescape('_testEquality'),
  278. smalltalk.method({
  279. selector: unescape('testEquality'),
  280. category: 'tests',
  281. fn: function (){
  282. var self=this;
  283. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  284. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  285. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  286. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  287. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  288. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  289. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  290. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  291. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  292. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  293. return self;},
  294. args: [],
  295. source: unescape('testEquality%0A%09%22We%27re%20on%20top%20of%20JS...just%20be%20sure%20to%20check%20the%20basics%21%22%0A%0A%09self%20deny%3A%200%20%3D%20false.%20%0A%09self%20deny%3A%20false%20%3D%200.%0A%09self%20deny%3A%20%27%27%20%3D%20false.%0A%09self%20deny%3A%20false%20%3D%20%27%27.%0A%0A%09self%20assert%3A%20true%20%3D%20true.%0A%09self%20deny%3A%20false%20%3D%20true.%0A%09self%20deny%3A%20true%20%3D%20false.%0A%09self%20assert%3A%20false%20%3D%20false.%0A%0A%09%22JS%20may%20do%20some%20type%20coercing%20after%20sending%20a%20message%22%0A%09self%20assert%3A%20true%20yourself%20%3D%20true.%0A%09self%20assert%3A%20true%20yourself%20%3D%20true%20yourself'),
  296. messageSends: ["deny:", unescape("%3D"), "assert:", "yourself"],
  297. referencedClasses: []
  298. }),
  299. smalltalk.BooleanTest);
  300. smalltalk.addMethod(
  301. unescape('_testLogicKeywords'),
  302. smalltalk.method({
  303. selector: unescape('testLogicKeywords'),
  304. category: 'tests',
  305. fn: function (){
  306. var self=this;
  307. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
  308. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
  309. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
  310. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
  311. return self;},
  312. args: [],
  313. source: unescape('testLogicKeywords%0A%20%0A%09%22Trivial%20logic%20table%22%0A%09self%20%0A%09%09assert%3A%20%28true%20and%3A%20%5B%20true%5D%29%3B%20%0A%09%09deny%3A%20%28true%20and%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20and%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20and%3A%20%5B%20false%20%5D%29.%0A%09self%20%0A%09%09assert%3A%20%28true%20or%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09assert%3A%20%28true%20or%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09assert%3A%20%28false%20or%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20or%3A%20%5B%20false%20%5D%29.%0A%20%20%20%20%20%20%20%20%0A%09%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20%0A%09%09assert%3A%20%28true%20and%3A%20%5B%201%20%3E%200%20%5D%29%3B%20%0A%09%09deny%3A%20%28%281%20%3E%200%29%20and%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09deny%3A%20%28%281%20%3E%200%29%20and%3A%20%5B%201%20%3E%202%20%5D%29.%0A%20%20%20%20%20%20%20%20self%20%0A%09%09assert%3A%20%28false%20or%3A%20%5B%201%20%3E%200%20%5D%29%3B%20%0A%09%09assert%3A%20%28%281%20%3E%200%29%20or%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09assert%3A%20%28%281%20%3E%200%29%20or%3A%20%5B%201%20%3E%202%20%5D%29'),
  314. messageSends: ["assert:", "and:", "deny:", "or:", unescape("%3E")],
  315. referencedClasses: []
  316. }),
  317. smalltalk.BooleanTest);
  318. smalltalk.addMethod(
  319. unescape('_testIfTrueIfFalse'),
  320. smalltalk.method({
  321. selector: unescape('testIfTrueIfFalse'),
  322. category: 'tests',
  323. fn: function (){
  324. var self=this;
  325. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  326. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  327. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  328. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  329. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  330. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  331. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  332. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  333. return self;},
  334. args: [],
  335. source: unescape('testIfTrueIfFalse%0A%20%0A%09self%20assert%3A%20%28true%20ifTrue%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20%27alternative%20block%27.%0A%09self%20assert%3A%20%28true%20ifFalse%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20nil.%0A%0A%09self%20assert%3A%20%28false%20ifTrue%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20nil.%0A%09self%20assert%3A%20%28false%20ifFalse%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20%27alternative%20block%27.%0A%0A%09self%20assert%3A%20%28false%20ifTrue%3A%20%5B%27alternative%20block%27%5D%20ifFalse%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block2%27.%0A%09self%20assert%3A%20%28false%20ifFalse%3A%20%5B%27alternative%20block%27%5D%20ifTrue%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block%27.%0A%0A%09self%20assert%3A%20%28true%20ifTrue%3A%20%5B%27alternative%20block%27%5D%20ifFalse%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block%27.%0A%09self%20assert%3A%20%28true%20ifFalse%3A%20%5B%27alternative%20block%27%5D%20ifTrue%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block2%27.'),
  336. messageSends: ["assert:", unescape("%3D"), "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  337. referencedClasses: []
  338. }),
  339. smalltalk.BooleanTest);
  340. smalltalk.addMethod(
  341. unescape('_testIdentity'),
  342. smalltalk.method({
  343. selector: unescape('testIdentity'),
  344. category: 'tests',
  345. fn: function (){
  346. var self=this;
  347. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  348. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  349. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  350. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  351. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  352. return self;},
  353. args: [],
  354. source: unescape('testIdentity%0A%09self%20assert%3A%20true%20%3D%3D%20true.%0A%09self%20assert%3A%20true%20yourself%20%3D%3D%20true.%0A%09self%20assert%3A%20true%20%3D%3D%20true%20yourself.%0A%09self%20assert%3A%20true%20yourself%20%3D%3D%20true%20yourself.%0A%0A%09self%20deny%3A%20true%20%3D%3D%20false'),
  355. messageSends: ["assert:", unescape("%3D%3D"), "yourself", "deny:"],
  356. referencedClasses: []
  357. }),
  358. smalltalk.BooleanTest);
  359. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  360. smalltalk.addMethod(
  361. unescape('_testPrintShowingDecimalPlaces'),
  362. smalltalk.method({
  363. selector: unescape('testPrintShowingDecimalPlaces'),
  364. category: 'tests',
  365. fn: function (){
  366. var self=this;
  367. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  368. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  369. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  370. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  371. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  372. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  373. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  374. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  375. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  376. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  377. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  378. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  379. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  380. return self;},
  381. args: [],
  382. source: unescape('testPrintShowingDecimalPlaces%0A%09self%20assert%3A%20%2723.00%27%20equals%3A%20%2823%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%2723.57%27%20equals%3A%20%2823.5698%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%27-234.56700%27%20equals%3A%28%20234.567%20negated%20printShowingDecimalPlaces%3A%205%29.%0A%09self%20assert%3A%20%2723%27%20equals%3A%20%2823.4567%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%2724%27%20equals%3A%20%2823.5567%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27-23%27%20equals%3A%20%2823.4567%20negated%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27-24%27%20equals%3A%20%2823.5567%20negated%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27100000000.0%27%20equals%3A%20%28100000000%20printShowingDecimalPlaces%3A%201%29.%0A%09self%20assert%3A%20%270.98000%27%20equals%3A%20%280.98%20printShowingDecimalPlaces%3A%205%29.%0A%09self%20assert%3A%20%27-0.98%27%20equals%3A%20%280.98%20negated%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%272.57%27%20equals%3A%20%282.567%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%27-2.57%27%20equals%3A%20%28-2.567%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%270.00%27%20equals%3A%20%280%20printShowingDecimalPlaces%3A%202%29.'),
  383. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  384. referencedClasses: []
  385. }),
  386. smalltalk.NumberTest);
  387. smalltalk.addMethod(
  388. unescape('_testEquality'),
  389. smalltalk.method({
  390. selector: unescape('testEquality'),
  391. category: 'tests',
  392. fn: function (){
  393. var self=this;
  394. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  395. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  396. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  397. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  398. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  399. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  400. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  401. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  402. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  403. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  404. return self;},
  405. args: [],
  406. source: unescape('testEquality%0A%09self%20assert%3A%201%20%3D%201.%0A%09self%20assert%3A%200%20%3D%200.%0A%09self%20deny%3A%201%20%3D%200.%0A%0A%09self%20assert%3A%201%20yourself%20%3D%201.%0A%09self%20assert%3A%201%20%3D%201%20yourself.%0A%09self%20assert%3A%201%20yourself%20%3D%201%20yourself.%0A%09%0A%09self%20deny%3A%200%20%3D%20false.%0A%09self%20deny%3A%20false%20%3D%200.%0A%09self%20deny%3A%20%27%27%20%3D%200.%0A%09self%20deny%3A%200%20%3D%20%27%27'),
  407. messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
  408. referencedClasses: []
  409. }),
  410. smalltalk.NumberTest);
  411. smalltalk.addMethod(
  412. unescape('_testArithmetic'),
  413. smalltalk.method({
  414. selector: unescape('testArithmetic'),
  415. category: 'tests',
  416. fn: function (){
  417. var self=this;
  418. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  419. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  420. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  421. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  422. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  423. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  424. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  425. return self;},
  426. args: [],
  427. source: unescape('testArithmetic%0A%09%0A%09%22We%20rely%20on%20JS%20here%2C%20so%20we%20won%27t%20test%20complex%20behavior%2C%20just%20check%20if%20%0A%09message%20sends%20are%20corrects%22%0A%0A%09self%20assert%3A%201.5%20+%201%20%3D%202.5.%0A%09self%20assert%3A%202%20-%201%20%3D%201.%0A%09self%20assert%3A%20-2%20-%201%20%3D%20-3.%0A%09self%20assert%3A%2012%20/%202%20%3D%206.%0A%09self%20assert%3A%203%20*%204%20%3D%2012.%0A%0A%09%22Simple%20parenthesis%20and%20execution%20order%22%0A%0A%09self%20assert%3A%201%20+%202%20*%203%20%3D%209.%0A%09self%20assert%3A%201%20+%20%282%20*%203%29%20%3D%207'),
  428. messageSends: ["assert:", unescape("%3D"), unescape("+"), unescape("-"), unescape("/"), unescape("*")],
  429. referencedClasses: []
  430. }),
  431. smalltalk.NumberTest);
  432. smalltalk.addMethod(
  433. unescape('_testRounded'),
  434. smalltalk.method({
  435. selector: unescape('testRounded'),
  436. category: 'tests',
  437. fn: function (){
  438. var self=this;
  439. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  440. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  441. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  442. return self;},
  443. args: [],
  444. source: unescape('testRounded%0A%09%0A%09self%20assert%3A%203%20rounded%20%3D%203.%0A%09self%20assert%3A%203.212%20rounded%20%3D%203.%0A%09self%20assert%3A%203.51%20rounded%20%3D%204'),
  445. messageSends: ["assert:", unescape("%3D"), "rounded"],
  446. referencedClasses: []
  447. }),
  448. smalltalk.NumberTest);
  449. smalltalk.addMethod(
  450. unescape('_testNegated'),
  451. smalltalk.method({
  452. selector: unescape('testNegated'),
  453. category: 'tests',
  454. fn: function (){
  455. var self=this;
  456. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  457. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  458. return self;},
  459. args: [],
  460. source: unescape('testNegated%0A%09self%20assert%3A%203%20negated%20%3D%20-3.%0A%09self%20assert%3A%20-3%20negated%20%3D%203'),
  461. messageSends: ["assert:", unescape("%3D"), "negated"],
  462. referencedClasses: []
  463. }),
  464. smalltalk.NumberTest);
  465. smalltalk.addMethod(
  466. unescape('_testComparison'),
  467. smalltalk.method({
  468. selector: unescape('testComparison'),
  469. category: 'tests',
  470. fn: function (){
  471. var self=this;
  472. smalltalk.send(self, "_assert_", [(3) > (2)]);
  473. smalltalk.send(self, "_assert_", [(2) < (3)]);
  474. smalltalk.send(self, "_deny_", [(3) < (2)]);
  475. smalltalk.send(self, "_deny_", [(2) > (3)]);
  476. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  477. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  478. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  479. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  480. return self;},
  481. args: [],
  482. source: unescape('testComparison%0A%0A%09self%20assert%3A%203%20%3E%202.%0A%09self%20assert%3A%202%20%3C%203.%0A%09%0A%09self%20deny%3A%203%20%3C%202.%0A%09self%20deny%3A%202%20%3E%203.%0A%0A%09self%20assert%3A%203%20%3E%3D%203.%0A%09self%20assert%3A%203.1%20%3E%3D%203.%0A%09self%20assert%3A%203%20%3C%3D%203.%0A%09self%20assert%3A%203%20%3C%3D%203.1'),
  483. messageSends: ["assert:", unescape("%3E"), unescape("%3C"), "deny:", unescape("%3E%3D"), unescape("%3C%3D")],
  484. referencedClasses: []
  485. }),
  486. smalltalk.NumberTest);
  487. smalltalk.addMethod(
  488. unescape('_testTruncated'),
  489. smalltalk.method({
  490. selector: unescape('testTruncated'),
  491. category: 'tests',
  492. fn: function (){
  493. var self=this;
  494. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  495. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  496. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  497. return self;},
  498. args: [],
  499. source: unescape('testTruncated%0A%09%0A%09self%20assert%3A%203%20truncated%20%3D%203.%0A%09self%20assert%3A%203.212%20truncated%20%3D%203.%0A%09self%20assert%3A%203.51%20truncated%20%3D%203'),
  500. messageSends: ["assert:", unescape("%3D"), "truncated"],
  501. referencedClasses: []
  502. }),
  503. smalltalk.NumberTest);
  504. smalltalk.addMethod(
  505. unescape('_testCopying'),
  506. smalltalk.method({
  507. selector: unescape('testCopying'),
  508. category: 'tests',
  509. fn: function (){
  510. var self=this;
  511. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  512. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  513. return self;},
  514. args: [],
  515. source: unescape('testCopying%0A%09self%20assert%3A%201%20copy%20%3D%3D%201.%0A%09self%20assert%3A%201%20deepCopy%20%3D%3D%201'),
  516. messageSends: ["assert:", unescape("%3D%3D"), "copy", "deepCopy"],
  517. referencedClasses: []
  518. }),
  519. smalltalk.NumberTest);
  520. smalltalk.addMethod(
  521. unescape('_testMinMax'),
  522. smalltalk.method({
  523. selector: unescape('testMinMax'),
  524. category: 'tests',
  525. fn: function (){
  526. var self=this;
  527. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  528. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  529. return self;},
  530. args: [],
  531. source: unescape('testMinMax%0A%09%0A%09self%20assert%3A%20%282%20max%3A%205%29%20equals%3A%205.%0A%09self%20assert%3A%20%282%20min%3A%205%29%20equals%3A%202'),
  532. messageSends: ["assert:equals:", "max:", "min:"],
  533. referencedClasses: []
  534. }),
  535. smalltalk.NumberTest);
  536. smalltalk.addMethod(
  537. unescape('_testIdentity'),
  538. smalltalk.method({
  539. selector: unescape('testIdentity'),
  540. category: 'tests',
  541. fn: function (){
  542. var self=this;
  543. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  544. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  545. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  546. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  547. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  548. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  549. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  550. return self;},
  551. args: [],
  552. source: unescape('testIdentity%0A%09self%20assert%3A%201%20%3D%3D%201.%0A%09self%20assert%3A%200%20%3D%3D%200.%0A%09self%20deny%3A%201%20%3D%3D%200.%0A%0A%09self%20assert%3A%201%20yourself%20%3D%3D%201.%0A%09self%20assert%3A%201%20%3D%3D%201%20yourself.%0A%09self%20assert%3A%201%20yourself%20%3D%3D%201%20yourself.%0A%09%0A%09self%20deny%3A%201%20%3D%3D%202'),
  553. messageSends: ["assert:", unescape("%3D%3D"), "deny:", "yourself"],
  554. referencedClasses: []
  555. }),
  556. smalltalk.NumberTest);
  557. smalltalk.addMethod(
  558. unescape('_testSqrt'),
  559. smalltalk.method({
  560. selector: unescape('testSqrt'),
  561. category: 'tests',
  562. fn: function (){
  563. var self=this;
  564. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  565. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  566. return self;},
  567. args: [],
  568. source: unescape('testSqrt%0A%09%0A%09self%20assert%3A%204%20sqrt%20%3D%202.%0A%09self%20assert%3A%2016%20sqrt%20%3D%204'),
  569. messageSends: ["assert:", unescape("%3D"), "sqrt"],
  570. referencedClasses: []
  571. }),
  572. smalltalk.NumberTest);
  573. smalltalk.addMethod(
  574. unescape('_testSquared'),
  575. smalltalk.method({
  576. selector: unescape('testSquared'),
  577. category: 'tests',
  578. fn: function (){
  579. var self=this;
  580. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  581. return self;},
  582. args: [],
  583. source: unescape('testSquared%0A%09%0A%09self%20assert%3A%204%20squared%20%3D%2016'),
  584. messageSends: ["assert:", unescape("%3D"), "squared"],
  585. referencedClasses: []
  586. }),
  587. smalltalk.NumberTest);
  588. smalltalk.addMethod(
  589. unescape('_testTimesRepeat'),
  590. smalltalk.method({
  591. selector: unescape('testTimesRepeat'),
  592. category: 'tests',
  593. fn: function (){
  594. var self=this;
  595. var i=nil;
  596. i=(0);
  597. smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  598. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  599. smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  600. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  601. return self;},
  602. args: [],
  603. source: unescape('testTimesRepeat%0A%09%7C%20i%20%7C%0A%0A%09i%20%3A%3D%200.%0A%090%20timesRepeat%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%200.%0A%0A%095%20timesRepeat%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%205'),
  604. messageSends: ["timesRepeat:", unescape("+"), "assert:equals:"],
  605. referencedClasses: []
  606. }),
  607. smalltalk.NumberTest);
  608. smalltalk.addMethod(
  609. unescape('_testTo'),
  610. smalltalk.method({
  611. selector: unescape('testTo'),
  612. category: 'tests',
  613. fn: function (){
  614. var self=this;
  615. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  616. return self;},
  617. args: [],
  618. source: unescape('testTo%0A%09self%20assert%3A%20%281%20to%3A%205%29%20equals%3A%20%23%281%202%203%204%205%29'),
  619. messageSends: ["assert:equals:", "to:"],
  620. referencedClasses: []
  621. }),
  622. smalltalk.NumberTest);
  623. smalltalk.addMethod(
  624. unescape('_testToBy'),
  625. smalltalk.method({
  626. selector: unescape('testToBy'),
  627. category: 'tests',
  628. fn: function (){
  629. var self=this;
  630. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  631. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  632. return self;},
  633. args: [],
  634. source: unescape('testToBy%0A%09self%20assert%3A%20%280%20to%3A%206%20by%3A%202%29%20equals%3A%20%23%280%202%204%206%29.%0A%0A%09self%20should%3A%20%5B1%20to%3A%204%20by%3A%200%5D%20raise%3A%20Error'),
  635. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  636. referencedClasses: ["Error"]
  637. }),
  638. smalltalk.NumberTest);
  639. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  640. smalltalk.addMethod(
  641. unescape('_testMethodWithArguments'),
  642. smalltalk.method({
  643. selector: unescape('testMethodWithArguments'),
  644. category: 'tests',
  645. fn: function (){
  646. var self=this;
  647. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  648. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  649. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  650. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  651. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  652. return self;},
  653. args: [],
  654. source: unescape('testMethodWithArguments%0A%09self%20deny%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.%0A%0A%09%27body%27%20asJQuery%20addClass%3A%20%27amber%27.%0A%09self%20assert%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.%0A%0A%09%27body%27%20asJQuery%20removeClass%3A%20%27amber%27.%0A%09self%20deny%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.'),
  655. messageSends: ["deny:", "hasClass:", "asJQuery", "addClass:", "assert:", "removeClass:"],
  656. referencedClasses: []
  657. }),
  658. smalltalk.JSObjectProxyTest);
  659. smalltalk.addMethod(
  660. unescape('_testYourself'),
  661. smalltalk.method({
  662. selector: unescape('testYourself'),
  663. category: 'tests',
  664. fn: function (){
  665. var self=this;
  666. var body=nil;
  667. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  668. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  669. smalltalk.send(body, "_removeClass_", ["amber"]);
  670. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  671. return self;},
  672. args: [],
  673. source: unescape('testYourself%0A%09%7Cbody%7C%0A%09body%20%3A%3D%20%27body%27%20asJQuery%0A%09%09%09%09addClass%3A%20%27amber%27%3B%0A%09%09%09%09yourself.%0A%0A%09self%20assert%3A%20%28body%20hasClass%3A%20%27amber%27%29.%0A%0A%09body%20removeClass%3A%20%27amber%27.%0A%09self%20deny%3A%20%28body%20hasClass%3A%20%27amber%27%29.'),
  674. messageSends: ["addClass:", "yourself", "asJQuery", "assert:", "hasClass:", "removeClass:", "deny:"],
  675. referencedClasses: []
  676. }),
  677. smalltalk.JSObjectProxyTest);
  678. smalltalk.addMethod(
  679. unescape('_testPropertyThatReturnsEmptyString'),
  680. smalltalk.method({
  681. selector: unescape('testPropertyThatReturnsEmptyString'),
  682. category: 'tests',
  683. fn: function (){
  684. var self=this;
  685. document.location.hash = '';
  686. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  687. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  688. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  689. return self;},
  690. args: [],
  691. source: unescape('testPropertyThatReturnsEmptyString%0A%09%3Cdocument.location.hash%20%3D%20%27%27%3E.%0A%09self%20assert%3A%20%27%27%20equals%3A%20document%20location%20hash.%0A%0A%09document%20location%20hash%3A%20%27test%27.%0A%09self%20assert%3A%20%27%23test%27%20equals%3A%20document%20location%20hash.'),
  692. messageSends: ["assert:equals:", "hash", "location", "hash:"],
  693. referencedClasses: []
  694. }),
  695. smalltalk.JSObjectProxyTest);
  696. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  697. smalltalk.addMethod(
  698. unescape('_setUp'),
  699. smalltalk.method({
  700. selector: unescape('setUp'),
  701. category: 'running',
  702. fn: function (){
  703. var self=this;
  704. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  705. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  706. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  707. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  708. self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", [unescape("server/grul/js")]);smalltalk.send($rec, "_commitPathSt_", [unescape("grul/st")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", []));
  709. return self;},
  710. args: [],
  711. source: unescape('setUp%0A%09backUpCommitPathJs%20%3A%3D%20Package%20defaultCommitPathJs.%0A%09backUpCommitPathSt%20%3A%3D%20Package%20defaultCommitPathSt.%0A%0A%09Package%20resetCommitPaths.%0A%0A%09zorkPackage%20%3A%3D%20Package%20new%20name%3A%20%27Zork%27.%0A%09grulPackage%20%3A%3D%20Package%20new%20%0A%09%09%09%09%09name%3A%20%27Grul%27%3B%0A%09%09%09%09%09commitPathJs%3A%20%27server/grul/js%27%3B%0A%09%09%09%09%09commitPathSt%3A%20%27grul/st%27%3B%0A%09%09%09%09%09yourself'),
  712. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  713. referencedClasses: ["Package"]
  714. }),
  715. smalltalk.PackageTest);
  716. smalltalk.addMethod(
  717. unescape('_tearDown'),
  718. smalltalk.method({
  719. selector: unescape('tearDown'),
  720. category: 'running',
  721. fn: function (){
  722. var self=this;
  723. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  724. return self;},
  725. args: [],
  726. source: unescape('tearDown%0A%09%20Package%20%0A%09%09defaultCommitPathJs%3A%20backUpCommitPathJs%3B%0A%09%09defaultCommitPathSt%3A%20backUpCommitPathSt'),
  727. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  728. referencedClasses: ["Package"]
  729. }),
  730. smalltalk.PackageTest);
  731. smalltalk.addMethod(
  732. unescape('_testGrulCommitPathStShouldBeGrulSt'),
  733. smalltalk.method({
  734. selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
  735. category: 'tests',
  736. fn: function (){
  737. var self=this;
  738. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  739. return self;},
  740. args: [],
  741. source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
  742. messageSends: ["assert:equals:", "commitPathSt"],
  743. referencedClasses: []
  744. }),
  745. smalltalk.PackageTest);
  746. smalltalk.addMethod(
  747. unescape('_testZorkCommitPathStShouldBeSt'),
  748. smalltalk.method({
  749. selector: unescape('testZorkCommitPathStShouldBeSt'),
  750. category: 'tests',
  751. fn: function (){
  752. var self=this;
  753. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  754. return self;},
  755. args: [],
  756. source: unescape('testZorkCommitPathStShouldBeSt%0A%09self%20assert%3A%20%27st%27%20equals%3A%20zorkPackage%20commitPathSt'),
  757. messageSends: ["assert:equals:", "commitPathSt"],
  758. referencedClasses: []
  759. }),
  760. smalltalk.PackageTest);
  761. smalltalk.addMethod(
  762. unescape('_testZorkCommitPathJsShouldBeJs'),
  763. smalltalk.method({
  764. selector: unescape('testZorkCommitPathJsShouldBeJs'),
  765. category: 'tests',
  766. fn: function (){
  767. var self=this;
  768. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  769. return self;},
  770. args: [],
  771. source: unescape('testZorkCommitPathJsShouldBeJs%0A%09self%20assert%3A%20%27js%27%20equals%3A%20zorkPackage%20commitPathJs'),
  772. messageSends: ["assert:equals:", "commitPathJs"],
  773. referencedClasses: []
  774. }),
  775. smalltalk.PackageTest);
  776. smalltalk.addMethod(
  777. unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
  778. smalltalk.method({
  779. selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
  780. category: 'tests',
  781. fn: function (){
  782. var self=this;
  783. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  784. return self;},
  785. args: [],
  786. source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
  787. messageSends: ["assert:equals:", "commitPathJs"],
  788. referencedClasses: []
  789. }),
  790. smalltalk.PackageTest);
  791. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  792. smalltalk.addMethod(
  793. unescape('_setUp'),
  794. smalltalk.method({
  795. selector: unescape('setUp'),
  796. category: 'running',
  797. fn: function (){
  798. var self=this;
  799. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  800. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  801. return self;},
  802. args: [],
  803. source: unescape('setUp%0A%09super%20setUp.%0A%0A%09Package%0A%09%09defaultCommitPathJs%3A%20%27javascripts/%27%3B%0A%09%09defaultCommitPathSt%3A%20%27smalltalk/%27.'),
  804. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  805. referencedClasses: ["Package"]
  806. }),
  807. smalltalk.PackageWithDefaultCommitPathChangedTest);
  808. smalltalk.addMethod(
  809. unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
  810. smalltalk.method({
  811. selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
  812. category: 'tests',
  813. fn: function (){
  814. var self=this;
  815. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  816. return self;},
  817. args: [],
  818. source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
  819. messageSends: ["assert:equals:", "commitPathJs"],
  820. referencedClasses: []
  821. }),
  822. smalltalk.PackageWithDefaultCommitPathChangedTest);
  823. smalltalk.addMethod(
  824. unescape('_testGrulCommitPathStShouldBeGrulSt'),
  825. smalltalk.method({
  826. selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
  827. category: 'tests',
  828. fn: function (){
  829. var self=this;
  830. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  831. return self;},
  832. args: [],
  833. source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
  834. messageSends: ["assert:equals:", "commitPathSt"],
  835. referencedClasses: []
  836. }),
  837. smalltalk.PackageWithDefaultCommitPathChangedTest);
  838. smalltalk.addMethod(
  839. unescape('_testZorkCommitPathJsShouldBeJavascript'),
  840. smalltalk.method({
  841. selector: unescape('testZorkCommitPathJsShouldBeJavascript'),
  842. category: 'tests',
  843. fn: function (){
  844. var self=this;
  845. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  846. return self;},
  847. args: [],
  848. source: unescape('testZorkCommitPathJsShouldBeJavascript%0A%09self%20assert%3A%20%27javascripts/%27%20equals%3A%20zorkPackage%20commitPathJs'),
  849. messageSends: ["assert:equals:", "commitPathJs"],
  850. referencedClasses: []
  851. }),
  852. smalltalk.PackageWithDefaultCommitPathChangedTest);
  853. smalltalk.addMethod(
  854. unescape('_testZorkCommitPathStShouldBeSmalltalk'),
  855. smalltalk.method({
  856. selector: unescape('testZorkCommitPathStShouldBeSmalltalk'),
  857. category: 'tests',
  858. fn: function (){
  859. var self=this;
  860. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  861. return self;},
  862. args: [],
  863. source: unescape('testZorkCommitPathStShouldBeSmalltalk%0A%09self%20assert%3A%20%27smalltalk/%27%20equals%3A%20zorkPackage%20commitPathSt'),
  864. messageSends: ["assert:equals:", "commitPathSt"],
  865. referencedClasses: []
  866. }),
  867. smalltalk.PackageWithDefaultCommitPathChangedTest);
  868. smalltalk.addMethod(
  869. unescape('_shouldInheritSelectors'),
  870. smalltalk.method({
  871. selector: unescape('shouldInheritSelectors'),
  872. category: 'accessing',
  873. fn: function (){
  874. var self=this;
  875. return false;
  876. return self;},
  877. args: [],
  878. source: unescape('shouldInheritSelectors%0A%09%5E%20false'),
  879. messageSends: [],
  880. referencedClasses: []
  881. }),
  882. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  883. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  884. smalltalk.addMethod(
  885. unescape('_testValue'),
  886. smalltalk.method({
  887. selector: unescape('testValue'),
  888. category: 'tests',
  889. fn: function (){
  890. var self=this;
  891. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  892. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
  893. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
  894. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  895. return self;},
  896. args: [],
  897. source: unescape('testValue%0A%09self%20assert%3A%20%28%5B1+1%5D%20value%29%20equals%3A%202.%0A%09self%20assert%3A%20%28%5B%3Ax%20%7C%20x%20+1%5D%20value%3A%202%29%20equals%3A%203.%0A%09self%20assert%3A%20%28%5B%3Ax%20%3Ay%20%7C%20x*y%5D%20value%3A%202%20value%3A%204%29%20equals%3A%208.%20%0A%0A%09%22Arguments%20are%20optional%20in%20Amber.%20This%20isn%27t%20ANSI%20compliant.%22%0A%0A%09self%20assert%3A%20%28%5B%3Aa%20%3Ab%20%3Ac%20%7C%201%5D%20value%29%20equals%3A%201'),
  898. messageSends: ["assert:equals:", "value", unescape("+"), "value:", "value:value:", unescape("*")],
  899. referencedClasses: []
  900. }),
  901. smalltalk.BlockClosureTest);
  902. smalltalk.addMethod(
  903. unescape('_testOnDo'),
  904. smalltalk.method({
  905. selector: unescape('testOnDo'),
  906. category: 'tests',
  907. fn: function (){
  908. var self=this;
  909. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
  910. return self;},
  911. args: [],
  912. source: unescape('testOnDo%0A%09self%20assert%3A%20%28%5BError%20new%20signal%5D%20on%3A%20Error%20do%3A%20%5B%3Aex%20%7C%20true%5D%29'),
  913. messageSends: ["assert:", "on:do:", "signal", "new"],
  914. referencedClasses: ["Error"]
  915. }),
  916. smalltalk.BlockClosureTest);
  917. smalltalk.addMethod(
  918. unescape('_testEnsure'),
  919. smalltalk.method({
  920. selector: unescape('testEnsure'),
  921. category: 'tests',
  922. fn: function (){
  923. var self=this;
  924. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  925. return self;},
  926. args: [],
  927. source: unescape('testEnsure%0A%09self%20assert%3A%20%28%5BError%20new%5D%20ensure%3A%20%5Btrue%5D%29'),
  928. messageSends: ["assert:", "ensure:", "new"],
  929. referencedClasses: ["Error"]
  930. }),
  931. smalltalk.BlockClosureTest);
  932. smalltalk.addMethod(
  933. unescape('_testNumArgs'),
  934. smalltalk.method({
  935. selector: unescape('testNumArgs'),
  936. category: 'tests',
  937. fn: function (){
  938. var self=this;
  939. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  940. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  941. return self;},
  942. args: [],
  943. source: unescape('testNumArgs%0A%09self%20assert%3A%20%5B%5D%20numArgs%20equals%3A%200.%0A%09self%20assert%3A%20%5B%3Aa%20%3Ab%20%7C%20%5D%20numArgs%20equals%3A%202'),
  944. messageSends: ["assert:equals:", "numArgs"],
  945. referencedClasses: []
  946. }),
  947. smalltalk.BlockClosureTest);
  948. smalltalk.addMethod(
  949. unescape('_testValueWithPossibleArguments'),
  950. smalltalk.method({
  951. selector: unescape('testValueWithPossibleArguments'),
  952. category: 'tests',
  953. fn: function (){
  954. var self=this;
  955. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  956. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
  957. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
  958. return self;},
  959. args: [],
  960. source: unescape('testValueWithPossibleArguments%0A%09self%20assert%3A%20%28%5B1%5D%20valueWithPossibleArguments%3A%20%23%283%204%29%29%20equals%3A%201.%0A%09self%20assert%3A%20%28%5B%3Aa%20%7C%20a%20+%204%5D%20valueWithPossibleArguments%3A%20%23%283%204%29%29%20equals%3A%207.%0A%09self%20assert%3A%20%28%5B%3Aa%20%3Ab%20%7C%20a%20+%20b%5D%20valueWithPossibleArguments%3A%20%23%283%204%205%29%29%20equals%3A%207.'),
  961. messageSends: ["assert:equals:", "valueWithPossibleArguments:", unescape("+")],
  962. referencedClasses: []
  963. }),
  964. smalltalk.BlockClosureTest);
  965. smalltalk.addMethod(
  966. unescape('_testWhileTrue'),
  967. smalltalk.method({
  968. selector: unescape('testWhileTrue'),
  969. category: 'tests',
  970. fn: function (){
  971. var self=this;
  972. var i=nil;
  973. i=(0);
  974. (function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
  975. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  976. i=(0);
  977. (function(){while((function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
  978. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  979. return self;},
  980. args: [],
  981. source: unescape('testWhileTrue%0A%09%7C%20i%20%7C%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3C%205%5D%20whileTrue%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%205.%0A%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3A%3D%20i%20+%201.%20i%20%3C%205%5D%20whileTrue.%0A%09self%20assert%3A%20i%20equals%3A%205'),
  982. messageSends: ["whileTrue:", unescape("%3C"), unescape("+"), "assert:equals:", "whileTrue"],
  983. referencedClasses: []
  984. }),
  985. smalltalk.BlockClosureTest);
  986. smalltalk.addMethod(
  987. unescape('_testWhileFalse'),
  988. smalltalk.method({
  989. selector: unescape('testWhileFalse'),
  990. category: 'tests',
  991. fn: function (){
  992. var self=this;
  993. var i=nil;
  994. i=(0);
  995. (function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
  996. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  997. i=(0);
  998. (function(){while(!(function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
  999. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  1000. return self;},
  1001. args: [],
  1002. source: unescape('testWhileFalse%0A%09%7C%20i%20%7C%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3E%205%5D%20whileFalse%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%206.%0A%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3A%3D%20i%20+%201.%20i%20%3E%205%5D%20whileFalse.%0A%09self%20assert%3A%20i%20equals%3A%206'),
  1003. messageSends: ["whileFalse:", unescape("%3E"), unescape("+"), "assert:equals:", "whileFalse"],
  1004. referencedClasses: []
  1005. }),
  1006. smalltalk.BlockClosureTest);
  1007. smalltalk.addMethod(
  1008. unescape('_testCompiledSource'),
  1009. smalltalk.method({
  1010. selector: unescape('testCompiledSource'),
  1011. category: 'tests',
  1012. fn: function (){
  1013. var self=this;
  1014. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), unescape("function%20%28%29%7Breturn%20%281%29%20+%20%281%29%3B%7D")]);
  1015. return self;},
  1016. args: [],
  1017. source: unescape('testCompiledSource%0A%09self%20assert%3A%20%5B1+1%5D%20compiledSource%20equals%3A%20%20%27function%20%28%29%7Breturn%20%281%29%20+%20%281%29%3B%7D%27%20'),
  1018. messageSends: ["assert:equals:", "compiledSource", unescape("+")],
  1019. referencedClasses: []
  1020. }),
  1021. smalltalk.BlockClosureTest);
  1022. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1023. smalltalk.addMethod(
  1024. unescape('_testEquality'),
  1025. smalltalk.method({
  1026. selector: unescape('testEquality'),
  1027. category: 'tests',
  1028. fn: function (){
  1029. var self=this;
  1030. var o=nil;
  1031. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  1032. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1033. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  1034. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  1035. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  1036. return self;},
  1037. args: [],
  1038. source: unescape('testEquality%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09self%20deny%3A%20o%20%3D%20Object%20new.%0A%09self%20assert%3A%20o%20%3D%20o.%0A%09self%20assert%3A%20o%20yourself%20%3D%20o.%0A%09self%20assert%3A%20o%20%3D%20o%20yourself'),
  1039. messageSends: ["new", "deny:", unescape("%3D"), "assert:", "yourself"],
  1040. referencedClasses: ["Object"]
  1041. }),
  1042. smalltalk.ObjectTest);
  1043. smalltalk.addMethod(
  1044. unescape('_testIdentity'),
  1045. smalltalk.method({
  1046. selector: unescape('testIdentity'),
  1047. category: 'tests',
  1048. fn: function (){
  1049. var self=this;
  1050. var o=nil;
  1051. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  1052. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1053. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  1054. return self;},
  1055. args: [],
  1056. source: unescape('testIdentity%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09self%20deny%3A%20o%20%3D%3D%20Object%20new.%0A%09self%20assert%3A%20o%20%3D%3D%20o'),
  1057. messageSends: ["new", "deny:", unescape("%3D%3D"), "assert:"],
  1058. referencedClasses: ["Object"]
  1059. }),
  1060. smalltalk.ObjectTest);