1
0

Kernel-Tests.deploy.js 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('ArrayTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testAtIfAbsent",
  5. smalltalk.method({
  6. selector: "testAtIfAbsent",
  7. fn: function (){
  8. var self=this;
  9. var array=nil;
  10. (array=["hello", "world"]);
  11. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(1)]), "hello"]);
  12. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(2)]), "world"]);
  13. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(2), (function(){return "not found";})]), "world"]);
  14. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(0), (function(){return "not found";})]), "not found"]);
  15. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(-10), (function(){return "not found";})]), "not found"]);
  16. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(3), (function(){return "not found";})]), "not found"]);
  17. return self;}
  18. }),
  19. smalltalk.ArrayTest);
  20. smalltalk.addMethod(
  21. "_testFirstN",
  22. smalltalk.method({
  23. selector: "testFirstN",
  24. fn: function (){
  25. var self=this;
  26. smalltalk.send(self, "_assert_equals_", [[(1),(2),(3)], smalltalk.send([(1),(2),(3),(4),(5)], "_first_", [(3)])]);
  27. return self;}
  28. }),
  29. smalltalk.ArrayTest);
  30. smalltalk.addMethod(
  31. "_testIfEmpty",
  32. smalltalk.method({
  33. selector: "testIfEmpty",
  34. fn: function (){
  35. var self=this;
  36. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [(function(){return "zork";})])]);
  37. return self;}
  38. }),
  39. smalltalk.ArrayTest);
  40. smalltalk.addMethod(
  41. "_testPrintString",
  42. smalltalk.method({
  43. selector: "testPrintString",
  44. fn: function (){
  45. var self=this;
  46. var array=nil;
  47. (array=smalltalk.send((smalltalk.Array || Array), "_new", []));
  48. smalltalk.send(self, "_assert_equals_", ["a Array ()", smalltalk.send(array, "_printString", [])]);
  49. (function($rec){smalltalk.send($rec, "_add_", [(1)]);return smalltalk.send($rec, "_add_", [(3)]);})(array);
  50. smalltalk.send(self, "_assert_equals_", ["a Array (1 3)", smalltalk.send(array, "_printString", [])]);
  51. smalltalk.send(array, "_add_", ["foo"]);
  52. smalltalk.send(self, "_assert_equals_", ["a Array (1 3 'foo')", smalltalk.send(array, "_printString", [])]);
  53. (function($rec){smalltalk.send($rec, "_remove_", [(1)]);return smalltalk.send($rec, "_remove_", [(3)]);})(array);
  54. smalltalk.send(self, "_assert_equals_", ["a Array ('foo')", smalltalk.send(array, "_printString", [])]);
  55. smalltalk.send(array, "_addLast_", [(3)]);
  56. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3)", smalltalk.send(array, "_printString", [])]);
  57. smalltalk.send(array, "_addLast_", [(3)]);
  58. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3 3)", smalltalk.send(array, "_printString", [])]);
  59. return self;}
  60. }),
  61. smalltalk.ArrayTest);
  62. smalltalk.addClass('AssociationTest', smalltalk.TestCase, [], 'Kernel-Tests');
  63. smalltalk.addMethod(
  64. "_testClassCreation",
  65. smalltalk.method({
  66. selector: "testClassCreation",
  67. fn: function (){
  68. var self=this;
  69. var anAssociation=nil;
  70. var key=nil;
  71. var value=nil;
  72. (key="KEY_STRING");
  73. (value="VALUE_STRING");
  74. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", [key, value]));
  75. smalltalk.send(self, "_assert_equals_", [key, smalltalk.send(anAssociation, "_key", [])]);
  76. smalltalk.send(self, "_assert_equals_", [value, smalltalk.send(anAssociation, "_value", [])]);
  77. return self;}
  78. }),
  79. smalltalk.AssociationTest);
  80. smalltalk.addMethod(
  81. "_testEqualAssociations",
  82. smalltalk.method({
  83. selector: "testEqualAssociations",
  84. fn: function (){
  85. var self=this;
  86. var anAssociation=nil;
  87. var anotherAssociation=nil;
  88. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  89. (anotherAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  90. smalltalk.send(self, "_assert_equals_", [anAssociation, anotherAssociation]);
  91. return self;}
  92. }),
  93. smalltalk.AssociationTest);
  94. smalltalk.addMethod(
  95. "_testKeyAccess",
  96. smalltalk.method({
  97. selector: "testKeyAccess",
  98. fn: function (){
  99. var self=this;
  100. var anAssociation=nil;
  101. var key=nil;
  102. (key="KEY_STRING");
  103. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_new", []));
  104. smalltalk.send(anAssociation, "_key_", [key]);
  105. smalltalk.send(self, "_assert_equals_", [key, smalltalk.send(anAssociation, "_key", [])]);
  106. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_value", [])]);
  107. return self;}
  108. }),
  109. smalltalk.AssociationTest);
  110. smalltalk.addMethod(
  111. "_testNotEqualAssociations",
  112. smalltalk.method({
  113. selector: "testNotEqualAssociations",
  114. fn: function (){
  115. var self=this;
  116. var anAssociation=nil;
  117. var anotherAssociation=nil;
  118. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  119. (anotherAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY2", "VALUE2"]));
  120. smalltalk.send(self, "_deny_", [smalltalk.send(anAssociation, "__eq", [anotherAssociation])]);
  121. return self;}
  122. }),
  123. smalltalk.AssociationTest);
  124. smalltalk.addMethod(
  125. "_testPrintString",
  126. smalltalk.method({
  127. selector: "testPrintString",
  128. fn: function (){
  129. var self=this;
  130. var anAssociation=nil;
  131. var returnString=nil;
  132. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_key_value_", ["KEY", "VALUE"]));
  133. (returnString=smalltalk.send(anAssociation, "_printString", []));
  134. smalltalk.send(self, "_assert_equals_", ["'KEY'->'VALUE'", returnString]);
  135. return self;}
  136. }),
  137. smalltalk.AssociationTest);
  138. smalltalk.addMethod(
  139. "_testUninitializedObject",
  140. smalltalk.method({
  141. selector: "testUninitializedObject",
  142. fn: function (){
  143. var self=this;
  144. var anAssociation=nil;
  145. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_new", []));
  146. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_key", [])]);
  147. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_value", [])]);
  148. return self;}
  149. }),
  150. smalltalk.AssociationTest);
  151. smalltalk.addMethod(
  152. "_testValueAccess",
  153. smalltalk.method({
  154. selector: "testValueAccess",
  155. fn: function (){
  156. var self=this;
  157. var anAssociation=nil;
  158. var value=nil;
  159. (value="VALUE_STRING");
  160. (anAssociation=smalltalk.send((smalltalk.Association || Association), "_new", []));
  161. smalltalk.send(anAssociation, "_value_", [value]);
  162. smalltalk.send(self, "_assert_equals_", [nil, smalltalk.send(anAssociation, "_key", [])]);
  163. smalltalk.send(self, "_assert_equals_", [value, smalltalk.send(anAssociation, "_value", [])]);
  164. return self;}
  165. }),
  166. smalltalk.AssociationTest);
  167. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  168. smalltalk.addMethod(
  169. "_testCompiledSource",
  170. smalltalk.method({
  171. selector: "testCompiledSource",
  172. fn: function (){
  173. var self=this;
  174. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
  175. return self;}
  176. }),
  177. smalltalk.BlockClosureTest);
  178. smalltalk.addMethod(
  179. "_testEnsure",
  180. smalltalk.method({
  181. selector: "testEnsure",
  182. fn: function (){
  183. var self=this;
  184. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  185. return self;}
  186. }),
  187. smalltalk.BlockClosureTest);
  188. smalltalk.addMethod(
  189. "_testNumArgs",
  190. smalltalk.method({
  191. selector: "testNumArgs",
  192. fn: function (){
  193. var self=this;
  194. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  195. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  196. return self;}
  197. }),
  198. smalltalk.BlockClosureTest);
  199. smalltalk.addMethod(
  200. "_testOnDo",
  201. smalltalk.method({
  202. selector: "testOnDo",
  203. fn: function (){
  204. var self=this;
  205. 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;})])]);
  206. return self;}
  207. }),
  208. smalltalk.BlockClosureTest);
  209. smalltalk.addMethod(
  210. "_testValue",
  211. smalltalk.method({
  212. selector: "testValue",
  213. fn: function (){
  214. var self=this;
  215. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  216. 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)]);
  217. 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)]);
  218. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  219. return self;}
  220. }),
  221. smalltalk.BlockClosureTest);
  222. smalltalk.addMethod(
  223. "_testValueWithPossibleArguments",
  224. smalltalk.method({
  225. selector: "testValueWithPossibleArguments",
  226. fn: function (){
  227. var self=this;
  228. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  229. 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)]);
  230. 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)]);
  231. return self;}
  232. }),
  233. smalltalk.BlockClosureTest);
  234. smalltalk.addMethod(
  235. "_testWhileFalse",
  236. smalltalk.method({
  237. selector: "testWhileFalse",
  238. fn: function (){
  239. var self=this;
  240. var i=nil;
  241. (i=(0));
  242. (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)])));})()}})();
  243. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  244. (i=(0));
  245. (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)]));})()) {}})();
  246. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  247. return self;}
  248. }),
  249. smalltalk.BlockClosureTest);
  250. smalltalk.addMethod(
  251. "_testWhileTrue",
  252. smalltalk.method({
  253. selector: "testWhileTrue",
  254. fn: function (){
  255. var self=this;
  256. var i=nil;
  257. (i=(0));
  258. (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)])));})()}})();
  259. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  260. (i=(0));
  261. (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)]));})()) {}})();
  262. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  263. return self;}
  264. }),
  265. smalltalk.BlockClosureTest);
  266. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  267. smalltalk.addMethod(
  268. "_testEquality",
  269. smalltalk.method({
  270. selector: "testEquality",
  271. fn: function (){
  272. var self=this;
  273. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  274. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  275. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  276. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  277. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  278. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  279. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  280. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  281. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  283. return self;}
  284. }),
  285. smalltalk.BooleanTest);
  286. smalltalk.addMethod(
  287. "_testIdentity",
  288. smalltalk.method({
  289. selector: "testIdentity",
  290. fn: function (){
  291. var self=this;
  292. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq_eq", [false])]);
  293. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [(0)])]);
  294. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
  295. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
  296. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  297. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
  298. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  299. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
  300. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  301. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  302. return self;}
  303. }),
  304. smalltalk.BooleanTest);
  305. smalltalk.addMethod(
  306. "_testIfTrueIfFalse",
  307. smalltalk.method({
  308. selector: "testIfTrueIfFalse",
  309. fn: function (){
  310. var self=this;
  311. 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"])]);
  312. 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])]);
  313. 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])]);
  314. 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"])]);
  315. 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"])]);
  316. 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"])]);
  317. 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"])]);
  318. 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"])]);
  319. return self;}
  320. }),
  321. smalltalk.BooleanTest);
  322. smalltalk.addMethod(
  323. "_testLogic",
  324. smalltalk.method({
  325. selector: "testLogic",
  326. fn: function (){
  327. var self=this;
  328. (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);
  329. (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);
  330. (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);
  331. (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);
  332. return self;}
  333. }),
  334. smalltalk.BooleanTest);
  335. smalltalk.addMethod(
  336. "_testLogicKeywords",
  337. smalltalk.method({
  338. selector: "testLogicKeywords",
  339. fn: function (){
  340. var self=this;
  341. (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);
  342. (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);
  343. (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);
  344. (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);
  345. return self;}
  346. }),
  347. smalltalk.BooleanTest);
  348. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  349. smalltalk.addMethod(
  350. "_setUp",
  351. smalltalk.method({
  352. selector: "setUp",
  353. fn: function (){
  354. var self=this;
  355. (self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []));
  356. return self;}
  357. }),
  358. smalltalk.ClassBuilderTest);
  359. smalltalk.addMethod(
  360. "_tearDown",
  361. smalltalk.method({
  362. selector: "tearDown",
  363. fn: function (){
  364. var self=this;
  365. (($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return (self['@theClass']=nil);})() : nil;
  366. return self;}
  367. }),
  368. smalltalk.ClassBuilderTest);
  369. smalltalk.addMethod(
  370. "_testClassCopy",
  371. smalltalk.method({
  372. selector: "testClassCopy",
  373. fn: function (){
  374. var self=this;
  375. (self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]));
  376. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
  377. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
  378. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  379. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
  380. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
  381. return self;}
  382. }),
  383. smalltalk.ClassBuilderTest);
  384. smalltalk.addMethod(
  385. "_testInstanceVariableNames",
  386. smalltalk.method({
  387. selector: "testInstanceVariableNames",
  388. fn: function (){
  389. var self=this;
  390. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  391. return self;}
  392. }),
  393. smalltalk.ClassBuilderTest);
  394. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  395. smalltalk.addMethod(
  396. "_testAccessing",
  397. smalltalk.method({
  398. selector: "testAccessing",
  399. fn: function (){
  400. var self=this;
  401. var d=nil;
  402. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  403. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  404. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  405. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  406. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  407. smalltalk.send(d, "_at_put_", [(1), (2)]);
  408. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  409. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  410. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  411. return self;}
  412. }),
  413. smalltalk.DictionaryTest);
  414. smalltalk.addMethod(
  415. "_testDynamicDictionaries",
  416. smalltalk.method({
  417. selector: "testDynamicDictionaries",
  418. fn: function (){
  419. var self=this;
  420. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [(1)])]), "_asDictionary", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_", [smalltalk.send("hello", "__minus_gt", [(1)])])])]);
  421. return self;}
  422. }),
  423. smalltalk.DictionaryTest);
  424. smalltalk.addMethod(
  425. "_testEquality",
  426. smalltalk.method({
  427. selector: "testEquality",
  428. fn: function (){
  429. var self=this;
  430. var d1=nil;
  431. var d2=nil;
  432. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  433. (d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  434. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  435. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  436. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  437. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  438. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  439. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  440. (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", [])));
  441. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  442. return self;}
  443. }),
  444. smalltalk.DictionaryTest);
  445. smalltalk.addMethod(
  446. "_testIfAbsent",
  447. smalltalk.method({
  448. selector: "testIfAbsent",
  449. fn: function (){
  450. var self=this;
  451. var d=nil;
  452. var visited=nil;
  453. (visited=false);
  454. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  455. smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return (visited=true);})]);
  456. smalltalk.send(self, "_assert_", [visited]);
  457. return self;}
  458. }),
  459. smalltalk.DictionaryTest);
  460. smalltalk.addMethod(
  461. "_testIfPresent",
  462. smalltalk.method({
  463. selector: "testIfPresent",
  464. fn: function (){
  465. var self=this;
  466. var d=nil;
  467. var visited=nil;
  468. var absent=nil;
  469. (visited=false);
  470. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  471. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  472. smalltalk.send(d, "_at_ifPresent_", ["hello", (function(value){return (visited=value);})]);
  473. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  474. (absent=smalltalk.send(d, "_at_ifPresent_", ["bye", (function(value){return (visited=value);})]));
  475. smalltalk.send(self, "_assert_", [smalltalk.send(absent, "_isNil", [])]);
  476. return self;}
  477. }),
  478. smalltalk.DictionaryTest);
  479. smalltalk.addMethod(
  480. "_testIfPresentIfAbsent",
  481. smalltalk.method({
  482. selector: "testIfPresentIfAbsent",
  483. fn: function (){
  484. var self=this;
  485. var d=nil;
  486. var visited=nil;
  487. (visited=false);
  488. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  489. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  490. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["hello", (function(value){return (visited=value);}), (function(){return (visited=true);})]);
  491. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  492. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["buy", (function(value){return (visited=value);}), (function(){return (visited=true);})]);
  493. smalltalk.send(self, "_assert_", [visited]);
  494. return self;}
  495. }),
  496. smalltalk.DictionaryTest);
  497. smalltalk.addMethod(
  498. "_testKeys",
  499. smalltalk.method({
  500. selector: "testKeys",
  501. fn: function (){
  502. var self=this;
  503. var d=nil;
  504. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  505. smalltalk.send(d, "_at_put_", [(1), (2)]);
  506. smalltalk.send(d, "_at_put_", [(2), (3)]);
  507. smalltalk.send(d, "_at_put_", [(3), (4)]);
  508. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  509. return self;}
  510. }),
  511. smalltalk.DictionaryTest);
  512. smalltalk.addMethod(
  513. "_testPrintString",
  514. smalltalk.method({
  515. selector: "testPrintString",
  516. fn: function (){
  517. var self=this;
  518. smalltalk.send(self, "_assert_equals_", ["a Dictionary('firstname' -> 'James' , 'lastname' -> 'Bond')", (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", []))]);
  519. return self;}
  520. }),
  521. smalltalk.DictionaryTest);
  522. smalltalk.addMethod(
  523. "_testRemoveKey",
  524. smalltalk.method({
  525. selector: "testRemoveKey",
  526. fn: function (){
  527. var self=this;
  528. var d=nil;
  529. var key=nil;
  530. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  531. smalltalk.send(d, "_at_put_", [(1), (2)]);
  532. smalltalk.send(d, "_at_put_", [(2), (3)]);
  533. smalltalk.send(d, "_at_put_", [(3), (4)]);
  534. (key=(2));
  535. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  536. smalltalk.send(d, "_removeKey_", [key]);
  537. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (3)]])]);
  538. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (4)]])]);
  539. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [(2)])]);
  540. return self;}
  541. }),
  542. smalltalk.DictionaryTest);
  543. smalltalk.addMethod(
  544. "_testRemoveKeyIfAbsent",
  545. smalltalk.method({
  546. selector: "testRemoveKeyIfAbsent",
  547. fn: function (){
  548. var self=this;
  549. var d=nil;
  550. var key=nil;
  551. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  552. smalltalk.send(d, "_at_put_", [(1), (2)]);
  553. smalltalk.send(d, "_at_put_", [(2), (3)]);
  554. smalltalk.send(d, "_at_put_", [(3), (4)]);
  555. (key=(2));
  556. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [(3)])]);
  557. (key=(3));
  558. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(4)])]);
  559. (key="why");
  560. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(42)])]);
  561. return self;}
  562. }),
  563. smalltalk.DictionaryTest);
  564. smalltalk.addMethod(
  565. "_testSize",
  566. smalltalk.method({
  567. selector: "testSize",
  568. fn: function (){
  569. var self=this;
  570. var d=nil;
  571. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  572. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  573. smalltalk.send(d, "_at_put_", [(1), (2)]);
  574. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  575. smalltalk.send(d, "_at_put_", [(2), (3)]);
  576. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  577. return self;}
  578. }),
  579. smalltalk.DictionaryTest);
  580. smalltalk.addMethod(
  581. "_testValues",
  582. smalltalk.method({
  583. selector: "testValues",
  584. fn: function (){
  585. var self=this;
  586. var d=nil;
  587. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  588. smalltalk.send(d, "_at_put_", [(1), (2)]);
  589. smalltalk.send(d, "_at_put_", [(2), (3)]);
  590. smalltalk.send(d, "_at_put_", [(3), (4)]);
  591. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  592. return self;}
  593. }),
  594. smalltalk.DictionaryTest);
  595. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  596. smalltalk.addMethod(
  597. "_jsObject",
  598. smalltalk.method({
  599. selector: "jsObject",
  600. fn: function (){
  601. var self=this;
  602. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  603. return self;}
  604. }),
  605. smalltalk.JSObjectProxyTest);
  606. smalltalk.addMethod(
  607. "_testDNU",
  608. smalltalk.method({
  609. selector: "testDNU",
  610. fn: function (){
  611. var self=this;
  612. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  613. return self;}
  614. }),
  615. smalltalk.JSObjectProxyTest);
  616. smalltalk.addMethod(
  617. "_testMessageSend",
  618. smalltalk.method({
  619. selector: "testMessageSend",
  620. fn: function (){
  621. var self=this;
  622. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  623. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  624. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  625. return self;}
  626. }),
  627. smalltalk.JSObjectProxyTest);
  628. smalltalk.addMethod(
  629. "_testMethodWithArguments",
  630. smalltalk.method({
  631. selector: "testMethodWithArguments",
  632. fn: function (){
  633. var self=this;
  634. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  635. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  636. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  637. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  638. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  639. return self;}
  640. }),
  641. smalltalk.JSObjectProxyTest);
  642. smalltalk.addMethod(
  643. "_testPrinting",
  644. smalltalk.method({
  645. selector: "testPrinting",
  646. fn: function (){
  647. var self=this;
  648. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  649. return self;}
  650. }),
  651. smalltalk.JSObjectProxyTest);
  652. smalltalk.addMethod(
  653. "_testPropertyThatReturnsEmptyString",
  654. smalltalk.method({
  655. selector: "testPropertyThatReturnsEmptyString",
  656. fn: function (){
  657. var self=this;
  658. document.location.hash = '';
  659. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  660. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  661. smalltalk.send(self, "_assert_equals_", ["#test", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  662. return self;}
  663. }),
  664. smalltalk.JSObjectProxyTest);
  665. smalltalk.addMethod(
  666. "_testYourself",
  667. smalltalk.method({
  668. selector: "testYourself",
  669. fn: function (){
  670. var self=this;
  671. var body=nil;
  672. (body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
  673. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  674. smalltalk.send(body, "_removeClass_", ["amber"]);
  675. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  676. return self;}
  677. }),
  678. smalltalk.JSObjectProxyTest);
  679. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  680. smalltalk.addMethod(
  681. "_testArithmetic",
  682. smalltalk.method({
  683. selector: "testArithmetic",
  684. fn: function (){
  685. var self=this;
  686. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  687. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  688. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  689. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  690. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  691. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  692. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  693. return self;}
  694. }),
  695. smalltalk.NumberTest);
  696. smalltalk.addMethod(
  697. "_testComparison",
  698. smalltalk.method({
  699. selector: "testComparison",
  700. fn: function (){
  701. var self=this;
  702. smalltalk.send(self, "_assert_", [(3) > (2)]);
  703. smalltalk.send(self, "_assert_", [(2) < (3)]);
  704. smalltalk.send(self, "_deny_", [(3) < (2)]);
  705. smalltalk.send(self, "_deny_", [(2) > (3)]);
  706. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  707. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  708. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  709. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  710. return self;}
  711. }),
  712. smalltalk.NumberTest);
  713. smalltalk.addMethod(
  714. "_testCopying",
  715. smalltalk.method({
  716. selector: "testCopying",
  717. fn: function (){
  718. var self=this;
  719. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  720. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  721. return self;}
  722. }),
  723. smalltalk.NumberTest);
  724. smalltalk.addMethod(
  725. "_testEquality",
  726. smalltalk.method({
  727. selector: "testEquality",
  728. fn: function (){
  729. var self=this;
  730. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  731. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  732. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  733. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  734. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  735. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  736. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  737. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  738. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  739. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  740. return self;}
  741. }),
  742. smalltalk.NumberTest);
  743. smalltalk.addMethod(
  744. "_testIdentity",
  745. smalltalk.method({
  746. selector: "testIdentity",
  747. fn: function (){
  748. var self=this;
  749. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  750. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  751. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  752. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  753. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  754. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  755. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  756. return self;}
  757. }),
  758. smalltalk.NumberTest);
  759. smalltalk.addMethod(
  760. "_testMinMax",
  761. smalltalk.method({
  762. selector: "testMinMax",
  763. fn: function (){
  764. var self=this;
  765. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  766. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  767. return self;}
  768. }),
  769. smalltalk.NumberTest);
  770. smalltalk.addMethod(
  771. "_testNegated",
  772. smalltalk.method({
  773. selector: "testNegated",
  774. fn: function (){
  775. var self=this;
  776. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  777. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  778. return self;}
  779. }),
  780. smalltalk.NumberTest);
  781. smalltalk.addMethod(
  782. "_testPrintShowingDecimalPlaces",
  783. smalltalk.method({
  784. selector: "testPrintShowingDecimalPlaces",
  785. fn: function (){
  786. var self=this;
  787. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  788. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  789. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  790. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  791. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  792. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  793. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  794. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  795. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  796. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  797. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  798. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  799. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  800. return self;}
  801. }),
  802. smalltalk.NumberTest);
  803. smalltalk.addMethod(
  804. "_testRounded",
  805. smalltalk.method({
  806. selector: "testRounded",
  807. fn: function (){
  808. var self=this;
  809. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  810. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  811. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  812. return self;}
  813. }),
  814. smalltalk.NumberTest);
  815. smalltalk.addMethod(
  816. "_testSqrt",
  817. smalltalk.method({
  818. selector: "testSqrt",
  819. fn: function (){
  820. var self=this;
  821. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  822. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  823. return self;}
  824. }),
  825. smalltalk.NumberTest);
  826. smalltalk.addMethod(
  827. "_testSquared",
  828. smalltalk.method({
  829. selector: "testSquared",
  830. fn: function (){
  831. var self=this;
  832. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  833. return self;}
  834. }),
  835. smalltalk.NumberTest);
  836. smalltalk.addMethod(
  837. "_testTimesRepeat",
  838. smalltalk.method({
  839. selector: "testTimesRepeat",
  840. fn: function (){
  841. var self=this;
  842. var i=nil;
  843. (i=(0));
  844. smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  845. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  846. smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  847. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  848. return self;}
  849. }),
  850. smalltalk.NumberTest);
  851. smalltalk.addMethod(
  852. "_testTo",
  853. smalltalk.method({
  854. selector: "testTo",
  855. fn: function (){
  856. var self=this;
  857. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  858. return self;}
  859. }),
  860. smalltalk.NumberTest);
  861. smalltalk.addMethod(
  862. "_testToBy",
  863. smalltalk.method({
  864. selector: "testToBy",
  865. fn: function (){
  866. var self=this;
  867. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  868. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  869. return self;}
  870. }),
  871. smalltalk.NumberTest);
  872. smalltalk.addMethod(
  873. "_testTruncated",
  874. smalltalk.method({
  875. selector: "testTruncated",
  876. fn: function (){
  877. var self=this;
  878. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  879. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  880. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  881. return self;}
  882. }),
  883. smalltalk.NumberTest);
  884. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  885. smalltalk.addMethod(
  886. "_foo",
  887. smalltalk.method({
  888. selector: "foo",
  889. fn: function (){
  890. var self=this;
  891. return self['@foo'];
  892. return self;}
  893. }),
  894. smalltalk.ObjectMock);
  895. smalltalk.addMethod(
  896. "_foo_",
  897. smalltalk.method({
  898. selector: "foo:",
  899. fn: function (anObject){
  900. var self=this;
  901. (self['@foo']=anObject);
  902. return self;}
  903. }),
  904. smalltalk.ObjectMock);
  905. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  906. smalltalk.addMethod(
  907. "_testBasicAccess",
  908. smalltalk.method({
  909. selector: "testBasicAccess",
  910. fn: function (){
  911. var self=this;
  912. var o=nil;
  913. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  914. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  915. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  916. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  917. return self;}
  918. }),
  919. smalltalk.ObjectTest);
  920. smalltalk.addMethod(
  921. "_testBasicPerform",
  922. smalltalk.method({
  923. selector: "testBasicPerform",
  924. fn: function (){
  925. var self=this;
  926. var o=nil;
  927. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  928. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  929. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  930. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  931. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  932. return self;}
  933. }),
  934. smalltalk.ObjectTest);
  935. smalltalk.addMethod(
  936. "_testDNU",
  937. smalltalk.method({
  938. selector: "testDNU",
  939. fn: function (){
  940. var self=this;
  941. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  942. return self;}
  943. }),
  944. smalltalk.ObjectTest);
  945. smalltalk.addMethod(
  946. "_testEquality",
  947. smalltalk.method({
  948. selector: "testEquality",
  949. fn: function (){
  950. var self=this;
  951. var o=nil;
  952. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  953. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  954. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  955. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  956. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  957. return self;}
  958. }),
  959. smalltalk.ObjectTest);
  960. smalltalk.addMethod(
  961. "_testHalt",
  962. smalltalk.method({
  963. selector: "testHalt",
  964. fn: function (){
  965. var self=this;
  966. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  967. return self;}
  968. }),
  969. smalltalk.ObjectTest);
  970. smalltalk.addMethod(
  971. "_testIdentity",
  972. smalltalk.method({
  973. selector: "testIdentity",
  974. fn: function (){
  975. var self=this;
  976. var o=nil;
  977. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  978. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  979. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  980. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  981. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  982. return self;}
  983. }),
  984. smalltalk.ObjectTest);
  985. smalltalk.addMethod(
  986. "_testIfNil",
  987. smalltalk.method({
  988. selector: "testIfNil",
  989. fn: function (){
  990. var self=this;
  991. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  992. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  993. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  994. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  995. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  996. return self;}
  997. }),
  998. smalltalk.ObjectTest);
  999. smalltalk.addMethod(
  1000. "_testInstVars",
  1001. smalltalk.method({
  1002. selector: "testInstVars",
  1003. fn: function (){
  1004. var self=this;
  1005. var o=nil;
  1006. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1007. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  1008. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  1009. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  1010. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  1011. return self;}
  1012. }),
  1013. smalltalk.ObjectTest);
  1014. smalltalk.addMethod(
  1015. "_testNilUndefined",
  1016. smalltalk.method({
  1017. selector: "testNilUndefined",
  1018. fn: function (){
  1019. var self=this;
  1020. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  1021. return self;}
  1022. }),
  1023. smalltalk.ObjectTest);
  1024. smalltalk.addMethod(
  1025. "_testYourself",
  1026. smalltalk.method({
  1027. selector: "testYourself",
  1028. fn: function (){
  1029. var self=this;
  1030. var o=nil;
  1031. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1032. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1033. return self;}
  1034. }),
  1035. smalltalk.ObjectTest);
  1036. smalltalk.addMethod(
  1037. "_testidentityHash",
  1038. smalltalk.method({
  1039. selector: "testidentityHash",
  1040. fn: function (){
  1041. var self=this;
  1042. var o1=nil;
  1043. var o2=nil;
  1044. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1045. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1046. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1047. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1048. return self;}
  1049. }),
  1050. smalltalk.ObjectTest);
  1051. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1052. smalltalk.addMethod(
  1053. "_setUp",
  1054. smalltalk.method({
  1055. selector: "setUp",
  1056. fn: function (){
  1057. var self=this;
  1058. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  1059. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  1060. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  1061. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  1062. (self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", ["server/grul/js"]);smalltalk.send($rec, "_commitPathSt_", ["grul/st"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", [])));
  1063. return self;}
  1064. }),
  1065. smalltalk.PackageTest);
  1066. smalltalk.addMethod(
  1067. "_tearDown",
  1068. smalltalk.method({
  1069. selector: "tearDown",
  1070. fn: function (){
  1071. var self=this;
  1072. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  1073. return self;}
  1074. }),
  1075. smalltalk.PackageTest);
  1076. smalltalk.addMethod(
  1077. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1078. smalltalk.method({
  1079. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1080. fn: function (){
  1081. var self=this;
  1082. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1083. return self;}
  1084. }),
  1085. smalltalk.PackageTest);
  1086. smalltalk.addMethod(
  1087. "_testGrulCommitPathStShouldBeGrulSt",
  1088. smalltalk.method({
  1089. selector: "testGrulCommitPathStShouldBeGrulSt",
  1090. fn: function (){
  1091. var self=this;
  1092. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1093. return self;}
  1094. }),
  1095. smalltalk.PackageTest);
  1096. smalltalk.addMethod(
  1097. "_testZorkCommitPathJsShouldBeJs",
  1098. smalltalk.method({
  1099. selector: "testZorkCommitPathJsShouldBeJs",
  1100. fn: function (){
  1101. var self=this;
  1102. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1103. return self;}
  1104. }),
  1105. smalltalk.PackageTest);
  1106. smalltalk.addMethod(
  1107. "_testZorkCommitPathStShouldBeSt",
  1108. smalltalk.method({
  1109. selector: "testZorkCommitPathStShouldBeSt",
  1110. fn: function (){
  1111. var self=this;
  1112. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1113. return self;}
  1114. }),
  1115. smalltalk.PackageTest);
  1116. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  1117. smalltalk.addMethod(
  1118. "_setUp",
  1119. smalltalk.method({
  1120. selector: "setUp",
  1121. fn: function (){
  1122. var self=this;
  1123. smalltalk.send(self, "_setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest.superclass || nil);
  1124. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", ["javascripts/"]);return smalltalk.send($rec, "_defaultCommitPathSt_", ["smalltalk/"]);})((smalltalk.Package || Package));
  1125. return self;}
  1126. }),
  1127. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1128. smalltalk.addMethod(
  1129. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1130. smalltalk.method({
  1131. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1132. fn: function (){
  1133. var self=this;
  1134. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1135. return self;}
  1136. }),
  1137. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1138. smalltalk.addMethod(
  1139. "_testGrulCommitPathStShouldBeGrulSt",
  1140. smalltalk.method({
  1141. selector: "testGrulCommitPathStShouldBeGrulSt",
  1142. fn: function (){
  1143. var self=this;
  1144. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1145. return self;}
  1146. }),
  1147. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1148. smalltalk.addMethod(
  1149. "_testZorkCommitPathJsShouldBeJavascript",
  1150. smalltalk.method({
  1151. selector: "testZorkCommitPathJsShouldBeJavascript",
  1152. fn: function (){
  1153. var self=this;
  1154. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1155. return self;}
  1156. }),
  1157. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1158. smalltalk.addMethod(
  1159. "_testZorkCommitPathStShouldBeSmalltalk",
  1160. smalltalk.method({
  1161. selector: "testZorkCommitPathStShouldBeSmalltalk",
  1162. fn: function (){
  1163. var self=this;
  1164. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1165. return self;}
  1166. }),
  1167. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1168. smalltalk.addMethod(
  1169. "_shouldInheritSelectors",
  1170. smalltalk.method({
  1171. selector: "shouldInheritSelectors",
  1172. fn: function (){
  1173. var self=this;
  1174. return false;
  1175. return self;}
  1176. }),
  1177. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  1178. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1179. smalltalk.addMethod(
  1180. "_testAccessing",
  1181. smalltalk.method({
  1182. selector: "testAccessing",
  1183. fn: function (){
  1184. var self=this;
  1185. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1186. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1187. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1188. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1189. return self;}
  1190. }),
  1191. smalltalk.PointTest);
  1192. smalltalk.addMethod(
  1193. "_testArithmetic",
  1194. smalltalk.method({
  1195. selector: "testArithmetic",
  1196. fn: function (){
  1197. var self=this;
  1198. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__star", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(9), (16)])]);
  1199. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver +smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(6), (8)])]);
  1200. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver -smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__minus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(0), (0)])]);
  1201. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((6), "__at", [(8)])).klass === smalltalk.Number) ? $receiver /smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__slash", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(2), (2)])]);
  1202. return self;}
  1203. }),
  1204. smalltalk.PointTest);
  1205. smalltalk.addMethod(
  1206. "_testAt",
  1207. smalltalk.method({
  1208. selector: "testAt",
  1209. fn: function (){
  1210. var self=this;
  1211. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1212. return self;}
  1213. }),
  1214. smalltalk.PointTest);
  1215. smalltalk.addMethod(
  1216. "_testEgality",
  1217. smalltalk.method({
  1218. selector: "testEgality",
  1219. fn: function (){
  1220. var self=this;
  1221. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1222. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1223. return self;}
  1224. }),
  1225. smalltalk.PointTest);
  1226. smalltalk.addMethod(
  1227. "_testTranslateBy",
  1228. smalltalk.method({
  1229. selector: "testTranslateBy",
  1230. fn: function (){
  1231. var self=this;
  1232. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1233. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(2)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [smalltalk.send((1), "_negated", [])])])]);
  1234. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1235. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "__at", [(3)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__at", [(0)])])]);
  1236. return self;}
  1237. }),
  1238. smalltalk.PointTest);
  1239. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1240. smalltalk.addMethod(
  1241. "_textNext",
  1242. smalltalk.method({
  1243. selector: "textNext",
  1244. fn: function (){
  1245. var self=this;
  1246. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1247. var next=nil;
  1248. (next=smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", []));smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver >=(0) : smalltalk.send($receiver, "__gt_eq", [(0)]))]);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver <(1) : smalltalk.send($receiver, "__lt", [(1)]))]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);})]);
  1249. return self;}
  1250. }),
  1251. smalltalk.RandomTest);
  1252. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1253. smalltalk.addMethod(
  1254. "_testAddRemove",
  1255. smalltalk.method({
  1256. selector: "testAddRemove",
  1257. fn: function (){
  1258. var self=this;
  1259. var set=nil;
  1260. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1261. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1262. smalltalk.send(set, "_add_", [(3)]);
  1263. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1264. smalltalk.send(set, "_add_", [(5)]);
  1265. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1266. smalltalk.send(set, "_remove_", [(3)]);
  1267. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1268. return self;}
  1269. }),
  1270. smalltalk.SetTest);
  1271. smalltalk.addMethod(
  1272. "_testAt",
  1273. smalltalk.method({
  1274. selector: "testAt",
  1275. fn: function (){
  1276. var self=this;
  1277. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1278. return self;}
  1279. }),
  1280. smalltalk.SetTest);
  1281. smalltalk.addMethod(
  1282. "_testPrintString",
  1283. smalltalk.method({
  1284. selector: "testPrintString",
  1285. fn: function (){
  1286. var self=this;
  1287. var set=nil;
  1288. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1289. smalltalk.send(self, "_assert_equals_", ["a Set ()", smalltalk.send(set, "_printString", [])]);
  1290. (function($rec){smalltalk.send($rec, "_add_", [(1)]);return smalltalk.send($rec, "_add_", [(3)]);})(set);
  1291. smalltalk.send(self, "_assert_equals_", ["a Set (1 3)", smalltalk.send(set, "_printString", [])]);
  1292. smalltalk.send(set, "_add_", ["foo"]);
  1293. smalltalk.send(self, "_assert_equals_", ["a Set (1 3 'foo')", smalltalk.send(set, "_printString", [])]);
  1294. (function($rec){smalltalk.send($rec, "_remove_", [(1)]);return smalltalk.send($rec, "_remove_", [(3)]);})(set);
  1295. smalltalk.send(self, "_assert_equals_", ["a Set ('foo')", smalltalk.send(set, "_printString", [])]);
  1296. smalltalk.send(set, "_add_", [(3)]);
  1297. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  1298. smalltalk.send(set, "_add_", [(3)]);
  1299. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  1300. return self;}
  1301. }),
  1302. smalltalk.SetTest);
  1303. smalltalk.addMethod(
  1304. "_testSize",
  1305. smalltalk.method({
  1306. selector: "testSize",
  1307. fn: function (){
  1308. var self=this;
  1309. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1310. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1311. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1312. return self;}
  1313. }),
  1314. smalltalk.SetTest);
  1315. smalltalk.addMethod(
  1316. "_testUnicity",
  1317. smalltalk.method({
  1318. selector: "testUnicity",
  1319. fn: function (){
  1320. var self=this;
  1321. var set=nil;
  1322. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1323. smalltalk.send(set, "_add_", [(21)]);
  1324. smalltalk.send(set, "_add_", ["hello"]);
  1325. smalltalk.send(set, "_add_", [(21)]);
  1326. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1327. smalltalk.send(set, "_add_", ["hello"]);
  1328. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1329. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1330. return self;}
  1331. }),
  1332. smalltalk.SetTest);
  1333. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1334. smalltalk.addMethod(
  1335. "_testAddRemove",
  1336. smalltalk.method({
  1337. selector: "testAddRemove",
  1338. fn: function (){
  1339. var self=this;
  1340. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1341. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1342. return self;}
  1343. }),
  1344. smalltalk.StringTest);
  1345. smalltalk.addMethod(
  1346. "_testAsArray",
  1347. smalltalk.method({
  1348. selector: "testAsArray",
  1349. fn: function (){
  1350. var self=this;
  1351. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1352. return self;}
  1353. }),
  1354. smalltalk.StringTest);
  1355. smalltalk.addMethod(
  1356. "_testAt",
  1357. smalltalk.method({
  1358. selector: "testAt",
  1359. fn: function (){
  1360. var self=this;
  1361. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1362. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1363. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1364. return self;}
  1365. }),
  1366. smalltalk.StringTest);
  1367. smalltalk.addMethod(
  1368. "_testAtPut",
  1369. smalltalk.method({
  1370. selector: "testAtPut",
  1371. fn: function (){
  1372. var self=this;
  1373. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1374. return self;}
  1375. }),
  1376. smalltalk.StringTest);
  1377. smalltalk.addMethod(
  1378. "_testCopyWithoutAll",
  1379. smalltalk.method({
  1380. selector: "testCopyWithoutAll",
  1381. fn: function (){
  1382. var self=this;
  1383. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1384. return self;}
  1385. }),
  1386. smalltalk.StringTest);
  1387. smalltalk.addMethod(
  1388. "_testEquality",
  1389. smalltalk.method({
  1390. selector: "testEquality",
  1391. fn: function (){
  1392. var self=this;
  1393. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1394. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1395. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1396. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1397. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1398. return self;}
  1399. }),
  1400. smalltalk.StringTest);
  1401. smalltalk.addMethod(
  1402. "_testIdentity",
  1403. smalltalk.method({
  1404. selector: "testIdentity",
  1405. fn: function (){
  1406. var self=this;
  1407. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1408. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1409. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1410. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1411. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
  1412. return self;}
  1413. }),
  1414. smalltalk.StringTest);
  1415. smalltalk.addMethod(
  1416. "_testIncludesSubString",
  1417. smalltalk.method({
  1418. selector: "testIncludesSubString",
  1419. fn: function (){
  1420. var self=this;
  1421. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1422. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1423. return self;}
  1424. }),
  1425. smalltalk.StringTest);
  1426. smalltalk.addMethod(
  1427. "_testJoin",
  1428. smalltalk.method({
  1429. selector: "testJoin",
  1430. fn: function (){
  1431. var self=this;
  1432. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1433. return self;}
  1434. }),
  1435. smalltalk.StringTest);
  1436. smalltalk.addMethod(
  1437. "_testPrintString",
  1438. smalltalk.method({
  1439. selector: "testPrintString",
  1440. fn: function (){
  1441. var self=this;
  1442. smalltalk.send(self, "_assert_equals_", ["'test_string'", smalltalk.send("test_string", "_printString", [])]);
  1443. return self;}
  1444. }),
  1445. smalltalk.StringTest);
  1446. smalltalk.addMethod(
  1447. "_testSize",
  1448. smalltalk.method({
  1449. selector: "testSize",
  1450. fn: function (){
  1451. var self=this;
  1452. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1453. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1454. return self;}
  1455. }),
  1456. smalltalk.StringTest);
  1457. smalltalk.addMethod(
  1458. "_testStreamContents",
  1459. smalltalk.method({
  1460. selector: "testStreamContents",
  1461. fn: function (){
  1462. var self=this;
  1463. 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);})])]);
  1464. return self;}
  1465. }),
  1466. smalltalk.StringTest);
  1467. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1468. smalltalk.addMethod(
  1469. "_testAsString",
  1470. smalltalk.method({
  1471. selector: "testAsString",
  1472. fn: function (){
  1473. var self=this;
  1474. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1475. return self;}
  1476. }),
  1477. smalltalk.SymbolTest);
  1478. smalltalk.addMethod(
  1479. "_testAsSymbol",
  1480. smalltalk.method({
  1481. selector: "testAsSymbol",
  1482. fn: function (){
  1483. var self=this;
  1484. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1485. return self;}
  1486. }),
  1487. smalltalk.SymbolTest);
  1488. smalltalk.addMethod(
  1489. "_testAt",
  1490. smalltalk.method({
  1491. selector: "testAt",
  1492. fn: function (){
  1493. var self=this;
  1494. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1495. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1496. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1497. return self;}
  1498. }),
  1499. smalltalk.SymbolTest);
  1500. smalltalk.addMethod(
  1501. "_testAtPut",
  1502. smalltalk.method({
  1503. selector: "testAtPut",
  1504. fn: function (){
  1505. var self=this;
  1506. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1507. return self;}
  1508. }),
  1509. smalltalk.SymbolTest);
  1510. smalltalk.addMethod(
  1511. "_testComparing",
  1512. smalltalk.method({
  1513. selector: "testComparing",
  1514. fn: function (){
  1515. var self=this;
  1516. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1517. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1518. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1519. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1520. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1521. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1522. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1523. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1524. return self;}
  1525. }),
  1526. smalltalk.SymbolTest);
  1527. smalltalk.addMethod(
  1528. "_testCopying",
  1529. smalltalk.method({
  1530. selector: "testCopying",
  1531. fn: function (){
  1532. var self=this;
  1533. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1534. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1535. return self;}
  1536. }),
  1537. smalltalk.SymbolTest);
  1538. smalltalk.addMethod(
  1539. "_testEquality",
  1540. smalltalk.method({
  1541. selector: "testEquality",
  1542. fn: function (){
  1543. var self=this;
  1544. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1545. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1546. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1547. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1548. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1549. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1550. return self;}
  1551. }),
  1552. smalltalk.SymbolTest);
  1553. smalltalk.addMethod(
  1554. "_testIdentity",
  1555. smalltalk.method({
  1556. selector: "testIdentity",
  1557. fn: function (){
  1558. var self=this;
  1559. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1560. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1561. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1562. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1563. return self;}
  1564. }),
  1565. smalltalk.SymbolTest);
  1566. smalltalk.addMethod(
  1567. "_testIsSymbolIsString",
  1568. smalltalk.method({
  1569. selector: "testIsSymbolIsString",
  1570. fn: function (){
  1571. var self=this;
  1572. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1573. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1574. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1575. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1576. return self;}
  1577. }),
  1578. smalltalk.SymbolTest);
  1579. smalltalk.addMethod(
  1580. "_testSize",
  1581. smalltalk.method({
  1582. selector: "testSize",
  1583. fn: function (){
  1584. var self=this;
  1585. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1586. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1587. return self;}
  1588. }),
  1589. smalltalk.SymbolTest);
  1590. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1591. smalltalk.addMethod(
  1592. "_testCopying",
  1593. smalltalk.method({
  1594. selector: "testCopying",
  1595. fn: function (){
  1596. var self=this;
  1597. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1598. return self;}
  1599. }),
  1600. smalltalk.UndefinedTest);
  1601. smalltalk.addMethod(
  1602. "_testDeepCopy",
  1603. smalltalk.method({
  1604. selector: "testDeepCopy",
  1605. fn: function (){
  1606. var self=this;
  1607. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1608. return self;}
  1609. }),
  1610. smalltalk.UndefinedTest);
  1611. smalltalk.addMethod(
  1612. "_testIfNil",
  1613. smalltalk.method({
  1614. selector: "testIfNil",
  1615. fn: function (){
  1616. var self=this;
  1617. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1618. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1619. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1620. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1621. return self;}
  1622. }),
  1623. smalltalk.UndefinedTest);
  1624. smalltalk.addMethod(
  1625. "_testIsNil",
  1626. smalltalk.method({
  1627. selector: "testIsNil",
  1628. fn: function (){
  1629. var self=this;
  1630. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1631. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1632. return self;}
  1633. }),
  1634. smalltalk.UndefinedTest);