Kernel-Tests.deploy.js 139 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626
  1. smalltalk.addPackage('Kernel-Tests');
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "testCanClearInterval",
  6. fn: function (){
  7. var self=this;
  8. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  9. return smalltalk.withContext(function($ctx1) {
  10. _st(self)._shouldnt_raise_((function(){
  11. return smalltalk.withContext(function($ctx2) {
  12. return _st(_st((function(){
  13. return smalltalk.withContext(function($ctx3) {
  14. return _st(_st($Error())._new())._signal();
  15. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithInterval_((0)))._clearInterval();
  16. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  17. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  18. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]}),
  19. smalltalk.BlockClosureTest);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "testCanClearTimeout",
  23. fn: function (){
  24. var self=this;
  25. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  26. return smalltalk.withContext(function($ctx1) {
  27. _st(self)._shouldnt_raise_((function(){
  28. return smalltalk.withContext(function($ctx2) {
  29. return _st(_st((function(){
  30. return smalltalk.withContext(function($ctx3) {
  31. return _st(_st($Error())._new())._signal();
  32. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((0)))._clearTimeout();
  33. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  34. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  35. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]}),
  36. smalltalk.BlockClosureTest);
  37. smalltalk.addMethod(
  38. smalltalk.method({
  39. selector: "testCompiledSource",
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. _st(self)._assert_(_st(_st((function(){
  44. return smalltalk.withContext(function($ctx2) {
  45. return _st((1)).__plus((1));
  46. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  47. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  48. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]}),
  49. smalltalk.BlockClosureTest);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "testCurrySelf",
  53. fn: function (){
  54. var self=this;
  55. var curriedMethod,array;
  56. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  57. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58. return smalltalk.withContext(function($ctx1) {
  59. curriedMethod=_st(_st((function(selfarg,x){
  60. return smalltalk.withContext(function($ctx2) {
  61. return _st(selfarg)._at_(x);
  62. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  63. array=[(3), (1), (4)];
  64. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  65. _st((function(){
  66. return smalltalk.withContext(function($ctx2) {
  67. return _st(self)._assert_equals_(_st(array)._foo_((2)),(1));
  68. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  69. return smalltalk.withContext(function($ctx2) {
  70. return _st($Array())._removeCompiledMethod_(curriedMethod);
  71. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  72. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  73. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"]}),
  74. smalltalk.BlockClosureTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testEnsure",
  78. fn: function (){
  79. var self=this;
  80. return smalltalk.withContext(function($ctx1) {
  81. _st(self)._assert_equals_(_st((function(){
  82. return smalltalk.withContext(function($ctx2) {
  83. return (3);
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  85. return smalltalk.withContext(function($ctx2) {
  86. return (4);
  87. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  88. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  89. messageSends: ["assert:equals:", "ensure:"]}),
  90. smalltalk.BlockClosureTest);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "testEnsureRaises",
  94. fn: function (){
  95. var self=this;
  96. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  97. return smalltalk.withContext(function($ctx1) {
  98. _st(self)._should_raise_((function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. return _st((function(){
  101. return smalltalk.withContext(function($ctx3) {
  102. return _st(_st($Error())._new())._signal();
  103. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  104. return smalltalk.withContext(function($ctx3) {
  105. return true;
  106. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  108. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  109. messageSends: ["should:raise:", "ensure:", "signal", "new"]}),
  110. smalltalk.BlockClosureTest);
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testExceptionSemantics",
  114. fn: function (){
  115. var self=this;
  116. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  117. return smalltalk.withContext(function($ctx1) {
  118. _st(self)._timeout_((100));
  119. _st(_st(self)._async_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. _st(self)._assert_(true);
  124. _st($Error())._signal();
  125. _st(self)._deny_(true);
  126. return _st(self)._finished();
  127. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(self)._finished();
  130. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx1)})}));
  131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  132. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  133. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"]}),
  134. smalltalk.BlockClosureTest);
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "testNewWithValues",
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. function theTestPrototype() {
  142. this.name = "theTestPrototype";
  143. }
  144. function theTestConstructor(arg1, arg2, arg3) {}
  145. theTestConstructor.prototype = new theTestPrototype;
  146. var theWrappedConstructor = _st(theTestConstructor);
  147. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  148. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');;
  149. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  150. messageSends: []}),
  151. smalltalk.BlockClosureTest);
  152. smalltalk.addMethod(
  153. smalltalk.method({
  154. selector: "testNumArgs",
  155. fn: function (){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) {
  158. _st(self)._assert_equals_(_st((function(){
  159. return smalltalk.withContext(function($ctx2) {
  160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  161. _st(self)._assert_equals_(_st((function(a,b){
  162. return smalltalk.withContext(function($ctx2) {
  163. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  165. messageSends: ["assert:equals:", "numArgs"]}),
  166. smalltalk.BlockClosureTest);
  167. smalltalk.addMethod(
  168. smalltalk.method({
  169. selector: "testOnDo",
  170. fn: function (){
  171. var self=this;
  172. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  173. return smalltalk.withContext(function($ctx1) {
  174. _st(self)._assert_(_st((function(){
  175. return smalltalk.withContext(function($ctx2) {
  176. return _st(_st($Error())._new())._signal();
  177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  178. return smalltalk.withContext(function($ctx2) {
  179. return true;
  180. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  181. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  182. messageSends: ["assert:", "on:do:", "signal", "new"]}),
  183. smalltalk.BlockClosureTest);
  184. smalltalk.addMethod(
  185. smalltalk.method({
  186. selector: "testValue",
  187. fn: function (){
  188. var self=this;
  189. return smalltalk.withContext(function($ctx1) {
  190. _st(self)._assert_equals_(_st((function(){
  191. return smalltalk.withContext(function($ctx2) {
  192. return _st((1)).__plus((1));
  193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  194. _st(self)._assert_equals_(_st((function(x){
  195. return smalltalk.withContext(function($ctx2) {
  196. return _st(x).__plus((1));
  197. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  198. _st(self)._assert_equals_(_st((function(x,y){
  199. return smalltalk.withContext(function($ctx2) {
  200. return _st(x).__star(y);
  201. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  202. _st(self)._assert_equals_(_st((function(a,b,c){
  203. return smalltalk.withContext(function($ctx2) {
  204. return (1);
  205. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  206. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  207. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]}),
  208. smalltalk.BlockClosureTest);
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "testValueWithPossibleArguments",
  212. fn: function (){
  213. var self=this;
  214. return smalltalk.withContext(function($ctx1) {
  215. _st(self)._assert_equals_(_st((function(){
  216. return smalltalk.withContext(function($ctx2) {
  217. return (1);
  218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  219. _st(self)._assert_equals_(_st((function(a){
  220. return smalltalk.withContext(function($ctx2) {
  221. return _st(a).__plus((4));
  222. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  223. _st(self)._assert_equals_(_st((function(a,b){
  224. return smalltalk.withContext(function($ctx2) {
  225. return _st(a).__plus(b);
  226. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  227. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  228. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]}),
  229. smalltalk.BlockClosureTest);
  230. smalltalk.addMethod(
  231. smalltalk.method({
  232. selector: "testWhileFalse",
  233. fn: function (){
  234. var self=this;
  235. var i;
  236. return smalltalk.withContext(function($ctx1) {
  237. i=(0);
  238. _st((function(){
  239. return smalltalk.withContext(function($ctx2) {
  240. return _st(i).__gt((5));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  242. return smalltalk.withContext(function($ctx2) {
  243. i=_st(i).__plus((1));
  244. return i;
  245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  246. _st(self)._assert_equals_(i,(6));
  247. i=(0);
  248. _st((function(){
  249. return smalltalk.withContext(function($ctx2) {
  250. i=_st(i).__plus((1));
  251. i;
  252. return _st(i).__gt((5));
  253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  254. _st(self)._assert_equals_(i,(6));
  255. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  256. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"]}),
  257. smalltalk.BlockClosureTest);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "testWhileTrue",
  261. fn: function (){
  262. var self=this;
  263. var i;
  264. return smalltalk.withContext(function($ctx1) {
  265. i=(0);
  266. _st((function(){
  267. return smalltalk.withContext(function($ctx2) {
  268. return _st(i).__lt((5));
  269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  270. return smalltalk.withContext(function($ctx2) {
  271. i=_st(i).__plus((1));
  272. return i;
  273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  274. _st(self)._assert_equals_(i,(5));
  275. i=(0);
  276. _st((function(){
  277. return smalltalk.withContext(function($ctx2) {
  278. i=_st(i).__plus((1));
  279. i;
  280. return _st(i).__lt((5));
  281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  282. _st(self)._assert_equals_(i,(5));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  284. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"]}),
  285. smalltalk.BlockClosureTest);
  286. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  287. smalltalk.addMethod(
  288. smalltalk.method({
  289. selector: "testEquality",
  290. fn: function (){
  291. var self=this;
  292. return smalltalk.withContext(function($ctx1) {
  293. _st(self)._deny_(_st((0)).__eq(false));
  294. _st(self)._deny_(_st(false).__eq((0)));
  295. _st(self)._deny_(_st("").__eq(false));
  296. _st(self)._deny_(_st(false).__eq(""));
  297. _st(self)._assert_(_st(true).__eq(true));
  298. _st(self)._deny_(_st(false).__eq(true));
  299. _st(self)._deny_(_st(true).__eq(false));
  300. _st(self)._assert_(_st(false).__eq(false));
  301. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  302. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  303. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  304. messageSends: ["deny:", "=", "assert:", "yourself"]}),
  305. smalltalk.BooleanTest);
  306. smalltalk.addMethod(
  307. smalltalk.method({
  308. selector: "testIdentity",
  309. fn: function (){
  310. var self=this;
  311. return smalltalk.withContext(function($ctx1) {
  312. _st(self)._deny_(_st((0)).__eq_eq(false));
  313. _st(self)._deny_(_st(false).__eq_eq((0)));
  314. _st(self)._deny_(_st("").__eq_eq(false));
  315. _st(self)._deny_(_st(false).__eq_eq(""));
  316. _st(self)._assert_(_st(true).__eq_eq(true));
  317. _st(self)._deny_(_st(false).__eq_eq(true));
  318. _st(self)._deny_(_st(true).__eq_eq(false));
  319. _st(self)._assert_(_st(false).__eq_eq(false));
  320. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  321. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  322. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  323. messageSends: ["deny:", "==", "assert:", "yourself"]}),
  324. smalltalk.BooleanTest);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "testIfTrueIfFalse",
  328. fn: function (){
  329. var self=this;
  330. return smalltalk.withContext(function($ctx1) {
  331. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  332. $1=self;
  333. if(smalltalk.assert(true)){
  334. $2="alternative block";
  335. };
  336. _st($1)._assert_equals_($2,"alternative block");
  337. $3=self;
  338. if(! smalltalk.assert(true)){
  339. $4="alternative block";
  340. };
  341. _st($3)._assert_equals_($4,nil);
  342. $5=self;
  343. if(smalltalk.assert(false)){
  344. $6="alternative block";
  345. };
  346. _st($5)._assert_equals_($6,nil);
  347. $7=self;
  348. if(! smalltalk.assert(false)){
  349. $8="alternative block";
  350. };
  351. _st($7)._assert_equals_($8,"alternative block");
  352. $9=self;
  353. if(smalltalk.assert(false)){
  354. $10="alternative block";
  355. } else {
  356. $10="alternative block2";
  357. };
  358. _st($9)._assert_equals_($10,"alternative block2");
  359. $11=self;
  360. if(smalltalk.assert(false)){
  361. $12="alternative block2";
  362. } else {
  363. $12="alternative block";
  364. };
  365. _st($11)._assert_equals_($12,"alternative block");
  366. $13=self;
  367. if(smalltalk.assert(true)){
  368. $14="alternative block";
  369. } else {
  370. $14="alternative block2";
  371. };
  372. _st($13)._assert_equals_($14,"alternative block");
  373. $15=self;
  374. if(smalltalk.assert(true)){
  375. $16="alternative block2";
  376. } else {
  377. $16="alternative block";
  378. };
  379. _st($15)._assert_equals_($16,"alternative block2");
  380. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  381. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]}),
  382. smalltalk.BooleanTest);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "testIfTrueIfFalseWithBoxing",
  386. fn: function (){
  387. var self=this;
  388. return smalltalk.withContext(function($ctx1) {
  389. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  390. $1=self;
  391. $3=_st(true)._yourself();
  392. if(smalltalk.assert($3)){
  393. $2="alternative block";
  394. };
  395. _st($1)._assert_equals_($2,"alternative block");
  396. $4=self;
  397. $6=_st(true)._yourself();
  398. if(! smalltalk.assert($6)){
  399. $5="alternative block";
  400. };
  401. _st($4)._assert_equals_($5,nil);
  402. $7=self;
  403. $9=_st(false)._yourself();
  404. if(smalltalk.assert($9)){
  405. $8="alternative block";
  406. };
  407. _st($7)._assert_equals_($8,nil);
  408. $10=self;
  409. $12=_st(false)._yourself();
  410. if(! smalltalk.assert($12)){
  411. $11="alternative block";
  412. };
  413. _st($10)._assert_equals_($11,"alternative block");
  414. $13=self;
  415. $15=_st(false)._yourself();
  416. if(smalltalk.assert($15)){
  417. $14="alternative block";
  418. } else {
  419. $14="alternative block2";
  420. };
  421. _st($13)._assert_equals_($14,"alternative block2");
  422. $16=self;
  423. $18=_st(false)._yourself();
  424. if(smalltalk.assert($18)){
  425. $17="alternative block2";
  426. } else {
  427. $17="alternative block";
  428. };
  429. _st($16)._assert_equals_($17,"alternative block");
  430. $19=self;
  431. $21=_st(true)._yourself();
  432. if(smalltalk.assert($21)){
  433. $20="alternative block";
  434. } else {
  435. $20="alternative block2";
  436. };
  437. _st($19)._assert_equals_($20,"alternative block");
  438. $22=self;
  439. $24=_st(true)._yourself();
  440. if(smalltalk.assert($24)){
  441. $23="alternative block2";
  442. } else {
  443. $23="alternative block";
  444. };
  445. _st($22)._assert_equals_($23,"alternative block2");
  446. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  447. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]}),
  448. smalltalk.BooleanTest);
  449. smalltalk.addMethod(
  450. smalltalk.method({
  451. selector: "testLogic",
  452. fn: function (){
  453. var self=this;
  454. return smalltalk.withContext(function($ctx1) {
  455. var $1,$2,$3,$4,$5,$6,$7,$8;
  456. $1=self;
  457. _st($1)._assert_(_st(true).__and(true));
  458. _st($1)._deny_(_st(true).__and(false));
  459. _st($1)._deny_(_st(false).__and(true));
  460. $2=_st($1)._deny_(_st(false).__and(false));
  461. $3=self;
  462. _st($3)._assert_(_st(true).__or(true));
  463. _st($3)._assert_(_st(true).__or(false));
  464. _st($3)._assert_(_st(false).__or(true));
  465. $4=_st($3)._deny_(_st(false).__or(false));
  466. $5=self;
  467. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  468. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  469. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  470. $7=self;
  471. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  472. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  473. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  474. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  475. messageSends: ["assert:", "&", "deny:", "|", ">"]}),
  476. smalltalk.BooleanTest);
  477. smalltalk.addMethod(
  478. smalltalk.method({
  479. selector: "testLogicKeywords",
  480. fn: function (){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) {
  483. var $1,$2,$3,$4,$5,$6,$7,$8;
  484. $1=self;
  485. _st($1)._assert_(_st(true)._and_((function(){
  486. return smalltalk.withContext(function($ctx2) {
  487. return true;
  488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  489. _st($1)._deny_(_st(true)._and_((function(){
  490. return smalltalk.withContext(function($ctx2) {
  491. return false;
  492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  493. _st($1)._deny_(_st(false)._and_((function(){
  494. return smalltalk.withContext(function($ctx2) {
  495. return true;
  496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  497. $2=_st($1)._deny_(_st(false)._and_((function(){
  498. return smalltalk.withContext(function($ctx2) {
  499. return false;
  500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  501. $3=self;
  502. _st($3)._assert_(_st(true)._or_((function(){
  503. return smalltalk.withContext(function($ctx2) {
  504. return true;
  505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  506. _st($3)._assert_(_st(true)._or_((function(){
  507. return smalltalk.withContext(function($ctx2) {
  508. return false;
  509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  510. _st($3)._assert_(_st(false)._or_((function(){
  511. return smalltalk.withContext(function($ctx2) {
  512. return true;
  513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  514. $4=_st($3)._deny_(_st(false)._or_((function(){
  515. return smalltalk.withContext(function($ctx2) {
  516. return false;
  517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  518. $5=self;
  519. _st($5)._assert_(_st(true)._and_((function(){
  520. return smalltalk.withContext(function($ctx2) {
  521. return _st((1)).__gt((0));
  522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  523. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  524. return smalltalk.withContext(function($ctx2) {
  525. return false;
  526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  527. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  528. return smalltalk.withContext(function($ctx2) {
  529. return _st((1)).__gt((2));
  530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  531. $7=self;
  532. _st($7)._assert_(_st(false)._or_((function(){
  533. return smalltalk.withContext(function($ctx2) {
  534. return _st((1)).__gt((0));
  535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  536. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  537. return smalltalk.withContext(function($ctx2) {
  538. return false;
  539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  540. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  541. return smalltalk.withContext(function($ctx2) {
  542. return _st((1)).__gt((2));
  543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  544. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  545. messageSends: ["assert:", "and:", "deny:", "or:", ">"]}),
  546. smalltalk.BooleanTest);
  547. smalltalk.addMethod(
  548. smalltalk.method({
  549. selector: "testNonBooleanError",
  550. fn: function (){
  551. var self=this;
  552. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  553. return smalltalk.withContext(function($ctx1) {
  554. _st(self)._should_raise_((function(){
  555. return smalltalk.withContext(function($ctx2) {
  556. if(smalltalk.assert("")){
  557. } else {
  558. };
  559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$NonBooleanReceiver());
  560. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  561. messageSends: ["should:raise:", "ifTrue:ifFalse:"]}),
  562. smalltalk.BooleanTest);
  563. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  564. smalltalk.addMethod(
  565. smalltalk.method({
  566. selector: "setUp",
  567. fn: function (){
  568. var self=this;
  569. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  570. return smalltalk.withContext(function($ctx1) {
  571. self["@builder"]=_st($ClassBuilder())._new();
  572. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  573. messageSends: ["new"]}),
  574. smalltalk.ClassBuilderTest);
  575. smalltalk.addMethod(
  576. smalltalk.method({
  577. selector: "tearDown",
  578. fn: function (){
  579. var self=this;
  580. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  581. return smalltalk.withContext(function($ctx1) {
  582. var $1;
  583. $1=self["@theClass"];
  584. if(($receiver = $1) == nil || $receiver == undefined){
  585. $1;
  586. } else {
  587. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  588. self["@theClass"]=nil;
  589. self["@theClass"];
  590. };
  591. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  592. messageSends: ["ifNotNil:", "removeClass:", "current"]}),
  593. smalltalk.ClassBuilderTest);
  594. smalltalk.addMethod(
  595. smalltalk.method({
  596. selector: "testClassCopy",
  597. fn: function (){
  598. var self=this;
  599. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  600. return smalltalk.withContext(function($ctx1) {
  601. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  602. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  603. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  604. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  605. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  606. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  607. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  608. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]}),
  609. smalltalk.ClassBuilderTest);
  610. smalltalk.addMethod(
  611. smalltalk.method({
  612. selector: "testClassMigration",
  613. fn: function (){
  614. var self=this;
  615. var instance,oldClass;
  616. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  617. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  618. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  619. return smalltalk.withContext(function($ctx1) {
  620. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  621. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  622. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  623. _st(self)._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  624. _st(self)._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  625. _st(self)._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  626. _st(self)._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  627. _st(self)._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  628. _st(self)._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  629. _st(self)._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  630. _st(self)._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  631. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  632. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  633. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]}),
  634. smalltalk.ClassBuilderTest);
  635. smalltalk.addMethod(
  636. smalltalk.method({
  637. selector: "testClassMigrationWithClassInstanceVariables",
  638. fn: function (){
  639. var self=this;
  640. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  641. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  642. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  643. return smalltalk.withContext(function($ctx1) {
  644. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  645. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  646. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  647. _st(self)._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  648. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  649. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  650. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"]}),
  651. smalltalk.ClassBuilderTest);
  652. smalltalk.addMethod(
  653. smalltalk.method({
  654. selector: "testClassMigrationWithSubclasses",
  655. fn: function (){
  656. var self=this;
  657. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  658. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  659. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  660. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  661. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  662. return smalltalk.withContext(function($ctx1) {
  663. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  664. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  665. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  666. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  667. _st(self)._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  668. _st(self)._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  669. _st(self)._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  670. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  671. return smalltalk.withContext(function($ctx2) {
  672. return _st(_st($Smalltalk())._current())._removeClass_(each);
  673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  674. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  675. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"]}),
  676. smalltalk.ClassBuilderTest);
  677. smalltalk.addMethod(
  678. smalltalk.method({
  679. selector: "testInstanceVariableNames",
  680. fn: function (){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) {
  683. _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  684. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  685. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]}),
  686. smalltalk.ClassBuilderTest);
  687. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  688. smalltalk.addMethod(
  689. smalltalk.method({
  690. selector: "assertSameContents:as:",
  691. fn: function (aCollection,anotherCollection){
  692. var self=this;
  693. return smalltalk.withContext(function($ctx1) {
  694. _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  695. _st(aCollection)._do_((function(each){
  696. return smalltalk.withContext(function($ctx2) {
  697. return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  699. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  700. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]}),
  701. smalltalk.CollectionTest);
  702. smalltalk.addMethod(
  703. smalltalk.method({
  704. selector: "collection",
  705. fn: function (){
  706. var self=this;
  707. return smalltalk.withContext(function($ctx1) {
  708. var $1;
  709. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  710. return $1;
  711. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  712. messageSends: ["withAll:", "defaultValues", "collectionClass"]}),
  713. smalltalk.CollectionTest);
  714. smalltalk.addMethod(
  715. smalltalk.method({
  716. selector: "collectionClass",
  717. fn: function (){
  718. var self=this;
  719. return smalltalk.withContext(function($ctx1) {
  720. var $1;
  721. $1=_st(_st(self)._class())._collectionClass();
  722. return $1;
  723. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  724. messageSends: ["collectionClass", "class"]}),
  725. smalltalk.CollectionTest);
  726. smalltalk.addMethod(
  727. smalltalk.method({
  728. selector: "collectionWithDuplicates",
  729. fn: function (){
  730. var self=this;
  731. return smalltalk.withContext(function($ctx1) {
  732. var $1;
  733. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  734. return $1;
  735. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  736. messageSends: ["withAll:", "collectionClass"]}),
  737. smalltalk.CollectionTest);
  738. smalltalk.addMethod(
  739. smalltalk.method({
  740. selector: "defaultValues",
  741. fn: function (){
  742. var self=this;
  743. return smalltalk.withContext(function($ctx1) {
  744. var $1;
  745. $1=[(1), (2), (3), (-4)];
  746. return $1;
  747. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  748. messageSends: []}),
  749. smalltalk.CollectionTest);
  750. smalltalk.addMethod(
  751. smalltalk.method({
  752. selector: "isCollectionReadOnly",
  753. fn: function (){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) {
  756. return false;
  757. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  758. messageSends: []}),
  759. smalltalk.CollectionTest);
  760. smalltalk.addMethod(
  761. smalltalk.method({
  762. selector: "testAsArray",
  763. fn: function (){
  764. var self=this;
  765. return smalltalk.withContext(function($ctx1) {
  766. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  767. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  768. messageSends: ["assertSameContents:as:", "collection", "asArray"]}),
  769. smalltalk.CollectionTest);
  770. smalltalk.addMethod(
  771. smalltalk.method({
  772. selector: "testAsOrderedCollection",
  773. fn: function (){
  774. var self=this;
  775. return smalltalk.withContext(function($ctx1) {
  776. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  777. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  778. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]}),
  779. smalltalk.CollectionTest);
  780. smalltalk.addMethod(
  781. smalltalk.method({
  782. selector: "testAsSet",
  783. fn: function (){
  784. var self=this;
  785. var c,set;
  786. return smalltalk.withContext(function($ctx1) {
  787. c=_st(self)._collectionWithDuplicates();
  788. set=_st(c)._asSet();
  789. _st(self)._assert_equals_(_st(set)._size(),(5));
  790. _st(c)._do_((function(each){
  791. return smalltalk.withContext(function($ctx2) {
  792. return _st(self)._assert_(_st(set)._includes_(each));
  793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  794. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  795. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]}),
  796. smalltalk.CollectionTest);
  797. smalltalk.addMethod(
  798. smalltalk.method({
  799. selector: "testCollect",
  800. fn: function (){
  801. var self=this;
  802. var newCollection;
  803. return smalltalk.withContext(function($ctx1) {
  804. newCollection=[(1), (2), (3), (4)];
  805. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  806. return smalltalk.withContext(function($ctx2) {
  807. return _st(each)._abs();
  808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  809. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  810. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"]}),
  811. smalltalk.CollectionTest);
  812. smalltalk.addMethod(
  813. smalltalk.method({
  814. selector: "testDetect",
  815. fn: function (){
  816. var self=this;
  817. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  818. return smalltalk.withContext(function($ctx1) {
  819. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  820. return smalltalk.withContext(function($ctx2) {
  821. return _st(each).__lt((0));
  822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  823. _st(self)._should_raise_((function(){
  824. return smalltalk.withContext(function($ctx2) {
  825. return _st(_st(self)._collection())._detect_((function(each){
  826. return smalltalk.withContext(function($ctx3) {
  827. return _st(each).__eq((6));
  828. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  830. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  831. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="]}),
  832. smalltalk.CollectionTest);
  833. smalltalk.addMethod(
  834. smalltalk.method({
  835. selector: "testDo",
  836. fn: function (){
  837. var self=this;
  838. var newCollection;
  839. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  840. return smalltalk.withContext(function($ctx1) {
  841. newCollection=_st($OrderedCollection())._new();
  842. _st(_st(self)._collection())._do_((function(each){
  843. return smalltalk.withContext(function($ctx2) {
  844. return _st(newCollection)._add_(each);
  845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  846. _st(self)._assertSameContents_as_(_st(self)._collection(),newCollection);
  847. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  848. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"]}),
  849. smalltalk.CollectionTest);
  850. smalltalk.addMethod(
  851. smalltalk.method({
  852. selector: "testIsEmpty",
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  857. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  858. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  859. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]}),
  860. smalltalk.CollectionTest);
  861. smalltalk.addMethod(
  862. smalltalk.method({
  863. selector: "testSelect",
  864. fn: function (){
  865. var self=this;
  866. var newCollection;
  867. return smalltalk.withContext(function($ctx1) {
  868. newCollection=[(2), (-4)];
  869. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  870. return smalltalk.withContext(function($ctx2) {
  871. return _st(each)._even();
  872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  873. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  874. messageSends: ["assertSameContents:as:", "select:", "even", "collection"]}),
  875. smalltalk.CollectionTest);
  876. smalltalk.addMethod(
  877. smalltalk.method({
  878. selector: "testSize",
  879. fn: function (){
  880. var self=this;
  881. return smalltalk.withContext(function($ctx1) {
  882. _st(self)._assert_equals_(_st(_st(_st(self)._collectionClass())._new())._size(),(0));
  883. _st(self)._assert_equals_(_st(_st(self)._collection())._size(),(4));
  884. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  885. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"]}),
  886. smalltalk.CollectionTest);
  887. smalltalk.addMethod(
  888. smalltalk.method({
  889. selector: "collectionClass",
  890. fn: function (){
  891. var self=this;
  892. return smalltalk.withContext(function($ctx1) {
  893. return nil;
  894. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  895. messageSends: []}),
  896. smalltalk.CollectionTest.klass);
  897. smalltalk.addMethod(
  898. smalltalk.method({
  899. selector: "isAbstract",
  900. fn: function (){
  901. var self=this;
  902. return smalltalk.withContext(function($ctx1) {
  903. var $1;
  904. $1=_st(_st(self)._collectionClass())._isNil();
  905. return $1;
  906. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  907. messageSends: ["isNil", "collectionClass"]}),
  908. smalltalk.CollectionTest.klass);
  909. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  910. smalltalk.addMethod(
  911. smalltalk.method({
  912. selector: "testAt",
  913. fn: function (){
  914. var self=this;
  915. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  916. return smalltalk.withContext(function($ctx1) {
  917. _st(self)._assert_equals_(_st(_st(self)._collection())._at_((4)),(-4));
  918. _st(self)._should_raise_((function(){
  919. return smalltalk.withContext(function($ctx2) {
  920. return _st(_st(self)._collection())._at_((5));
  921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  922. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  923. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"]}),
  924. smalltalk.IndexableCollectionTest);
  925. smalltalk.addMethod(
  926. smalltalk.method({
  927. selector: "testAtIfAbsent",
  928. fn: function (){
  929. var self=this;
  930. return smalltalk.withContext(function($ctx1) {
  931. _st(self)._assert_equals_(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  932. return smalltalk.withContext(function($ctx2) {
  933. return "none";
  934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  935. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  936. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"]}),
  937. smalltalk.IndexableCollectionTest);
  938. smalltalk.addMethod(
  939. smalltalk.method({
  940. selector: "testContains",
  941. fn: function (){
  942. var self=this;
  943. var collection;
  944. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  945. return smalltalk.withContext(function($ctx1) {
  946. collection=_st(self)._collection();
  947. _st(self)._assert_(_st(_st(self)._collection())._contains_((function(each){
  948. return smalltalk.withContext(function($ctx2) {
  949. return _st(each).__eq(_st(_st(self)._collection())._first());
  950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  951. _st(self)._deny_(_st(_st(self)._collection())._contains_((function(each){
  952. return smalltalk.withContext(function($ctx2) {
  953. return _st(each).__eq(_st($Object())._new());
  954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  955. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  956. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"]}),
  957. smalltalk.IndexableCollectionTest);
  958. smalltalk.addMethod(
  959. smalltalk.method({
  960. selector: "testIndexOf",
  961. fn: function (){
  962. var self=this;
  963. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  964. return smalltalk.withContext(function($ctx1) {
  965. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_((2)),(2));
  966. _st(self)._should_raise_((function(){
  967. return smalltalk.withContext(function($ctx2) {
  968. return _st(_st(self)._collection())._indexOf_((999));
  969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  970. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  971. return smalltalk.withContext(function($ctx2) {
  972. return "sentinel";
  973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  974. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  975. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  976. smalltalk.IndexableCollectionTest);
  977. smalltalk.addMethod(
  978. smalltalk.method({
  979. selector: "testWithIndexDo",
  980. fn: function (){
  981. var self=this;
  982. var collection;
  983. return smalltalk.withContext(function($ctx1) {
  984. collection=_st(self)._collection();
  985. _st(_st(self)._collection())._withIndexDo_((function(each,index){
  986. return smalltalk.withContext(function($ctx2) {
  987. return _st(self)._assert_equals_(_st(collection)._at_(index),each);
  988. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  989. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  990. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]}),
  991. smalltalk.IndexableCollectionTest);
  992. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  993. smalltalk.addMethod(
  994. smalltalk.method({
  995. selector: "collection",
  996. fn: function (){
  997. var self=this;
  998. return smalltalk.withContext(function($ctx1) {
  999. var $1;
  1000. $1=smalltalk.HashedCollection._fromPairs_([_st("b").__minus_gt((1)),_st("a").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  1001. return $1;
  1002. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1003. messageSends: ["->"]}),
  1004. smalltalk.HashedCollectionTest);
  1005. smalltalk.addMethod(
  1006. smalltalk.method({
  1007. selector: "collectionWithDuplicates",
  1008. fn: function (){
  1009. var self=this;
  1010. return smalltalk.withContext(function($ctx1) {
  1011. var $1;
  1012. $1=smalltalk.HashedCollection._fromPairs_([_st("b").__minus_gt((1)),_st("a").__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))]);
  1013. return $1;
  1014. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1015. messageSends: ["->"]}),
  1016. smalltalk.HashedCollectionTest);
  1017. smalltalk.addMethod(
  1018. smalltalk.method({
  1019. selector: "testAt",
  1020. fn: function (){
  1021. var self=this;
  1022. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1023. return smalltalk.withContext(function($ctx1) {
  1024. _st(self)._assert_equals_(_st(_st(self)._collection())._at_("a"),(2));
  1025. _st(self)._should_raise_((function(){
  1026. return smalltalk.withContext(function($ctx2) {
  1027. return _st(_st(self)._collection())._at_((5));
  1028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1029. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1030. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"]}),
  1031. smalltalk.HashedCollectionTest);
  1032. smalltalk.addMethod(
  1033. smalltalk.method({
  1034. selector: "testContains",
  1035. fn: function (){
  1036. var self=this;
  1037. var collection;
  1038. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1039. return smalltalk.withContext(function($ctx1) {
  1040. collection=_st(self)._collection();
  1041. _st(self)._assert_(_st(_st(self)._collection())._contains_((function(each){
  1042. return smalltalk.withContext(function($ctx2) {
  1043. return _st(each).__eq(_st(_st(_st(self)._collection())._values())._first());
  1044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1045. _st(self)._deny_(_st(_st(self)._collection())._contains_((function(each){
  1046. return smalltalk.withContext(function($ctx2) {
  1047. return _st(each).__eq(_st($Object())._new());
  1048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1049. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1050. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"]}),
  1051. smalltalk.HashedCollectionTest);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "testIndexOf",
  1055. fn: function (){
  1056. var self=this;
  1057. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1058. return smalltalk.withContext(function($ctx1) {
  1059. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_((2)),"a");
  1060. _st(self)._should_raise_((function(){
  1061. return smalltalk.withContext(function($ctx2) {
  1062. return _st(_st(self)._collection())._indexOf_((999));
  1063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1064. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  1065. return smalltalk.withContext(function($ctx2) {
  1066. return "sentinel";
  1067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1068. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1069. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  1070. smalltalk.HashedCollectionTest);
  1071. smalltalk.addMethod(
  1072. smalltalk.method({
  1073. selector: "collectionClass",
  1074. fn: function (){
  1075. var self=this;
  1076. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1077. return smalltalk.withContext(function($ctx1) {
  1078. var $1;
  1079. $1=$HashedCollection();
  1080. return $1;
  1081. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1082. messageSends: []}),
  1083. smalltalk.HashedCollectionTest.klass);
  1084. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1085. smalltalk.addMethod(
  1086. smalltalk.method({
  1087. selector: "collection",
  1088. fn: function (){
  1089. var self=this;
  1090. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1091. return smalltalk.withContext(function($ctx1) {
  1092. var $2,$3,$1;
  1093. $2=_st($Dictionary())._new();
  1094. _st($2)._at_put_((1),(1));
  1095. _st($2)._at_put_("a",(2));
  1096. _st($2)._at_put_(true,(3));
  1097. _st($2)._at_put_((4),(-4));
  1098. $3=_st($2)._yourself();
  1099. $1=$3;
  1100. return $1;
  1101. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1102. messageSends: ["at:put:", "new", "yourself"]}),
  1103. smalltalk.DictionaryTest);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "collectionWithDuplicates",
  1107. fn: function (){
  1108. var self=this;
  1109. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1110. return smalltalk.withContext(function($ctx1) {
  1111. var $2,$3,$1;
  1112. $2=_st($Dictionary())._new();
  1113. _st($2)._at_put_((1),(1));
  1114. _st($2)._at_put_("a",(2));
  1115. _st($2)._at_put_(true,(3));
  1116. _st($2)._at_put_((4),(-4));
  1117. _st($2)._at_put_("b",(1));
  1118. _st($2)._at_put_((3),(3));
  1119. _st($2)._at_put_(false,(12));
  1120. $3=_st($2)._yourself();
  1121. $1=$3;
  1122. return $1;
  1123. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1124. messageSends: ["at:put:", "new", "yourself"]}),
  1125. smalltalk.DictionaryTest);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "testAccessing",
  1129. fn: function (){
  1130. var self=this;
  1131. var d;
  1132. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1133. return smalltalk.withContext(function($ctx1) {
  1134. d=_st($Dictionary())._new();
  1135. _st(d)._at_put_("hello","world");
  1136. _st(self)._assert_equals_(_st(d)._at_("hello"),"world");
  1137. _st(self)._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1138. return smalltalk.withContext(function($ctx2) {
  1139. return nil;
  1140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1141. _st(self)._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1142. return smalltalk.withContext(function($ctx2) {
  1143. return nil;
  1144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1145. _st(self)._assert_(_st(d)._includesKey_("hello"));
  1146. _st(self)._deny_(_st(d)._includesKey_("foo"));
  1147. _st(d)._at_put_((1),(2));
  1148. _st(self)._assert_equals_(_st(d)._at_((1)),(2));
  1149. _st(d)._at_put_(_st((1)).__at((3)),(3));
  1150. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((3))),(3));
  1151. _st(self)._assert_(_st(d)._includesKey_(_st((1)).__at((3))));
  1152. _st(self)._deny_(_st(d)._includesKey_(_st((3)).__at((1))));
  1153. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1154. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]}),
  1155. smalltalk.DictionaryTest);
  1156. smalltalk.addMethod(
  1157. smalltalk.method({
  1158. selector: "testDynamicDictionaries",
  1159. fn: function (){
  1160. var self=this;
  1161. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1162. return smalltalk.withContext(function($ctx1) {
  1163. _st(self)._assert_equals_(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_(_st("hello").__minus_gt((1))));
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1165. messageSends: ["assert:equals:", "asDictionary", "->", "with:"]}),
  1166. smalltalk.DictionaryTest);
  1167. smalltalk.addMethod(
  1168. smalltalk.method({
  1169. selector: "testEquality",
  1170. fn: function (){
  1171. var self=this;
  1172. var d1,d2;
  1173. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1174. return smalltalk.withContext(function($ctx1) {
  1175. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1176. _st(self)._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1177. $1=_st($Dictionary())._new();
  1178. _st($1)._at_put_((1),(2));
  1179. $2=_st($1)._yourself();
  1180. d1=$2;
  1181. $3=_st($Dictionary())._new();
  1182. _st($3)._at_put_((1),(2));
  1183. $4=_st($3)._yourself();
  1184. d2=$4;
  1185. _st(self)._assert_(_st(d1).__eq(d2));
  1186. $5=_st($Dictionary())._new();
  1187. _st($5)._at_put_((1),(3));
  1188. $6=_st($5)._yourself();
  1189. d2=$6;
  1190. _st(self)._deny_(_st(d1).__eq(d2));
  1191. $7=_st($Dictionary())._new();
  1192. _st($7)._at_put_((2),(2));
  1193. $8=_st($7)._yourself();
  1194. d2=$8;
  1195. _st(self)._deny_(_st(d1).__eq(d2));
  1196. $9=_st($Dictionary())._new();
  1197. _st($9)._at_put_((1),(2));
  1198. _st($9)._at_put_((3),(4));
  1199. $10=_st($9)._yourself();
  1200. d2=$10;
  1201. _st(self)._deny_(_st(d1).__eq(d2));
  1202. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1203. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"]}),
  1204. smalltalk.DictionaryTest);
  1205. smalltalk.addMethod(
  1206. smalltalk.method({
  1207. selector: "testIfAbsent",
  1208. fn: function (){
  1209. var self=this;
  1210. var d,visited;
  1211. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1212. return smalltalk.withContext(function($ctx1) {
  1213. visited=false;
  1214. d=_st($Dictionary())._new();
  1215. _st(d)._at_ifAbsent_("hello",(function(){
  1216. return smalltalk.withContext(function($ctx2) {
  1217. visited=true;
  1218. return visited;
  1219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1220. _st(self)._assert_(visited);
  1221. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1222. messageSends: ["new", "at:ifAbsent:", "assert:"]}),
  1223. smalltalk.DictionaryTest);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "testIfPresent",
  1227. fn: function (){
  1228. var self=this;
  1229. var d,visited,absent;
  1230. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1231. return smalltalk.withContext(function($ctx1) {
  1232. visited=false;
  1233. d=_st($Dictionary())._new();
  1234. _st(d)._at_put_("hello","world");
  1235. _st(d)._at_ifPresent_("hello",(function(value){
  1236. return smalltalk.withContext(function($ctx2) {
  1237. visited=value;
  1238. return visited;
  1239. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1240. _st(self)._assert_equals_(visited,"world");
  1241. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1242. return smalltalk.withContext(function($ctx2) {
  1243. visited=value;
  1244. return visited;
  1245. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1246. _st(self)._assert_(_st(absent)._isNil());
  1247. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1248. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"]}),
  1249. smalltalk.DictionaryTest);
  1250. smalltalk.addMethod(
  1251. smalltalk.method({
  1252. selector: "testIfPresentIfAbsent",
  1253. fn: function (){
  1254. var self=this;
  1255. var d,visited;
  1256. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1257. return smalltalk.withContext(function($ctx1) {
  1258. visited=false;
  1259. d=_st($Dictionary())._new();
  1260. _st(d)._at_put_("hello","world");
  1261. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1262. return smalltalk.withContext(function($ctx2) {
  1263. visited=value;
  1264. return visited;
  1265. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1266. return smalltalk.withContext(function($ctx2) {
  1267. visited=true;
  1268. return visited;
  1269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1270. _st(self)._assert_equals_(visited,"world");
  1271. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1272. return smalltalk.withContext(function($ctx2) {
  1273. visited=value;
  1274. return visited;
  1275. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1276. return smalltalk.withContext(function($ctx2) {
  1277. visited=true;
  1278. return visited;
  1279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1280. _st(self)._assert_(visited);
  1281. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1282. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"]}),
  1283. smalltalk.DictionaryTest);
  1284. smalltalk.addMethod(
  1285. smalltalk.method({
  1286. selector: "testKeys",
  1287. fn: function (){
  1288. var self=this;
  1289. var d;
  1290. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1291. return smalltalk.withContext(function($ctx1) {
  1292. d=_st($Dictionary())._new();
  1293. _st(d)._at_put_((1),(2));
  1294. _st(d)._at_put_((2),(3));
  1295. _st(d)._at_put_((3),(4));
  1296. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1297. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1298. messageSends: ["new", "at:put:", "assert:equals:", "keys"]}),
  1299. smalltalk.DictionaryTest);
  1300. smalltalk.addMethod(
  1301. smalltalk.method({
  1302. selector: "testPointKey",
  1303. fn: function (){
  1304. var self=this;
  1305. var d;
  1306. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1307. return smalltalk.withContext(function($ctx1) {
  1308. d=_st($Dictionary())._new();
  1309. _st(d)._at_put_(_st((1)).__at((1)),"foo");
  1310. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"foo");
  1311. _st(d)._at_put_(_st((1)).__at((1)),"bar");
  1312. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"bar");
  1313. _st(d)._removeKey_(_st((1)).__at((1)));
  1314. _st(self)._assert_equals_(_st(d)._at_ifAbsent_(_st((1)).__at((1)),(function(){
  1315. return smalltalk.withContext(function($ctx2) {
  1316. return "baz";
  1317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1318. _st(self)._deny_(_st(d)._includesKey_(_st((1)).__at((1))));
  1319. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1320. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"]}),
  1321. smalltalk.DictionaryTest);
  1322. smalltalk.addMethod(
  1323. smalltalk.method({
  1324. selector: "testPrintString",
  1325. fn: function (){
  1326. var self=this;
  1327. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1328. return smalltalk.withContext(function($ctx1) {
  1329. var $1,$2;
  1330. $1=_st($Dictionary())._new();
  1331. _st($1)._at_put_("firstname","James");
  1332. _st($1)._at_put_("lastname","Bond");
  1333. $2=_st($1)._printString();
  1334. _st(self)._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1335. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1336. messageSends: ["assert:equals:", "at:put:", "new", "printString"]}),
  1337. smalltalk.DictionaryTest);
  1338. smalltalk.addMethod(
  1339. smalltalk.method({
  1340. selector: "testRemoveKey",
  1341. fn: function (){
  1342. var self=this;
  1343. var d,key;
  1344. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1345. return smalltalk.withContext(function($ctx1) {
  1346. d=_st($Dictionary())._new();
  1347. _st(d)._at_put_((1),(2));
  1348. _st(d)._at_put_((2),(3));
  1349. _st(d)._at_put_((3),(4));
  1350. key=(2);
  1351. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1352. _st(d)._removeKey_(key);
  1353. _st(self)._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1354. _st(self)._assert_equals_(_st(d)._values(),[(2), (4)]);
  1355. _st(self)._deny_(_st(d)._includesKey_((2)));
  1356. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1357. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"]}),
  1358. smalltalk.DictionaryTest);
  1359. smalltalk.addMethod(
  1360. smalltalk.method({
  1361. selector: "testRemoveKeyIfAbsent",
  1362. fn: function (){
  1363. var self=this;
  1364. var d,key;
  1365. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1366. return smalltalk.withContext(function($ctx1) {
  1367. d=_st($Dictionary())._new();
  1368. _st(d)._at_put_((1),(2));
  1369. _st(d)._at_put_((2),(3));
  1370. _st(d)._at_put_((3),(4));
  1371. key=(2);
  1372. _st(self)._assert_equals_(_st(d)._removeKey_(key),(3));
  1373. key=(3);
  1374. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1375. return smalltalk.withContext(function($ctx2) {
  1376. return (42);
  1377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1378. key="why";
  1379. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1380. return smalltalk.withContext(function($ctx2) {
  1381. return (42);
  1382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1383. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1384. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"]}),
  1385. smalltalk.DictionaryTest);
  1386. smalltalk.addMethod(
  1387. smalltalk.method({
  1388. selector: "testSize",
  1389. fn: function (){
  1390. var self=this;
  1391. var d;
  1392. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1393. return smalltalk.withContext(function($ctx1) {
  1394. d=_st($Dictionary())._new();
  1395. _st(self)._assert_equals_(_st(d)._size(),(0));
  1396. _st(d)._at_put_((1),(2));
  1397. _st(self)._assert_equals_(_st(d)._size(),(1));
  1398. _st(d)._at_put_((2),(3));
  1399. _st(self)._assert_equals_(_st(d)._size(),(2));
  1400. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1401. messageSends: ["new", "assert:equals:", "size", "at:put:"]}),
  1402. smalltalk.DictionaryTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "testValues",
  1406. fn: function (){
  1407. var self=this;
  1408. var d;
  1409. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1410. return smalltalk.withContext(function($ctx1) {
  1411. d=_st($Dictionary())._new();
  1412. _st(d)._at_put_((1),(2));
  1413. _st(d)._at_put_((2),(3));
  1414. _st(d)._at_put_((3),(4));
  1415. _st(self)._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1416. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1417. messageSends: ["new", "at:put:", "assert:equals:", "values"]}),
  1418. smalltalk.DictionaryTest);
  1419. smalltalk.addMethod(
  1420. smalltalk.method({
  1421. selector: "collectionClass",
  1422. fn: function (){
  1423. var self=this;
  1424. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1425. return smalltalk.withContext(function($ctx1) {
  1426. var $1;
  1427. $1=$Dictionary();
  1428. return $1;
  1429. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1430. messageSends: []}),
  1431. smalltalk.DictionaryTest.klass);
  1432. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1433. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1434. smalltalk.addMethod(
  1435. smalltalk.method({
  1436. selector: "testAtIfAbsent",
  1437. fn: function (){
  1438. var self=this;
  1439. var array;
  1440. return smalltalk.withContext(function($ctx1) {
  1441. array=["hello", "world"];
  1442. _st(self)._assert_equals_(_st(array)._at_((1)),"hello");
  1443. _st(self)._assert_equals_(_st(array)._at_((2)),"world");
  1444. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1445. return smalltalk.withContext(function($ctx2) {
  1446. return "not found";
  1447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1448. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1449. return smalltalk.withContext(function($ctx2) {
  1450. return "not found";
  1451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1452. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1453. return smalltalk.withContext(function($ctx2) {
  1454. return "not found";
  1455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1456. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1457. return smalltalk.withContext(function($ctx2) {
  1458. return "not found";
  1459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1460. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1461. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"]}),
  1462. smalltalk.ArrayTest);
  1463. smalltalk.addMethod(
  1464. smalltalk.method({
  1465. selector: "testFirstN",
  1466. fn: function (){
  1467. var self=this;
  1468. return smalltalk.withContext(function($ctx1) {
  1469. _st(self)._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1470. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1471. messageSends: ["assert:equals:", "first:"]}),
  1472. smalltalk.ArrayTest);
  1473. smalltalk.addMethod(
  1474. smalltalk.method({
  1475. selector: "testIfEmpty",
  1476. fn: function (){
  1477. var self=this;
  1478. return smalltalk.withContext(function($ctx1) {
  1479. _st(self)._assert_equals_(_st("")._ifEmpty_((function(){
  1480. return smalltalk.withContext(function($ctx2) {
  1481. return "zork";
  1482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1483. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1484. messageSends: ["assert:equals:", "ifEmpty:"]}),
  1485. smalltalk.ArrayTest);
  1486. smalltalk.addMethod(
  1487. smalltalk.method({
  1488. selector: "testPrintString",
  1489. fn: function (){
  1490. var self=this;
  1491. var array;
  1492. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1493. return smalltalk.withContext(function($ctx1) {
  1494. var $1,$2,$3,$4;
  1495. array=_st($Array())._new();
  1496. _st(self)._assert_equals_(_st(array)._printString(),"an Array ()");
  1497. $1=array;
  1498. _st($1)._add_((1));
  1499. $2=_st($1)._add_((3));
  1500. _st(self)._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1501. _st(array)._add_("foo");
  1502. _st(self)._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1503. $3=array;
  1504. _st($3)._remove_((1));
  1505. $4=_st($3)._remove_((3));
  1506. _st(self)._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1507. _st(array)._addLast_((3));
  1508. _st(self)._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1509. _st(array)._addLast_((3));
  1510. _st(self)._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1511. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1512. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]}),
  1513. smalltalk.ArrayTest);
  1514. smalltalk.addMethod(
  1515. smalltalk.method({
  1516. selector: "collectionClass",
  1517. fn: function (){
  1518. var self=this;
  1519. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1520. return smalltalk.withContext(function($ctx1) {
  1521. var $1;
  1522. $1=$Array();
  1523. return $1;
  1524. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  1525. messageSends: []}),
  1526. smalltalk.ArrayTest.klass);
  1527. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "collection",
  1531. fn: function (){
  1532. var self=this;
  1533. return smalltalk.withContext(function($ctx1) {
  1534. return "hello";
  1535. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  1536. messageSends: []}),
  1537. smalltalk.StringTest);
  1538. smalltalk.addMethod(
  1539. smalltalk.method({
  1540. selector: "collectionWithDuplicates",
  1541. fn: function (){
  1542. var self=this;
  1543. return smalltalk.withContext(function($ctx1) {
  1544. return "abbaerte";
  1545. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  1546. messageSends: []}),
  1547. smalltalk.StringTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAddRemove",
  1551. fn: function (){
  1552. var self=this;
  1553. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1554. return smalltalk.withContext(function($ctx1) {
  1555. _st(self)._should_raise_((function(){
  1556. return smalltalk.withContext(function($ctx2) {
  1557. return _st("hello")._add_("a");
  1558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1559. _st(self)._should_raise_((function(){
  1560. return smalltalk.withContext(function($ctx2) {
  1561. return _st("hello")._remove_("h");
  1562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1563. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  1564. messageSends: ["should:raise:", "add:", "remove:"]}),
  1565. smalltalk.StringTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsArray",
  1569. fn: function (){
  1570. var self=this;
  1571. return smalltalk.withContext(function($ctx1) {
  1572. _st(self)._assert_equals_(_st("hello")._asArray(),["h", "e", "l", "l", "o"]);
  1573. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  1574. messageSends: ["assert:equals:", "asArray"]}),
  1575. smalltalk.StringTest);
  1576. smalltalk.addMethod(
  1577. smalltalk.method({
  1578. selector: "testAt",
  1579. fn: function (){
  1580. var self=this;
  1581. return smalltalk.withContext(function($ctx1) {
  1582. _st(self)._assert_equals_(_st("hello")._at_((1)),"h");
  1583. _st(self)._assert_equals_(_st("hello")._at_((5)),"o");
  1584. _st(self)._assert_equals_(_st("hello")._at_ifAbsent_((6),(function(){
  1585. return smalltalk.withContext(function($ctx2) {
  1586. return nil;
  1587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1588. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  1589. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"]}),
  1590. smalltalk.StringTest);
  1591. smalltalk.addMethod(
  1592. smalltalk.method({
  1593. selector: "testAtPut",
  1594. fn: function (){
  1595. var self=this;
  1596. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1597. return smalltalk.withContext(function($ctx1) {
  1598. _st(self)._should_raise_((function(){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return _st("hello")._at_put_((1),"a");
  1601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1602. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  1603. messageSends: ["should:raise:", "at:put:"]}),
  1604. smalltalk.StringTest);
  1605. smalltalk.addMethod(
  1606. smalltalk.method({
  1607. selector: "testCollect",
  1608. fn: function (){
  1609. var self=this;
  1610. var newCollection;
  1611. return smalltalk.withContext(function($ctx1) {
  1612. newCollection="hheelllloo";
  1613. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1614. return smalltalk.withContext(function($ctx2) {
  1615. return _st(each).__comma(each);
  1616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1617. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  1618. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"]}),
  1619. smalltalk.StringTest);
  1620. smalltalk.addMethod(
  1621. smalltalk.method({
  1622. selector: "testCopyWithoutAll",
  1623. fn: function (){
  1624. var self=this;
  1625. return smalltalk.withContext(function($ctx1) {
  1626. _st(self)._assert_equals_(_st("*hello* *world*")._copyWithoutAll_("*"),"hello world");
  1627. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  1628. messageSends: ["assert:equals:", "copyWithoutAll:"]}),
  1629. smalltalk.StringTest);
  1630. smalltalk.addMethod(
  1631. smalltalk.method({
  1632. selector: "testDetect",
  1633. fn: function (){
  1634. var self=this;
  1635. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1636. return smalltalk.withContext(function($ctx1) {
  1637. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  1638. return smalltalk.withContext(function($ctx2) {
  1639. return _st(each).__eq("h");
  1640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  1641. _st(self)._should_raise_((function(){
  1642. return smalltalk.withContext(function($ctx2) {
  1643. return _st(_st(self)._collection())._detect_((function(each){
  1644. return smalltalk.withContext(function($ctx3) {
  1645. return _st(each).__eq((6));
  1646. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1648. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  1649. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"]}),
  1650. smalltalk.StringTest);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "testEquality",
  1654. fn: function (){
  1655. var self=this;
  1656. return smalltalk.withContext(function($ctx1) {
  1657. _st(self)._assert_equals_("hello","hello");
  1658. _st(self)._deny_(_st("hello").__eq("world"));
  1659. _st(self)._deny_(_st("hello").__eq(_st([])._at_ifAbsent_((1),(function(){
  1660. return smalltalk.withContext(function($ctx2) {
  1661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))));
  1662. _st(self)._assert_equals_("hello",_st("hello")._yourself());
  1663. _st(self)._assert_equals_(_st("hello")._yourself(),"hello");
  1664. _st(self)._deny_(_st("").__eq((0)));
  1665. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  1666. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]}),
  1667. smalltalk.StringTest);
  1668. smalltalk.addMethod(
  1669. smalltalk.method({
  1670. selector: "testIdentity",
  1671. fn: function (){
  1672. var self=this;
  1673. return smalltalk.withContext(function($ctx1) {
  1674. _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1675. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1676. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1677. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1678. _st(self)._deny_(_st("").__eq_eq((0)));
  1679. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  1680. messageSends: ["assert:", "==", "deny:", "yourself"]}),
  1681. smalltalk.StringTest);
  1682. smalltalk.addMethod(
  1683. smalltalk.method({
  1684. selector: "testIncludesSubString",
  1685. fn: function (){
  1686. var self=this;
  1687. return smalltalk.withContext(function($ctx1) {
  1688. _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  1689. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  1690. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  1691. messageSends: ["assert:", "includesSubString:", "deny:"]}),
  1692. smalltalk.StringTest);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "testIndexOf",
  1696. fn: function (){
  1697. var self=this;
  1698. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1699. return smalltalk.withContext(function($ctx1) {
  1700. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_("e"),(2));
  1701. _st(self)._should_raise_((function(){
  1702. return smalltalk.withContext(function($ctx2) {
  1703. return _st(_st(self)._collection())._indexOf_((999));
  1704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1705. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  1706. return smalltalk.withContext(function($ctx2) {
  1707. return "sentinel";
  1708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1709. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  1710. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"]}),
  1711. smalltalk.StringTest);
  1712. smalltalk.addMethod(
  1713. smalltalk.method({
  1714. selector: "testJoin",
  1715. fn: function (){
  1716. var self=this;
  1717. return smalltalk.withContext(function($ctx1) {
  1718. _st(self)._assert_equals_(_st(",")._join_(["hello", "world"]),"hello,world");
  1719. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  1720. messageSends: ["assert:equals:", "join:"]}),
  1721. smalltalk.StringTest);
  1722. smalltalk.addMethod(
  1723. smalltalk.method({
  1724. selector: "testSelect",
  1725. fn: function (){
  1726. var self=this;
  1727. var newCollection;
  1728. return smalltalk.withContext(function($ctx1) {
  1729. newCollection="o";
  1730. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1731. return smalltalk.withContext(function($ctx2) {
  1732. return _st(each).__eq("o");
  1733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  1735. messageSends: ["assertSameContents:as:", "select:", "=", "collection"]}),
  1736. smalltalk.StringTest);
  1737. smalltalk.addMethod(
  1738. smalltalk.method({
  1739. selector: "testSize",
  1740. fn: function (){
  1741. var self=this;
  1742. return smalltalk.withContext(function($ctx1) {
  1743. _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  1744. _st(self)._assert_equals_(_st("")._size(),(0));
  1745. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  1746. messageSends: ["assert:equals:", "size"]}),
  1747. smalltalk.StringTest);
  1748. smalltalk.addMethod(
  1749. smalltalk.method({
  1750. selector: "testStreamContents",
  1751. fn: function (){
  1752. var self=this;
  1753. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1754. return smalltalk.withContext(function($ctx1) {
  1755. var $1,$2;
  1756. _st(self)._assert_equals_(_st($String())._streamContents_((function(aStream){
  1757. return smalltalk.withContext(function($ctx2) {
  1758. $1=aStream;
  1759. _st($1)._nextPutAll_("hello");
  1760. _st($1)._space();
  1761. $2=_st($1)._nextPutAll_("world");
  1762. return $2;
  1763. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  1764. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  1765. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]}),
  1766. smalltalk.StringTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "collectionClass",
  1770. fn: function (){
  1771. var self=this;
  1772. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1773. return smalltalk.withContext(function($ctx1) {
  1774. var $1;
  1775. $1=$String();
  1776. return $1;
  1777. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  1778. messageSends: []}),
  1779. smalltalk.StringTest.klass);
  1780. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1781. smalltalk.addMethod(
  1782. smalltalk.method({
  1783. selector: "jsObject",
  1784. fn: function (){
  1785. var self=this;
  1786. return smalltalk.withContext(function($ctx1) {
  1787. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  1788. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  1789. messageSends: []}),
  1790. smalltalk.JSObjectProxyTest);
  1791. smalltalk.addMethod(
  1792. smalltalk.method({
  1793. selector: "testAtIfAbsent",
  1794. fn: function (){
  1795. var self=this;
  1796. var testObject;
  1797. return smalltalk.withContext(function($ctx1) {
  1798. testObject=_st(self)._jsObject();
  1799. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  1800. return smalltalk.withContext(function($ctx2) {
  1801. return "Property does not exist";
  1802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  1803. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return "Property does not exist";
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1807. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  1808. return smalltalk.withContext(function($ctx2) {
  1809. return "Property does not exist";
  1810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  1811. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  1812. return smalltalk.withContext(function($ctx2) {
  1813. return "Property does not exist";
  1814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1815. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1816. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]}),
  1817. smalltalk.JSObjectProxyTest);
  1818. smalltalk.addMethod(
  1819. smalltalk.method({
  1820. selector: "testAtIfPresent",
  1821. fn: function (){
  1822. var self=this;
  1823. var testObject;
  1824. return smalltalk.withContext(function($ctx1) {
  1825. testObject=_st(self)._jsObject();
  1826. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  1827. return smalltalk.withContext(function($ctx2) {
  1828. return _st("hello ").__comma(_st(x)._asString());
  1829. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),nil);
  1830. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  1831. return smalltalk.withContext(function($ctx2) {
  1832. return _st("hello ").__comma(_st(x)._asString());
  1833. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  1834. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  1835. return smalltalk.withContext(function($ctx2) {
  1836. return _st("hello ").__comma(_st(x)._asString());
  1837. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello 1");
  1838. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  1839. return smalltalk.withContext(function($ctx2) {
  1840. return _st("hello ").__comma(_st(x)._asString());
  1841. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  1842. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1843. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]}),
  1844. smalltalk.JSObjectProxyTest);
  1845. smalltalk.addMethod(
  1846. smalltalk.method({
  1847. selector: "testAtIfPresentIfAbsent",
  1848. fn: function (){
  1849. var self=this;
  1850. var testObject;
  1851. return smalltalk.withContext(function($ctx1) {
  1852. testObject=_st(self)._jsObject();
  1853. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  1854. return smalltalk.withContext(function($ctx2) {
  1855. return _st("hello ").__comma(_st(x)._asString());
  1856. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1857. return smalltalk.withContext(function($ctx2) {
  1858. return "not present";
  1859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not present");
  1860. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  1861. return smalltalk.withContext(function($ctx2) {
  1862. return _st("hello ").__comma(_st(x)._asString());
  1863. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1864. return smalltalk.withContext(function($ctx2) {
  1865. return "not present";
  1866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  1867. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  1868. return smalltalk.withContext(function($ctx2) {
  1869. return _st("hello ").__comma(_st(x)._asString());
  1870. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1871. return smalltalk.withContext(function($ctx2) {
  1872. return "not present";
  1873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello 1");
  1874. _st(self)._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  1875. return smalltalk.withContext(function($ctx2) {
  1876. return _st("hello ").__comma(_st(x)._asString());
  1877. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return "not present";
  1880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  1881. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1882. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]}),
  1883. smalltalk.JSObjectProxyTest);
  1884. smalltalk.addMethod(
  1885. smalltalk.method({
  1886. selector: "testDNU",
  1887. fn: function (){
  1888. var self=this;
  1889. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1890. return smalltalk.withContext(function($ctx1) {
  1891. _st(self)._should_raise_((function(){
  1892. return smalltalk.withContext(function($ctx2) {
  1893. return _st(_st(self)._jsObject())._foo();
  1894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  1895. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  1896. messageSends: ["should:raise:", "foo", "jsObject"]}),
  1897. smalltalk.JSObjectProxyTest);
  1898. smalltalk.addMethod(
  1899. smalltalk.method({
  1900. selector: "testMessageSend",
  1901. fn: function (){
  1902. var self=this;
  1903. return smalltalk.withContext(function($ctx1) {
  1904. _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  1905. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  1906. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  1907. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  1908. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]}),
  1909. smalltalk.JSObjectProxyTest);
  1910. smalltalk.addMethod(
  1911. smalltalk.method({
  1912. selector: "testMethodWithArguments",
  1913. fn: function (){
  1914. var self=this;
  1915. return smalltalk.withContext(function($ctx1) {
  1916. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  1917. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  1918. messageSends: ["assert:equals:", "c:", "jsObject"]}),
  1919. smalltalk.JSObjectProxyTest);
  1920. smalltalk.addMethod(
  1921. smalltalk.method({
  1922. selector: "testPrinting",
  1923. fn: function (){
  1924. var self=this;
  1925. return smalltalk.withContext(function($ctx1) {
  1926. _st(self)._assert_equals_(_st(_st(self)._jsObject())._printString(),"[object Object]");
  1927. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  1928. messageSends: ["assert:equals:", "printString", "jsObject"]}),
  1929. smalltalk.JSObjectProxyTest);
  1930. smalltalk.addMethod(
  1931. smalltalk.method({
  1932. selector: "testPropertyThatReturnsEmptyString",
  1933. fn: function (){
  1934. var self=this;
  1935. var object;
  1936. return smalltalk.withContext(function($ctx1) {
  1937. object=_st(self)._jsObject();
  1938. _st(self)._assert_equals_(_st(object)._d(),"");
  1939. _st(object)._d_("hello");
  1940. _st(self)._assert_equals_(_st(object)._d(),"hello");
  1941. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  1942. messageSends: ["jsObject", "assert:equals:", "d", "d:"]}),
  1943. smalltalk.JSObjectProxyTest);
  1944. smalltalk.addMethod(
  1945. smalltalk.method({
  1946. selector: "testPropertyThatReturnsUndefined",
  1947. fn: function (){
  1948. var self=this;
  1949. var object;
  1950. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1951. return smalltalk.withContext(function($ctx1) {
  1952. object=_st(self)._jsObject();
  1953. _st(self)._shouldnt_raise_((function(){
  1954. return smalltalk.withContext(function($ctx2) {
  1955. return _st(object)._e();
  1956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  1957. _st(self)._assert_(_st(_st(object)._e())._isNil());
  1958. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  1959. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]}),
  1960. smalltalk.JSObjectProxyTest);
  1961. smalltalk.addMethod(
  1962. smalltalk.method({
  1963. selector: "testValue",
  1964. fn: function (){
  1965. var self=this;
  1966. var testObject;
  1967. return smalltalk.withContext(function($ctx1) {
  1968. testObject=_st(self)._jsObject();
  1969. _st(self)._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  1970. _st(testObject)._at_put_("value","aValue");
  1971. _st(self)._assert_equals_(_st(testObject)._value(),"aValue");
  1972. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  1973. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"]}),
  1974. smalltalk.JSObjectProxyTest);
  1975. smalltalk.addMethod(
  1976. smalltalk.method({
  1977. selector: "testYourself",
  1978. fn: function (){
  1979. var self=this;
  1980. var object;
  1981. return smalltalk.withContext(function($ctx1) {
  1982. var $1,$2;
  1983. $1=_st(self)._jsObject();
  1984. _st($1)._d_("test");
  1985. $2=_st($1)._yourself();
  1986. object=$2;
  1987. _st(self)._assert_equals_(_st(object)._d(),"test");
  1988. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  1989. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]}),
  1990. smalltalk.JSObjectProxyTest);
  1991. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testCatchingException",
  1995. fn: function (){
  1996. var self=this;
  1997. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1998. return smalltalk.withContext(function($ctx1) {
  1999. _st((function(){
  2000. return smalltalk.withContext(function($ctx2) {
  2001. return _st(self)._throwException();
  2002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  2003. return smalltalk.withContext(function($ctx2) {
  2004. return _st(self)._assert_(_st(_st(error)._exception()).__eq("test"));
  2005. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2006. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2007. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"]}),
  2008. smalltalk.JavaScriptExceptionTest);
  2009. smalltalk.addMethod(
  2010. smalltalk.method({
  2011. selector: "testRaisingException",
  2012. fn: function (){
  2013. var self=this;
  2014. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2015. return smalltalk.withContext(function($ctx1) {
  2016. _st(self)._should_raise_((function(){
  2017. return smalltalk.withContext(function($ctx2) {
  2018. return _st(self)._throwException();
  2019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$JavaScriptException());
  2020. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2021. messageSends: ["should:raise:", "throwException"]}),
  2022. smalltalk.JavaScriptExceptionTest);
  2023. smalltalk.addMethod(
  2024. smalltalk.method({
  2025. selector: "throwException",
  2026. fn: function (){
  2027. var self=this;
  2028. return smalltalk.withContext(function($ctx1) {
  2029. throw 'test';
  2030. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2031. messageSends: []}),
  2032. smalltalk.JavaScriptExceptionTest);
  2033. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "testValue",
  2037. fn: function (){
  2038. var self=this;
  2039. var messageSend;
  2040. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2041. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2042. return smalltalk.withContext(function($ctx1) {
  2043. var $1,$2;
  2044. $1=_st($MessageSend())._new();
  2045. _st($1)._receiver_(_st($Object())._new());
  2046. _st($1)._selector_("asString");
  2047. $2=_st($1)._yourself();
  2048. messageSend=$2;
  2049. _st(self)._assert_equals_(_st(messageSend)._value(),"an Object");
  2050. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2051. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]}),
  2052. smalltalk.MessageSendTest);
  2053. smalltalk.addMethod(
  2054. smalltalk.method({
  2055. selector: "testValueWithArguments",
  2056. fn: function (){
  2057. var self=this;
  2058. var messageSend;
  2059. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2060. return smalltalk.withContext(function($ctx1) {
  2061. var $1,$2;
  2062. $1=_st($MessageSend())._new();
  2063. _st($1)._receiver_((2));
  2064. _st($1)._selector_("+");
  2065. $2=_st($1)._yourself();
  2066. messageSend=$2;
  2067. _st(self)._assert_equals_(_st(messageSend)._value_((3)),(5));
  2068. _st(self)._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2069. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2070. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]}),
  2071. smalltalk.MessageSendTest);
  2072. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2073. smalltalk.addMethod(
  2074. smalltalk.method({
  2075. selector: "testAbs",
  2076. fn: function (){
  2077. var self=this;
  2078. return smalltalk.withContext(function($ctx1) {
  2079. _st(self)._assert_equals_(_st((4))._abs(),(4));
  2080. _st(self)._assert_equals_(_st((-4))._abs(),(4));
  2081. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  2082. messageSends: ["assert:equals:", "abs"]}),
  2083. smalltalk.NumberTest);
  2084. smalltalk.addMethod(
  2085. smalltalk.method({
  2086. selector: "testArithmetic",
  2087. fn: function (){
  2088. var self=this;
  2089. return smalltalk.withContext(function($ctx1) {
  2090. _st(self)._assert_equals_(_st((1.5)).__plus((1)),(2.5));
  2091. _st(self)._assert_equals_(_st((2)).__minus((1)),(1));
  2092. _st(self)._assert_equals_(_st((-2)).__minus((1)),(-3));
  2093. _st(self)._assert_equals_(_st((12)).__slash((2)),(6));
  2094. _st(self)._assert_equals_(_st((3)).__star((4)),(12));
  2095. _st(self)._assert_equals_(_st(_st((1)).__plus((2))).__star((3)),(9));
  2096. _st(self)._assert_equals_(_st((1)).__plus(_st((2)).__star((3))),(7));
  2097. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  2098. messageSends: ["assert:equals:", "+", "-", "/", "*"]}),
  2099. smalltalk.NumberTest);
  2100. smalltalk.addMethod(
  2101. smalltalk.method({
  2102. selector: "testComparison",
  2103. fn: function (){
  2104. var self=this;
  2105. return smalltalk.withContext(function($ctx1) {
  2106. _st(self)._assert_(_st((3)).__gt((2)));
  2107. _st(self)._assert_(_st((2)).__lt((3)));
  2108. _st(self)._deny_(_st((3)).__lt((2)));
  2109. _st(self)._deny_(_st((2)).__gt((3)));
  2110. _st(self)._assert_(_st((3)).__gt_eq((3)));
  2111. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  2112. _st(self)._assert_(_st((3)).__lt_eq((3)));
  2113. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  2114. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  2115. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]}),
  2116. smalltalk.NumberTest);
  2117. smalltalk.addMethod(
  2118. smalltalk.method({
  2119. selector: "testCopying",
  2120. fn: function (){
  2121. var self=this;
  2122. return smalltalk.withContext(function($ctx1) {
  2123. _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  2124. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  2125. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  2126. messageSends: ["assert:", "==", "copy", "deepCopy"]}),
  2127. smalltalk.NumberTest);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "testEquality",
  2131. fn: function (){
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) {
  2134. _st(self)._assert_(_st((1)).__eq((1)));
  2135. _st(self)._assert_(_st((0)).__eq((0)));
  2136. _st(self)._deny_(_st((1)).__eq((0)));
  2137. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  2138. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  2139. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  2140. _st(self)._deny_(_st((0)).__eq(false));
  2141. _st(self)._deny_(_st(false).__eq((0)));
  2142. _st(self)._deny_(_st("").__eq((0)));
  2143. _st(self)._deny_(_st((0)).__eq(""));
  2144. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  2145. messageSends: ["assert:", "=", "deny:", "yourself"]}),
  2146. smalltalk.NumberTest);
  2147. smalltalk.addMethod(
  2148. smalltalk.method({
  2149. selector: "testHexNumbers",
  2150. fn: function (){
  2151. var self=this;
  2152. return smalltalk.withContext(function($ctx1) {
  2153. _st(self)._assert_equals_((9),(9));
  2154. _st(self)._assert_equals_(_st((10))._truncated(),(10));
  2155. _st(self)._assert_equals_(_st((11))._truncated(),(11));
  2156. _st(self)._assert_equals_(_st((12))._truncated(),(12));
  2157. _st(self)._assert_equals_(_st((13))._truncated(),(13));
  2158. _st(self)._assert_equals_(_st((14))._truncated(),(14));
  2159. _st(self)._assert_equals_(_st((15))._truncated(),(15));
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  2161. messageSends: ["assert:equals:", "truncated"]}),
  2162. smalltalk.NumberTest);
  2163. smalltalk.addMethod(
  2164. smalltalk.method({
  2165. selector: "testIdentity",
  2166. fn: function (){
  2167. var self=this;
  2168. return smalltalk.withContext(function($ctx1) {
  2169. _st(self)._assert_(_st((1)).__eq_eq((1)));
  2170. _st(self)._assert_(_st((0)).__eq_eq((0)));
  2171. _st(self)._deny_(_st((1)).__eq_eq((0)));
  2172. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  2173. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  2174. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  2175. _st(self)._deny_(_st((1)).__eq_eq((2)));
  2176. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  2177. messageSends: ["assert:", "==", "deny:", "yourself"]}),
  2178. smalltalk.NumberTest);
  2179. smalltalk.addMethod(
  2180. smalltalk.method({
  2181. selector: "testInvalidHexNumbers",
  2182. fn: function (){
  2183. var self=this;
  2184. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2185. return smalltalk.withContext(function($ctx1) {
  2186. _st(self)._should_raise_((function(){
  2187. return smalltalk.withContext(function($ctx2) {
  2188. return _st((16))._rG();
  2189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2190. _st(self)._should_raise_((function(){
  2191. return smalltalk.withContext(function($ctx2) {
  2192. return _st((16))._rg();
  2193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2194. _st(self)._should_raise_((function(){
  2195. return smalltalk.withContext(function($ctx2) {
  2196. return _st((16))._rH();
  2197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2198. _st(self)._should_raise_((function(){
  2199. return smalltalk.withContext(function($ctx2) {
  2200. return _st((16))._rh();
  2201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2202. _st(self)._should_raise_((function(){
  2203. return smalltalk.withContext(function($ctx2) {
  2204. return _st((16))._rI();
  2205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2206. _st(self)._should_raise_((function(){
  2207. return smalltalk.withContext(function($ctx2) {
  2208. return _st((16))._ri();
  2209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2210. _st(self)._should_raise_((function(){
  2211. return smalltalk.withContext(function($ctx2) {
  2212. return _st((16))._rJ();
  2213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2214. _st(self)._should_raise_((function(){
  2215. return smalltalk.withContext(function($ctx2) {
  2216. return _st((16))._rj();
  2217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2218. _st(self)._should_raise_((function(){
  2219. return smalltalk.withContext(function($ctx2) {
  2220. return _st((16))._rK();
  2221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2222. _st(self)._should_raise_((function(){
  2223. return smalltalk.withContext(function($ctx2) {
  2224. return _st((16))._rk();
  2225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2226. _st(self)._should_raise_((function(){
  2227. return smalltalk.withContext(function($ctx2) {
  2228. return _st((16))._rL();
  2229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2230. _st(self)._should_raise_((function(){
  2231. return smalltalk.withContext(function($ctx2) {
  2232. return _st((16))._rl();
  2233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2234. _st(self)._should_raise_((function(){
  2235. return smalltalk.withContext(function($ctx2) {
  2236. return _st((16))._rM();
  2237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2238. _st(self)._should_raise_((function(){
  2239. return smalltalk.withContext(function($ctx2) {
  2240. return _st((16))._rm();
  2241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2242. _st(self)._should_raise_((function(){
  2243. return smalltalk.withContext(function($ctx2) {
  2244. return _st((16))._rN();
  2245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2246. _st(self)._should_raise_((function(){
  2247. return smalltalk.withContext(function($ctx2) {
  2248. return _st((16))._rn();
  2249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2250. _st(self)._should_raise_((function(){
  2251. return smalltalk.withContext(function($ctx2) {
  2252. return _st((16))._rO();
  2253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2254. _st(self)._should_raise_((function(){
  2255. return smalltalk.withContext(function($ctx2) {
  2256. return _st((16))._ro();
  2257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2258. _st(self)._should_raise_((function(){
  2259. return smalltalk.withContext(function($ctx2) {
  2260. return _st((16))._rP();
  2261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2262. _st(self)._should_raise_((function(){
  2263. return smalltalk.withContext(function($ctx2) {
  2264. return _st((16))._rp();
  2265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2266. _st(self)._should_raise_((function(){
  2267. return smalltalk.withContext(function($ctx2) {
  2268. return _st((16))._rQ();
  2269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2270. _st(self)._should_raise_((function(){
  2271. return smalltalk.withContext(function($ctx2) {
  2272. return _st((16))._rq();
  2273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2274. _st(self)._should_raise_((function(){
  2275. return smalltalk.withContext(function($ctx2) {
  2276. return _st((16))._rR();
  2277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2278. _st(self)._should_raise_((function(){
  2279. return smalltalk.withContext(function($ctx2) {
  2280. return _st((16))._rr();
  2281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2282. _st(self)._should_raise_((function(){
  2283. return smalltalk.withContext(function($ctx2) {
  2284. return _st((16))._rS();
  2285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2286. _st(self)._should_raise_((function(){
  2287. return smalltalk.withContext(function($ctx2) {
  2288. return _st((16))._rs();
  2289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2290. _st(self)._should_raise_((function(){
  2291. return smalltalk.withContext(function($ctx2) {
  2292. return _st((16))._rT();
  2293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2294. _st(self)._should_raise_((function(){
  2295. return smalltalk.withContext(function($ctx2) {
  2296. return _st((16))._rt();
  2297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2298. _st(self)._should_raise_((function(){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. return _st((16))._rU();
  2301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2302. _st(self)._should_raise_((function(){
  2303. return smalltalk.withContext(function($ctx2) {
  2304. return _st((16))._ru();
  2305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2306. _st(self)._should_raise_((function(){
  2307. return smalltalk.withContext(function($ctx2) {
  2308. return _st((16))._rV();
  2309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2310. _st(self)._should_raise_((function(){
  2311. return smalltalk.withContext(function($ctx2) {
  2312. return _st((16))._rv();
  2313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2314. _st(self)._should_raise_((function(){
  2315. return smalltalk.withContext(function($ctx2) {
  2316. return _st((16))._rW();
  2317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2318. _st(self)._should_raise_((function(){
  2319. return smalltalk.withContext(function($ctx2) {
  2320. return _st((16))._rw();
  2321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2322. _st(self)._should_raise_((function(){
  2323. return smalltalk.withContext(function($ctx2) {
  2324. return _st((16))._rX();
  2325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2326. _st(self)._should_raise_((function(){
  2327. return smalltalk.withContext(function($ctx2) {
  2328. return _st((16))._rx();
  2329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2330. _st(self)._should_raise_((function(){
  2331. return smalltalk.withContext(function($ctx2) {
  2332. return _st((16))._rY();
  2333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2334. _st(self)._should_raise_((function(){
  2335. return smalltalk.withContext(function($ctx2) {
  2336. return _st((16))._ry();
  2337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2338. _st(self)._should_raise_((function(){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. return _st((16))._rZ();
  2341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2342. _st(self)._should_raise_((function(){
  2343. return smalltalk.withContext(function($ctx2) {
  2344. return _st((16))._rz();
  2345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2346. _st(self)._should_raise_((function(){
  2347. return smalltalk.withContext(function($ctx2) {
  2348. return _st((11259375))._Z();
  2349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2350. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  2351. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]}),
  2352. smalltalk.NumberTest);
  2353. smalltalk.addMethod(
  2354. smalltalk.method({
  2355. selector: "testMinMax",
  2356. fn: function (){
  2357. var self=this;
  2358. return smalltalk.withContext(function($ctx1) {
  2359. _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  2360. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  2361. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  2362. messageSends: ["assert:equals:", "max:", "min:"]}),
  2363. smalltalk.NumberTest);
  2364. smalltalk.addMethod(
  2365. smalltalk.method({
  2366. selector: "testNegated",
  2367. fn: function (){
  2368. var self=this;
  2369. return smalltalk.withContext(function($ctx1) {
  2370. _st(self)._assert_equals_(_st((3))._negated(),(-3));
  2371. _st(self)._assert_equals_(_st((-3))._negated(),(3));
  2372. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  2373. messageSends: ["assert:equals:", "negated"]}),
  2374. smalltalk.NumberTest);
  2375. smalltalk.addMethod(
  2376. smalltalk.method({
  2377. selector: "testPrintShowingDecimalPlaces",
  2378. fn: function (){
  2379. var self=this;
  2380. return smalltalk.withContext(function($ctx1) {
  2381. _st(self)._assert_equals_(_st((23))._printShowingDecimalPlaces_((2)),"23.00");
  2382. _st(self)._assert_equals_(_st((23.5698))._printShowingDecimalPlaces_((2)),"23.57");
  2383. _st(self)._assert_equals_(_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  2384. _st(self)._assert_equals_(_st((23.4567))._printShowingDecimalPlaces_((0)),"23");
  2385. _st(self)._assert_equals_(_st((23.5567))._printShowingDecimalPlaces_((0)),"24");
  2386. _st(self)._assert_equals_(_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)),"-23");
  2387. _st(self)._assert_equals_(_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)),"-24");
  2388. _st(self)._assert_equals_(_st((100000000))._printShowingDecimalPlaces_((1)),"100000000.0");
  2389. _st(self)._assert_equals_(_st((0.98))._printShowingDecimalPlaces_((5)),"0.98000");
  2390. _st(self)._assert_equals_(_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  2391. _st(self)._assert_equals_(_st((2.567))._printShowingDecimalPlaces_((2)),"2.57");
  2392. _st(self)._assert_equals_(_st((-2.567))._printShowingDecimalPlaces_((2)),"-2.57");
  2393. _st(self)._assert_equals_(_st((0))._printShowingDecimalPlaces_((2)),"0.00");
  2394. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  2395. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]}),
  2396. smalltalk.NumberTest);
  2397. smalltalk.addMethod(
  2398. smalltalk.method({
  2399. selector: "testRounded",
  2400. fn: function (){
  2401. var self=this;
  2402. return smalltalk.withContext(function($ctx1) {
  2403. _st(self)._assert_equals_(_st((3))._rounded(),(3));
  2404. _st(self)._assert_equals_(_st((3.212))._rounded(),(3));
  2405. _st(self)._assert_equals_(_st((3.51))._rounded(),(4));
  2406. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  2407. messageSends: ["assert:equals:", "rounded"]}),
  2408. smalltalk.NumberTest);
  2409. smalltalk.addMethod(
  2410. smalltalk.method({
  2411. selector: "testSqrt",
  2412. fn: function (){
  2413. var self=this;
  2414. return smalltalk.withContext(function($ctx1) {
  2415. _st(self)._assert_equals_(_st((4))._sqrt(),(2));
  2416. _st(self)._assert_equals_(_st((16))._sqrt(),(4));
  2417. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  2418. messageSends: ["assert:equals:", "sqrt"]}),
  2419. smalltalk.NumberTest);
  2420. smalltalk.addMethod(
  2421. smalltalk.method({
  2422. selector: "testSquared",
  2423. fn: function (){
  2424. var self=this;
  2425. return smalltalk.withContext(function($ctx1) {
  2426. _st(self)._assert_equals_(_st((4))._squared(),(16));
  2427. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  2428. messageSends: ["assert:equals:", "squared"]}),
  2429. smalltalk.NumberTest);
  2430. smalltalk.addMethod(
  2431. smalltalk.method({
  2432. selector: "testTimesRepeat",
  2433. fn: function (){
  2434. var self=this;
  2435. var i;
  2436. return smalltalk.withContext(function($ctx1) {
  2437. i=(0);
  2438. _st((0))._timesRepeat_((function(){
  2439. return smalltalk.withContext(function($ctx2) {
  2440. i=_st(i).__plus((1));
  2441. return i;
  2442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2443. _st(self)._assert_equals_(i,(0));
  2444. _st((5))._timesRepeat_((function(){
  2445. return smalltalk.withContext(function($ctx2) {
  2446. i=_st(i).__plus((1));
  2447. return i;
  2448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2449. _st(self)._assert_equals_(i,(5));
  2450. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  2451. messageSends: ["timesRepeat:", "+", "assert:equals:"]}),
  2452. smalltalk.NumberTest);
  2453. smalltalk.addMethod(
  2454. smalltalk.method({
  2455. selector: "testTo",
  2456. fn: function (){
  2457. var self=this;
  2458. return smalltalk.withContext(function($ctx1) {
  2459. _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  2460. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  2461. messageSends: ["assert:equals:", "to:"]}),
  2462. smalltalk.NumberTest);
  2463. smalltalk.addMethod(
  2464. smalltalk.method({
  2465. selector: "testToBy",
  2466. fn: function (){
  2467. var self=this;
  2468. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2469. return smalltalk.withContext(function($ctx1) {
  2470. _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  2471. _st(self)._should_raise_((function(){
  2472. return smalltalk.withContext(function($ctx2) {
  2473. return _st((1))._to_by_((4),(0));
  2474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2475. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  2476. messageSends: ["assert:equals:", "to:by:", "should:raise:"]}),
  2477. smalltalk.NumberTest);
  2478. smalltalk.addMethod(
  2479. smalltalk.method({
  2480. selector: "testTruncated",
  2481. fn: function (){
  2482. var self=this;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. _st(self)._assert_equals_(_st((3))._truncated(),(3));
  2485. _st(self)._assert_equals_(_st((3.212))._truncated(),(3));
  2486. _st(self)._assert_equals_(_st((3.51))._truncated(),(3));
  2487. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  2488. messageSends: ["assert:equals:", "truncated"]}),
  2489. smalltalk.NumberTest);
  2490. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  2491. smalltalk.addMethod(
  2492. smalltalk.method({
  2493. selector: "foo",
  2494. fn: function (){
  2495. var self=this;
  2496. return smalltalk.withContext(function($ctx1) {
  2497. var $1;
  2498. $1=self["@foo"];
  2499. return $1;
  2500. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  2501. messageSends: []}),
  2502. smalltalk.ObjectMock);
  2503. smalltalk.addMethod(
  2504. smalltalk.method({
  2505. selector: "foo:",
  2506. fn: function (anObject){
  2507. var self=this;
  2508. return smalltalk.withContext(function($ctx1) {
  2509. self["@foo"]=anObject;
  2510. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  2511. messageSends: []}),
  2512. smalltalk.ObjectMock);
  2513. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2514. smalltalk.addMethod(
  2515. smalltalk.method({
  2516. selector: "notDefined",
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.withContext(function($ctx1) {
  2520. return undefined;;
  2521. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  2522. messageSends: []}),
  2523. smalltalk.ObjectTest);
  2524. smalltalk.addMethod(
  2525. smalltalk.method({
  2526. selector: "testBasicAccess",
  2527. fn: function (){
  2528. var self=this;
  2529. var o;
  2530. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2531. return smalltalk.withContext(function($ctx1) {
  2532. o=_st($Object())._new();
  2533. _st(o)._basicAt_put_("a",(1));
  2534. _st(self)._assert_equals_(_st(o)._basicAt_("a"),(1));
  2535. _st(self)._assert_equals_(_st(o)._basicAt_("b"),nil);
  2536. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  2537. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]}),
  2538. smalltalk.ObjectTest);
  2539. smalltalk.addMethod(
  2540. smalltalk.method({
  2541. selector: "testBasicPerform",
  2542. fn: function (){
  2543. var self=this;
  2544. var o;
  2545. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2546. return smalltalk.withContext(function($ctx1) {
  2547. o=_st($Object())._new();
  2548. _st(o)._basicAt_put_("func",(function(){
  2549. return smalltalk.withContext(function($ctx2) {
  2550. return "hello";
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2552. _st(o)._basicAt_put_("func2",(function(a){
  2553. return smalltalk.withContext(function($ctx2) {
  2554. return _st(a).__plus((1));
  2555. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  2556. _st(self)._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  2557. _st(self)._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2558. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  2559. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]}),
  2560. smalltalk.ObjectTest);
  2561. smalltalk.addMethod(
  2562. smalltalk.method({
  2563. selector: "testDNU",
  2564. fn: function (){
  2565. var self=this;
  2566. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2567. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2568. return smalltalk.withContext(function($ctx1) {
  2569. _st(self)._should_raise_((function(){
  2570. return smalltalk.withContext(function($ctx2) {
  2571. return _st(_st($Object())._new())._foo();
  2572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2573. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  2574. messageSends: ["should:raise:", "foo", "new"]}),
  2575. smalltalk.ObjectTest);
  2576. smalltalk.addMethod(
  2577. smalltalk.method({
  2578. selector: "testEquality",
  2579. fn: function (){
  2580. var self=this;
  2581. var o;
  2582. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2583. return smalltalk.withContext(function($ctx1) {
  2584. o=_st($Object())._new();
  2585. _st(self)._deny_(_st(o).__eq(_st($Object())._new()));
  2586. _st(self)._assert_(_st(o).__eq(o));
  2587. _st(self)._assert_(_st(_st(o)._yourself()).__eq(o));
  2588. _st(self)._assert_(_st(o).__eq(_st(o)._yourself()));
  2589. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  2590. messageSends: ["new", "deny:", "=", "assert:", "yourself"]}),
  2591. smalltalk.ObjectTest);
  2592. smalltalk.addMethod(
  2593. smalltalk.method({
  2594. selector: "testHalt",
  2595. fn: function (){
  2596. var self=this;
  2597. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2598. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2599. return smalltalk.withContext(function($ctx1) {
  2600. _st(self)._should_raise_((function(){
  2601. return smalltalk.withContext(function($ctx2) {
  2602. return _st(_st($Object())._new())._halt();
  2603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2604. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  2605. messageSends: ["should:raise:", "halt", "new"]}),
  2606. smalltalk.ObjectTest);
  2607. smalltalk.addMethod(
  2608. smalltalk.method({
  2609. selector: "testIdentity",
  2610. fn: function (){
  2611. var self=this;
  2612. var o;
  2613. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2614. return smalltalk.withContext(function($ctx1) {
  2615. o=_st($Object())._new();
  2616. _st(self)._deny_(_st(o).__eq_eq(_st($Object())._new()));
  2617. _st(self)._assert_(_st(o).__eq_eq(o));
  2618. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2619. _st(self)._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  2620. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  2621. messageSends: ["new", "deny:", "==", "assert:", "yourself"]}),
  2622. smalltalk.ObjectTest);
  2623. smalltalk.addMethod(
  2624. smalltalk.method({
  2625. selector: "testIfNil",
  2626. fn: function (){
  2627. var self=this;
  2628. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2629. return smalltalk.withContext(function($ctx1) {
  2630. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  2631. _st(self)._deny_(_st(_st($Object())._new())._isNil());
  2632. $1=self;
  2633. $4=_st($Object())._new();
  2634. if(($receiver = $4) == nil || $receiver == undefined){
  2635. $3=true;
  2636. } else {
  2637. $3=$4;
  2638. };
  2639. $2=_st($3).__eq(true);
  2640. _st($1)._deny_($2);
  2641. $5=self;
  2642. $7=_st($Object())._new();
  2643. if(($receiver = $7) == nil || $receiver == undefined){
  2644. $6=$7;
  2645. } else {
  2646. $6=true;
  2647. };
  2648. _st($5)._assert_equals_($6,true);
  2649. $8=self;
  2650. $10=_st($Object())._new();
  2651. if(($receiver = $10) == nil || $receiver == undefined){
  2652. $9=false;
  2653. } else {
  2654. $9=true;
  2655. };
  2656. _st($8)._assert_equals_($9,true);
  2657. $11=self;
  2658. $13=_st($Object())._new();
  2659. if(($receiver = $13) == nil || $receiver == undefined){
  2660. $12=false;
  2661. } else {
  2662. $12=true;
  2663. };
  2664. _st($11)._assert_equals_($12,true);
  2665. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  2666. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]}),
  2667. smalltalk.ObjectTest);
  2668. smalltalk.addMethod(
  2669. smalltalk.method({
  2670. selector: "testInstVars",
  2671. fn: function (){
  2672. var self=this;
  2673. var o;
  2674. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  2675. return smalltalk.withContext(function($ctx1) {
  2676. o=_st($ObjectMock())._new();
  2677. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  2678. _st(o)._instVarAt_put_("foo",(1));
  2679. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2680. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2681. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  2682. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]}),
  2683. smalltalk.ObjectTest);
  2684. smalltalk.addMethod(
  2685. smalltalk.method({
  2686. selector: "testNilUndefined",
  2687. fn: function (){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. _st(self)._assert_equals_(_st(self)._notDefined(),nil);
  2691. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  2692. messageSends: ["assert:equals:", "notDefined"]}),
  2693. smalltalk.ObjectTest);
  2694. smalltalk.addMethod(
  2695. smalltalk.method({
  2696. selector: "testYourself",
  2697. fn: function (){
  2698. var self=this;
  2699. var o;
  2700. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  2701. return smalltalk.withContext(function($ctx1) {
  2702. o=_st($ObjectMock())._new();
  2703. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2704. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  2705. messageSends: ["new", "assert:", "==", "yourself"]}),
  2706. smalltalk.ObjectTest);
  2707. smalltalk.addMethod(
  2708. smalltalk.method({
  2709. selector: "testidentityHash",
  2710. fn: function (){
  2711. var self=this;
  2712. var o1,o2;
  2713. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2714. return smalltalk.withContext(function($ctx1) {
  2715. o1=_st($Object())._new();
  2716. o2=_st($Object())._new();
  2717. _st(self)._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  2718. _st(self)._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  2719. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  2720. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]}),
  2721. smalltalk.ObjectTest);
  2722. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2723. smalltalk.addMethod(
  2724. smalltalk.method({
  2725. selector: "setUp",
  2726. fn: function (){
  2727. var self=this;
  2728. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2729. return smalltalk.withContext(function($ctx1) {
  2730. var $1,$2;
  2731. self["@backUpCommitPathJs"]=_st($Package())._defaultCommitPathJs();
  2732. self["@backUpCommitPathSt"]=_st($Package())._defaultCommitPathSt();
  2733. _st($Package())._resetCommitPaths();
  2734. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2735. $1=_st($Package())._new();
  2736. _st($1)._name_("Grul");
  2737. _st($1)._commitPathJs_("server/grul/js");
  2738. _st($1)._commitPathSt_("grul/st");
  2739. $2=_st($1)._yourself();
  2740. self["@grulPackage"]=$2;
  2741. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageTest)})},
  2742. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"]}),
  2743. smalltalk.PackageTest);
  2744. smalltalk.addMethod(
  2745. smalltalk.method({
  2746. selector: "tearDown",
  2747. fn: function (){
  2748. var self=this;
  2749. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2750. return smalltalk.withContext(function($ctx1) {
  2751. var $1,$2;
  2752. $1=$Package();
  2753. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2754. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2755. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.PackageTest)})},
  2756. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"]}),
  2757. smalltalk.PackageTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2761. fn: function (){
  2762. var self=this;
  2763. return smalltalk.withContext(function($ctx1) {
  2764. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2765. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageTest)})},
  2766. messageSends: ["assert:equals:", "commitPathJs"]}),
  2767. smalltalk.PackageTest);
  2768. smalltalk.addMethod(
  2769. smalltalk.method({
  2770. selector: "testGrulCommitPathStShouldBeGrulSt",
  2771. fn: function (){
  2772. var self=this;
  2773. return smalltalk.withContext(function($ctx1) {
  2774. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2775. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageTest)})},
  2776. messageSends: ["assert:equals:", "commitPathSt"]}),
  2777. smalltalk.PackageTest);
  2778. smalltalk.addMethod(
  2779. smalltalk.method({
  2780. selector: "testZorkCommitPathJsShouldBeJs",
  2781. fn: function (){
  2782. var self=this;
  2783. return smalltalk.withContext(function($ctx1) {
  2784. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2785. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.PackageTest)})},
  2786. messageSends: ["assert:equals:", "commitPathJs"]}),
  2787. smalltalk.PackageTest);
  2788. smalltalk.addMethod(
  2789. smalltalk.method({
  2790. selector: "testZorkCommitPathStShouldBeSt",
  2791. fn: function (){
  2792. var self=this;
  2793. return smalltalk.withContext(function($ctx1) {
  2794. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2795. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.PackageTest)})},
  2796. messageSends: ["assert:equals:", "commitPathSt"]}),
  2797. smalltalk.PackageTest);
  2798. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2799. smalltalk.addMethod(
  2800. smalltalk.method({
  2801. selector: "setUp",
  2802. fn: function (){
  2803. var self=this;
  2804. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2805. return smalltalk.withContext(function($ctx1) {
  2806. var $1,$2;
  2807. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  2808. $1=$Package();
  2809. _st($1)._defaultCommitPathJs_("javascripts/");
  2810. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2811. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2812. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"]}),
  2813. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2814. smalltalk.addMethod(
  2815. smalltalk.method({
  2816. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2817. fn: function (){
  2818. var self=this;
  2819. return smalltalk.withContext(function($ctx1) {
  2820. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2821. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2822. messageSends: ["assert:equals:", "commitPathJs"]}),
  2823. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2824. smalltalk.addMethod(
  2825. smalltalk.method({
  2826. selector: "testGrulCommitPathStShouldBeGrulSt",
  2827. fn: function (){
  2828. var self=this;
  2829. return smalltalk.withContext(function($ctx1) {
  2830. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2831. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2832. messageSends: ["assert:equals:", "commitPathSt"]}),
  2833. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2834. smalltalk.addMethod(
  2835. smalltalk.method({
  2836. selector: "testZorkCommitPathJsShouldBeJavascript",
  2837. fn: function (){
  2838. var self=this;
  2839. return smalltalk.withContext(function($ctx1) {
  2840. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2841. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2842. messageSends: ["assert:equals:", "commitPathJs"]}),
  2843. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2844. smalltalk.addMethod(
  2845. smalltalk.method({
  2846. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2847. fn: function (){
  2848. var self=this;
  2849. return smalltalk.withContext(function($ctx1) {
  2850. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2851. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  2852. messageSends: ["assert:equals:", "commitPathSt"]}),
  2853. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2854. smalltalk.addMethod(
  2855. smalltalk.method({
  2856. selector: "shouldInheritSelectors",
  2857. fn: function (){
  2858. var self=this;
  2859. return smalltalk.withContext(function($ctx1) {
  2860. return false;
  2861. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.PackageWithDefaultCommitPathChangedTest.klass)})},
  2862. messageSends: []}),
  2863. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2864. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2865. smalltalk.addMethod(
  2866. smalltalk.method({
  2867. selector: "testAccessing",
  2868. fn: function (){
  2869. var self=this;
  2870. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2871. return smalltalk.withContext(function($ctx1) {
  2872. _st(self)._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  2873. _st(self)._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  2874. _st(self)._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  2875. _st(self)._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  2876. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  2877. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]}),
  2878. smalltalk.PointTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "testArithmetic",
  2882. fn: function (){
  2883. var self=this;
  2884. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2885. return smalltalk.withContext(function($ctx1) {
  2886. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st($Point())._x_y_((9),(16)));
  2887. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st($Point())._x_y_((6),(8)));
  2888. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st($Point())._x_y_((0),(0)));
  2889. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st($Point())._x_y_((2),(2)));
  2890. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  2891. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]}),
  2892. smalltalk.PointTest);
  2893. smalltalk.addMethod(
  2894. smalltalk.method({
  2895. selector: "testAt",
  2896. fn: function (){
  2897. var self=this;
  2898. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2899. return smalltalk.withContext(function($ctx1) {
  2900. _st(self)._assert_equals_(_st((3)).__at((4)),_st($Point())._x_y_((3),(4)));
  2901. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  2902. messageSends: ["assert:equals:", "@", "x:y:"]}),
  2903. smalltalk.PointTest);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "testEgality",
  2907. fn: function (){
  2908. var self=this;
  2909. return smalltalk.withContext(function($ctx1) {
  2910. _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  2911. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  2912. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  2913. messageSends: ["assert:", "=", "@", "deny:"]}),
  2914. smalltalk.PointTest);
  2915. smalltalk.addMethod(
  2916. smalltalk.method({
  2917. selector: "testTranslateBy",
  2918. fn: function (){
  2919. var self=this;
  2920. return smalltalk.withContext(function($ctx1) {
  2921. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))),_st((3)).__at((4)));
  2922. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())),_st((3)).__at((2)));
  2923. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))),_st((5)).__at((6)));
  2924. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))),_st((0)).__at((3)));
  2925. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  2926. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]}),
  2927. smalltalk.PointTest);
  2928. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2929. smalltalk.addMethod(
  2930. smalltalk.method({
  2931. selector: "textNext",
  2932. fn: function (){
  2933. var self=this;
  2934. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  2935. return smalltalk.withContext(function($ctx1) {
  2936. _st((10000))._timesRepeat_((function(){
  2937. var current,next;
  2938. return smalltalk.withContext(function($ctx2) {
  2939. next=_st(_st($Random())._new())._next();
  2940. next;
  2941. _st(self)._assert_(_st(next).__gt_eq((0)));
  2942. _st(self)._assert_(_st(next).__lt((1)));
  2943. _st(self)._deny_(_st(current).__eq(next));
  2944. return _st(next).__eq(current);
  2945. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  2946. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  2947. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]}),
  2948. smalltalk.RandomTest);
  2949. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2950. smalltalk.addMethod(
  2951. smalltalk.method({
  2952. selector: "testAddRemove",
  2953. fn: function (){
  2954. var self=this;
  2955. var set;
  2956. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  2957. return smalltalk.withContext(function($ctx1) {
  2958. set=_st($Set())._new();
  2959. _st(self)._assert_(_st(set)._isEmpty());
  2960. _st(set)._add_((3));
  2961. _st(self)._assert_(_st(set)._includes_((3)));
  2962. _st(set)._add_((5));
  2963. _st(self)._assert_(_st(set)._includes_((5)));
  2964. _st(set)._remove_((3));
  2965. _st(self)._deny_(_st(set)._includes_((3)));
  2966. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  2967. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]}),
  2968. smalltalk.SetTest);
  2969. smalltalk.addMethod(
  2970. smalltalk.method({
  2971. selector: "testAt",
  2972. fn: function (){
  2973. var self=this;
  2974. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  2975. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2976. return smalltalk.withContext(function($ctx1) {
  2977. _st(self)._should_raise_((function(){
  2978. return smalltalk.withContext(function($ctx2) {
  2979. return _st(_st($Set())._new())._at_put_((1),(2));
  2980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2981. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  2982. messageSends: ["should:raise:", "at:put:", "new"]}),
  2983. smalltalk.SetTest);
  2984. smalltalk.addMethod(
  2985. smalltalk.method({
  2986. selector: "testCollect",
  2987. fn: function (){
  2988. var self=this;
  2989. return smalltalk.withContext(function($ctx1) {
  2990. _st(self)._assert_equals_(_st(_st([(5), (6), (8)])._asSet())._collect_((function(x){
  2991. return smalltalk.withContext(function($ctx2) {
  2992. return _st(x).__backslash_backslash((3));
  2993. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),_st([(0), (2)])._asSet());
  2994. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  2995. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"]}),
  2996. smalltalk.SetTest);
  2997. smalltalk.addMethod(
  2998. smalltalk.method({
  2999. selector: "testComparing",
  3000. fn: function (){
  3001. var self=this;
  3002. return smalltalk.withContext(function($ctx1) {
  3003. _st(self)._assert_equals_(_st([(0), (2)])._asSet(),_st([(0), (2)])._asSet());
  3004. _st(self)._assert_equals_(_st([(2), (0)])._asSet(),_st([(0), (2)])._asSet());
  3005. _st(self)._deny_(_st(_st([(0), (2), (3)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3006. _st(self)._deny_(_st(_st([(1), (2)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3007. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  3008. messageSends: ["assert:equals:", "asSet", "deny:", "="]}),
  3009. smalltalk.SetTest);
  3010. smalltalk.addMethod(
  3011. smalltalk.method({
  3012. selector: "testPrintString",
  3013. fn: function (){
  3014. var self=this;
  3015. var set;
  3016. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3017. return smalltalk.withContext(function($ctx1) {
  3018. var $1,$2,$3,$4;
  3019. set=_st($Set())._new();
  3020. _st(self)._assert_equals_(_st(set)._printString(),"a Set ()");
  3021. $1=set;
  3022. _st($1)._add_((1));
  3023. $2=_st($1)._add_((3));
  3024. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3025. _st(set)._add_("foo");
  3026. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3027. $3=set;
  3028. _st($3)._remove_((1));
  3029. $4=_st($3)._remove_((3));
  3030. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3031. _st(set)._add_((3));
  3032. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3033. _st(set)._add_((3));
  3034. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3035. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  3036. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]}),
  3037. smalltalk.SetTest);
  3038. smalltalk.addMethod(
  3039. smalltalk.method({
  3040. selector: "testSize",
  3041. fn: function (){
  3042. var self=this;
  3043. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3044. return smalltalk.withContext(function($ctx1) {
  3045. _st(self)._assert_equals_(_st(_st($Set())._new())._size(),(0));
  3046. _st(self)._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  3047. _st(self)._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  3048. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  3049. messageSends: ["assert:equals:", "size", "new", "withAll:"]}),
  3050. smalltalk.SetTest);
  3051. smalltalk.addMethod(
  3052. smalltalk.method({
  3053. selector: "testUnicity",
  3054. fn: function (){
  3055. var self=this;
  3056. var set;
  3057. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3058. return smalltalk.withContext(function($ctx1) {
  3059. set=_st($Set())._new();
  3060. _st(set)._add_((21));
  3061. _st(set)._add_("hello");
  3062. _st(set)._add_((21));
  3063. _st(self)._assert_equals_(_st(set)._size(),(2));
  3064. _st(set)._add_("hello");
  3065. _st(self)._assert_equals_(_st(set)._size(),(2));
  3066. _st(self)._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  3067. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  3068. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]}),
  3069. smalltalk.SetTest);
  3070. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3071. smalltalk.addMethod(
  3072. smalltalk.method({
  3073. selector: "collectionClass",
  3074. fn: function (){
  3075. var self=this;
  3076. return smalltalk.withContext(function($ctx1) {
  3077. var $1;
  3078. $1=_st(_st(self)._class())._collectionClass();
  3079. return $1;
  3080. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  3081. messageSends: ["collectionClass", "class"]}),
  3082. smalltalk.StreamTest);
  3083. smalltalk.addMethod(
  3084. smalltalk.method({
  3085. selector: "newCollection",
  3086. fn: function (){
  3087. var self=this;
  3088. return smalltalk.withContext(function($ctx1) {
  3089. var $1;
  3090. $1=_st(_st(self)._collectionClass())._new();
  3091. return $1;
  3092. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  3093. messageSends: ["new", "collectionClass"]}),
  3094. smalltalk.StreamTest);
  3095. smalltalk.addMethod(
  3096. smalltalk.method({
  3097. selector: "newStream",
  3098. fn: function (){
  3099. var self=this;
  3100. return smalltalk.withContext(function($ctx1) {
  3101. var $1;
  3102. $1=_st(_st(_st(self)._collectionClass())._new())._stream();
  3103. return $1;
  3104. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  3105. messageSends: ["stream", "new", "collectionClass"]}),
  3106. smalltalk.StreamTest);
  3107. smalltalk.addMethod(
  3108. smalltalk.method({
  3109. selector: "testAtStartAtEnd",
  3110. fn: function (){
  3111. var self=this;
  3112. var stream;
  3113. return smalltalk.withContext(function($ctx1) {
  3114. stream=_st(self)._newStream();
  3115. _st(self)._assert_(_st(stream)._atStart());
  3116. _st(self)._assert_(_st(stream)._atEnd());
  3117. _st(stream)._nextPutAll_(_st(self)._newCollection());
  3118. _st(self)._assert_(_st(stream)._atEnd());
  3119. _st(self)._deny_(_st(stream)._atStart());
  3120. _st(stream)._position_((1));
  3121. _st(self)._deny_(_st(stream)._atEnd());
  3122. _st(self)._deny_(_st(stream)._atStart());
  3123. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  3124. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]}),
  3125. smalltalk.StreamTest);
  3126. smalltalk.addMethod(
  3127. smalltalk.method({
  3128. selector: "testContents",
  3129. fn: function (){
  3130. var self=this;
  3131. var stream;
  3132. return smalltalk.withContext(function($ctx1) {
  3133. stream=_st(self)._newStream();
  3134. _st(stream)._nextPutAll_(_st(self)._newCollection());
  3135. _st(self)._assert_equals_(_st(stream)._contents(),_st(self)._newCollection());
  3136. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  3137. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]}),
  3138. smalltalk.StreamTest);
  3139. smalltalk.addMethod(
  3140. smalltalk.method({
  3141. selector: "testIsEmpty",
  3142. fn: function (){
  3143. var self=this;
  3144. var stream;
  3145. return smalltalk.withContext(function($ctx1) {
  3146. stream=_st(self)._newStream();
  3147. _st(self)._assert_(_st(stream)._isEmpty());
  3148. _st(stream)._nextPutAll_(_st(self)._newCollection());
  3149. _st(self)._deny_(_st(stream)._isEmpty());
  3150. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  3151. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]}),
  3152. smalltalk.StreamTest);
  3153. smalltalk.addMethod(
  3154. smalltalk.method({
  3155. selector: "testPosition",
  3156. fn: function (){
  3157. var self=this;
  3158. var collection,stream;
  3159. return smalltalk.withContext(function($ctx1) {
  3160. collection=_st(self)._newCollection();
  3161. stream=_st(self)._newStream();
  3162. _st(stream)._nextPutAll_(collection);
  3163. _st(self)._assert_equals_(_st(stream)._position(),_st(collection)._size());
  3164. _st(stream)._position_((0));
  3165. _st(self)._assert_equals_(_st(stream)._position(),(0));
  3166. _st(stream)._next();
  3167. _st(self)._assert_equals_(_st(stream)._position(),(1));
  3168. _st(stream)._next();
  3169. _st(self)._assert_equals_(_st(stream)._position(),(2));
  3170. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  3171. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]}),
  3172. smalltalk.StreamTest);
  3173. smalltalk.addMethod(
  3174. smalltalk.method({
  3175. selector: "testReading",
  3176. fn: function (){
  3177. var self=this;
  3178. var stream,collection;
  3179. return smalltalk.withContext(function($ctx1) {
  3180. var $1,$2;
  3181. collection=_st(self)._newCollection();
  3182. stream=_st(self)._newStream();
  3183. $1=stream;
  3184. _st($1)._nextPutAll_(collection);
  3185. $2=_st($1)._position_((0));
  3186. _st(collection)._do_((function(each){
  3187. return smalltalk.withContext(function($ctx2) {
  3188. return _st(self)._assert_equals_(_st(stream)._next(),each);
  3189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3190. _st(self)._assert_(_st(_st(stream)._next())._isNil());
  3191. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3192. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]}),
  3193. smalltalk.StreamTest);
  3194. smalltalk.addMethod(
  3195. smalltalk.method({
  3196. selector: "testStreamContents",
  3197. fn: function (){
  3198. var self=this;
  3199. return smalltalk.withContext(function($ctx1) {
  3200. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  3201. messageSends: []}),
  3202. smalltalk.StreamTest);
  3203. smalltalk.addMethod(
  3204. smalltalk.method({
  3205. selector: "testWrite",
  3206. fn: function (){
  3207. var self=this;
  3208. var stream,collection;
  3209. return smalltalk.withContext(function($ctx1) {
  3210. collection=_st(self)._newCollection();
  3211. stream=_st(self)._newStream();
  3212. _st(collection)._do_((function(each){
  3213. return smalltalk.withContext(function($ctx2) {
  3214. return _st(stream).__lt_lt(each);
  3215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3216. _st(self)._assert_equals_(_st(stream)._contents(),collection);
  3217. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3218. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]}),
  3219. smalltalk.StreamTest);
  3220. smalltalk.addMethod(
  3221. smalltalk.method({
  3222. selector: "testWriting",
  3223. fn: function (){
  3224. var self=this;
  3225. var stream,collection;
  3226. return smalltalk.withContext(function($ctx1) {
  3227. collection=_st(self)._newCollection();
  3228. stream=_st(self)._newStream();
  3229. _st(collection)._do_((function(each){
  3230. return smalltalk.withContext(function($ctx2) {
  3231. return _st(stream)._nextPut_(each);
  3232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3233. _st(self)._assert_equals_(_st(stream)._contents(),collection);
  3234. stream=_st(self)._newStream();
  3235. _st(stream)._nextPutAll_(collection);
  3236. _st(self)._assert_equals_(_st(stream)._contents(),collection);
  3237. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  3238. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]}),
  3239. smalltalk.StreamTest);
  3240. smalltalk.addMethod(
  3241. smalltalk.method({
  3242. selector: "collectionClass",
  3243. fn: function (){
  3244. var self=this;
  3245. return smalltalk.withContext(function($ctx1) {
  3246. return nil;
  3247. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  3248. messageSends: []}),
  3249. smalltalk.StreamTest.klass);
  3250. smalltalk.addMethod(
  3251. smalltalk.method({
  3252. selector: "isAbstract",
  3253. fn: function (){
  3254. var self=this;
  3255. return smalltalk.withContext(function($ctx1) {
  3256. var $1;
  3257. $1=_st(_st(self)._collectionClass())._isNil();
  3258. return $1;
  3259. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  3260. messageSends: ["isNil", "collectionClass"]}),
  3261. smalltalk.StreamTest.klass);
  3262. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  3263. smalltalk.addMethod(
  3264. smalltalk.method({
  3265. selector: "newCollection",
  3266. fn: function (){
  3267. var self=this;
  3268. return smalltalk.withContext(function($ctx1) {
  3269. var $1;
  3270. $1=[true,(1),_st((3)).__at((4)),"foo"];
  3271. return $1;
  3272. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  3273. messageSends: ["@"]}),
  3274. smalltalk.ArrayStreamTest);
  3275. smalltalk.addMethod(
  3276. smalltalk.method({
  3277. selector: "collectionClass",
  3278. fn: function (){
  3279. var self=this;
  3280. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $1;
  3283. $1=$Array();
  3284. return $1;
  3285. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  3286. messageSends: []}),
  3287. smalltalk.ArrayStreamTest.klass);
  3288. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  3289. smalltalk.addMethod(
  3290. smalltalk.method({
  3291. selector: "newCollection",
  3292. fn: function (){
  3293. var self=this;
  3294. return smalltalk.withContext(function($ctx1) {
  3295. return "hello world";
  3296. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  3297. messageSends: []}),
  3298. smalltalk.StringStreamTest);
  3299. smalltalk.addMethod(
  3300. smalltalk.method({
  3301. selector: "collectionClass",
  3302. fn: function (){
  3303. var self=this;
  3304. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3305. return smalltalk.withContext(function($ctx1) {
  3306. var $1;
  3307. $1=$String();
  3308. return $1;
  3309. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  3310. messageSends: []}),
  3311. smalltalk.StringStreamTest.klass);
  3312. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3313. smalltalk.addMethod(
  3314. smalltalk.method({
  3315. selector: "testCopying",
  3316. fn: function (){
  3317. var self=this;
  3318. return smalltalk.withContext(function($ctx1) {
  3319. _st(self)._assert_equals_(_st(nil)._copy(),nil);
  3320. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  3321. messageSends: ["assert:equals:", "copy"]}),
  3322. smalltalk.UndefinedTest);
  3323. smalltalk.addMethod(
  3324. smalltalk.method({
  3325. selector: "testDeepCopy",
  3326. fn: function (){
  3327. var self=this;
  3328. return smalltalk.withContext(function($ctx1) {
  3329. _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  3330. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  3331. messageSends: ["assert:", "=", "deepCopy"]}),
  3332. smalltalk.UndefinedTest);
  3333. smalltalk.addMethod(
  3334. smalltalk.method({
  3335. selector: "testIfNil",
  3336. fn: function (){
  3337. var self=this;
  3338. return smalltalk.withContext(function($ctx1) {
  3339. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  3340. $1=self;
  3341. if(($receiver = nil) == nil || $receiver == undefined){
  3342. $2=true;
  3343. } else {
  3344. $2=nil;
  3345. };
  3346. _st($1)._assert_equals_($2,true);
  3347. $3=self;
  3348. if(($receiver = nil) == nil || $receiver == undefined){
  3349. $5=nil;
  3350. } else {
  3351. $5=true;
  3352. };
  3353. $4=_st($5).__eq(true);
  3354. _st($3)._deny_($4);
  3355. $6=self;
  3356. if(($receiver = nil) == nil || $receiver == undefined){
  3357. $7=true;
  3358. } else {
  3359. $7=false;
  3360. };
  3361. _st($6)._assert_equals_($7,true);
  3362. $8=self;
  3363. if(($receiver = nil) == nil || $receiver == undefined){
  3364. $10=false;
  3365. } else {
  3366. $10=true;
  3367. };
  3368. $9=_st($10).__eq(true);
  3369. _st($8)._deny_($9);
  3370. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  3371. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]}),
  3372. smalltalk.UndefinedTest);
  3373. smalltalk.addMethod(
  3374. smalltalk.method({
  3375. selector: "testIsNil",
  3376. fn: function (){
  3377. var self=this;
  3378. return smalltalk.withContext(function($ctx1) {
  3379. _st(self)._assert_(_st(nil)._isNil());
  3380. _st(self)._deny_(_st(nil)._notNil());
  3381. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  3382. messageSends: ["assert:", "isNil", "deny:", "notNil"]}),
  3383. smalltalk.UndefinedTest);