Kernel-Tests.deploy.js 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCompiledSource",
  5. smalltalk.method({
  6. selector: "testCompiledSource",
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((function(){
  10. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  11. })}))._compiledSource())._includesSubString_("function"));
  12. return self}, self, "testCompiledSource", [], smalltalk.BlockClosureTest)}
  13. }),
  14. smalltalk.BlockClosureTest);
  15. smalltalk.addMethod(
  16. "_testEnsure",
  17. smalltalk.method({
  18. selector: "testEnsure",
  19. fn: function (){
  20. var self=this;
  21. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_((3),_st((function(){
  22. return smalltalk.withContext(function($ctx2) { return (3);
  23. })}))._ensure_((function(){
  24. return smalltalk.withContext(function($ctx2) { return (4);
  25. })})));
  26. return self}, self, "testEnsure", [], smalltalk.BlockClosureTest)}
  27. }),
  28. smalltalk.BlockClosureTest);
  29. smalltalk.addMethod(
  30. "_testEnsureRaises",
  31. smalltalk.method({
  32. selector: "testEnsureRaises",
  33. fn: function (){
  34. var self=this;
  35. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  36. return smalltalk.withContext(function($ctx2) { return _st((function(){
  37. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  38. })}))._ensure_((function(){
  39. return smalltalk.withContext(function($ctx3) { return true;
  40. })}));
  41. })}),(smalltalk.Error || Error));
  42. return self}, self, "testEnsureRaises", [], smalltalk.BlockClosureTest)}
  43. }),
  44. smalltalk.BlockClosureTest);
  45. smalltalk.addMethod(
  46. "_testNumArgs",
  47. smalltalk.method({
  48. selector: "testNumArgs",
  49. fn: function (){
  50. var self=this;
  51. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  52. return smalltalk.withContext(function($ctx2) { })}))._numArgs(),(0));
  53. _st(self)._assert_equals_(_st((function(a,b){
  54. return smalltalk.withContext(function($ctx2) { })}))._numArgs(),(2));
  55. return self}, self, "testNumArgs", [], smalltalk.BlockClosureTest)}
  56. }),
  57. smalltalk.BlockClosureTest);
  58. smalltalk.addMethod(
  59. "_testOnDo",
  60. smalltalk.method({
  61. selector: "testOnDo",
  62. fn: function (){
  63. var self=this;
  64. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((function(){
  65. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  66. })}))._on_do_((smalltalk.Error || Error),(function(ex){
  67. return smalltalk.withContext(function($ctx2) { return true;
  68. })})));
  69. return self}, self, "testOnDo", [], smalltalk.BlockClosureTest)}
  70. }),
  71. smalltalk.BlockClosureTest);
  72. smalltalk.addMethod(
  73. "_testValue",
  74. smalltalk.method({
  75. selector: "testValue",
  76. fn: function (){
  77. var self=this;
  78. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  79. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  80. })}))._value(),(2));
  81. _st(self)._assert_equals_(_st((function(x){
  82. return smalltalk.withContext(function($ctx2) { return _st(x).__plus((1));
  83. })}))._value_((2)),(3));
  84. _st(self)._assert_equals_(_st((function(x,y){
  85. return smalltalk.withContext(function($ctx2) { return _st(x).__star(y);
  86. })}))._value_value_((2),(4)),(8));
  87. _st(self)._assert_equals_(_st((function(a,b,c){
  88. return smalltalk.withContext(function($ctx2) { return (1);
  89. })}))._value(),(1));
  90. return self}, self, "testValue", [], smalltalk.BlockClosureTest)}
  91. }),
  92. smalltalk.BlockClosureTest);
  93. smalltalk.addMethod(
  94. "_testValueWithPossibleArguments",
  95. smalltalk.method({
  96. selector: "testValueWithPossibleArguments",
  97. fn: function (){
  98. var self=this;
  99. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  100. return smalltalk.withContext(function($ctx2) { return (1);
  101. })}))._valueWithPossibleArguments_([(3), (4)]),(1));
  102. _st(self)._assert_equals_(_st((function(a){
  103. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((4));
  104. })}))._valueWithPossibleArguments_([(3), (4)]),(7));
  105. _st(self)._assert_equals_(_st((function(a,b){
  106. return smalltalk.withContext(function($ctx2) { return _st(a).__plus(b);
  107. })}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  108. return self}, self, "testValueWithPossibleArguments", [], smalltalk.BlockClosureTest)}
  109. }),
  110. smalltalk.BlockClosureTest);
  111. smalltalk.addMethod(
  112. "_testWhileFalse",
  113. smalltalk.method({
  114. selector: "testWhileFalse",
  115. fn: function (){
  116. var self=this;
  117. return smalltalk.withContext(function($ctx1) { $ctx1.i=nil;
  118. $ctx1.locals.i=(0);
  119. _st((function(){
  120. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.i).__gt((5));
  121. })}))._whileFalse_((function(){
  122. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  123. return $ctx1.locals.i;
  124. })}));
  125. _st(self)._assert_equals_($ctx1.locals.i,(6));
  126. $ctx1.locals.i=(0);
  127. _st((function(){
  128. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  129. $ctx1.locals.i;
  130. return _st($ctx1.locals.i).__gt((5));
  131. })}))._whileFalse();
  132. _st(self)._assert_equals_($ctx1.locals.i,(6));
  133. return self}, self, "testWhileFalse", [], smalltalk.BlockClosureTest)}
  134. }),
  135. smalltalk.BlockClosureTest);
  136. smalltalk.addMethod(
  137. "_testWhileTrue",
  138. smalltalk.method({
  139. selector: "testWhileTrue",
  140. fn: function (){
  141. var self=this;
  142. return smalltalk.withContext(function($ctx1) { $ctx1.i=nil;
  143. $ctx1.locals.i=(0);
  144. _st((function(){
  145. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.i).__lt((5));
  146. })}))._whileTrue_((function(){
  147. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  148. return $ctx1.locals.i;
  149. })}));
  150. _st(self)._assert_equals_($ctx1.locals.i,(5));
  151. $ctx1.locals.i=(0);
  152. _st((function(){
  153. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  154. $ctx1.locals.i;
  155. return _st($ctx1.locals.i).__lt((5));
  156. })}))._whileTrue();
  157. _st(self)._assert_equals_($ctx1.locals.i,(5));
  158. return self}, self, "testWhileTrue", [], smalltalk.BlockClosureTest)}
  159. }),
  160. smalltalk.BlockClosureTest);
  161. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  162. smalltalk.addMethod(
  163. "_testEquality",
  164. smalltalk.method({
  165. selector: "testEquality",
  166. fn: function (){
  167. var self=this;
  168. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq(false));
  169. _st(self)._deny_(_st(false).__eq((0)));
  170. _st(self)._deny_(_st("").__eq(false));
  171. _st(self)._deny_(_st(false).__eq(""));
  172. _st(self)._assert_(_st(true).__eq(true));
  173. _st(self)._deny_(_st(false).__eq(true));
  174. _st(self)._deny_(_st(true).__eq(false));
  175. _st(self)._assert_(_st(false).__eq(false));
  176. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  177. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  178. return self}, self, "testEquality", [], smalltalk.BooleanTest)}
  179. }),
  180. smalltalk.BooleanTest);
  181. smalltalk.addMethod(
  182. "_testIdentity",
  183. smalltalk.method({
  184. selector: "testIdentity",
  185. fn: function (){
  186. var self=this;
  187. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq_eq(false));
  188. _st(self)._deny_(_st(false).__eq_eq((0)));
  189. _st(self)._deny_(_st("").__eq_eq(false));
  190. _st(self)._deny_(_st(false).__eq_eq(""));
  191. _st(self)._assert_(_st(true).__eq_eq(true));
  192. _st(self)._deny_(_st(false).__eq_eq(true));
  193. _st(self)._deny_(_st(true).__eq_eq(false));
  194. _st(self)._assert_(_st(false).__eq_eq(false));
  195. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  196. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  197. return self}, self, "testIdentity", [], smalltalk.BooleanTest)}
  198. }),
  199. smalltalk.BooleanTest);
  200. smalltalk.addMethod(
  201. "_testIfTrueIfFalse",
  202. smalltalk.method({
  203. selector: "testIfTrueIfFalse",
  204. fn: function (){
  205. var self=this;
  206. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  207. if(smalltalk.assert(true)){
  208. $1="alternative block";
  209. };
  210. _st(self)._assert_(_st($1).__eq("alternative block"));
  211. if(! smalltalk.assert(true)){
  212. $2="alternative block";
  213. };
  214. _st(self)._assert_(_st($2).__eq(nil));
  215. if(smalltalk.assert(false)){
  216. $3="alternative block";
  217. };
  218. _st(self)._assert_(_st($3).__eq(nil));
  219. if(! smalltalk.assert(false)){
  220. $4="alternative block";
  221. };
  222. _st(self)._assert_(_st($4).__eq("alternative block"));
  223. if(smalltalk.assert(false)){
  224. $5="alternative block";
  225. } else {
  226. $5="alternative block2";
  227. };
  228. _st(self)._assert_(_st($5).__eq("alternative block2"));
  229. if(smalltalk.assert(false)){
  230. $6="alternative block2";
  231. } else {
  232. $6="alternative block";
  233. };
  234. _st(self)._assert_(_st($6).__eq("alternative block"));
  235. if(smalltalk.assert(true)){
  236. $7="alternative block";
  237. } else {
  238. $7="alternative block2";
  239. };
  240. _st(self)._assert_(_st($7).__eq("alternative block"));
  241. if(smalltalk.assert(true)){
  242. $8="alternative block2";
  243. } else {
  244. $8="alternative block";
  245. };
  246. _st(self)._assert_(_st($8).__eq("alternative block2"));
  247. return self}, self, "testIfTrueIfFalse", [], smalltalk.BooleanTest)}
  248. }),
  249. smalltalk.BooleanTest);
  250. smalltalk.addMethod(
  251. "_testLogic",
  252. smalltalk.method({
  253. selector: "testLogic",
  254. fn: function (){
  255. var self=this;
  256. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  257. _st(self)._assert_(_st(true).__and(true));
  258. _st(self)._deny_(_st(true).__and(false));
  259. _st(self)._deny_(_st(false).__and(true));
  260. $1=_st(self)._deny_(_st(false).__and(false));
  261. _st(self)._assert_(_st(true).__or(true));
  262. _st(self)._assert_(_st(true).__or(false));
  263. _st(self)._assert_(_st(false).__or(true));
  264. $2=_st(self)._deny_(_st(false).__or(false));
  265. _st(self)._assert_(_st(true).__and(_st((1)).__gt((0))));
  266. _st(self)._deny_(_st(_st((1)).__gt((0))).__and(false));
  267. $3=_st(self)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  268. _st(self)._assert_(_st(false).__or(_st((1)).__gt((0))));
  269. _st(self)._assert_(_st(_st((1)).__gt((0))).__or(false));
  270. $4=_st(self)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  271. return self}, self, "testLogic", [], smalltalk.BooleanTest)}
  272. }),
  273. smalltalk.BooleanTest);
  274. smalltalk.addMethod(
  275. "_testLogicKeywords",
  276. smalltalk.method({
  277. selector: "testLogicKeywords",
  278. fn: function (){
  279. var self=this;
  280. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  281. _st(self)._assert_(_st(true)._and_((function(){
  282. return smalltalk.withContext(function($ctx2) { return true;
  283. })})));
  284. _st(self)._deny_(_st(true)._and_((function(){
  285. return smalltalk.withContext(function($ctx2) { return false;
  286. })})));
  287. _st(self)._deny_(_st(false)._and_((function(){
  288. return smalltalk.withContext(function($ctx2) { return true;
  289. })})));
  290. $1=_st(self)._deny_(_st(false)._and_((function(){
  291. return smalltalk.withContext(function($ctx2) { return false;
  292. })})));
  293. _st(self)._assert_(_st(true)._or_((function(){
  294. return smalltalk.withContext(function($ctx2) { return true;
  295. })})));
  296. _st(self)._assert_(_st(true)._or_((function(){
  297. return smalltalk.withContext(function($ctx2) { return false;
  298. })})));
  299. _st(self)._assert_(_st(false)._or_((function(){
  300. return smalltalk.withContext(function($ctx2) { return true;
  301. })})));
  302. $2=_st(self)._deny_(_st(false)._or_((function(){
  303. return smalltalk.withContext(function($ctx2) { return false;
  304. })})));
  305. _st(self)._assert_(_st(true)._and_((function(){
  306. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  307. })})));
  308. _st(self)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  309. return smalltalk.withContext(function($ctx2) { return false;
  310. })})));
  311. $3=_st(self)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  312. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  313. })})));
  314. _st(self)._assert_(_st(false)._or_((function(){
  315. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  316. })})));
  317. _st(self)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  318. return smalltalk.withContext(function($ctx2) { return false;
  319. })})));
  320. $4=_st(self)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  321. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  322. })})));
  323. return self}, self, "testLogicKeywords", [], smalltalk.BooleanTest)}
  324. }),
  325. smalltalk.BooleanTest);
  326. smalltalk.addMethod(
  327. "_testNonBooleanError",
  328. smalltalk.method({
  329. selector: "testNonBooleanError",
  330. fn: function (){
  331. var self=this;
  332. var b;
  333. b= '' ;
  334. ;
  335. smalltalk.send(self,"_should_raise_",[(function(){
  336. if(smalltalk.assert(self["@nonBoolean"])){
  337. } else {
  338. };
  339. }),(smalltalk.NonBooleanReceiver || NonBooleanReceiver)]);
  340. return self}
  341. }),
  342. smalltalk.BooleanTest);
  343. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  344. smalltalk.addMethod(
  345. "_setUp",
  346. smalltalk.method({
  347. selector: "setUp",
  348. fn: function (){
  349. var self=this;
  350. return smalltalk.withContext(function($ctx1) { self["@builder"]=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  351. return self}, self, "setUp", [], smalltalk.ClassBuilderTest)}
  352. }),
  353. smalltalk.ClassBuilderTest);
  354. smalltalk.addMethod(
  355. "_tearDown",
  356. smalltalk.method({
  357. selector: "tearDown",
  358. fn: function (){
  359. var self=this;
  360. return smalltalk.withContext(function($ctx1) { if(($receiver = self["@theClass"]) == nil || $receiver == undefined){
  361. self["@theClass"];
  362. } else {
  363. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(self["@theClass"]);
  364. self["@theClass"]=nil;
  365. self["@theClass"];
  366. };
  367. return self}, self, "tearDown", [], smalltalk.ClassBuilderTest)}
  368. }),
  369. smalltalk.ClassBuilderTest);
  370. smalltalk.addMethod(
  371. "_testClassCopy",
  372. smalltalk.method({
  373. selector: "testClassCopy",
  374. fn: function (){
  375. var self=this;
  376. return smalltalk.withContext(function($ctx1) { self["@theClass"]=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  377. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._superclass()));
  378. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._instanceVariableNames()));
  379. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  380. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._package()));
  381. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st((smalltalk.ObjectMock || ObjectMock))._methodDictionary())._keys());
  382. return self}, self, "testClassCopy", [], smalltalk.ClassBuilderTest)}
  383. }),
  384. smalltalk.ClassBuilderTest);
  385. smalltalk.addMethod(
  386. "_testInstanceVariableNames",
  387. smalltalk.method({
  388. selector: "testInstanceVariableNames",
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  392. return self}, self, "testInstanceVariableNames", [], smalltalk.ClassBuilderTest)}
  393. }),
  394. smalltalk.ClassBuilderTest);
  395. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  396. smalltalk.addMethod(
  397. "_assertSameContents_as_",
  398. smalltalk.method({
  399. selector: "assertSameContents:as:",
  400. fn: function (aCollection,anotherCollection){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  403. _st(aCollection)._do_((function(each){
  404. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  405. })}));
  406. return self}, self, "assertSameContents:as:", [aCollection,anotherCollection], smalltalk.CollectionTest)}
  407. }),
  408. smalltalk.CollectionTest);
  409. smalltalk.addMethod(
  410. "_collection",
  411. smalltalk.method({
  412. selector: "collection",
  413. fn: function (){
  414. var self=this;
  415. return smalltalk.withContext(function($ctx1) { var $1;
  416. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  417. return $1;
  418. }, self, "collection", [], smalltalk.CollectionTest)}
  419. }),
  420. smalltalk.CollectionTest);
  421. smalltalk.addMethod(
  422. "_collectionClass",
  423. smalltalk.method({
  424. selector: "collectionClass",
  425. fn: function (){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) { var $1;
  428. $1=_st(_st(self)._class())._collectionClass();
  429. return $1;
  430. }, self, "collectionClass", [], smalltalk.CollectionTest)}
  431. }),
  432. smalltalk.CollectionTest);
  433. smalltalk.addMethod(
  434. "_collectionWithDuplicates",
  435. smalltalk.method({
  436. selector: "collectionWithDuplicates",
  437. fn: function (){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) { var $1;
  440. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  441. return $1;
  442. }, self, "collectionWithDuplicates", [], smalltalk.CollectionTest)}
  443. }),
  444. smalltalk.CollectionTest);
  445. smalltalk.addMethod(
  446. "_defaultValues",
  447. smalltalk.method({
  448. selector: "defaultValues",
  449. fn: function (){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) { return [(1), (2), (3), (-4)];
  452. }, self, "defaultValues", [], smalltalk.CollectionTest)}
  453. }),
  454. smalltalk.CollectionTest);
  455. smalltalk.addMethod(
  456. "_isCollectionReadOnly",
  457. smalltalk.method({
  458. selector: "isCollectionReadOnly",
  459. fn: function (){
  460. var self=this;
  461. return smalltalk.withContext(function($ctx1) { return false;
  462. }, self, "isCollectionReadOnly", [], smalltalk.CollectionTest)}
  463. }),
  464. smalltalk.CollectionTest);
  465. smalltalk.addMethod(
  466. "_testAsArray",
  467. smalltalk.method({
  468. selector: "testAsArray",
  469. fn: function (){
  470. var self=this;
  471. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  472. return self}, self, "testAsArray", [], smalltalk.CollectionTest)}
  473. }),
  474. smalltalk.CollectionTest);
  475. smalltalk.addMethod(
  476. "_testAsOrderedCollection",
  477. smalltalk.method({
  478. selector: "testAsOrderedCollection",
  479. fn: function (){
  480. var self=this;
  481. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  482. return self}, self, "testAsOrderedCollection", [], smalltalk.CollectionTest)}
  483. }),
  484. smalltalk.CollectionTest);
  485. smalltalk.addMethod(
  486. "_testAsSet",
  487. smalltalk.method({
  488. selector: "testAsSet",
  489. fn: function (){
  490. var self=this;
  491. return smalltalk.withContext(function($ctx1) { $ctx1.c=nil;
  492. $ctx1.set=nil;
  493. $ctx1.locals.c=_st(self)._collectionWithDuplicates();
  494. $ctx1.locals.set=_st($ctx1.locals.c)._asSet();
  495. _st(self)._assert_(_st(_st($ctx1.locals.set)._size()).__eq((5)));
  496. _st($ctx1.locals.c)._do_((function(each){
  497. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st($ctx1.locals.set)._includes_(each));
  498. })}));
  499. return self}, self, "testAsSet", [], smalltalk.CollectionTest)}
  500. }),
  501. smalltalk.CollectionTest);
  502. smalltalk.addMethod(
  503. "_testCollect",
  504. smalltalk.method({
  505. selector: "testCollect",
  506. fn: function (){
  507. var self=this;
  508. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  509. $ctx1.locals.newCollection=[(1), (2), (3), (4)];
  510. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  511. return smalltalk.withContext(function($ctx2) { return _st(each)._abs();
  512. })})),$ctx1.locals.newCollection);
  513. return self}, self, "testCollect", [], smalltalk.CollectionTest)}
  514. }),
  515. smalltalk.CollectionTest);
  516. smalltalk.addMethod(
  517. "_testDetect",
  518. smalltalk.method({
  519. selector: "testDetect",
  520. fn: function (){
  521. var self=this;
  522. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  523. return smalltalk.withContext(function($ctx2) { return _st(each).__lt((0));
  524. })}))).__eq((-4)));
  525. _st(self)._should_raise_((function(){
  526. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  527. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  528. })}));
  529. })}),(smalltalk.Error || Error));
  530. return self}, self, "testDetect", [], smalltalk.CollectionTest)}
  531. }),
  532. smalltalk.CollectionTest);
  533. smalltalk.addMethod(
  534. "_testDo",
  535. smalltalk.method({
  536. selector: "testDo",
  537. fn: function (){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  540. $ctx1.locals.newCollection=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  541. _st(_st(self)._collection())._do_((function(each){
  542. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.newCollection)._add_(each);
  543. })}));
  544. _st(self)._assertSameContents_as_(_st(self)._collection(),$ctx1.locals.newCollection);
  545. return self}, self, "testDo", [], smalltalk.CollectionTest)}
  546. }),
  547. smalltalk.CollectionTest);
  548. smalltalk.addMethod(
  549. "_testIsEmpty",
  550. smalltalk.method({
  551. selector: "testIsEmpty",
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  555. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  556. return self}, self, "testIsEmpty", [], smalltalk.CollectionTest)}
  557. }),
  558. smalltalk.CollectionTest);
  559. smalltalk.addMethod(
  560. "_testSelect",
  561. smalltalk.method({
  562. selector: "testSelect",
  563. fn: function (){
  564. var self=this;
  565. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  566. $ctx1.locals.newCollection=[(2), (-4)];
  567. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  568. return smalltalk.withContext(function($ctx2) { return _st(each)._even();
  569. })})),$ctx1.locals.newCollection);
  570. return self}, self, "testSelect", [], smalltalk.CollectionTest)}
  571. }),
  572. smalltalk.CollectionTest);
  573. smalltalk.addMethod(
  574. "_testSize",
  575. smalltalk.method({
  576. selector: "testSize",
  577. fn: function (){
  578. var self=this;
  579. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(_st(self)._collectionClass())._new())._size()).__eq((0)));
  580. _st(self)._assert_(_st(_st(_st(self)._collection())._size()).__eq((4)));
  581. return self}, self, "testSize", [], smalltalk.CollectionTest)}
  582. }),
  583. smalltalk.CollectionTest);
  584. smalltalk.addMethod(
  585. "_collectionClass",
  586. smalltalk.method({
  587. selector: "collectionClass",
  588. fn: function (){
  589. var self=this;
  590. return smalltalk.withContext(function($ctx1) { return nil;
  591. }, self, "collectionClass", [], smalltalk.CollectionTest.klass)}
  592. }),
  593. smalltalk.CollectionTest.klass);
  594. smalltalk.addMethod(
  595. "_isAbstract",
  596. smalltalk.method({
  597. selector: "isAbstract",
  598. fn: function (){
  599. var self=this;
  600. return smalltalk.withContext(function($ctx1) { var $1;
  601. $1=_st(_st(self)._collectionClass())._isNil();
  602. return $1;
  603. }, self, "isAbstract", [], smalltalk.CollectionTest.klass)}
  604. }),
  605. smalltalk.CollectionTest.klass);
  606. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  607. smalltalk.addMethod(
  608. "_collection",
  609. smalltalk.method({
  610. selector: "collection",
  611. fn: function (){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) { var $1;
  614. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  615. return $1;
  616. }, self, "collection", [], smalltalk.HashedCollectionTest)}
  617. }),
  618. smalltalk.HashedCollectionTest);
  619. smalltalk.addMethod(
  620. "_collectionWithDuplicates",
  621. smalltalk.method({
  622. selector: "collectionWithDuplicates",
  623. fn: function (){
  624. var self=this;
  625. return smalltalk.withContext(function($ctx1) { var $1;
  626. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4)),_st("e").__minus_gt((1)),_st("f").__minus_gt((2)),_st("g").__minus_gt((10))]);
  627. return $1;
  628. }, self, "collectionWithDuplicates", [], smalltalk.HashedCollectionTest)}
  629. }),
  630. smalltalk.HashedCollectionTest);
  631. smalltalk.addMethod(
  632. "_collectionClass",
  633. smalltalk.method({
  634. selector: "collectionClass",
  635. fn: function (){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) { return (smalltalk.HashedCollection || HashedCollection);
  638. }, self, "collectionClass", [], smalltalk.HashedCollectionTest.klass)}
  639. }),
  640. smalltalk.HashedCollectionTest.klass);
  641. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  642. smalltalk.addMethod(
  643. "_collection",
  644. smalltalk.method({
  645. selector: "collection",
  646. fn: function (){
  647. var self=this;
  648. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  649. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  650. _st($2)._at_put_((1),(1));
  651. _st($2)._at_put_("a",(2));
  652. _st($2)._at_put_(true,(3));
  653. _st($2)._at_put_((4),(-4));
  654. $3=_st($2)._yourself();
  655. $1=$3;
  656. return $1;
  657. }, self, "collection", [], smalltalk.DictionaryTest)}
  658. }),
  659. smalltalk.DictionaryTest);
  660. smalltalk.addMethod(
  661. "_collectionWithDuplicates",
  662. smalltalk.method({
  663. selector: "collectionWithDuplicates",
  664. fn: function (){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  667. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  668. _st($2)._at_put_((1),(1));
  669. _st($2)._at_put_("a",(2));
  670. _st($2)._at_put_(true,(3));
  671. _st($2)._at_put_((4),(-4));
  672. _st($2)._at_put_("b",(1));
  673. _st($2)._at_put_((3),(3));
  674. _st($2)._at_put_(false,(12));
  675. $3=_st($2)._yourself();
  676. $1=$3;
  677. return $1;
  678. }, self, "collectionWithDuplicates", [], smalltalk.DictionaryTest)}
  679. }),
  680. smalltalk.DictionaryTest);
  681. smalltalk.addMethod(
  682. "_testAccessing",
  683. smalltalk.method({
  684. selector: "testAccessing",
  685. fn: function (){
  686. var self=this;
  687. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  688. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  689. _st($ctx1.locals.d)._at_put_("hello","world");
  690. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_("hello")).__eq("world"));
  691. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_ifAbsent_("hello",(function(){
  692. return smalltalk.withContext(function($ctx2) { return nil;
  693. })}))).__eq("world"));
  694. _st(self)._deny_(_st(_st($ctx1.locals.d)._at_ifAbsent_("foo",(function(){
  695. return smalltalk.withContext(function($ctx2) { return nil;
  696. })}))).__eq("world"));
  697. _st($ctx1.locals.d)._at_put_((1),(2));
  698. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_((1))).__eq((2)));
  699. _st($ctx1.locals.d)._at_put_(_st((1)).__at((3)),(3));
  700. _st(self)._assert_(_st(_st($ctx1.locals.d)._at_(_st((1)).__at((3)))).__eq((3)));
  701. return self}, self, "testAccessing", [], smalltalk.DictionaryTest)}
  702. }),
  703. smalltalk.DictionaryTest);
  704. smalltalk.addMethod(
  705. "_testDynamicDictionaries",
  706. smalltalk.method({
  707. selector: "testDynamicDictionaries",
  708. fn: function (){
  709. var self=this;
  710. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary()).__eq(_st((smalltalk.Dictionary || Dictionary))._with_(_st("hello").__minus_gt((1)))));
  711. return self}, self, "testDynamicDictionaries", [], smalltalk.DictionaryTest)}
  712. }),
  713. smalltalk.DictionaryTest);
  714. smalltalk.addMethod(
  715. "_testEquality",
  716. smalltalk.method({
  717. selector: "testEquality",
  718. fn: function (){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  721. $ctx1.d1=nil;
  722. $ctx1.d2=nil;
  723. _st(self)._assert_(_st(_st((smalltalk.Dictionary || Dictionary))._new()).__eq(_st((smalltalk.Dictionary || Dictionary))._new()));
  724. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  725. _st($1)._at_put_((1),(2));
  726. $2=_st($1)._yourself();
  727. $ctx1.locals.d1=$2;
  728. $3=_st((smalltalk.Dictionary || Dictionary))._new();
  729. _st($3)._at_put_((1),(2));
  730. $4=_st($3)._yourself();
  731. $ctx1.locals.d2=$4;
  732. _st(self)._assert_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  733. $5=_st((smalltalk.Dictionary || Dictionary))._new();
  734. _st($5)._at_put_((1),(3));
  735. $6=_st($5)._yourself();
  736. $ctx1.locals.d2=$6;
  737. _st(self)._deny_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  738. $7=_st((smalltalk.Dictionary || Dictionary))._new();
  739. _st($7)._at_put_((2),(2));
  740. $8=_st($7)._yourself();
  741. $ctx1.locals.d2=$8;
  742. _st(self)._deny_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  743. $9=_st((smalltalk.Dictionary || Dictionary))._new();
  744. _st($9)._at_put_((1),(2));
  745. _st($9)._at_put_((3),(4));
  746. $10=_st($9)._yourself();
  747. $ctx1.locals.d2=$10;
  748. _st(self)._deny_(_st($ctx1.locals.d1).__eq($ctx1.locals.d2));
  749. return self}, self, "testEquality", [], smalltalk.DictionaryTest)}
  750. }),
  751. smalltalk.DictionaryTest);
  752. smalltalk.addMethod(
  753. "_testIfAbsent",
  754. smalltalk.method({
  755. selector: "testIfAbsent",
  756. fn: function (){
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  759. $ctx1.visited=nil;
  760. $ctx1.locals.visited=false;
  761. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  762. _st($ctx1.locals.d)._at_ifAbsent_("hello",(function(){
  763. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=true;
  764. return $ctx1.locals.visited;
  765. })}));
  766. _st(self)._assert_($ctx1.locals.visited);
  767. return self}, self, "testIfAbsent", [], smalltalk.DictionaryTest)}
  768. }),
  769. smalltalk.DictionaryTest);
  770. smalltalk.addMethod(
  771. "_testIfPresent",
  772. smalltalk.method({
  773. selector: "testIfPresent",
  774. fn: function (){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  777. $ctx1.visited=nil;
  778. $ctx1.absent=nil;
  779. $ctx1.locals.visited=false;
  780. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  781. _st($ctx1.locals.d)._at_put_("hello","world");
  782. _st($ctx1.locals.d)._at_ifPresent_("hello",(function(value){
  783. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  784. return $ctx1.locals.visited;
  785. })}));
  786. _st(self)._assert_(_st($ctx1.locals.visited).__eq("world"));
  787. $ctx1.locals.absent=_st($ctx1.locals.d)._at_ifPresent_("bye",(function(value){
  788. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  789. return $ctx1.locals.visited;
  790. })}));
  791. _st(self)._assert_(_st($ctx1.locals.absent)._isNil());
  792. return self}, self, "testIfPresent", [], smalltalk.DictionaryTest)}
  793. }),
  794. smalltalk.DictionaryTest);
  795. smalltalk.addMethod(
  796. "_testIfPresentIfAbsent",
  797. smalltalk.method({
  798. selector: "testIfPresentIfAbsent",
  799. fn: function (){
  800. var self=this;
  801. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  802. $ctx1.visited=nil;
  803. $ctx1.locals.visited=false;
  804. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  805. _st($ctx1.locals.d)._at_put_("hello","world");
  806. _st($ctx1.locals.d)._at_ifPresent_ifAbsent_("hello",(function(value){
  807. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  808. return $ctx1.locals.visited;
  809. })}),(function(){
  810. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=true;
  811. return $ctx1.locals.visited;
  812. })}));
  813. _st(self)._assert_(_st($ctx1.locals.visited).__eq("world"));
  814. _st($ctx1.locals.d)._at_ifPresent_ifAbsent_("buy",(function(value){
  815. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=value;
  816. return $ctx1.locals.visited;
  817. })}),(function(){
  818. return smalltalk.withContext(function($ctx2) { $ctx1.locals.visited=true;
  819. return $ctx1.locals.visited;
  820. })}));
  821. _st(self)._assert_($ctx1.locals.visited);
  822. return self}, self, "testIfPresentIfAbsent", [], smalltalk.DictionaryTest)}
  823. }),
  824. smalltalk.DictionaryTest);
  825. smalltalk.addMethod(
  826. "_testKeys",
  827. smalltalk.method({
  828. selector: "testKeys",
  829. fn: function (){
  830. var self=this;
  831. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  832. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  833. _st($ctx1.locals.d)._at_put_((1),(2));
  834. _st($ctx1.locals.d)._at_put_((2),(3));
  835. _st($ctx1.locals.d)._at_put_((3),(4));
  836. _st(self)._assert_(_st(_st($ctx1.locals.d)._keys()).__eq([(1), (2), (3)]));
  837. return self}, self, "testKeys", [], smalltalk.DictionaryTest)}
  838. }),
  839. smalltalk.DictionaryTest);
  840. smalltalk.addMethod(
  841. "_testPrintString",
  842. smalltalk.method({
  843. selector: "testPrintString",
  844. fn: function (){
  845. var self=this;
  846. return smalltalk.withContext(function($ctx1) { var $1,$2;
  847. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  848. _st($1)._at_put_("firstname","James");
  849. _st($1)._at_put_("lastname","Bond");
  850. $2=_st($1)._printString();
  851. _st(self)._assert_equals_("a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2);
  852. return self}, self, "testPrintString", [], smalltalk.DictionaryTest)}
  853. }),
  854. smalltalk.DictionaryTest);
  855. smalltalk.addMethod(
  856. "_testRemoveKey",
  857. smalltalk.method({
  858. selector: "testRemoveKey",
  859. fn: function (){
  860. var self=this;
  861. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  862. $ctx1.key=nil;
  863. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  864. _st($ctx1.locals.d)._at_put_((1),(2));
  865. _st($ctx1.locals.d)._at_put_((2),(3));
  866. _st($ctx1.locals.d)._at_put_((3),(4));
  867. $ctx1.locals.key=(2);
  868. _st(self)._assert_(_st(_st($ctx1.locals.d)._keys()).__eq([(1), (2), (3)]));
  869. _st($ctx1.locals.d)._removeKey_($ctx1.locals.key);
  870. _st(self)._assert_(_st(_st($ctx1.locals.d)._keys()).__eq([(1), (3)]));
  871. _st(self)._assert_(_st(_st($ctx1.locals.d)._values()).__eq([(2), (4)]));
  872. _st(self)._deny_(_st($ctx1.locals.d)._includesKey_((2)));
  873. return self}, self, "testRemoveKey", [], smalltalk.DictionaryTest)}
  874. }),
  875. smalltalk.DictionaryTest);
  876. smalltalk.addMethod(
  877. "_testRemoveKeyIfAbsent",
  878. smalltalk.method({
  879. selector: "testRemoveKeyIfAbsent",
  880. fn: function (){
  881. var self=this;
  882. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  883. $ctx1.key=nil;
  884. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  885. _st($ctx1.locals.d)._at_put_((1),(2));
  886. _st($ctx1.locals.d)._at_put_((2),(3));
  887. _st($ctx1.locals.d)._at_put_((3),(4));
  888. $ctx1.locals.key=(2);
  889. _st(self)._assert_(_st(_st($ctx1.locals.d)._removeKey_($ctx1.locals.key)).__eq((3)));
  890. $ctx1.locals.key=(3);
  891. _st(self)._assert_(_st(_st($ctx1.locals.d)._removeKey_ifAbsent_($ctx1.locals.key,(function(){
  892. return smalltalk.withContext(function($ctx2) { return (42);
  893. })}))).__eq((4)));
  894. $ctx1.locals.key="why";
  895. _st(self)._assert_(_st(_st($ctx1.locals.d)._removeKey_ifAbsent_($ctx1.locals.key,(function(){
  896. return smalltalk.withContext(function($ctx2) { return (42);
  897. })}))).__eq((42)));
  898. return self}, self, "testRemoveKeyIfAbsent", [], smalltalk.DictionaryTest)}
  899. }),
  900. smalltalk.DictionaryTest);
  901. smalltalk.addMethod(
  902. "_testSize",
  903. smalltalk.method({
  904. selector: "testSize",
  905. fn: function (){
  906. var self=this;
  907. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  908. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  909. _st(self)._assert_(_st(_st($ctx1.locals.d)._size()).__eq((0)));
  910. _st($ctx1.locals.d)._at_put_((1),(2));
  911. _st(self)._assert_(_st(_st($ctx1.locals.d)._size()).__eq((1)));
  912. _st($ctx1.locals.d)._at_put_((2),(3));
  913. _st(self)._assert_(_st(_st($ctx1.locals.d)._size()).__eq((2)));
  914. return self}, self, "testSize", [], smalltalk.DictionaryTest)}
  915. }),
  916. smalltalk.DictionaryTest);
  917. smalltalk.addMethod(
  918. "_testValues",
  919. smalltalk.method({
  920. selector: "testValues",
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) { $ctx1.d=nil;
  924. $ctx1.locals.d=_st((smalltalk.Dictionary || Dictionary))._new();
  925. _st($ctx1.locals.d)._at_put_((1),(2));
  926. _st($ctx1.locals.d)._at_put_((2),(3));
  927. _st($ctx1.locals.d)._at_put_((3),(4));
  928. _st(self)._assert_(_st(_st($ctx1.locals.d)._values()).__eq([(2), (3), (4)]));
  929. return self}, self, "testValues", [], smalltalk.DictionaryTest)}
  930. }),
  931. smalltalk.DictionaryTest);
  932. smalltalk.addMethod(
  933. "_collectionClass",
  934. smalltalk.method({
  935. selector: "collectionClass",
  936. fn: function (){
  937. var self=this;
  938. return smalltalk.withContext(function($ctx1) { return (smalltalk.Dictionary || Dictionary);
  939. }, self, "collectionClass", [], smalltalk.DictionaryTest.klass)}
  940. }),
  941. smalltalk.DictionaryTest.klass);
  942. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  943. smalltalk.addMethod(
  944. "_testAt",
  945. smalltalk.method({
  946. selector: "testAt",
  947. fn: function (){
  948. var self=this;
  949. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_((4))).__eq((-4)));
  950. _st(self)._should_raise_((function(){
  951. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._at_((5));
  952. })}),(smalltalk.Error || Error));
  953. return self}, self, "testAt", [], smalltalk.SequenceableCollectionTest)}
  954. }),
  955. smalltalk.SequenceableCollectionTest);
  956. smalltalk.addMethod(
  957. "_testAtIfAbsent",
  958. smalltalk.method({
  959. selector: "testAtIfAbsent",
  960. fn: function (){
  961. var self=this;
  962. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  963. return smalltalk.withContext(function($ctx2) { return "none";
  964. })}))).__eq("none"));
  965. return self}, self, "testAtIfAbsent", [], smalltalk.SequenceableCollectionTest)}
  966. }),
  967. smalltalk.SequenceableCollectionTest);
  968. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  969. smalltalk.addMethod(
  970. "_testAtIfAbsent",
  971. smalltalk.method({
  972. selector: "testAtIfAbsent",
  973. fn: function (){
  974. var self=this;
  975. return smalltalk.withContext(function($ctx1) { $ctx1.array=nil;
  976. $ctx1.locals.array=["hello", "world"];
  977. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_((1)),"hello");
  978. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_((2)),"world");
  979. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((2),(function(){
  980. return smalltalk.withContext(function($ctx2) { return "not found";
  981. })})),"world");
  982. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((0),(function(){
  983. return smalltalk.withContext(function($ctx2) { return "not found";
  984. })})),"not found");
  985. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((-10),(function(){
  986. return smalltalk.withContext(function($ctx2) { return "not found";
  987. })})),"not found");
  988. _st(self)._assert_equals_(_st($ctx1.locals.array)._at_ifAbsent_((3),(function(){
  989. return smalltalk.withContext(function($ctx2) { return "not found";
  990. })})),"not found");
  991. return self}, self, "testAtIfAbsent", [], smalltalk.ArrayTest)}
  992. }),
  993. smalltalk.ArrayTest);
  994. smalltalk.addMethod(
  995. "_testFirstN",
  996. smalltalk.method({
  997. selector: "testFirstN",
  998. fn: function (){
  999. var self=this;
  1000. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_([(1),(2),(3)],_st([(1),(2),(3),(4),(5)])._first_((3)));
  1001. return self}, self, "testFirstN", [], smalltalk.ArrayTest)}
  1002. }),
  1003. smalltalk.ArrayTest);
  1004. smalltalk.addMethod(
  1005. "_testIfEmpty",
  1006. smalltalk.method({
  1007. selector: "testIfEmpty",
  1008. fn: function (){
  1009. var self=this;
  1010. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("zork",_st("")._ifEmpty_((function(){
  1011. return smalltalk.withContext(function($ctx2) { return "zork";
  1012. })})));
  1013. return self}, self, "testIfEmpty", [], smalltalk.ArrayTest)}
  1014. }),
  1015. smalltalk.ArrayTest);
  1016. smalltalk.addMethod(
  1017. "_testPrintString",
  1018. smalltalk.method({
  1019. selector: "testPrintString",
  1020. fn: function (){
  1021. var self=this;
  1022. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1023. $ctx1.array=nil;
  1024. $ctx1.locals.array=_st((smalltalk.Array || Array))._new();
  1025. _st(self)._assert_equals_("a Array ()",_st($ctx1.locals.array)._printString());
  1026. _st($ctx1.locals.array)._add_((1));
  1027. $1=_st($ctx1.locals.array)._add_((3));
  1028. _st(self)._assert_equals_("a Array (1 3)",_st($ctx1.locals.array)._printString());
  1029. _st($ctx1.locals.array)._add_("foo");
  1030. _st(self)._assert_equals_("a Array (1 3 'foo')",_st($ctx1.locals.array)._printString());
  1031. _st($ctx1.locals.array)._remove_((1));
  1032. $2=_st($ctx1.locals.array)._remove_((3));
  1033. _st(self)._assert_equals_("a Array ('foo')",_st($ctx1.locals.array)._printString());
  1034. _st($ctx1.locals.array)._addLast_((3));
  1035. _st(self)._assert_equals_("a Array ('foo' 3)",_st($ctx1.locals.array)._printString());
  1036. _st($ctx1.locals.array)._addLast_((3));
  1037. _st(self)._assert_equals_("a Array ('foo' 3 3)",_st($ctx1.locals.array)._printString());
  1038. return self}, self, "testPrintString", [], smalltalk.ArrayTest)}
  1039. }),
  1040. smalltalk.ArrayTest);
  1041. smalltalk.addMethod(
  1042. "_collectionClass",
  1043. smalltalk.method({
  1044. selector: "collectionClass",
  1045. fn: function (){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) { return (smalltalk.Array || Array);
  1048. }, self, "collectionClass", [], smalltalk.ArrayTest.klass)}
  1049. }),
  1050. smalltalk.ArrayTest.klass);
  1051. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1052. smalltalk.addMethod(
  1053. "_collection",
  1054. smalltalk.method({
  1055. selector: "collection",
  1056. fn: function (){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) { return "hello";
  1059. }, self, "collection", [], smalltalk.StringTest)}
  1060. }),
  1061. smalltalk.StringTest);
  1062. smalltalk.addMethod(
  1063. "_collectionWithDuplicates",
  1064. smalltalk.method({
  1065. selector: "collectionWithDuplicates",
  1066. fn: function (){
  1067. var self=this;
  1068. return smalltalk.withContext(function($ctx1) { return "abbaerte";
  1069. }, self, "collectionWithDuplicates", [], smalltalk.StringTest)}
  1070. }),
  1071. smalltalk.StringTest);
  1072. smalltalk.addMethod(
  1073. "_testAddRemove",
  1074. smalltalk.method({
  1075. selector: "testAddRemove",
  1076. fn: function (){
  1077. var self=this;
  1078. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1079. return smalltalk.withContext(function($ctx2) { return _st("hello")._add_("a");
  1080. })}),(smalltalk.Error || Error));
  1081. _st(self)._should_raise_((function(){
  1082. return smalltalk.withContext(function($ctx2) { return _st("hello")._remove_("h");
  1083. })}),(smalltalk.Error || Error));
  1084. return self}, self, "testAddRemove", [], smalltalk.StringTest)}
  1085. }),
  1086. smalltalk.StringTest);
  1087. smalltalk.addMethod(
  1088. "_testAsArray",
  1089. smalltalk.method({
  1090. selector: "testAsArray",
  1091. fn: function (){
  1092. var self=this;
  1093. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._asArray()).__eq(["h", "e", "l", "l", "o"]));
  1094. return self}, self, "testAsArray", [], smalltalk.StringTest)}
  1095. }),
  1096. smalltalk.StringTest);
  1097. smalltalk.addMethod(
  1098. "_testAt",
  1099. smalltalk.method({
  1100. selector: "testAt",
  1101. fn: function (){
  1102. var self=this;
  1103. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._at_((1))).__eq("h"));
  1104. _st(self)._assert_(_st(_st("hello")._at_((5))).__eq("o"));
  1105. _st(self)._assert_(_st(_st("hello")._at_ifAbsent_((6),(function(){
  1106. return smalltalk.withContext(function($ctx2) { return nil;
  1107. })}))).__eq(nil));
  1108. return self}, self, "testAt", [], smalltalk.StringTest)}
  1109. }),
  1110. smalltalk.StringTest);
  1111. smalltalk.addMethod(
  1112. "_testAtPut",
  1113. smalltalk.method({
  1114. selector: "testAtPut",
  1115. fn: function (){
  1116. var self=this;
  1117. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1118. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1119. })}),(smalltalk.Error || Error));
  1120. return self}, self, "testAtPut", [], smalltalk.StringTest)}
  1121. }),
  1122. smalltalk.StringTest);
  1123. smalltalk.addMethod(
  1124. "_testCollect",
  1125. smalltalk.method({
  1126. selector: "testCollect",
  1127. fn: function (){
  1128. var self=this;
  1129. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  1130. $ctx1.locals.newCollection="hheelllloo";
  1131. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1132. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1133. })})),$ctx1.locals.newCollection);
  1134. return self}, self, "testCollect", [], smalltalk.StringTest)}
  1135. }),
  1136. smalltalk.StringTest);
  1137. smalltalk.addMethod(
  1138. "_testCopyWithoutAll",
  1139. smalltalk.method({
  1140. selector: "testCopyWithoutAll",
  1141. fn: function (){
  1142. var self=this;
  1143. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello world",_st("*hello* *world*")._copyWithoutAll_("*"));
  1144. return self}, self, "testCopyWithoutAll", [], smalltalk.StringTest)}
  1145. }),
  1146. smalltalk.StringTest);
  1147. smalltalk.addMethod(
  1148. "_testDetect",
  1149. smalltalk.method({
  1150. selector: "testDetect",
  1151. fn: function (){
  1152. var self=this;
  1153. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1154. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1155. })}))).__eq("h"));
  1156. _st(self)._should_raise_((function(){
  1157. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1158. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  1159. })}));
  1160. })}),(smalltalk.Error || Error));
  1161. return self}, self, "testDetect", [], smalltalk.StringTest)}
  1162. }),
  1163. smalltalk.StringTest);
  1164. smalltalk.addMethod(
  1165. "_testEquality",
  1166. smalltalk.method({
  1167. selector: "testEquality",
  1168. fn: function (){
  1169. var self=this;
  1170. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq("hello"));
  1171. _st(self)._deny_(_st("hello").__eq("world"));
  1172. _st(self)._assert_(_st("hello").__eq(_st("hello")._yourself()));
  1173. _st(self)._assert_(_st(_st("hello")._yourself()).__eq("hello"));
  1174. _st(self)._deny_(_st("").__eq((0)));
  1175. return self}, self, "testEquality", [], smalltalk.StringTest)}
  1176. }),
  1177. smalltalk.StringTest);
  1178. smalltalk.addMethod(
  1179. "_testIdentity",
  1180. smalltalk.method({
  1181. selector: "testIdentity",
  1182. fn: function (){
  1183. var self=this;
  1184. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1185. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1186. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1187. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1188. _st(self)._deny_(_st("").__eq_eq((0)));
  1189. return self}, self, "testIdentity", [], smalltalk.StringTest)}
  1190. }),
  1191. smalltalk.StringTest);
  1192. smalltalk.addMethod(
  1193. "_testIncludesSubString",
  1194. smalltalk.method({
  1195. selector: "testIncludesSubString",
  1196. fn: function (){
  1197. var self=this;
  1198. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  1199. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  1200. return self}, self, "testIncludesSubString", [], smalltalk.StringTest)}
  1201. }),
  1202. smalltalk.StringTest);
  1203. smalltalk.addMethod(
  1204. "_testJoin",
  1205. smalltalk.method({
  1206. selector: "testJoin",
  1207. fn: function (){
  1208. var self=this;
  1209. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello,world",_st(",")._join_(["hello", "world"]));
  1210. return self}, self, "testJoin", [], smalltalk.StringTest)}
  1211. }),
  1212. smalltalk.StringTest);
  1213. smalltalk.addMethod(
  1214. "_testSelect",
  1215. smalltalk.method({
  1216. selector: "testSelect",
  1217. fn: function (){
  1218. var self=this;
  1219. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  1220. $ctx1.locals.newCollection="o";
  1221. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1222. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1223. })})),$ctx1.locals.newCollection);
  1224. return self}, self, "testSelect", [], smalltalk.StringTest)}
  1225. }),
  1226. smalltalk.StringTest);
  1227. smalltalk.addMethod(
  1228. "_testSize",
  1229. smalltalk.method({
  1230. selector: "testSize",
  1231. fn: function (){
  1232. var self=this;
  1233. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  1234. _st(self)._assert_equals_(_st("")._size(),(0));
  1235. return self}, self, "testSize", [], smalltalk.StringTest)}
  1236. }),
  1237. smalltalk.StringTest);
  1238. smalltalk.addMethod(
  1239. "_testStreamContents",
  1240. smalltalk.method({
  1241. selector: "testStreamContents",
  1242. fn: function (){
  1243. var self=this;
  1244. return smalltalk.withContext(function($ctx1) { var $1;
  1245. _st(self)._assert_equals_("hello world",_st((smalltalk.String || String))._streamContents_((function(aStream){
  1246. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_("hello");
  1247. _st(aStream)._space();
  1248. $1=_st(aStream)._nextPutAll_("world");
  1249. return $1;
  1250. })})));
  1251. return self}, self, "testStreamContents", [], smalltalk.StringTest)}
  1252. }),
  1253. smalltalk.StringTest);
  1254. smalltalk.addMethod(
  1255. "_collectionClass",
  1256. smalltalk.method({
  1257. selector: "collectionClass",
  1258. fn: function (){
  1259. var self=this;
  1260. return smalltalk.withContext(function($ctx1) { return (smalltalk.String || String);
  1261. }, self, "collectionClass", [], smalltalk.StringTest.klass)}
  1262. }),
  1263. smalltalk.StringTest.klass);
  1264. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1265. smalltalk.addMethod(
  1266. "_collection",
  1267. smalltalk.method({
  1268. selector: "collection",
  1269. fn: function (){
  1270. var self=this;
  1271. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("hello");
  1272. }, self, "collection", [], smalltalk.SymbolTest)}
  1273. }),
  1274. smalltalk.SymbolTest);
  1275. smalltalk.addMethod(
  1276. "_collectionWithDuplicates",
  1277. smalltalk.method({
  1278. selector: "collectionWithDuplicates",
  1279. fn: function (){
  1280. var self=this;
  1281. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("phhaaarorra");
  1282. }, self, "collectionWithDuplicates", [], smalltalk.SymbolTest)}
  1283. }),
  1284. smalltalk.SymbolTest);
  1285. smalltalk.addMethod(
  1286. "_testAsString",
  1287. smalltalk.method({
  1288. selector: "testAsString",
  1289. fn: function (){
  1290. var self=this;
  1291. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._asString(),"hello");
  1292. return self}, self, "testAsString", [], smalltalk.SymbolTest)}
  1293. }),
  1294. smalltalk.SymbolTest);
  1295. smalltalk.addMethod(
  1296. "_testAsSymbol",
  1297. smalltalk.method({
  1298. selector: "testAsSymbol",
  1299. fn: function (){
  1300. var self=this;
  1301. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(_st(smalltalk.symbolFor("hello"))._asSymbol()));
  1302. return self}, self, "testAsSymbol", [], smalltalk.SymbolTest)}
  1303. }),
  1304. smalltalk.SymbolTest);
  1305. smalltalk.addMethod(
  1306. "_testAt",
  1307. smalltalk.method({
  1308. selector: "testAt",
  1309. fn: function (){
  1310. var self=this;
  1311. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((1))).__eq("h"));
  1312. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((5))).__eq("o"));
  1313. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_ifAbsent_((6),(function(){
  1314. return smalltalk.withContext(function($ctx2) { return nil;
  1315. })}))).__eq(nil));
  1316. return self}, self, "testAt", [], smalltalk.SymbolTest)}
  1317. }),
  1318. smalltalk.SymbolTest);
  1319. smalltalk.addMethod(
  1320. "_testAtPut",
  1321. smalltalk.method({
  1322. selector: "testAtPut",
  1323. fn: function (){
  1324. var self=this;
  1325. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1326. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1327. })}),(smalltalk.Error || Error));
  1328. return self}, self, "testAtPut", [], smalltalk.SymbolTest)}
  1329. }),
  1330. smalltalk.SymbolTest);
  1331. smalltalk.addMethod(
  1332. "_testCollect",
  1333. smalltalk.method({
  1334. selector: "testCollect",
  1335. fn: function (){
  1336. var self=this;
  1337. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  1338. $ctx1.locals.newCollection=smalltalk.symbolFor("hheelllloo");
  1339. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1340. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1341. })})),$ctx1.locals.newCollection);
  1342. return self}, self, "testCollect", [], smalltalk.SymbolTest)}
  1343. }),
  1344. smalltalk.SymbolTest);
  1345. smalltalk.addMethod(
  1346. "_testComparing",
  1347. smalltalk.method({
  1348. selector: "testComparing",
  1349. fn: function (){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("aa")));
  1352. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("ba")));
  1353. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt(smalltalk.symbolFor("ba")));
  1354. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt(smalltalk.symbolFor("ba")));
  1355. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("aa")));
  1356. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("ba")));
  1357. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt_eq(smalltalk.symbolFor("ba")));
  1358. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt_eq(smalltalk.symbolFor("ba")));
  1359. return self}, self, "testComparing", [], smalltalk.SymbolTest)}
  1360. }),
  1361. smalltalk.SymbolTest);
  1362. smalltalk.addMethod(
  1363. "_testCopying",
  1364. smalltalk.method({
  1365. selector: "testCopying",
  1366. fn: function (){
  1367. var self=this;
  1368. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._copy()).__eq_eq(smalltalk.symbolFor("hello")));
  1369. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._deepCopy()).__eq_eq(smalltalk.symbolFor("hello")));
  1370. return self}, self, "testCopying", [], smalltalk.SymbolTest)}
  1371. }),
  1372. smalltalk.SymbolTest);
  1373. smalltalk.addMethod(
  1374. "_testDetect",
  1375. smalltalk.method({
  1376. selector: "testDetect",
  1377. fn: function (){
  1378. var self=this;
  1379. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1380. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1381. })}))).__eq("h"));
  1382. _st(self)._should_raise_((function(){
  1383. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1384. return smalltalk.withContext(function($ctx3) { return _st(each).__eq("z");
  1385. })}));
  1386. })}),(smalltalk.Error || Error));
  1387. return self}, self, "testDetect", [], smalltalk.SymbolTest)}
  1388. }),
  1389. smalltalk.SymbolTest);
  1390. smalltalk.addMethod(
  1391. "_testEquality",
  1392. smalltalk.method({
  1393. selector: "testEquality",
  1394. fn: function (){
  1395. var self=this;
  1396. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("hello")));
  1397. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("world")));
  1398. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  1399. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(smalltalk.symbolFor("hello")));
  1400. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq("hello"));
  1401. _st(self)._deny_(_st("hello").__eq(smalltalk.symbolFor("hello")));
  1402. return self}, self, "testEquality", [], smalltalk.SymbolTest)}
  1403. }),
  1404. smalltalk.SymbolTest);
  1405. smalltalk.addMethod(
  1406. "_testIdentity",
  1407. smalltalk.method({
  1408. selector: "testIdentity",
  1409. fn: function (){
  1410. var self=this;
  1411. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("hello")));
  1412. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("world")));
  1413. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  1414. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(_st(_st(smalltalk.symbolFor("hello"))._asString())._asSymbol()));
  1415. return self}, self, "testIdentity", [], smalltalk.SymbolTest)}
  1416. }),
  1417. smalltalk.SymbolTest);
  1418. smalltalk.addMethod(
  1419. "_testIsEmpty",
  1420. smalltalk.method({
  1421. selector: "testIsEmpty",
  1422. fn: function (){
  1423. var self=this;
  1424. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  1425. _st(self)._assert_(_st(_st("")._asSymbol())._isEmpty());
  1426. return self}, self, "testIsEmpty", [], smalltalk.SymbolTest)}
  1427. }),
  1428. smalltalk.SymbolTest);
  1429. smalltalk.addMethod(
  1430. "_testIsSymbolIsString",
  1431. smalltalk.method({
  1432. selector: "testIsSymbolIsString",
  1433. fn: function (){
  1434. var self=this;
  1435. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello"))._isSymbol());
  1436. _st(self)._deny_(_st("hello")._isSymbol());
  1437. _st(self)._deny_(_st(smalltalk.symbolFor("hello"))._isString());
  1438. _st(self)._assert_(_st("hello")._isString());
  1439. return self}, self, "testIsSymbolIsString", [], smalltalk.SymbolTest)}
  1440. }),
  1441. smalltalk.SymbolTest);
  1442. smalltalk.addMethod(
  1443. "_testSelect",
  1444. smalltalk.method({
  1445. selector: "testSelect",
  1446. fn: function (){
  1447. var self=this;
  1448. return smalltalk.withContext(function($ctx1) { $ctx1.newCollection=nil;
  1449. $ctx1.locals.newCollection="o";
  1450. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1451. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1452. })})),$ctx1.locals.newCollection);
  1453. return self}, self, "testSelect", [], smalltalk.SymbolTest)}
  1454. }),
  1455. smalltalk.SymbolTest);
  1456. smalltalk.addMethod(
  1457. "_testSize",
  1458. smalltalk.method({
  1459. selector: "testSize",
  1460. fn: function (){
  1461. var self=this;
  1462. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("a"))._size(),(1));
  1463. _st(self)._assert_equals_(_st(smalltalk.symbolFor("aaaaa"))._size(),(5));
  1464. return self}, self, "testSize", [], smalltalk.SymbolTest)}
  1465. }),
  1466. smalltalk.SymbolTest);
  1467. smalltalk.addMethod(
  1468. "_collectionClass",
  1469. smalltalk.method({
  1470. selector: "collectionClass",
  1471. fn: function (){
  1472. var self=this;
  1473. return smalltalk.withContext(function($ctx1) { return (smalltalk.Symbol || Symbol);
  1474. }, self, "collectionClass", [], smalltalk.SymbolTest.klass)}
  1475. }),
  1476. smalltalk.SymbolTest.klass);
  1477. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1478. smalltalk.addMethod(
  1479. "_jsObject",
  1480. smalltalk.method({
  1481. selector: "jsObject",
  1482. fn: function (){
  1483. var self=this;
  1484. return smalltalk.withContext(function($ctx1) { return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null};
  1485. ;
  1486. return self}, self, "jsObject", [], smalltalk.JSObjectProxyTest)}
  1487. }),
  1488. smalltalk.JSObjectProxyTest);
  1489. smalltalk.addMethod(
  1490. "_testDNU",
  1491. smalltalk.method({
  1492. selector: "testDNU",
  1493. fn: function (){
  1494. var self=this;
  1495. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1496. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._jsObject())._foo();
  1497. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1498. return self}, self, "testDNU", [], smalltalk.JSObjectProxyTest)}
  1499. }),
  1500. smalltalk.JSObjectProxyTest);
  1501. smalltalk.addMethod(
  1502. "_testMessageSend",
  1503. smalltalk.method({
  1504. selector: "testMessageSend",
  1505. fn: function (){
  1506. var self=this;
  1507. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  1508. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  1509. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  1510. return self}, self, "testMessageSend", [], smalltalk.JSObjectProxyTest)}
  1511. }),
  1512. smalltalk.JSObjectProxyTest);
  1513. smalltalk.addMethod(
  1514. "_testMethodWithArguments",
  1515. smalltalk.method({
  1516. selector: "testMethodWithArguments",
  1517. fn: function (){
  1518. var self=this;
  1519. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  1520. return self}, self, "testMethodWithArguments", [], smalltalk.JSObjectProxyTest)}
  1521. }),
  1522. smalltalk.JSObjectProxyTest);
  1523. smalltalk.addMethod(
  1524. "_testPrinting",
  1525. smalltalk.method({
  1526. selector: "testPrinting",
  1527. fn: function (){
  1528. var self=this;
  1529. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._jsObject())._printString()).__eq("[object Object]"));
  1530. return self}, self, "testPrinting", [], smalltalk.JSObjectProxyTest)}
  1531. }),
  1532. smalltalk.JSObjectProxyTest);
  1533. smalltalk.addMethod(
  1534. "_testPropertyThatReturnsEmptyString",
  1535. smalltalk.method({
  1536. selector: "testPropertyThatReturnsEmptyString",
  1537. fn: function (){
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) { $ctx1.object=nil;
  1540. $ctx1.locals.object=_st(self)._jsObject();
  1541. _st(self)._assert_equals_("",_st($ctx1.locals.object)._d());
  1542. _st($ctx1.locals.object)._d_("hello");
  1543. _st(self)._assert_equals_("hello",_st($ctx1.locals.object)._d());
  1544. return self}, self, "testPropertyThatReturnsEmptyString", [], smalltalk.JSObjectProxyTest)}
  1545. }),
  1546. smalltalk.JSObjectProxyTest);
  1547. smalltalk.addMethod(
  1548. "_testPropertyThatReturnsUndefined",
  1549. smalltalk.method({
  1550. selector: "testPropertyThatReturnsUndefined",
  1551. fn: function (){
  1552. var self=this;
  1553. return smalltalk.withContext(function($ctx1) { $ctx1.object=nil;
  1554. $ctx1.locals.object=_st(self)._jsObject();
  1555. _st(self)._shouldnt_raise_((function(){
  1556. return smalltalk.withContext(function($ctx2) { return _st($ctx1.locals.object)._e();
  1557. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1558. _st(self)._assert_(_st(_st($ctx1.locals.object)._e())._isNil());
  1559. return self}, self, "testPropertyThatReturnsUndefined", [], smalltalk.JSObjectProxyTest)}
  1560. }),
  1561. smalltalk.JSObjectProxyTest);
  1562. smalltalk.addMethod(
  1563. "_testYourself",
  1564. smalltalk.method({
  1565. selector: "testYourself",
  1566. fn: function (){
  1567. var self=this;
  1568. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1569. $ctx1.object=nil;
  1570. $1=_st(self)._jsObject();
  1571. _st($1)._d_("test");
  1572. $2=_st($1)._yourself();
  1573. $ctx1.locals.object=$2;
  1574. _st(self)._assert_equals_(_st($ctx1.locals.object)._d(),"test");
  1575. return self}, self, "testYourself", [], smalltalk.JSObjectProxyTest)}
  1576. }),
  1577. smalltalk.JSObjectProxyTest);
  1578. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1579. smalltalk.addMethod(
  1580. "_testAbs",
  1581. smalltalk.method({
  1582. selector: "testAbs",
  1583. fn: function (){
  1584. var self=this;
  1585. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._abs()).__eq((4)));
  1586. _st(self)._assert_(_st(_st((-4))._abs()).__eq((4)));
  1587. return self}, self, "testAbs", [], smalltalk.NumberTest)}
  1588. }),
  1589. smalltalk.NumberTest);
  1590. smalltalk.addMethod(
  1591. "_testArithmetic",
  1592. smalltalk.method({
  1593. selector: "testArithmetic",
  1594. fn: function (){
  1595. var self=this;
  1596. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1.5)).__plus((1))).__eq((2.5)));
  1597. _st(self)._assert_(_st(_st((2)).__minus((1))).__eq((1)));
  1598. _st(self)._assert_(_st(_st((-2)).__minus((1))).__eq((-3)));
  1599. _st(self)._assert_(_st(_st((12)).__slash((2))).__eq((6)));
  1600. _st(self)._assert_(_st(_st((3)).__star((4))).__eq((12)));
  1601. _st(self)._assert_(_st(_st(_st((1)).__plus((2))).__star((3))).__eq((9)));
  1602. _st(self)._assert_(_st(_st((1)).__plus(_st((2)).__star((3)))).__eq((7)));
  1603. return self}, self, "testArithmetic", [], smalltalk.NumberTest)}
  1604. }),
  1605. smalltalk.NumberTest);
  1606. smalltalk.addMethod(
  1607. "_testComparison",
  1608. smalltalk.method({
  1609. selector: "testComparison",
  1610. fn: function (){
  1611. var self=this;
  1612. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((3)).__gt((2)));
  1613. _st(self)._assert_(_st((2)).__lt((3)));
  1614. _st(self)._deny_(_st((3)).__lt((2)));
  1615. _st(self)._deny_(_st((2)).__gt((3)));
  1616. _st(self)._assert_(_st((3)).__gt_eq((3)));
  1617. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  1618. _st(self)._assert_(_st((3)).__lt_eq((3)));
  1619. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  1620. return self}, self, "testComparison", [], smalltalk.NumberTest)}
  1621. }),
  1622. smalltalk.NumberTest);
  1623. smalltalk.addMethod(
  1624. "_testCopying",
  1625. smalltalk.method({
  1626. selector: "testCopying",
  1627. fn: function (){
  1628. var self=this;
  1629. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  1630. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  1631. return self}, self, "testCopying", [], smalltalk.NumberTest)}
  1632. }),
  1633. smalltalk.NumberTest);
  1634. smalltalk.addMethod(
  1635. "_testEquality",
  1636. smalltalk.method({
  1637. selector: "testEquality",
  1638. fn: function (){
  1639. var self=this;
  1640. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq((1)));
  1641. _st(self)._assert_(_st((0)).__eq((0)));
  1642. _st(self)._deny_(_st((1)).__eq((0)));
  1643. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  1644. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  1645. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  1646. _st(self)._deny_(_st((0)).__eq(false));
  1647. _st(self)._deny_(_st(false).__eq((0)));
  1648. _st(self)._deny_(_st("").__eq((0)));
  1649. _st(self)._deny_(_st((0)).__eq(""));
  1650. return self}, self, "testEquality", [], smalltalk.NumberTest)}
  1651. }),
  1652. smalltalk.NumberTest);
  1653. smalltalk.addMethod(
  1654. "_testHexNumbers",
  1655. smalltalk.method({
  1656. selector: "testHexNumbers",
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((9)).__eq((9)));
  1660. _st(self)._assert_(_st(_st((10))._truncated()).__eq((10)));
  1661. _st(self)._assert_(_st(_st((11))._truncated()).__eq((11)));
  1662. _st(self)._assert_(_st(_st((12))._truncated()).__eq((12)));
  1663. _st(self)._assert_(_st(_st((13))._truncated()).__eq((13)));
  1664. _st(self)._assert_(_st(_st((14))._truncated()).__eq((14)));
  1665. _st(self)._assert_(_st(_st((15))._truncated()).__eq((15)));
  1666. return self}, self, "testHexNumbers", [], smalltalk.NumberTest)}
  1667. }),
  1668. smalltalk.NumberTest);
  1669. smalltalk.addMethod(
  1670. "_testIdentity",
  1671. smalltalk.method({
  1672. selector: "testIdentity",
  1673. fn: function (){
  1674. var self=this;
  1675. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq_eq((1)));
  1676. _st(self)._assert_(_st((0)).__eq_eq((0)));
  1677. _st(self)._deny_(_st((1)).__eq_eq((0)));
  1678. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  1679. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  1680. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  1681. _st(self)._deny_(_st((1)).__eq_eq((2)));
  1682. return self}, self, "testIdentity", [], smalltalk.NumberTest)}
  1683. }),
  1684. smalltalk.NumberTest);
  1685. smalltalk.addMethod(
  1686. "_testInvalidHexNumbers",
  1687. smalltalk.method({
  1688. selector: "testInvalidHexNumbers",
  1689. fn: function (){
  1690. var self=this;
  1691. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1692. return smalltalk.withContext(function($ctx2) { return _st((16))._rG();
  1693. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1694. _st(self)._should_raise_((function(){
  1695. return smalltalk.withContext(function($ctx2) { return _st((16))._rg();
  1696. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1697. _st(self)._should_raise_((function(){
  1698. return smalltalk.withContext(function($ctx2) { return _st((16))._rH();
  1699. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1700. _st(self)._should_raise_((function(){
  1701. return smalltalk.withContext(function($ctx2) { return _st((16))._rh();
  1702. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1703. _st(self)._should_raise_((function(){
  1704. return smalltalk.withContext(function($ctx2) { return _st((16))._rI();
  1705. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1706. _st(self)._should_raise_((function(){
  1707. return smalltalk.withContext(function($ctx2) { return _st((16))._ri();
  1708. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1709. _st(self)._should_raise_((function(){
  1710. return smalltalk.withContext(function($ctx2) { return _st((16))._rJ();
  1711. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1712. _st(self)._should_raise_((function(){
  1713. return smalltalk.withContext(function($ctx2) { return _st((16))._rj();
  1714. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1715. _st(self)._should_raise_((function(){
  1716. return smalltalk.withContext(function($ctx2) { return _st((16))._rK();
  1717. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1718. _st(self)._should_raise_((function(){
  1719. return smalltalk.withContext(function($ctx2) { return _st((16))._rk();
  1720. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1721. _st(self)._should_raise_((function(){
  1722. return smalltalk.withContext(function($ctx2) { return _st((16))._rL();
  1723. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1724. _st(self)._should_raise_((function(){
  1725. return smalltalk.withContext(function($ctx2) { return _st((16))._rl();
  1726. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1727. _st(self)._should_raise_((function(){
  1728. return smalltalk.withContext(function($ctx2) { return _st((16))._rM();
  1729. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1730. _st(self)._should_raise_((function(){
  1731. return smalltalk.withContext(function($ctx2) { return _st((16))._rm();
  1732. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1733. _st(self)._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) { return _st((16))._rN();
  1735. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1736. _st(self)._should_raise_((function(){
  1737. return smalltalk.withContext(function($ctx2) { return _st((16))._rn();
  1738. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1739. _st(self)._should_raise_((function(){
  1740. return smalltalk.withContext(function($ctx2) { return _st((16))._rO();
  1741. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1742. _st(self)._should_raise_((function(){
  1743. return smalltalk.withContext(function($ctx2) { return _st((16))._ro();
  1744. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1745. _st(self)._should_raise_((function(){
  1746. return smalltalk.withContext(function($ctx2) { return _st((16))._rP();
  1747. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1748. _st(self)._should_raise_((function(){
  1749. return smalltalk.withContext(function($ctx2) { return _st((16))._rp();
  1750. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1751. _st(self)._should_raise_((function(){
  1752. return smalltalk.withContext(function($ctx2) { return _st((16))._rQ();
  1753. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1754. _st(self)._should_raise_((function(){
  1755. return smalltalk.withContext(function($ctx2) { return _st((16))._rq();
  1756. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1757. _st(self)._should_raise_((function(){
  1758. return smalltalk.withContext(function($ctx2) { return _st((16))._rR();
  1759. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1760. _st(self)._should_raise_((function(){
  1761. return smalltalk.withContext(function($ctx2) { return _st((16))._rr();
  1762. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1763. _st(self)._should_raise_((function(){
  1764. return smalltalk.withContext(function($ctx2) { return _st((16))._rS();
  1765. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1766. _st(self)._should_raise_((function(){
  1767. return smalltalk.withContext(function($ctx2) { return _st((16))._rs();
  1768. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1769. _st(self)._should_raise_((function(){
  1770. return smalltalk.withContext(function($ctx2) { return _st((16))._rT();
  1771. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1772. _st(self)._should_raise_((function(){
  1773. return smalltalk.withContext(function($ctx2) { return _st((16))._rt();
  1774. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1775. _st(self)._should_raise_((function(){
  1776. return smalltalk.withContext(function($ctx2) { return _st((16))._rU();
  1777. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1778. _st(self)._should_raise_((function(){
  1779. return smalltalk.withContext(function($ctx2) { return _st((16))._ru();
  1780. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1781. _st(self)._should_raise_((function(){
  1782. return smalltalk.withContext(function($ctx2) { return _st((16))._rV();
  1783. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1784. _st(self)._should_raise_((function(){
  1785. return smalltalk.withContext(function($ctx2) { return _st((16))._rv();
  1786. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1787. _st(self)._should_raise_((function(){
  1788. return smalltalk.withContext(function($ctx2) { return _st((16))._rW();
  1789. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1790. _st(self)._should_raise_((function(){
  1791. return smalltalk.withContext(function($ctx2) { return _st((16))._rw();
  1792. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1793. _st(self)._should_raise_((function(){
  1794. return smalltalk.withContext(function($ctx2) { return _st((16))._rX();
  1795. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1796. _st(self)._should_raise_((function(){
  1797. return smalltalk.withContext(function($ctx2) { return _st((16))._rx();
  1798. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1799. _st(self)._should_raise_((function(){
  1800. return smalltalk.withContext(function($ctx2) { return _st((16))._rY();
  1801. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1802. _st(self)._should_raise_((function(){
  1803. return smalltalk.withContext(function($ctx2) { return _st((16))._ry();
  1804. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1805. _st(self)._should_raise_((function(){
  1806. return smalltalk.withContext(function($ctx2) { return _st((16))._rZ();
  1807. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1808. _st(self)._should_raise_((function(){
  1809. return smalltalk.withContext(function($ctx2) { return _st((16))._rz();
  1810. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1811. _st(self)._should_raise_((function(){
  1812. return smalltalk.withContext(function($ctx2) { return _st((11259375))._Z();
  1813. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1814. return self}, self, "testInvalidHexNumbers", [], smalltalk.NumberTest)}
  1815. }),
  1816. smalltalk.NumberTest);
  1817. smalltalk.addMethod(
  1818. "_testMinMax",
  1819. smalltalk.method({
  1820. selector: "testMinMax",
  1821. fn: function (){
  1822. var self=this;
  1823. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  1824. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  1825. return self}, self, "testMinMax", [], smalltalk.NumberTest)}
  1826. }),
  1827. smalltalk.NumberTest);
  1828. smalltalk.addMethod(
  1829. "_testNegated",
  1830. smalltalk.method({
  1831. selector: "testNegated",
  1832. fn: function (){
  1833. var self=this;
  1834. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._negated()).__eq((-3)));
  1835. _st(self)._assert_(_st(_st((-3))._negated()).__eq((3)));
  1836. return self}, self, "testNegated", [], smalltalk.NumberTest)}
  1837. }),
  1838. smalltalk.NumberTest);
  1839. smalltalk.addMethod(
  1840. "_testPrintShowingDecimalPlaces",
  1841. smalltalk.method({
  1842. selector: "testPrintShowingDecimalPlaces",
  1843. fn: function (){
  1844. var self=this;
  1845. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("23.00",_st((23))._printShowingDecimalPlaces_((2)));
  1846. _st(self)._assert_equals_("23.57",_st((23.5698))._printShowingDecimalPlaces_((2)));
  1847. _st(self)._assert_equals_("-234.56700",_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)));
  1848. _st(self)._assert_equals_("23",_st((23.4567))._printShowingDecimalPlaces_((0)));
  1849. _st(self)._assert_equals_("24",_st((23.5567))._printShowingDecimalPlaces_((0)));
  1850. _st(self)._assert_equals_("-23",_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)));
  1851. _st(self)._assert_equals_("-24",_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)));
  1852. _st(self)._assert_equals_("100000000.0",_st((100000000))._printShowingDecimalPlaces_((1)));
  1853. _st(self)._assert_equals_("0.98000",_st((0.98))._printShowingDecimalPlaces_((5)));
  1854. _st(self)._assert_equals_("-0.98",_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)));
  1855. _st(self)._assert_equals_("2.57",_st((2.567))._printShowingDecimalPlaces_((2)));
  1856. _st(self)._assert_equals_("-2.57",_st((-2.567))._printShowingDecimalPlaces_((2)));
  1857. _st(self)._assert_equals_("0.00",_st((0))._printShowingDecimalPlaces_((2)));
  1858. return self}, self, "testPrintShowingDecimalPlaces", [], smalltalk.NumberTest)}
  1859. }),
  1860. smalltalk.NumberTest);
  1861. smalltalk.addMethod(
  1862. "_testRounded",
  1863. smalltalk.method({
  1864. selector: "testRounded",
  1865. fn: function (){
  1866. var self=this;
  1867. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._rounded()).__eq((3)));
  1868. _st(self)._assert_(_st(_st((3.212))._rounded()).__eq((3)));
  1869. _st(self)._assert_(_st(_st((3.51))._rounded()).__eq((4)));
  1870. return self}, self, "testRounded", [], smalltalk.NumberTest)}
  1871. }),
  1872. smalltalk.NumberTest);
  1873. smalltalk.addMethod(
  1874. "_testSqrt",
  1875. smalltalk.method({
  1876. selector: "testSqrt",
  1877. fn: function (){
  1878. var self=this;
  1879. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._sqrt()).__eq((2)));
  1880. _st(self)._assert_(_st(_st((16))._sqrt()).__eq((4)));
  1881. return self}, self, "testSqrt", [], smalltalk.NumberTest)}
  1882. }),
  1883. smalltalk.NumberTest);
  1884. smalltalk.addMethod(
  1885. "_testSquared",
  1886. smalltalk.method({
  1887. selector: "testSquared",
  1888. fn: function (){
  1889. var self=this;
  1890. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._squared()).__eq((16)));
  1891. return self}, self, "testSquared", [], smalltalk.NumberTest)}
  1892. }),
  1893. smalltalk.NumberTest);
  1894. smalltalk.addMethod(
  1895. "_testTimesRepeat",
  1896. smalltalk.method({
  1897. selector: "testTimesRepeat",
  1898. fn: function (){
  1899. var self=this;
  1900. return smalltalk.withContext(function($ctx1) { $ctx1.i=nil;
  1901. $ctx1.locals.i=(0);
  1902. _st((0))._timesRepeat_((function(){
  1903. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  1904. return $ctx1.locals.i;
  1905. })}));
  1906. _st(self)._assert_equals_($ctx1.locals.i,(0));
  1907. _st((5))._timesRepeat_((function(){
  1908. return smalltalk.withContext(function($ctx2) { $ctx1.locals.i=_st($ctx1.locals.i).__plus((1));
  1909. return $ctx1.locals.i;
  1910. })}));
  1911. _st(self)._assert_equals_($ctx1.locals.i,(5));
  1912. return self}, self, "testTimesRepeat", [], smalltalk.NumberTest)}
  1913. }),
  1914. smalltalk.NumberTest);
  1915. smalltalk.addMethod(
  1916. "_testTo",
  1917. smalltalk.method({
  1918. selector: "testTo",
  1919. fn: function (){
  1920. var self=this;
  1921. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  1922. return self}, self, "testTo", [], smalltalk.NumberTest)}
  1923. }),
  1924. smalltalk.NumberTest);
  1925. smalltalk.addMethod(
  1926. "_testToBy",
  1927. smalltalk.method({
  1928. selector: "testToBy",
  1929. fn: function (){
  1930. var self=this;
  1931. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  1932. _st(self)._should_raise_((function(){
  1933. return smalltalk.withContext(function($ctx2) { return _st((1))._to_by_((4),(0));
  1934. })}),(smalltalk.Error || Error));
  1935. return self}, self, "testToBy", [], smalltalk.NumberTest)}
  1936. }),
  1937. smalltalk.NumberTest);
  1938. smalltalk.addMethod(
  1939. "_testTruncated",
  1940. smalltalk.method({
  1941. selector: "testTruncated",
  1942. fn: function (){
  1943. var self=this;
  1944. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._truncated()).__eq((3)));
  1945. _st(self)._assert_(_st(_st((3.212))._truncated()).__eq((3)));
  1946. _st(self)._assert_(_st(_st((3.51))._truncated()).__eq((3)));
  1947. return self}, self, "testTruncated", [], smalltalk.NumberTest)}
  1948. }),
  1949. smalltalk.NumberTest);
  1950. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1951. smalltalk.addMethod(
  1952. "_foo",
  1953. smalltalk.method({
  1954. selector: "foo",
  1955. fn: function (){
  1956. var self=this;
  1957. return smalltalk.withContext(function($ctx1) { return self["@foo"];
  1958. }, self, "foo", [], smalltalk.ObjectMock)}
  1959. }),
  1960. smalltalk.ObjectMock);
  1961. smalltalk.addMethod(
  1962. "_foo_",
  1963. smalltalk.method({
  1964. selector: "foo:",
  1965. fn: function (anObject){
  1966. var self=this;
  1967. return smalltalk.withContext(function($ctx1) { self["@foo"]=anObject;
  1968. return self}, self, "foo:", [anObject], smalltalk.ObjectMock)}
  1969. }),
  1970. smalltalk.ObjectMock);
  1971. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1972. smalltalk.addMethod(
  1973. "_notDefined",
  1974. smalltalk.method({
  1975. selector: "notDefined",
  1976. fn: function (){
  1977. var self=this;
  1978. return smalltalk.withContext(function($ctx1) { return undefined;;
  1979. ;
  1980. return self}, self, "notDefined", [], smalltalk.ObjectTest)}
  1981. }),
  1982. smalltalk.ObjectTest);
  1983. smalltalk.addMethod(
  1984. "_testBasicAccess",
  1985. smalltalk.method({
  1986. selector: "testBasicAccess",
  1987. fn: function (){
  1988. var self=this;
  1989. return smalltalk.withContext(function($ctx1) { $ctx1.o=nil;
  1990. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  1991. _st($ctx1.locals.o)._basicAt_put_("a",(1));
  1992. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicAt_("a"),(1));
  1993. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicAt_("b"),nil);
  1994. return self}, self, "testBasicAccess", [], smalltalk.ObjectTest)}
  1995. }),
  1996. smalltalk.ObjectTest);
  1997. smalltalk.addMethod(
  1998. "_testBasicPerform",
  1999. smalltalk.method({
  2000. selector: "testBasicPerform",
  2001. fn: function (){
  2002. var self=this;
  2003. return smalltalk.withContext(function($ctx1) { $ctx1.o=nil;
  2004. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2005. _st($ctx1.locals.o)._basicAt_put_("func",(function(){
  2006. return smalltalk.withContext(function($ctx2) { return "hello";
  2007. })}));
  2008. _st($ctx1.locals.o)._basicAt_put_("func2",(function(a){
  2009. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((1));
  2010. })}));
  2011. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicPerform_("func"),"hello");
  2012. _st(self)._assert_equals_(_st($ctx1.locals.o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2013. return self}, self, "testBasicPerform", [], smalltalk.ObjectTest)}
  2014. }),
  2015. smalltalk.ObjectTest);
  2016. smalltalk.addMethod(
  2017. "_testDNU",
  2018. smalltalk.method({
  2019. selector: "testDNU",
  2020. fn: function (){
  2021. var self=this;
  2022. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2023. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._foo();
  2024. })}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2025. return self}, self, "testDNU", [], smalltalk.ObjectTest)}
  2026. }),
  2027. smalltalk.ObjectTest);
  2028. smalltalk.addMethod(
  2029. "_testEquality",
  2030. smalltalk.method({
  2031. selector: "testEquality",
  2032. fn: function (){
  2033. var self=this;
  2034. return smalltalk.withContext(function($ctx1) { $ctx1.o=nil;
  2035. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2036. _st(self)._deny_(_st($ctx1.locals.o).__eq(_st((smalltalk.Object || Object))._new()));
  2037. _st(self)._assert_(_st($ctx1.locals.o).__eq($ctx1.locals.o));
  2038. _st(self)._assert_(_st(_st($ctx1.locals.o)._yourself()).__eq($ctx1.locals.o));
  2039. _st(self)._assert_(_st($ctx1.locals.o).__eq(_st($ctx1.locals.o)._yourself()));
  2040. return self}, self, "testEquality", [], smalltalk.ObjectTest)}
  2041. }),
  2042. smalltalk.ObjectTest);
  2043. smalltalk.addMethod(
  2044. "_testHalt",
  2045. smalltalk.method({
  2046. selector: "testHalt",
  2047. fn: function (){
  2048. var self=this;
  2049. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2050. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._halt();
  2051. })}),(smalltalk.Error || Error));
  2052. return self}, self, "testHalt", [], smalltalk.ObjectTest)}
  2053. }),
  2054. smalltalk.ObjectTest);
  2055. smalltalk.addMethod(
  2056. "_testIdentity",
  2057. smalltalk.method({
  2058. selector: "testIdentity",
  2059. fn: function (){
  2060. var self=this;
  2061. return smalltalk.withContext(function($ctx1) { $ctx1.o=nil;
  2062. $ctx1.locals.o=_st((smalltalk.Object || Object))._new();
  2063. _st(self)._deny_(_st($ctx1.locals.o).__eq_eq(_st((smalltalk.Object || Object))._new()));
  2064. _st(self)._assert_(_st($ctx1.locals.o).__eq_eq($ctx1.locals.o));
  2065. _st(self)._assert_(_st(_st($ctx1.locals.o)._yourself()).__eq_eq($ctx1.locals.o));
  2066. _st(self)._assert_(_st($ctx1.locals.o).__eq_eq(_st($ctx1.locals.o)._yourself()));
  2067. return self}, self, "testIdentity", [], smalltalk.ObjectTest)}
  2068. }),
  2069. smalltalk.ObjectTest);
  2070. smalltalk.addMethod(
  2071. "_testIfNil",
  2072. smalltalk.method({
  2073. selector: "testIfNil",
  2074. fn: function (){
  2075. var self=this;
  2076. return smalltalk.withContext(function($ctx1) { var $2,$1,$4,$3,$6,$5;
  2077. _st(self)._deny_(_st(_st((smalltalk.Object || Object))._new())._isNil());
  2078. $2=_st((smalltalk.Object || Object))._new();
  2079. if(($receiver = $2) == nil || $receiver == undefined){
  2080. $1=true;
  2081. } else {
  2082. $1=$2;
  2083. };
  2084. _st(self)._deny_(_st($1).__eq(true));
  2085. $4=_st((smalltalk.Object || Object))._new();
  2086. if(($receiver = $4) == nil || $receiver == undefined){
  2087. $3=$4;
  2088. } else {
  2089. $3=true;
  2090. };
  2091. _st(self)._assert_(_st($3).__eq(true));
  2092. $6=_st((smalltalk.Object || Object))._new();
  2093. if(($receiver = $6) == nil || $receiver == undefined){
  2094. $5=false;
  2095. } else {
  2096. $5=true;
  2097. };
  2098. _st(self)._assert_(_st($5).__eq(true));
  2099. _st(self)._assert_(_st(_st(_st((smalltalk.Object || Object))._new())._ifNotNil_ifNil_((function(){
  2100. return smalltalk.withContext(function($ctx2) { return true;
  2101. })}),(function(){
  2102. return smalltalk.withContext(function($ctx2) { return false;
  2103. })}))).__eq(true));
  2104. return self}, self, "testIfNil", [], smalltalk.ObjectTest)}
  2105. }),
  2106. smalltalk.ObjectTest);
  2107. smalltalk.addMethod(
  2108. "_testInstVars",
  2109. smalltalk.method({
  2110. selector: "testInstVars",
  2111. fn: function (){
  2112. var self=this;
  2113. return smalltalk.withContext(function($ctx1) { $ctx1.o=nil;
  2114. $ctx1.locals.o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  2115. _st(self)._assert_equals_(_st($ctx1.locals.o)._instVarAt_(smalltalk.symbolFor("foo")),nil);
  2116. _st($ctx1.locals.o)._instVarAt_put_(smalltalk.symbolFor("foo"),(1));
  2117. _st(self)._assert_equals_(_st($ctx1.locals.o)._instVarAt_(smalltalk.symbolFor("foo")),(1));
  2118. _st(self)._assert_equals_(_st($ctx1.locals.o)._instVarAt_("foo"),(1));
  2119. return self}, self, "testInstVars", [], smalltalk.ObjectTest)}
  2120. }),
  2121. smalltalk.ObjectTest);
  2122. smalltalk.addMethod(
  2123. "_testNilUndefined",
  2124. smalltalk.method({
  2125. selector: "testNilUndefined",
  2126. fn: function (){
  2127. var self=this;
  2128. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil).__eq(_st(self)._notDefined()));
  2129. return self}, self, "testNilUndefined", [], smalltalk.ObjectTest)}
  2130. }),
  2131. smalltalk.ObjectTest);
  2132. smalltalk.addMethod(
  2133. "_testYourself",
  2134. smalltalk.method({
  2135. selector: "testYourself",
  2136. fn: function (){
  2137. var self=this;
  2138. return smalltalk.withContext(function($ctx1) { $ctx1.o=nil;
  2139. $ctx1.locals.o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  2140. _st(self)._assert_(_st(_st($ctx1.locals.o)._yourself()).__eq_eq($ctx1.locals.o));
  2141. return self}, self, "testYourself", [], smalltalk.ObjectTest)}
  2142. }),
  2143. smalltalk.ObjectTest);
  2144. smalltalk.addMethod(
  2145. "_testidentityHash",
  2146. smalltalk.method({
  2147. selector: "testidentityHash",
  2148. fn: function (){
  2149. var self=this;
  2150. return smalltalk.withContext(function($ctx1) { $ctx1.o1=nil;
  2151. $ctx1.o2=nil;
  2152. $ctx1.locals.o1=_st((smalltalk.Object || Object))._new();
  2153. $ctx1.locals.o2=_st((smalltalk.Object || Object))._new();
  2154. _st(self)._assert_(_st(_st($ctx1.locals.o1)._identityHash()).__eq_eq(_st($ctx1.locals.o1)._identityHash()));
  2155. _st(self)._deny_(_st(_st($ctx1.locals.o1)._identityHash()).__eq_eq(_st($ctx1.locals.o2)._identityHash()));
  2156. return self}, self, "testidentityHash", [], smalltalk.ObjectTest)}
  2157. }),
  2158. smalltalk.ObjectTest);
  2159. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2160. smalltalk.addMethod(
  2161. "_setUp",
  2162. smalltalk.method({
  2163. selector: "setUp",
  2164. fn: function (){
  2165. var self=this;
  2166. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2167. self["@backUpCommitPathJs"]=_st((smalltalk.Package || Package))._defaultCommitPathJs();
  2168. self["@backUpCommitPathSt"]=_st((smalltalk.Package || Package))._defaultCommitPathSt();
  2169. _st((smalltalk.Package || Package))._resetCommitPaths();
  2170. self["@zorkPackage"]=_st(_st((smalltalk.Package || Package))._new())._name_("Zork");
  2171. $1=_st((smalltalk.Package || Package))._new();
  2172. _st($1)._name_("Grul");
  2173. _st($1)._commitPathJs_("server/grul/js");
  2174. _st($1)._commitPathSt_("grul/st");
  2175. $2=_st($1)._yourself();
  2176. self["@grulPackage"]=$2;
  2177. return self}, self, "setUp", [], smalltalk.PackageTest)}
  2178. }),
  2179. smalltalk.PackageTest);
  2180. smalltalk.addMethod(
  2181. "_tearDown",
  2182. smalltalk.method({
  2183. selector: "tearDown",
  2184. fn: function (){
  2185. var self=this;
  2186. return smalltalk.withContext(function($ctx1) { var $1;
  2187. _st((smalltalk.Package || Package))._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2188. $1=_st((smalltalk.Package || Package))._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2189. return self}, self, "tearDown", [], smalltalk.PackageTest)}
  2190. }),
  2191. smalltalk.PackageTest);
  2192. smalltalk.addMethod(
  2193. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2194. smalltalk.method({
  2195. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2196. fn: function (){
  2197. var self=this;
  2198. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  2199. return self}, self, "testGrulCommitPathJsShouldBeServerGrulJs", [], smalltalk.PackageTest)}
  2200. }),
  2201. smalltalk.PackageTest);
  2202. smalltalk.addMethod(
  2203. "_testGrulCommitPathStShouldBeGrulSt",
  2204. smalltalk.method({
  2205. selector: "testGrulCommitPathStShouldBeGrulSt",
  2206. fn: function (){
  2207. var self=this;
  2208. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  2209. return self}, self, "testGrulCommitPathStShouldBeGrulSt", [], smalltalk.PackageTest)}
  2210. }),
  2211. smalltalk.PackageTest);
  2212. smalltalk.addMethod(
  2213. "_testZorkCommitPathJsShouldBeJs",
  2214. smalltalk.method({
  2215. selector: "testZorkCommitPathJsShouldBeJs",
  2216. fn: function (){
  2217. var self=this;
  2218. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("js",_st(self["@zorkPackage"])._commitPathJs());
  2219. return self}, self, "testZorkCommitPathJsShouldBeJs", [], smalltalk.PackageTest)}
  2220. }),
  2221. smalltalk.PackageTest);
  2222. smalltalk.addMethod(
  2223. "_testZorkCommitPathStShouldBeSt",
  2224. smalltalk.method({
  2225. selector: "testZorkCommitPathStShouldBeSt",
  2226. fn: function (){
  2227. var self=this;
  2228. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("st",_st(self["@zorkPackage"])._commitPathSt());
  2229. return self}, self, "testZorkCommitPathStShouldBeSt", [], smalltalk.PackageTest)}
  2230. }),
  2231. smalltalk.PackageTest);
  2232. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2233. smalltalk.addMethod(
  2234. "_setUp",
  2235. smalltalk.method({
  2236. selector: "setUp",
  2237. fn: function (){
  2238. var self=this;
  2239. return smalltalk.withContext(function($ctx1) { var $1;
  2240. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  2241. _st((smalltalk.Package || Package))._defaultCommitPathJs_("javascripts/");
  2242. $1=_st((smalltalk.Package || Package))._defaultCommitPathSt_("smalltalk/");
  2243. return self}, self, "setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2244. }),
  2245. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2246. smalltalk.addMethod(
  2247. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2248. smalltalk.method({
  2249. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2250. fn: function (){
  2251. var self=this;
  2252. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  2253. return self}, self, "testGrulCommitPathJsShouldBeServerGrulJs", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2254. }),
  2255. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2256. smalltalk.addMethod(
  2257. "_testGrulCommitPathStShouldBeGrulSt",
  2258. smalltalk.method({
  2259. selector: "testGrulCommitPathStShouldBeGrulSt",
  2260. fn: function (){
  2261. var self=this;
  2262. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  2263. return self}, self, "testGrulCommitPathStShouldBeGrulSt", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2264. }),
  2265. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2266. smalltalk.addMethod(
  2267. "_testZorkCommitPathJsShouldBeJavascript",
  2268. smalltalk.method({
  2269. selector: "testZorkCommitPathJsShouldBeJavascript",
  2270. fn: function (){
  2271. var self=this;
  2272. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("javascripts/",_st(self["@zorkPackage"])._commitPathJs());
  2273. return self}, self, "testZorkCommitPathJsShouldBeJavascript", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2274. }),
  2275. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2276. smalltalk.addMethod(
  2277. "_testZorkCommitPathStShouldBeSmalltalk",
  2278. smalltalk.method({
  2279. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2280. fn: function (){
  2281. var self=this;
  2282. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("smalltalk/",_st(self["@zorkPackage"])._commitPathSt());
  2283. return self}, self, "testZorkCommitPathStShouldBeSmalltalk", [], smalltalk.PackageWithDefaultCommitPathChangedTest)}
  2284. }),
  2285. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2286. smalltalk.addMethod(
  2287. "_shouldInheritSelectors",
  2288. smalltalk.method({
  2289. selector: "shouldInheritSelectors",
  2290. fn: function (){
  2291. var self=this;
  2292. return smalltalk.withContext(function($ctx1) { return false;
  2293. }, self, "shouldInheritSelectors", [], smalltalk.PackageWithDefaultCommitPathChangedTest.klass)}
  2294. }),
  2295. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2296. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2297. smalltalk.addMethod(
  2298. "_testAccessing",
  2299. smalltalk.method({
  2300. selector: "testAccessing",
  2301. fn: function (){
  2302. var self=this;
  2303. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._x(),(3));
  2304. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._y(),(4));
  2305. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._x_((3)))._x(),(3));
  2306. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._y_((4)))._y(),(4));
  2307. return self}, self, "testAccessing", [], smalltalk.PointTest)}
  2308. }),
  2309. smalltalk.PointTest);
  2310. smalltalk.addMethod(
  2311. "_testArithmetic",
  2312. smalltalk.method({
  2313. selector: "testArithmetic",
  2314. fn: function (){
  2315. var self=this;
  2316. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((9),(16)));
  2317. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((6),(8)));
  2318. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((0),(0)));
  2319. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((2),(2)));
  2320. return self}, self, "testArithmetic", [], smalltalk.PointTest)}
  2321. }),
  2322. smalltalk.PointTest);
  2323. smalltalk.addMethod(
  2324. "_testAt",
  2325. smalltalk.method({
  2326. selector: "testAt",
  2327. fn: function (){
  2328. var self=this;
  2329. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st((smalltalk.Point || Point))._x_y_((3),(4)));
  2330. return self}, self, "testAt", [], smalltalk.PointTest)}
  2331. }),
  2332. smalltalk.PointTest);
  2333. smalltalk.addMethod(
  2334. "_testEgality",
  2335. smalltalk.method({
  2336. selector: "testEgality",
  2337. fn: function (){
  2338. var self=this;
  2339. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  2340. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  2341. return self}, self, "testEgality", [], smalltalk.PointTest)}
  2342. }),
  2343. smalltalk.PointTest);
  2344. smalltalk.addMethod(
  2345. "_testTranslateBy",
  2346. smalltalk.method({
  2347. selector: "testTranslateBy",
  2348. fn: function (){
  2349. var self=this;
  2350. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))));
  2351. _st(self)._assert_equals_(_st((3)).__at((2)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())));
  2352. _st(self)._assert_equals_(_st((5)).__at((6)),_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))));
  2353. _st(self)._assert_equals_(_st((0)).__at((3)),_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))));
  2354. return self}, self, "testTranslateBy", [], smalltalk.PointTest)}
  2355. }),
  2356. smalltalk.PointTest);
  2357. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2358. smalltalk.addMethod(
  2359. "_textNext",
  2360. smalltalk.method({
  2361. selector: "textNext",
  2362. fn: function (){
  2363. var self=this;
  2364. return smalltalk.withContext(function($ctx1) { _st((10000))._timesRepeat_((function(){
  2365. return smalltalk.withContext(function($ctx2) { $ctx2.current=nil;
  2366. $ctx2.next=nil;
  2367. $ctx2.locals.next=_st(_st((smalltalk.Random || Random))._new())._next();
  2368. $ctx2.locals.next;
  2369. _st(self)._assert_(_st($ctx2.locals.next).__gt_eq((0)));
  2370. _st(self)._assert_(_st($ctx2.locals.next).__lt((1)));
  2371. _st(self)._deny_(_st($ctx2.locals.current).__eq($ctx2.locals.next));
  2372. return _st($ctx2.locals.next).__eq($ctx2.locals.current);
  2373. })}));
  2374. return self}, self, "textNext", [], smalltalk.RandomTest)}
  2375. }),
  2376. smalltalk.RandomTest);
  2377. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2378. smalltalk.addMethod(
  2379. "_testAddRemove",
  2380. smalltalk.method({
  2381. selector: "testAddRemove",
  2382. fn: function (){
  2383. var self=this;
  2384. return smalltalk.withContext(function($ctx1) { $ctx1.set=nil;
  2385. $ctx1.locals.set=_st((smalltalk.Set || Set))._new();
  2386. _st(self)._assert_(_st($ctx1.locals.set)._isEmpty());
  2387. _st($ctx1.locals.set)._add_((3));
  2388. _st(self)._assert_(_st($ctx1.locals.set)._includes_((3)));
  2389. _st($ctx1.locals.set)._add_((5));
  2390. _st(self)._assert_(_st($ctx1.locals.set)._includes_((5)));
  2391. _st($ctx1.locals.set)._remove_((3));
  2392. _st(self)._deny_(_st($ctx1.locals.set)._includes_((3)));
  2393. return self}, self, "testAddRemove", [], smalltalk.SetTest)}
  2394. }),
  2395. smalltalk.SetTest);
  2396. smalltalk.addMethod(
  2397. "_testAt",
  2398. smalltalk.method({
  2399. selector: "testAt",
  2400. fn: function (){
  2401. var self=this;
  2402. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2403. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Set || Set))._new())._at_put_((1),(2));
  2404. })}),(smalltalk.Error || Error));
  2405. return self}, self, "testAt", [], smalltalk.SetTest)}
  2406. }),
  2407. smalltalk.SetTest);
  2408. smalltalk.addMethod(
  2409. "_testPrintString",
  2410. smalltalk.method({
  2411. selector: "testPrintString",
  2412. fn: function (){
  2413. var self=this;
  2414. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2415. $ctx1.set=nil;
  2416. $ctx1.locals.set=_st((smalltalk.Set || Set))._new();
  2417. _st(self)._assert_equals_("a Set ()",_st($ctx1.locals.set)._printString());
  2418. _st($ctx1.locals.set)._add_((1));
  2419. $1=_st($ctx1.locals.set)._add_((3));
  2420. _st(self)._assert_equals_("a Set (1 3)",_st($ctx1.locals.set)._printString());
  2421. _st($ctx1.locals.set)._add_("foo");
  2422. _st(self)._assert_equals_("a Set (1 3 'foo')",_st($ctx1.locals.set)._printString());
  2423. _st($ctx1.locals.set)._remove_((1));
  2424. $2=_st($ctx1.locals.set)._remove_((3));
  2425. _st(self)._assert_equals_("a Set ('foo')",_st($ctx1.locals.set)._printString());
  2426. _st($ctx1.locals.set)._add_((3));
  2427. _st(self)._assert_equals_("a Set ('foo' 3)",_st($ctx1.locals.set)._printString());
  2428. _st($ctx1.locals.set)._add_((3));
  2429. _st(self)._assert_equals_("a Set ('foo' 3)",_st($ctx1.locals.set)._printString());
  2430. return self}, self, "testPrintString", [], smalltalk.SetTest)}
  2431. }),
  2432. smalltalk.SetTest);
  2433. smalltalk.addMethod(
  2434. "_testSize",
  2435. smalltalk.method({
  2436. selector: "testSize",
  2437. fn: function (){
  2438. var self=this;
  2439. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._new())._size(),(0));
  2440. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (2), (3), (4)]))._size(),(4));
  2441. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (1), (1), (1)]))._size(),(1));
  2442. return self}, self, "testSize", [], smalltalk.SetTest)}
  2443. }),
  2444. smalltalk.SetTest);
  2445. smalltalk.addMethod(
  2446. "_testUnicity",
  2447. smalltalk.method({
  2448. selector: "testUnicity",
  2449. fn: function (){
  2450. var self=this;
  2451. return smalltalk.withContext(function($ctx1) { $ctx1.set=nil;
  2452. $ctx1.locals.set=_st((smalltalk.Set || Set))._new();
  2453. _st($ctx1.locals.set)._add_((21));
  2454. _st($ctx1.locals.set)._add_("hello");
  2455. _st($ctx1.locals.set)._add_((21));
  2456. _st(self)._assert_(_st(_st($ctx1.locals.set)._size()).__eq((2)));
  2457. _st($ctx1.locals.set)._add_("hello");
  2458. _st(self)._assert_(_st(_st($ctx1.locals.set)._size()).__eq((2)));
  2459. _st(self)._assert_equals_(_st($ctx1.locals.set)._asArray(),[(21), "hello"]);
  2460. return self}, self, "testUnicity", [], smalltalk.SetTest)}
  2461. }),
  2462. smalltalk.SetTest);
  2463. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2464. smalltalk.addMethod(
  2465. "_testCopying",
  2466. smalltalk.method({
  2467. selector: "testCopying",
  2468. fn: function (){
  2469. var self=this;
  2470. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(nil)._copy(),nil);
  2471. return self}, self, "testCopying", [], smalltalk.UndefinedTest)}
  2472. }),
  2473. smalltalk.UndefinedTest);
  2474. smalltalk.addMethod(
  2475. "_testDeepCopy",
  2476. smalltalk.method({
  2477. selector: "testDeepCopy",
  2478. fn: function (){
  2479. var self=this;
  2480. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  2481. return self}, self, "testDeepCopy", [], smalltalk.UndefinedTest)}
  2482. }),
  2483. smalltalk.UndefinedTest);
  2484. smalltalk.addMethod(
  2485. "_testIfNil",
  2486. smalltalk.method({
  2487. selector: "testIfNil",
  2488. fn: function (){
  2489. var self=this;
  2490. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  2491. if(($receiver = nil) == nil || $receiver == undefined){
  2492. $1=true;
  2493. } else {
  2494. $1=nil;
  2495. };
  2496. _st(self)._assert_equals_($1,true);
  2497. if(($receiver = nil) == nil || $receiver == undefined){
  2498. $2=nil;
  2499. } else {
  2500. $2=true;
  2501. };
  2502. _st(self)._deny_(_st($2).__eq(true));
  2503. if(($receiver = nil) == nil || $receiver == undefined){
  2504. $3=true;
  2505. } else {
  2506. $3=false;
  2507. };
  2508. _st(self)._assert_equals_($3,true);
  2509. _st(self)._deny_(_st(_st(nil)._ifNotNil_ifNil_((function(){
  2510. return smalltalk.withContext(function($ctx2) { return true;
  2511. })}),(function(){
  2512. return smalltalk.withContext(function($ctx2) { return false;
  2513. })}))).__eq(true));
  2514. return self}, self, "testIfNil", [], smalltalk.UndefinedTest)}
  2515. }),
  2516. smalltalk.UndefinedTest);
  2517. smalltalk.addMethod(
  2518. "_testIsNil",
  2519. smalltalk.method({
  2520. selector: "testIsNil",
  2521. fn: function (){
  2522. var self=this;
  2523. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil)._isNil());
  2524. _st(self)._deny_(_st(nil)._notNil());
  2525. return self}, self, "testIsNil", [], smalltalk.UndefinedTest)}
  2526. }),
  2527. smalltalk.UndefinedTest);