1
0

Kernel-Tests.js 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  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.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  341. smalltalk.addMethod(
  342. unescape('_testPrintShowingDecimalPlaces'),
  343. smalltalk.method({
  344. selector: unescape('testPrintShowingDecimalPlaces'),
  345. category: 'tests',
  346. fn: function (){
  347. var self=this;
  348. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  349. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  350. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  351. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  352. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  353. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  354. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  355. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  356. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  357. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  358. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  359. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  360. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  361. return self;},
  362. args: [],
  363. 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.'),
  364. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  365. referencedClasses: []
  366. }),
  367. smalltalk.NumberTest);
  368. smalltalk.addMethod(
  369. unescape('_testEquality'),
  370. smalltalk.method({
  371. selector: unescape('testEquality'),
  372. category: 'tests',
  373. fn: function (){
  374. var self=this;
  375. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  376. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  377. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  378. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  379. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  380. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  381. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  382. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  383. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  384. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  385. return self;},
  386. args: [],
  387. 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'),
  388. messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
  389. referencedClasses: []
  390. }),
  391. smalltalk.NumberTest);
  392. smalltalk.addMethod(
  393. unescape('_testArithmetic'),
  394. smalltalk.method({
  395. selector: unescape('testArithmetic'),
  396. category: 'tests',
  397. fn: function (){
  398. var self=this;
  399. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  400. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  401. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  402. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  403. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  404. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  405. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  406. return self;},
  407. args: [],
  408. 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'),
  409. messageSends: ["assert:", unescape("%3D"), unescape("+"), unescape("-"), unescape("/"), unescape("*")],
  410. referencedClasses: []
  411. }),
  412. smalltalk.NumberTest);
  413. smalltalk.addMethod(
  414. unescape('_testRounded'),
  415. smalltalk.method({
  416. selector: unescape('testRounded'),
  417. category: 'tests',
  418. fn: function (){
  419. var self=this;
  420. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  421. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  422. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  423. return self;},
  424. args: [],
  425. 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'),
  426. messageSends: ["assert:", unescape("%3D"), "rounded"],
  427. referencedClasses: []
  428. }),
  429. smalltalk.NumberTest);
  430. smalltalk.addMethod(
  431. unescape('_testNegated'),
  432. smalltalk.method({
  433. selector: unescape('testNegated'),
  434. category: 'tests',
  435. fn: function (){
  436. var self=this;
  437. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  438. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  439. return self;},
  440. args: [],
  441. source: unescape('testNegated%0A%09self%20assert%3A%203%20negated%20%3D%20-3.%0A%09self%20assert%3A%20-3%20negated%20%3D%203'),
  442. messageSends: ["assert:", unescape("%3D"), "negated"],
  443. referencedClasses: []
  444. }),
  445. smalltalk.NumberTest);
  446. smalltalk.addMethod(
  447. unescape('_testComparison'),
  448. smalltalk.method({
  449. selector: unescape('testComparison'),
  450. category: 'tests',
  451. fn: function (){
  452. var self=this;
  453. smalltalk.send(self, "_assert_", [(3) > (2)]);
  454. smalltalk.send(self, "_assert_", [(2) < (3)]);
  455. smalltalk.send(self, "_deny_", [(3) < (2)]);
  456. smalltalk.send(self, "_deny_", [(2) > (3)]);
  457. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  458. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  459. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  460. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  461. return self;},
  462. args: [],
  463. 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'),
  464. messageSends: ["assert:", unescape("%3E"), unescape("%3C"), "deny:", unescape("%3E%3D"), unescape("%3C%3D")],
  465. referencedClasses: []
  466. }),
  467. smalltalk.NumberTest);
  468. smalltalk.addMethod(
  469. unescape('_testTruncated'),
  470. smalltalk.method({
  471. selector: unescape('testTruncated'),
  472. category: 'tests',
  473. fn: function (){
  474. var self=this;
  475. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  476. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  477. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  478. return self;},
  479. args: [],
  480. 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'),
  481. messageSends: ["assert:", unescape("%3D"), "truncated"],
  482. referencedClasses: []
  483. }),
  484. smalltalk.NumberTest);
  485. smalltalk.addMethod(
  486. unescape('_testCopying'),
  487. smalltalk.method({
  488. selector: unescape('testCopying'),
  489. category: 'tests',
  490. fn: function (){
  491. var self=this;
  492. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  493. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  494. return self;},
  495. args: [],
  496. source: unescape('testCopying%0A%09self%20assert%3A%201%20copy%20%3D%3D%201.%0A%09self%20assert%3A%201%20deepCopy%20%3D%3D%201'),
  497. messageSends: ["assert:", unescape("%3D%3D"), "copy", "deepCopy"],
  498. referencedClasses: []
  499. }),
  500. smalltalk.NumberTest);
  501. smalltalk.addMethod(
  502. unescape('_testMinMax'),
  503. smalltalk.method({
  504. selector: unescape('testMinMax'),
  505. category: 'tests',
  506. fn: function (){
  507. var self=this;
  508. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  509. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  510. return self;},
  511. args: [],
  512. 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'),
  513. messageSends: ["assert:equals:", "max:", "min:"],
  514. referencedClasses: []
  515. }),
  516. smalltalk.NumberTest);
  517. smalltalk.addMethod(
  518. unescape('_testIdentity'),
  519. smalltalk.method({
  520. selector: unescape('testIdentity'),
  521. category: 'tests',
  522. fn: function (){
  523. var self=this;
  524. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  525. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  526. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  527. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  528. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  529. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  530. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  531. return self;},
  532. args: [],
  533. 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'),
  534. messageSends: ["assert:", unescape("%3D%3D"), "deny:", "yourself"],
  535. referencedClasses: []
  536. }),
  537. smalltalk.NumberTest);
  538. smalltalk.addMethod(
  539. unescape('_testSqrt'),
  540. smalltalk.method({
  541. selector: unescape('testSqrt'),
  542. category: 'tests',
  543. fn: function (){
  544. var self=this;
  545. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  546. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  547. return self;},
  548. args: [],
  549. source: unescape('testSqrt%0A%09%0A%09self%20assert%3A%204%20sqrt%20%3D%202.%0A%09self%20assert%3A%2016%20sqrt%20%3D%204'),
  550. messageSends: ["assert:", unescape("%3D"), "sqrt"],
  551. referencedClasses: []
  552. }),
  553. smalltalk.NumberTest);
  554. smalltalk.addMethod(
  555. unescape('_testSquared'),
  556. smalltalk.method({
  557. selector: unescape('testSquared'),
  558. category: 'tests',
  559. fn: function (){
  560. var self=this;
  561. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  562. return self;},
  563. args: [],
  564. source: unescape('testSquared%0A%09%0A%09self%20assert%3A%204%20squared%20%3D%2016'),
  565. messageSends: ["assert:", unescape("%3D"), "squared"],
  566. referencedClasses: []
  567. }),
  568. smalltalk.NumberTest);
  569. smalltalk.addMethod(
  570. unescape('_testTimesRepeat'),
  571. smalltalk.method({
  572. selector: unescape('testTimesRepeat'),
  573. category: 'tests',
  574. fn: function (){
  575. var self=this;
  576. var i=nil;
  577. i=(0);
  578. smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  579. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  580. smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  581. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  582. return self;},
  583. args: [],
  584. 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'),
  585. messageSends: ["timesRepeat:", unescape("+"), "assert:equals:"],
  586. referencedClasses: []
  587. }),
  588. smalltalk.NumberTest);
  589. smalltalk.addMethod(
  590. unescape('_testTo'),
  591. smalltalk.method({
  592. selector: unescape('testTo'),
  593. category: 'tests',
  594. fn: function (){
  595. var self=this;
  596. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  597. return self;},
  598. args: [],
  599. source: unescape('testTo%0A%09self%20assert%3A%20%281%20to%3A%205%29%20equals%3A%20%23%281%202%203%204%205%29'),
  600. messageSends: ["assert:equals:", "to:"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.NumberTest);
  604. smalltalk.addMethod(
  605. unescape('_testToBy'),
  606. smalltalk.method({
  607. selector: unescape('testToBy'),
  608. category: 'tests',
  609. fn: function (){
  610. var self=this;
  611. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  612. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  613. return self;},
  614. args: [],
  615. 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'),
  616. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  617. referencedClasses: ["Error"]
  618. }),
  619. smalltalk.NumberTest);
  620. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  621. smalltalk.addMethod(
  622. unescape('_testMethodWithArguments'),
  623. smalltalk.method({
  624. selector: unescape('testMethodWithArguments'),
  625. category: 'tests',
  626. fn: function (){
  627. var self=this;
  628. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  629. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  630. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  631. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  632. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  633. return self;},
  634. args: [],
  635. 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.'),
  636. messageSends: ["deny:", "hasClass:", "asJQuery", "addClass:", "assert:", "removeClass:"],
  637. referencedClasses: []
  638. }),
  639. smalltalk.JSObjectProxyTest);
  640. smalltalk.addMethod(
  641. unescape('_testYourself'),
  642. smalltalk.method({
  643. selector: unescape('testYourself'),
  644. category: 'tests',
  645. fn: function (){
  646. var self=this;
  647. var body=nil;
  648. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  649. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  650. smalltalk.send(body, "_removeClass_", ["amber"]);
  651. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  652. return self;},
  653. args: [],
  654. 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.'),
  655. messageSends: ["addClass:", "yourself", "asJQuery", "assert:", "hasClass:", "removeClass:", "deny:"],
  656. referencedClasses: []
  657. }),
  658. smalltalk.JSObjectProxyTest);
  659. smalltalk.addMethod(
  660. unescape('_testPropertyThatReturnsEmptyString'),
  661. smalltalk.method({
  662. selector: unescape('testPropertyThatReturnsEmptyString'),
  663. category: 'tests',
  664. fn: function (){
  665. var self=this;
  666. document.location.hash = '';
  667. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  668. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  669. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  670. return self;},
  671. args: [],
  672. 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.'),
  673. messageSends: ["assert:equals:", "hash", "location", "hash:"],
  674. referencedClasses: []
  675. }),
  676. smalltalk.JSObjectProxyTest);
  677. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  678. smalltalk.addMethod(
  679. unescape('_setUp'),
  680. smalltalk.method({
  681. selector: unescape('setUp'),
  682. category: 'running',
  683. fn: function (){
  684. var self=this;
  685. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  686. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  687. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  688. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  689. 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", []));
  690. return self;},
  691. args: [],
  692. 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'),
  693. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  694. referencedClasses: ["Package"]
  695. }),
  696. smalltalk.PackageTest);
  697. smalltalk.addMethod(
  698. unescape('_tearDown'),
  699. smalltalk.method({
  700. selector: unescape('tearDown'),
  701. category: 'running',
  702. fn: function (){
  703. var self=this;
  704. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  705. return self;},
  706. args: [],
  707. source: unescape('tearDown%0A%09%20Package%20%0A%09%09defaultCommitPathJs%3A%20backUpCommitPathJs%3B%0A%09%09defaultCommitPathSt%3A%20backUpCommitPathSt'),
  708. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  709. referencedClasses: ["Package"]
  710. }),
  711. smalltalk.PackageTest);
  712. smalltalk.addMethod(
  713. unescape('_testGrulCommitPathStShouldBeGrulSt'),
  714. smalltalk.method({
  715. selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
  716. category: 'tests',
  717. fn: function (){
  718. var self=this;
  719. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  720. return self;},
  721. args: [],
  722. source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
  723. messageSends: ["assert:equals:", "commitPathSt"],
  724. referencedClasses: []
  725. }),
  726. smalltalk.PackageTest);
  727. smalltalk.addMethod(
  728. unescape('_testZorkCommitPathStShouldBeSt'),
  729. smalltalk.method({
  730. selector: unescape('testZorkCommitPathStShouldBeSt'),
  731. category: 'tests',
  732. fn: function (){
  733. var self=this;
  734. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  735. return self;},
  736. args: [],
  737. source: unescape('testZorkCommitPathStShouldBeSt%0A%09self%20assert%3A%20%27st%27%20equals%3A%20zorkPackage%20commitPathSt'),
  738. messageSends: ["assert:equals:", "commitPathSt"],
  739. referencedClasses: []
  740. }),
  741. smalltalk.PackageTest);
  742. smalltalk.addMethod(
  743. unescape('_testZorkCommitPathJsShouldBeJs'),
  744. smalltalk.method({
  745. selector: unescape('testZorkCommitPathJsShouldBeJs'),
  746. category: 'tests',
  747. fn: function (){
  748. var self=this;
  749. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  750. return self;},
  751. args: [],
  752. source: unescape('testZorkCommitPathJsShouldBeJs%0A%09self%20assert%3A%20%27js%27%20equals%3A%20zorkPackage%20commitPathJs'),
  753. messageSends: ["assert:equals:", "commitPathJs"],
  754. referencedClasses: []
  755. }),
  756. smalltalk.PackageTest);
  757. smalltalk.addMethod(
  758. unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
  759. smalltalk.method({
  760. selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
  761. category: 'tests',
  762. fn: function (){
  763. var self=this;
  764. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  765. return self;},
  766. args: [],
  767. source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
  768. messageSends: ["assert:equals:", "commitPathJs"],
  769. referencedClasses: []
  770. }),
  771. smalltalk.PackageTest);
  772. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  773. smalltalk.addMethod(
  774. unescape('_setUp'),
  775. smalltalk.method({
  776. selector: unescape('setUp'),
  777. category: 'running',
  778. fn: function (){
  779. var self=this;
  780. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  781. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  782. return self;},
  783. args: [],
  784. source: unescape('setUp%0A%09super%20setUp.%0A%0A%09Package%0A%09%09defaultCommitPathJs%3A%20%27javascripts/%27%3B%0A%09%09defaultCommitPathSt%3A%20%27smalltalk/%27.'),
  785. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  786. referencedClasses: ["Package"]
  787. }),
  788. smalltalk.PackageWithDefaultCommitPathChangedTest);
  789. smalltalk.addMethod(
  790. unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
  791. smalltalk.method({
  792. selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
  793. category: 'tests',
  794. fn: function (){
  795. var self=this;
  796. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  797. return self;},
  798. args: [],
  799. source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
  800. messageSends: ["assert:equals:", "commitPathJs"],
  801. referencedClasses: []
  802. }),
  803. smalltalk.PackageWithDefaultCommitPathChangedTest);
  804. smalltalk.addMethod(
  805. unescape('_testGrulCommitPathStShouldBeGrulSt'),
  806. smalltalk.method({
  807. selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
  808. category: 'tests',
  809. fn: function (){
  810. var self=this;
  811. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  812. return self;},
  813. args: [],
  814. source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
  815. messageSends: ["assert:equals:", "commitPathSt"],
  816. referencedClasses: []
  817. }),
  818. smalltalk.PackageWithDefaultCommitPathChangedTest);
  819. smalltalk.addMethod(
  820. unescape('_testZorkCommitPathJsShouldBeJavascript'),
  821. smalltalk.method({
  822. selector: unescape('testZorkCommitPathJsShouldBeJavascript'),
  823. category: 'tests',
  824. fn: function (){
  825. var self=this;
  826. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  827. return self;},
  828. args: [],
  829. source: unescape('testZorkCommitPathJsShouldBeJavascript%0A%09self%20assert%3A%20%27javascripts/%27%20equals%3A%20zorkPackage%20commitPathJs'),
  830. messageSends: ["assert:equals:", "commitPathJs"],
  831. referencedClasses: []
  832. }),
  833. smalltalk.PackageWithDefaultCommitPathChangedTest);
  834. smalltalk.addMethod(
  835. unescape('_testZorkCommitPathStShouldBeSmalltalk'),
  836. smalltalk.method({
  837. selector: unescape('testZorkCommitPathStShouldBeSmalltalk'),
  838. category: 'tests',
  839. fn: function (){
  840. var self=this;
  841. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  842. return self;},
  843. args: [],
  844. source: unescape('testZorkCommitPathStShouldBeSmalltalk%0A%09self%20assert%3A%20%27smalltalk/%27%20equals%3A%20zorkPackage%20commitPathSt'),
  845. messageSends: ["assert:equals:", "commitPathSt"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.PackageWithDefaultCommitPathChangedTest);
  849. smalltalk.addMethod(
  850. unescape('_shouldInheritSelectors'),
  851. smalltalk.method({
  852. selector: unescape('shouldInheritSelectors'),
  853. category: 'accessing',
  854. fn: function (){
  855. var self=this;
  856. return false;
  857. return self;},
  858. args: [],
  859. source: unescape('shouldInheritSelectors%0A%09%5E%20false'),
  860. messageSends: [],
  861. referencedClasses: []
  862. }),
  863. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  864. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  865. smalltalk.addMethod(
  866. unescape('_testValue'),
  867. smalltalk.method({
  868. selector: unescape('testValue'),
  869. category: 'tests',
  870. fn: function (){
  871. var self=this;
  872. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  873. 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)]);
  874. 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)]);
  875. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  876. return self;},
  877. args: [],
  878. 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'),
  879. messageSends: ["assert:equals:", "value", unescape("+"), "value:", "value:value:", unescape("*")],
  880. referencedClasses: []
  881. }),
  882. smalltalk.BlockClosureTest);
  883. smalltalk.addMethod(
  884. unescape('_testOnDo'),
  885. smalltalk.method({
  886. selector: unescape('testOnDo'),
  887. category: 'tests',
  888. fn: function (){
  889. var self=this;
  890. 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;})])]);
  891. return self;},
  892. args: [],
  893. 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'),
  894. messageSends: ["assert:", "on:do:", "signal", "new"],
  895. referencedClasses: ["Error"]
  896. }),
  897. smalltalk.BlockClosureTest);
  898. smalltalk.addMethod(
  899. unescape('_testEnsure'),
  900. smalltalk.method({
  901. selector: unescape('testEnsure'),
  902. category: 'tests',
  903. fn: function (){
  904. var self=this;
  905. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  906. return self;},
  907. args: [],
  908. source: unescape('testEnsure%0A%09self%20assert%3A%20%28%5BError%20new%5D%20ensure%3A%20%5Btrue%5D%29'),
  909. messageSends: ["assert:", "ensure:", "new"],
  910. referencedClasses: ["Error"]
  911. }),
  912. smalltalk.BlockClosureTest);
  913. smalltalk.addMethod(
  914. unescape('_testNumArgs'),
  915. smalltalk.method({
  916. selector: unescape('testNumArgs'),
  917. category: 'tests',
  918. fn: function (){
  919. var self=this;
  920. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  921. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  922. return self;},
  923. args: [],
  924. 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'),
  925. messageSends: ["assert:equals:", "numArgs"],
  926. referencedClasses: []
  927. }),
  928. smalltalk.BlockClosureTest);
  929. smalltalk.addMethod(
  930. unescape('_testValueWithPossibleArguments'),
  931. smalltalk.method({
  932. selector: unescape('testValueWithPossibleArguments'),
  933. category: 'tests',
  934. fn: function (){
  935. var self=this;
  936. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  937. 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)]);
  938. 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)]);
  939. return self;},
  940. args: [],
  941. 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.'),
  942. messageSends: ["assert:equals:", "valueWithPossibleArguments:", unescape("+")],
  943. referencedClasses: []
  944. }),
  945. smalltalk.BlockClosureTest);
  946. smalltalk.addMethod(
  947. unescape('_testWhileTrue'),
  948. smalltalk.method({
  949. selector: unescape('testWhileTrue'),
  950. category: 'tests',
  951. fn: function (){
  952. var self=this;
  953. var i=nil;
  954. i=(0);
  955. (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)]));})()}})();
  956. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  957. i=(0);
  958. (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)]));})()) {}})();
  959. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  960. return self;},
  961. args: [],
  962. 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'),
  963. messageSends: ["whileTrue:", unescape("%3C"), unescape("+"), "assert:equals:", "whileTrue"],
  964. referencedClasses: []
  965. }),
  966. smalltalk.BlockClosureTest);
  967. smalltalk.addMethod(
  968. unescape('_testWhileFalse'),
  969. smalltalk.method({
  970. selector: unescape('testWhileFalse'),
  971. category: 'tests',
  972. fn: function (){
  973. var self=this;
  974. var i=nil;
  975. i=(0);
  976. (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)]));})()}})();
  977. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  978. i=(0);
  979. (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)]));})()) {}})();
  980. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  981. return self;},
  982. args: [],
  983. 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'),
  984. messageSends: ["whileFalse:", unescape("%3E"), unescape("+"), "assert:equals:", "whileFalse"],
  985. referencedClasses: []
  986. }),
  987. smalltalk.BlockClosureTest);
  988. smalltalk.addMethod(
  989. unescape('_testCompiledSource'),
  990. smalltalk.method({
  991. selector: unescape('testCompiledSource'),
  992. category: 'tests',
  993. fn: function (){
  994. var self=this;
  995. 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")]);
  996. return self;},
  997. args: [],
  998. 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'),
  999. messageSends: ["assert:equals:", "compiledSource", unescape("+")],
  1000. referencedClasses: []
  1001. }),
  1002. smalltalk.BlockClosureTest);
  1003. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1004. smalltalk.addMethod(
  1005. unescape('_testEquality'),
  1006. smalltalk.method({
  1007. selector: unescape('testEquality'),
  1008. category: 'tests',
  1009. fn: function (){
  1010. var self=this;
  1011. var o=nil;
  1012. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  1013. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1014. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  1015. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  1016. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  1017. return self;},
  1018. args: [],
  1019. 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'),
  1020. messageSends: ["new", "deny:", unescape("%3D"), "assert:", "yourself"],
  1021. referencedClasses: ["Object"]
  1022. }),
  1023. smalltalk.ObjectTest);
  1024. smalltalk.addMethod(
  1025. unescape('_testIdentity'),
  1026. smalltalk.method({
  1027. selector: unescape('testIdentity'),
  1028. category: 'tests',
  1029. fn: function (){
  1030. var self=this;
  1031. var o=nil;
  1032. o=smalltalk.send((smalltalk.Object || Object), "_new", []);
  1033. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1034. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  1035. return self;},
  1036. args: [],
  1037. 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'),
  1038. messageSends: ["new", "deny:", unescape("%3D%3D"), "assert:"],
  1039. referencedClasses: ["Object"]
  1040. }),
  1041. smalltalk.ObjectTest);