Kernel-Tests.deploy.js 139 KB

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