Kernel-Tests.js 182 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCanClearInterval",
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. category: 'tests',
  8. fn: function () {
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. _st(self)._shouldnt_raise_((function(){
  12. return smalltalk.withContext(function($ctx2) {
  13. return _st(_st((function(){
  14. return smalltalk.withContext(function($ctx3) {
  15. return _st(_st((smalltalk.Error || Error))._new())._signal();
  16. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithInterval_((0)))._clearInterval();
  17. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  18. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{}, smalltalk.BlockClosureTest)});},
  19. args: [],
  20. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  21. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  22. referencedClasses: ["Error"]
  23. }),
  24. smalltalk.BlockClosureTest);
  25. smalltalk.addMethod(
  26. "_testCanClearTimeout",
  27. smalltalk.method({
  28. selector: "testCanClearTimeout",
  29. category: 'tests',
  30. fn: function () {
  31. var self=this;
  32. return smalltalk.withContext(function($ctx1) {
  33. _st(self)._shouldnt_raise_((function(){
  34. return smalltalk.withContext(function($ctx2) {
  35. return _st(_st((function(){
  36. return smalltalk.withContext(function($ctx3) {
  37. return _st(_st((smalltalk.Error || Error))._new())._signal();
  38. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((0)))._clearTimeout();
  39. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  40. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{}, smalltalk.BlockClosureTest)});},
  41. args: [],
  42. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  43. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  44. referencedClasses: ["Error"]
  45. }),
  46. smalltalk.BlockClosureTest);
  47. smalltalk.addMethod(
  48. "_testCompiledSource",
  49. smalltalk.method({
  50. selector: "testCompiledSource",
  51. category: 'tests',
  52. fn: function () {
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. _st(self)._assert_(_st(_st((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return _st((1)).__plus((1));
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  59. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{}, smalltalk.BlockClosureTest)});},
  60. args: [],
  61. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  62. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.BlockClosureTest);
  66. smalltalk.addMethod(
  67. "_testCurrySelf",
  68. smalltalk.method({
  69. selector: "testCurrySelf",
  70. category: 'tests',
  71. fn: function (){
  72. var self=this;
  73. var curriedMethod,array;
  74. return smalltalk.withContext(function($ctx1) {
  75. curriedMethod=_st(_st((function(selfarg,x){
  76. return smalltalk.withContext(function($ctx2) {
  77. return _st(selfarg)._at_(x);
  78. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  79. array=[(3), (1), (4)];
  80. _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installMethod_forClass_category_(curriedMethod,(smalltalk.Array || Array),"**test helper");
  81. _st((function(){
  82. return smalltalk.withContext(function($ctx2) {
  83. return _st(self)._assert_equals_(_st(array)._foo_((2)),(1));
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  85. return smalltalk.withContext(function($ctx2) {
  86. return _st((smalltalk.Array || Array))._removeCompiledMethod_(curriedMethod);
  87. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  88. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array}, smalltalk.BlockClosureTest)})},
  89. args: [],
  90. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a array := #(3 1 4).\x0a ClassBuilder new installMethod: curriedMethod forClass: Array category: '**test helper'.\x0a [ self assert: (array foo: 2) equals: 1 ]\x0a ensure: [ Array removeCompiledMethod: curriedMethod ]",
  91. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"],
  92. referencedClasses: ["Array", "ClassBuilder"]
  93. }),
  94. smalltalk.BlockClosureTest);
  95. smalltalk.addMethod(
  96. "_testEnsure",
  97. smalltalk.method({
  98. selector: "testEnsure",
  99. category: 'tests',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. _st(self)._assert_equals_(_st((function(){
  104. return smalltalk.withContext(function($ctx2) {
  105. return (3);
  106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  107. return smalltalk.withContext(function($ctx2) {
  108. return (4);
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{}, smalltalk.BlockClosureTest)})},
  111. args: [],
  112. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  113. messageSends: ["assert:equals:", "ensure:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. "_testEnsureRaises",
  119. smalltalk.method({
  120. selector: "testEnsureRaises",
  121. category: 'tests',
  122. fn: function () {
  123. var self=this;
  124. return smalltalk.withContext(function($ctx1) {
  125. _st(self)._should_raise_((function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. return _st((function(){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(_st((smalltalk.Error || Error))._new())._signal();
  130. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  131. return smalltalk.withContext(function($ctx3) {
  132. return true;
  133. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  135. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{}, smalltalk.BlockClosureTest)});},
  136. args: [],
  137. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  138. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  139. referencedClasses: ["Error"]
  140. }),
  141. smalltalk.BlockClosureTest);
  142. smalltalk.addMethod(
  143. "_testExceptionSemantics",
  144. smalltalk.method({
  145. selector: "testExceptionSemantics",
  146. category: 'tests',
  147. fn: function () {
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) {
  150. _st(self)._timeout_((100));
  151. _st(_st(self)._async_((function(){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st((function(){
  154. return smalltalk.withContext(function($ctx3) {
  155. _st(self)._assert_(true);
  156. _st((smalltalk.Error || Error))._signal();
  157. _st(self)._deny_(true);
  158. return _st(self)._finished();
  159. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  160. return smalltalk.withContext(function($ctx3) {
  161. return _st(self)._finished();
  162. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx1)})}));
  163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{}, smalltalk.BlockClosureTest)});},
  165. args: [],
  166. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a self timeout: 100.\x0a \x0a (self async: [ \x0a \x09[ \x0a \x09self assert: true. \x0a Error signal. \x0a \x22The following should *not* be run\x22\x0a self deny: true.\x0a self finished.\x0a \x09\x09] on: Error do: [ :ex | self finished ] \x0a\x09]) valueWithTimeout: 0",
  167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"],
  168. referencedClasses: ["Error"]
  169. }),
  170. smalltalk.BlockClosureTest);
  171. smalltalk.addMethod(
  172. "_testNumArgs",
  173. smalltalk.method({
  174. selector: "testNumArgs",
  175. category: 'tests',
  176. fn: function () {
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) {
  179. _st(self)._assert_equals_(_st((function(){
  180. return smalltalk.withContext(function($ctx2) {
  181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  182. _st(self)._assert_equals_(_st((function(a,b){
  183. return smalltalk.withContext(function($ctx2) {
  184. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  185. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{}, smalltalk.BlockClosureTest)});},
  186. args: [],
  187. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  188. messageSends: ["assert:equals:", "numArgs"],
  189. referencedClasses: []
  190. }),
  191. smalltalk.BlockClosureTest);
  192. smalltalk.addMethod(
  193. "_testOnDo",
  194. smalltalk.method({
  195. selector: "testOnDo",
  196. category: 'tests',
  197. fn: function () {
  198. var self=this;
  199. return smalltalk.withContext(function($ctx1) {
  200. _st(self)._assert_(_st((function(){
  201. return smalltalk.withContext(function($ctx2) {
  202. return _st(_st((smalltalk.Error || Error))._new())._signal();
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  204. return smalltalk.withContext(function($ctx2) {
  205. return true;
  206. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{}, smalltalk.BlockClosureTest)});},
  208. args: [],
  209. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  210. messageSends: ["assert:", "on:do:", "signal", "new"],
  211. referencedClasses: ["Error"]
  212. }),
  213. smalltalk.BlockClosureTest);
  214. smalltalk.addMethod(
  215. "_testValue",
  216. smalltalk.method({
  217. selector: "testValue",
  218. category: 'tests',
  219. fn: function () {
  220. var self=this;
  221. return smalltalk.withContext(function($ctx1) {
  222. _st(self)._assert_equals_(_st((function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st((1)).__plus((1));
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  226. _st(self)._assert_equals_(_st((function(x){
  227. return smalltalk.withContext(function($ctx2) {
  228. return _st(x).__plus((1));
  229. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  230. _st(self)._assert_equals_(_st((function(x,y){
  231. return smalltalk.withContext(function($ctx2) {
  232. return _st(x).__star(y);
  233. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  234. _st(self)._assert_equals_(_st((function(a,b,c){
  235. return smalltalk.withContext(function($ctx2) {
  236. return (1);
  237. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  238. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{}, smalltalk.BlockClosureTest)});},
  239. args: [],
  240. source: "testValue\x0a\x09self assert: ([1+1] value) equals: 2.\x0a\x09self assert: ([:x | x +1] value: 2) equals: 3.\x0a\x09self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8. \x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([:a :b :c | 1] value) equals: 1",
  241. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  242. referencedClasses: []
  243. }),
  244. smalltalk.BlockClosureTest);
  245. smalltalk.addMethod(
  246. "_testValueWithPossibleArguments",
  247. smalltalk.method({
  248. selector: "testValueWithPossibleArguments",
  249. category: 'tests',
  250. fn: function () {
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. _st(self)._assert_equals_(_st((function(){
  254. return smalltalk.withContext(function($ctx2) {
  255. return (1);
  256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  257. _st(self)._assert_equals_(_st((function(a){
  258. return smalltalk.withContext(function($ctx2) {
  259. return _st(a).__plus((4));
  260. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  261. _st(self)._assert_equals_(_st((function(a,b){
  262. return smalltalk.withContext(function($ctx2) {
  263. return _st(a).__plus(b);
  264. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  265. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{}, smalltalk.BlockClosureTest)});},
  266. args: [],
  267. source: "testValueWithPossibleArguments\x0a\x09self assert: ([1] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([:a | a + 4] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([:a :b | a + b] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  268. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  269. referencedClasses: []
  270. }),
  271. smalltalk.BlockClosureTest);
  272. smalltalk.addMethod(
  273. "_testWhileFalse",
  274. smalltalk.method({
  275. selector: "testWhileFalse",
  276. category: 'tests',
  277. fn: function () {
  278. var self=this;
  279. var i;
  280. return smalltalk.withContext(function($ctx1) {
  281. i=(0);
  282. _st((function(){
  283. return smalltalk.withContext(function($ctx2) {
  284. return _st(i).__gt((5));
  285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  286. return smalltalk.withContext(function($ctx2) {
  287. i=_st(i).__plus((1));
  288. return i;
  289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  290. _st(self)._assert_equals_(i,(6));
  291. i=(0);
  292. _st((function(){
  293. return smalltalk.withContext(function($ctx2) {
  294. i=_st(i).__plus((1));
  295. i;
  296. return _st(i).__gt((5));
  297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  298. _st(self)._assert_equals_(i,(6));
  299. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i}, smalltalk.BlockClosureTest)});},
  300. args: [],
  301. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[i > 5] whileFalse: [i := i + 1].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[i := i + 1. i > 5] whileFalse.\x0a\x09self assert: i equals: 6",
  302. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
  303. referencedClasses: []
  304. }),
  305. smalltalk.BlockClosureTest);
  306. smalltalk.addMethod(
  307. "_testWhileTrue",
  308. smalltalk.method({
  309. selector: "testWhileTrue",
  310. category: 'tests',
  311. fn: function () {
  312. var self=this;
  313. var i;
  314. return smalltalk.withContext(function($ctx1) {
  315. i=(0);
  316. _st((function(){
  317. return smalltalk.withContext(function($ctx2) {
  318. return _st(i).__lt((5));
  319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  320. return smalltalk.withContext(function($ctx2) {
  321. i=_st(i).__plus((1));
  322. return i;
  323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  324. _st(self)._assert_equals_(i,(5));
  325. i=(0);
  326. _st((function(){
  327. return smalltalk.withContext(function($ctx2) {
  328. i=_st(i).__plus((1));
  329. i;
  330. return _st(i).__lt((5));
  331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  332. _st(self)._assert_equals_(i,(5));
  333. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i}, smalltalk.BlockClosureTest)});},
  334. args: [],
  335. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[i < 5] whileTrue: [i := i + 1].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[i := i + 1. i < 5] whileTrue.\x0a\x09self assert: i equals: 5",
  336. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
  337. referencedClasses: []
  338. }),
  339. smalltalk.BlockClosureTest);
  340. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  341. smalltalk.addMethod(
  342. "_testEquality",
  343. smalltalk.method({
  344. selector: "testEquality",
  345. category: 'tests',
  346. fn: function (){
  347. var self=this;
  348. return smalltalk.withContext(function($ctx1) {
  349. _st(self)._deny_(_st((0)).__eq(false));
  350. _st(self)._deny_(_st(false).__eq((0)));
  351. _st(self)._deny_(_st("").__eq(false));
  352. _st(self)._deny_(_st(false).__eq(""));
  353. _st(self)._assert_(_st(true).__eq(true));
  354. _st(self)._deny_(_st(false).__eq(true));
  355. _st(self)._deny_(_st(true).__eq(false));
  356. _st(self)._assert_(_st(false).__eq(false));
  357. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  358. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  359. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.BooleanTest)})},
  360. args: [],
  361. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false. \x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  362. messageSends: ["deny:", "=", "assert:", "yourself"],
  363. referencedClasses: []
  364. }),
  365. smalltalk.BooleanTest);
  366. smalltalk.addMethod(
  367. "_testIdentity",
  368. smalltalk.method({
  369. selector: "testIdentity",
  370. category: 'tests',
  371. fn: function () {
  372. var self=this;
  373. return smalltalk.withContext(function($ctx1) {
  374. _st(self)._deny_(_st((0)).__eq_eq(false));
  375. _st(self)._deny_(_st(false).__eq_eq((0)));
  376. _st(self)._deny_(_st("").__eq_eq(false));
  377. _st(self)._deny_(_st(false).__eq_eq(""));
  378. _st(self)._assert_(_st(true).__eq_eq(true));
  379. _st(self)._deny_(_st(false).__eq_eq(true));
  380. _st(self)._deny_(_st(true).__eq_eq(false));
  381. _st(self)._assert_(_st(false).__eq_eq(false));
  382. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  383. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  384. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.BooleanTest)});},
  385. args: [],
  386. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false. \x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  387. messageSends: ["deny:", "==", "assert:", "yourself"],
  388. referencedClasses: []
  389. }),
  390. smalltalk.BooleanTest);
  391. smalltalk.addMethod(
  392. "_testIfTrueIfFalse",
  393. smalltalk.method({
  394. selector: "testIfTrueIfFalse",
  395. category: 'tests',
  396. fn: function (){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) {
  399. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  400. $1=self;
  401. if(smalltalk.assert(true)){
  402. $2="alternative block";
  403. };
  404. _st($1)._assert_equals_($2,"alternative block");
  405. $3=self;
  406. if(! smalltalk.assert(true)){
  407. $4="alternative block";
  408. };
  409. _st($3)._assert_equals_($4,nil);
  410. $5=self;
  411. if(smalltalk.assert(false)){
  412. $6="alternative block";
  413. };
  414. _st($5)._assert_equals_($6,nil);
  415. $7=self;
  416. if(! smalltalk.assert(false)){
  417. $8="alternative block";
  418. };
  419. _st($7)._assert_equals_($8,"alternative block");
  420. $9=self;
  421. if(smalltalk.assert(false)){
  422. $10="alternative block";
  423. } else {
  424. $10="alternative block2";
  425. };
  426. _st($9)._assert_equals_($10,"alternative block2");
  427. $11=self;
  428. if(smalltalk.assert(false)){
  429. $12="alternative block2";
  430. } else {
  431. $12="alternative block";
  432. };
  433. _st($11)._assert_equals_($12,"alternative block");
  434. $13=self;
  435. if(smalltalk.assert(true)){
  436. $14="alternative block";
  437. } else {
  438. $14="alternative block2";
  439. };
  440. _st($13)._assert_equals_($14,"alternative block");
  441. $15=self;
  442. if(smalltalk.assert(true)){
  443. $16="alternative block2";
  444. } else {
  445. $16="alternative block";
  446. };
  447. _st($15)._assert_equals_($16,"alternative block2");
  448. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{}, smalltalk.BooleanTest)})},
  449. args: [],
  450. source: "testIfTrueIfFalse\x0a \x0a\x09self assert: (true ifTrue: ['alternative block']) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block']) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block']) equals: nil.\x0a\x09self assert: (false ifFalse: ['alternative block']) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block2'.",
  451. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BooleanTest);
  455. smalltalk.addMethod(
  456. "_testIfTrueIfFalseWithBoxing",
  457. smalltalk.method({
  458. selector: "testIfTrueIfFalseWithBoxing",
  459. category: 'tests',
  460. fn: function (){
  461. var self=this;
  462. return smalltalk.withContext(function($ctx1) {
  463. 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;
  464. $1=self;
  465. $3=_st(true)._yourself();
  466. if(smalltalk.assert($3)){
  467. $2="alternative block";
  468. };
  469. _st($1)._assert_equals_($2,"alternative block");
  470. $4=self;
  471. $6=_st(true)._yourself();
  472. if(! smalltalk.assert($6)){
  473. $5="alternative block";
  474. };
  475. _st($4)._assert_equals_($5,nil);
  476. $7=self;
  477. $9=_st(false)._yourself();
  478. if(smalltalk.assert($9)){
  479. $8="alternative block";
  480. };
  481. _st($7)._assert_equals_($8,nil);
  482. $10=self;
  483. $12=_st(false)._yourself();
  484. if(! smalltalk.assert($12)){
  485. $11="alternative block";
  486. };
  487. _st($10)._assert_equals_($11,"alternative block");
  488. $13=self;
  489. $15=_st(false)._yourself();
  490. if(smalltalk.assert($15)){
  491. $14="alternative block";
  492. } else {
  493. $14="alternative block2";
  494. };
  495. _st($13)._assert_equals_($14,"alternative block2");
  496. $16=self;
  497. $18=_st(false)._yourself();
  498. if(smalltalk.assert($18)){
  499. $17="alternative block2";
  500. } else {
  501. $17="alternative block";
  502. };
  503. _st($16)._assert_equals_($17,"alternative block");
  504. $19=self;
  505. $21=_st(true)._yourself();
  506. if(smalltalk.assert($21)){
  507. $20="alternative block";
  508. } else {
  509. $20="alternative block2";
  510. };
  511. _st($19)._assert_equals_($20,"alternative block");
  512. $22=self;
  513. $24=_st(true)._yourself();
  514. if(smalltalk.assert($24)){
  515. $23="alternative block2";
  516. } else {
  517. $23="alternative block";
  518. };
  519. _st($22)._assert_equals_($23,"alternative block2");
  520. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{}, smalltalk.BooleanTest)})},
  521. args: [],
  522. source: "testIfTrueIfFalseWithBoxing\x0a \x0a\x09self assert: (true yourself ifTrue: ['alternative block']) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block']) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block']) equals: nil.\x0a\x09self assert: (false yourself ifFalse: ['alternative block']) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block2'.",
  523. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  524. referencedClasses: []
  525. }),
  526. smalltalk.BooleanTest);
  527. smalltalk.addMethod(
  528. "_testLogic",
  529. smalltalk.method({
  530. selector: "testLogic",
  531. category: 'tests',
  532. fn: function (){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) {
  535. var $1,$2,$3,$4,$5,$6,$7,$8;
  536. $1=self;
  537. _st($1)._assert_(_st(true).__and(true));
  538. _st($1)._deny_(_st(true).__and(false));
  539. _st($1)._deny_(_st(false).__and(true));
  540. $2=_st($1)._deny_(_st(false).__and(false));
  541. $3=self;
  542. _st($3)._assert_(_st(true).__or(true));
  543. _st($3)._assert_(_st(true).__or(false));
  544. _st($3)._assert_(_st(false).__or(true));
  545. $4=_st($3)._deny_(_st(false).__or(false));
  546. $5=self;
  547. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  548. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  549. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  550. $7=self;
  551. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  552. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  553. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  554. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{}, smalltalk.BooleanTest)})},
  555. args: [],
  556. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a \x09deny: (true & false);\x0a deny: (false & true);\x0a deny: (false & false).\x0a\x09self assert: (true | true);\x0a \x09assert: (true | false);\x0a assert: (false | true);\x0a deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a \x09deny: ((1 > 0) & false);\x0a deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a \x09assert: ((1 > 0) | false);\x0a assert: ((1 > 0) | (1 > 2))",
  557. messageSends: ["assert:", "&", "deny:", "|", ">"],
  558. referencedClasses: []
  559. }),
  560. smalltalk.BooleanTest);
  561. smalltalk.addMethod(
  562. "_testLogicKeywords",
  563. smalltalk.method({
  564. selector: "testLogicKeywords",
  565. category: 'tests',
  566. fn: function (){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) {
  569. var $1,$2,$3,$4,$5,$6,$7,$8;
  570. $1=self;
  571. _st($1)._assert_(_st(true)._and_((function(){
  572. return smalltalk.withContext(function($ctx2) {
  573. return true;
  574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  575. _st($1)._deny_(_st(true)._and_((function(){
  576. return smalltalk.withContext(function($ctx2) {
  577. return false;
  578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  579. _st($1)._deny_(_st(false)._and_((function(){
  580. return smalltalk.withContext(function($ctx2) {
  581. return true;
  582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  583. $2=_st($1)._deny_(_st(false)._and_((function(){
  584. return smalltalk.withContext(function($ctx2) {
  585. return false;
  586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  587. $3=self;
  588. _st($3)._assert_(_st(true)._or_((function(){
  589. return smalltalk.withContext(function($ctx2) {
  590. return true;
  591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  592. _st($3)._assert_(_st(true)._or_((function(){
  593. return smalltalk.withContext(function($ctx2) {
  594. return false;
  595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  596. _st($3)._assert_(_st(false)._or_((function(){
  597. return smalltalk.withContext(function($ctx2) {
  598. return true;
  599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  600. $4=_st($3)._deny_(_st(false)._or_((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. return false;
  603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  604. $5=self;
  605. _st($5)._assert_(_st(true)._and_((function(){
  606. return smalltalk.withContext(function($ctx2) {
  607. return _st((1)).__gt((0));
  608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  609. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  610. return smalltalk.withContext(function($ctx2) {
  611. return false;
  612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  613. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  614. return smalltalk.withContext(function($ctx2) {
  615. return _st((1)).__gt((2));
  616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  617. $7=self;
  618. _st($7)._assert_(_st(false)._or_((function(){
  619. return smalltalk.withContext(function($ctx2) {
  620. return _st((1)).__gt((0));
  621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  622. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  623. return smalltalk.withContext(function($ctx2) {
  624. return false;
  625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  626. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  627. return smalltalk.withContext(function($ctx2) {
  628. return _st((1)).__gt((2));
  629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  630. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{}, smalltalk.BooleanTest)})},
  631. args: [],
  632. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self \x0a\x09\x09assert: (true and: [ true]); \x0a\x09\x09deny: (true and: [ false ]); \x0a\x09\x09deny: (false and: [ true ]); \x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self \x0a\x09\x09assert: (true or: [ true ]); \x0a\x09\x09assert: (true or: [ false ]); \x0a\x09\x09assert: (false or: [ true ]); \x0a\x09\x09deny: (false or: [ false ]).\x0a \x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self \x0a\x09\x09assert: (true and: [ 1 > 0 ]); \x0a\x09\x09deny: ((1 > 0) and: [ false ]); \x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self \x0a\x09\x09assert: (false or: [ 1 > 0 ]); \x0a\x09\x09assert: ((1 > 0) or: [ false ]); \x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  633. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.BooleanTest);
  637. smalltalk.addMethod(
  638. "_testNonBooleanError",
  639. smalltalk.method({
  640. selector: "testNonBooleanError",
  641. category: 'tests',
  642. fn: function () {
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. var $1,$2;
  646. $1=self;
  647. $2=(function(){
  648. return smalltalk.withContext(function($ctx2) {
  649. if(smalltalk.assert("")){
  650. } else {
  651. };
  652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  653. _st($1)._should_raise_($2,(smalltalk.NonBooleanReceiver || NonBooleanReceiver));
  654. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{}, smalltalk.BooleanTest)});},
  655. args: [],
  656. source: "testNonBooleanError\x0a self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  657. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  658. referencedClasses: ["NonBooleanReceiver"]
  659. }),
  660. smalltalk.BooleanTest);
  661. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  662. smalltalk.addMethod(
  663. "_setUp",
  664. smalltalk.method({
  665. selector: "setUp",
  666. category: 'running',
  667. fn: function () {
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) {
  670. self["@builder"]=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  671. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.ClassBuilderTest)});},
  672. args: [],
  673. source: "setUp\x0a\x09builder := ClassBuilder new",
  674. messageSends: ["new"],
  675. referencedClasses: ["ClassBuilder"]
  676. }),
  677. smalltalk.ClassBuilderTest);
  678. smalltalk.addMethod(
  679. "_tearDown",
  680. smalltalk.method({
  681. selector: "tearDown",
  682. category: 'running',
  683. fn: function () {
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) {
  686. var $1;
  687. $1=self["@theClass"];
  688. if(($receiver = $1) == nil || $receiver == undefined){
  689. $1;
  690. } else {
  691. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(self["@theClass"]);
  692. self["@theClass"]=nil;
  693. self["@theClass"];
  694. };
  695. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.ClassBuilderTest)});},
  696. args: [],
  697. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  698. messageSends: ["ifNotNil:", "removeClass:", "current"],
  699. referencedClasses: ["Smalltalk"]
  700. }),
  701. smalltalk.ClassBuilderTest);
  702. smalltalk.addMethod(
  703. "_testClassCopy",
  704. smalltalk.method({
  705. selector: "testClassCopy",
  706. category: 'tests',
  707. fn: function () {
  708. var self=this;
  709. return smalltalk.withContext(function($ctx1) {
  710. self["@theClass"]=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  711. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._superclass()));
  712. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._instanceVariableNames()));
  713. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  714. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._package()));
  715. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st((smalltalk.ObjectMock || ObjectMock))._methodDictionary())._keys());
  716. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{}, smalltalk.ClassBuilderTest)});},
  717. args: [],
  718. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  719. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  720. referencedClasses: ["ObjectMock"]
  721. }),
  722. smalltalk.ClassBuilderTest);
  723. smalltalk.addMethod(
  724. "_testClassMigration",
  725. smalltalk.method({
  726. selector: "testClassMigration",
  727. category: 'tests',
  728. fn: function (){
  729. var self=this;
  730. var instance,oldClass;
  731. return smalltalk.withContext(function($ctx1) {
  732. oldClass=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  733. instance=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"))._new();
  734. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  735. _st(self)._deny_(_st(oldClass).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  736. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._superclass()).__eq_eq((smalltalk.ObjectMock || ObjectMock)));
  737. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._instanceVariableNames())._isEmpty());
  738. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._selectors(),_st(oldClass)._selectors());
  739. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._comment(),_st(oldClass)._comment());
  740. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._package())._name(),"Kernel-Tests");
  741. _st(self)._deny_(_st(_st(instance)._class()).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  742. _st(self)._assert_(_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  743. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  744. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass}, smalltalk.ClassBuilderTest)})},
  745. args: [],
  746. source: "testClassMigration\x0a\x09| instance oldClass |\x0a \x0a oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a instance := (Smalltalk current at: 'ObjectMock2') new.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self deny: oldClass == ObjectMock2.\x0a \x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a self assert: ObjectMock2 comment equals: oldClass comment.\x0a self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a \x0a\x09self deny: instance class == ObjectMock2.\x0a \x22Commeting this out. Tests implementation detail.\x22\x0a \x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a \x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a \x0a Smalltalk current removeClass: ObjectMock2",
  747. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  748. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  749. }),
  750. smalltalk.ClassBuilderTest);
  751. smalltalk.addMethod(
  752. "_testClassMigrationWithClassInstanceVariables",
  753. smalltalk.method({
  754. selector: "testClassMigrationWithClassInstanceVariables",
  755. category: 'tests',
  756. fn: function () {
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) {
  759. _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  760. _st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames_("foo bar");
  761. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  762. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames(),["foo", "bar"]);
  763. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  764. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{}, smalltalk.ClassBuilderTest)});},
  765. args: [],
  766. source: "testClassMigrationWithClassInstanceVariables\x0a \x0a builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a \x0a Smalltalk current removeClass: ObjectMock2",
  767. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  768. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  769. }),
  770. smalltalk.ClassBuilderTest);
  771. smalltalk.addMethod(
  772. "_testClassMigrationWithSubclasses",
  773. smalltalk.method({
  774. selector: "testClassMigrationWithSubclasses",
  775. category: 'tests',
  776. fn: function () {
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  780. _st((smalltalk.ObjectMock2 || ObjectMock2))._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  781. _st((smalltalk.ObjectMock3 || ObjectMock3))._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  782. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  783. _st(self)._assert_(_st(_st((smalltalk.ObjectMock || ObjectMock))._subclasses())._includes_((smalltalk.ObjectMock2 || ObjectMock2)));
  784. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._subclasses())._includes_((smalltalk.ObjectMock3 || ObjectMock3)));
  785. _st(self)._assert_(_st(_st((smalltalk.ObjectMock3 || ObjectMock3))._subclasses())._includes_((smalltalk.ObjectMock4 || ObjectMock4)));
  786. _st(_st((smalltalk.ObjectMock || ObjectMock))._allSubclasses())._do_((function(each){
  787. return smalltalk.withContext(function($ctx2) {
  788. return _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(each);
  789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  790. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{}, smalltalk.ClassBuilderTest)});},
  791. args: [],
  792. source: "testClassMigrationWithSubclasses\x0a \x0a builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a \x0a ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  793. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"],
  794. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  795. }),
  796. smalltalk.ClassBuilderTest);
  797. smalltalk.addMethod(
  798. "_testInstanceVariableNames",
  799. smalltalk.method({
  800. selector: "testInstanceVariableNames",
  801. category: 'tests',
  802. fn: function () {
  803. var self=this;
  804. return smalltalk.withContext(function($ctx1) {
  805. _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  806. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{}, smalltalk.ClassBuilderTest)});},
  807. args: [],
  808. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  809. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  810. referencedClasses: []
  811. }),
  812. smalltalk.ClassBuilderTest);
  813. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  814. smalltalk.addMethod(
  815. "_assertSameContents_as_",
  816. smalltalk.method({
  817. selector: "assertSameContents:as:",
  818. category: 'convenience',
  819. fn: function (aCollection,anotherCollection){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) {
  822. _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  823. _st(aCollection)._do_((function(each){
  824. return smalltalk.withContext(function($ctx2) {
  825. return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  827. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection}, smalltalk.CollectionTest)})},
  828. args: ["aCollection", "anotherCollection"],
  829. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  830. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  831. referencedClasses: []
  832. }),
  833. smalltalk.CollectionTest);
  834. smalltalk.addMethod(
  835. "_collection",
  836. smalltalk.method({
  837. selector: "collection",
  838. category: 'accessing',
  839. fn: function () {
  840. var self=this;
  841. return smalltalk.withContext(function($ctx1) {
  842. var $1;
  843. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  844. return $1;
  845. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.CollectionTest)});},
  846. args: [],
  847. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  848. messageSends: ["withAll:", "defaultValues", "collectionClass"],
  849. referencedClasses: []
  850. }),
  851. smalltalk.CollectionTest);
  852. smalltalk.addMethod(
  853. "_collectionClass",
  854. smalltalk.method({
  855. selector: "collectionClass",
  856. category: 'accessing',
  857. fn: function () {
  858. var self=this;
  859. return smalltalk.withContext(function($ctx1) {
  860. var $1;
  861. $1=_st(_st(self)._class())._collectionClass();
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest)});},
  864. args: [],
  865. source: "collectionClass\x0a\x09^ self class collectionClass",
  866. messageSends: ["collectionClass", "class"],
  867. referencedClasses: []
  868. }),
  869. smalltalk.CollectionTest);
  870. smalltalk.addMethod(
  871. "_collectionWithDuplicates",
  872. smalltalk.method({
  873. selector: "collectionWithDuplicates",
  874. category: 'accessing',
  875. fn: function () {
  876. var self=this;
  877. return smalltalk.withContext(function($ctx1) {
  878. var $1;
  879. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  880. return $1;
  881. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.CollectionTest)});},
  882. args: [],
  883. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  884. messageSends: ["withAll:", "collectionClass"],
  885. referencedClasses: []
  886. }),
  887. smalltalk.CollectionTest);
  888. smalltalk.addMethod(
  889. "_defaultValues",
  890. smalltalk.method({
  891. selector: "defaultValues",
  892. category: 'accessing',
  893. fn: function () {
  894. var self=this;
  895. return smalltalk.withContext(function($ctx1) {
  896. return [(1), (2), (3), (-4)];
  897. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{}, smalltalk.CollectionTest)});},
  898. args: [],
  899. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  900. messageSends: [],
  901. referencedClasses: []
  902. }),
  903. smalltalk.CollectionTest);
  904. smalltalk.addMethod(
  905. "_isCollectionReadOnly",
  906. smalltalk.method({
  907. selector: "isCollectionReadOnly",
  908. category: 'testing',
  909. fn: function () {
  910. var self=this;
  911. return smalltalk.withContext(function($ctx1) {
  912. return false;
  913. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{}, smalltalk.CollectionTest)});},
  914. args: [],
  915. source: "isCollectionReadOnly\x0a\x09^ false",
  916. messageSends: [],
  917. referencedClasses: []
  918. }),
  919. smalltalk.CollectionTest);
  920. smalltalk.addMethod(
  921. "_testAsArray",
  922. smalltalk.method({
  923. selector: "testAsArray",
  924. category: 'tests',
  925. fn: function () {
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) {
  928. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  929. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.CollectionTest)});},
  930. args: [],
  931. source: "testAsArray\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asArray",
  932. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  933. referencedClasses: []
  934. }),
  935. smalltalk.CollectionTest);
  936. smalltalk.addMethod(
  937. "_testAsOrderedCollection",
  938. smalltalk.method({
  939. selector: "testAsOrderedCollection",
  940. category: 'tests',
  941. fn: function () {
  942. var self=this;
  943. return smalltalk.withContext(function($ctx1) {
  944. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  945. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{}, smalltalk.CollectionTest)});},
  946. args: [],
  947. source: "testAsOrderedCollection\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asOrderedCollection",
  948. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  949. referencedClasses: []
  950. }),
  951. smalltalk.CollectionTest);
  952. smalltalk.addMethod(
  953. "_testAsSet",
  954. smalltalk.method({
  955. selector: "testAsSet",
  956. category: 'tests',
  957. fn: function (){
  958. var self=this;
  959. var c,set;
  960. return smalltalk.withContext(function($ctx1) {
  961. c=_st(self)._collectionWithDuplicates();
  962. set=_st(c)._asSet();
  963. _st(self)._assert_equals_(_st(set)._size(),(5));
  964. _st(c)._do_((function(each){
  965. return smalltalk.withContext(function($ctx2) {
  966. return _st(self)._assert_(_st(set)._includes_(each));
  967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  968. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set}, smalltalk.CollectionTest)})},
  969. args: [],
  970. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  971. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  972. referencedClasses: []
  973. }),
  974. smalltalk.CollectionTest);
  975. smalltalk.addMethod(
  976. "_testCollect",
  977. smalltalk.method({
  978. selector: "testCollect",
  979. category: 'tests',
  980. fn: function () {
  981. var self=this;
  982. var newCollection;
  983. return smalltalk.withContext(function($ctx1) {
  984. newCollection=[(1), (2), (3), (4)];
  985. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  986. return smalltalk.withContext(function($ctx2) {
  987. return _st(each)._abs();
  988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  989. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.CollectionTest)});},
  990. args: [],
  991. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
  992. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
  993. referencedClasses: []
  994. }),
  995. smalltalk.CollectionTest);
  996. smalltalk.addMethod(
  997. "_testDetect",
  998. smalltalk.method({
  999. selector: "testDetect",
  1000. category: 'tests',
  1001. fn: function (){
  1002. var self=this;
  1003. return smalltalk.withContext(function($ctx1) {
  1004. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  1005. return smalltalk.withContext(function($ctx2) {
  1006. return _st(each).__lt((0));
  1007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  1008. _st(self)._should_raise_((function(){
  1009. return smalltalk.withContext(function($ctx2) {
  1010. return _st(_st(self)._collection())._detect_((function(each){
  1011. return smalltalk.withContext(function($ctx3) {
  1012. return _st(each).__eq((6));
  1013. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1015. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.CollectionTest)})},
  1016. args: [],
  1017. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1018. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="],
  1019. referencedClasses: ["Error"]
  1020. }),
  1021. smalltalk.CollectionTest);
  1022. smalltalk.addMethod(
  1023. "_testDo",
  1024. smalltalk.method({
  1025. selector: "testDo",
  1026. category: 'tests',
  1027. fn: function () {
  1028. var self=this;
  1029. var newCollection;
  1030. return smalltalk.withContext(function($ctx1) {
  1031. newCollection=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  1032. _st(_st(self)._collection())._do_((function(each){
  1033. return smalltalk.withContext(function($ctx2) {
  1034. return _st(newCollection)._add_(each);
  1035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1036. _st(self)._assertSameContents_as_(_st(self)._collection(),newCollection);
  1037. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection}, smalltalk.CollectionTest)});},
  1038. args: [],
  1039. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: newCollection",
  1040. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
  1041. referencedClasses: ["OrderedCollection"]
  1042. }),
  1043. smalltalk.CollectionTest);
  1044. smalltalk.addMethod(
  1045. "_testIsEmpty",
  1046. smalltalk.method({
  1047. selector: "testIsEmpty",
  1048. category: 'tests',
  1049. fn: function () {
  1050. var self=this;
  1051. return smalltalk.withContext(function($ctx1) {
  1052. _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  1053. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  1054. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.CollectionTest)});},
  1055. args: [],
  1056. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1057. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1058. referencedClasses: []
  1059. }),
  1060. smalltalk.CollectionTest);
  1061. smalltalk.addMethod(
  1062. "_testSelect",
  1063. smalltalk.method({
  1064. selector: "testSelect",
  1065. category: 'tests',
  1066. fn: function () {
  1067. var self=this;
  1068. var newCollection;
  1069. return smalltalk.withContext(function($ctx1) {
  1070. newCollection=[(2), (-4)];
  1071. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1072. return smalltalk.withContext(function($ctx2) {
  1073. return _st(each)._even();
  1074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1075. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.CollectionTest)});},
  1076. args: [],
  1077. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
  1078. messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.CollectionTest);
  1082. smalltalk.addMethod(
  1083. "_testSize",
  1084. smalltalk.method({
  1085. selector: "testSize",
  1086. category: 'tests',
  1087. fn: function (){
  1088. var self=this;
  1089. return smalltalk.withContext(function($ctx1) {
  1090. _st(self)._assert_equals_(_st(_st(_st(self)._collectionClass())._new())._size(),(0));
  1091. _st(self)._assert_equals_(_st(_st(self)._collection())._size(),(4));
  1092. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.CollectionTest)})},
  1093. args: [],
  1094. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1095. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1096. referencedClasses: []
  1097. }),
  1098. smalltalk.CollectionTest);
  1099. smalltalk.addMethod(
  1100. "_collectionClass",
  1101. smalltalk.method({
  1102. selector: "collectionClass",
  1103. category: 'accessing',
  1104. fn: function () {
  1105. var self=this;
  1106. return smalltalk.withContext(function($ctx1) {
  1107. return nil;
  1108. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest.klass)});},
  1109. args: [],
  1110. source: "collectionClass\x0a\x09^ nil",
  1111. messageSends: [],
  1112. referencedClasses: []
  1113. }),
  1114. smalltalk.CollectionTest.klass);
  1115. smalltalk.addMethod(
  1116. "_isAbstract",
  1117. smalltalk.method({
  1118. selector: "isAbstract",
  1119. category: 'testing',
  1120. fn: function () {
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. var $1;
  1124. $1=_st(_st(self)._collectionClass())._isNil();
  1125. return $1;
  1126. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{}, smalltalk.CollectionTest.klass)});},
  1127. args: [],
  1128. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1129. messageSends: ["isNil", "collectionClass"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.CollectionTest.klass);
  1133. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1134. smalltalk.addMethod(
  1135. "_collection",
  1136. smalltalk.method({
  1137. selector: "collection",
  1138. category: 'accessing',
  1139. fn: function (){
  1140. var self=this;
  1141. return smalltalk.withContext(function($ctx1) { var $1;
  1142. $1=smalltalk.HashedCollection._fromPairs_([_st("b").__minus_gt((1)),_st("a").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  1143. return $1;
  1144. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.HashedCollectionTest)})},
  1145. args: [],
  1146. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1147. messageSends: ["->"],
  1148. referencedClasses: []
  1149. }),
  1150. smalltalk.HashedCollectionTest);
  1151. smalltalk.addMethod(
  1152. "_collectionWithDuplicates",
  1153. smalltalk.method({
  1154. selector: "collectionWithDuplicates",
  1155. category: 'accessing',
  1156. fn: function (){
  1157. var self=this;
  1158. return smalltalk.withContext(function($ctx1) { var $1;
  1159. $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))]);
  1160. return $1;
  1161. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.HashedCollectionTest)})},
  1162. args: [],
  1163. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1164. messageSends: ["->"],
  1165. referencedClasses: []
  1166. }),
  1167. smalltalk.HashedCollectionTest);
  1168. smalltalk.addMethod(
  1169. "_testIndexOf",
  1170. smalltalk.method({
  1171. selector: "testIndexOf",
  1172. category: 'tests',
  1173. fn: function (){
  1174. var self=this;
  1175. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_((2)),"a");
  1176. _st(self)._should_raise_((function(){
  1177. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._indexOf_((999));
  1178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1179. _st(self)._assert_equals_(_st(_st(self)._collection())._indexOf_ifAbsent_((999),(function(){
  1180. return smalltalk.withContext(function($ctx2) { return "sentinel";
  1181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1182. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{}, smalltalk.HashedCollectionTest)})},
  1183. args: [],
  1184. source: "testIndexOf\x0a\x0a\x09self assert: (self collection indexOf: 2) equals: 'a'.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1185. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1186. referencedClasses: ["Error"]
  1187. }),
  1188. smalltalk.HashedCollectionTest);
  1189. smalltalk.addMethod(
  1190. "_collectionClass",
  1191. smalltalk.method({
  1192. selector: "collectionClass",
  1193. category: 'accessing',
  1194. fn: function () {
  1195. var self=this;
  1196. return smalltalk.withContext(function($ctx1) {
  1197. var $1;
  1198. $1=(smalltalk.HashedCollection || HashedCollection);
  1199. return $1;
  1200. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.HashedCollectionTest.klass)});},
  1201. args: [],
  1202. source: "collectionClass\x0a\x09^ HashedCollection",
  1203. messageSends: [],
  1204. referencedClasses: ["HashedCollection"]
  1205. }),
  1206. smalltalk.HashedCollectionTest.klass);
  1207. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1208. smalltalk.addMethod(
  1209. "_collection",
  1210. smalltalk.method({
  1211. selector: "collection",
  1212. category: 'accessing',
  1213. fn: function () {
  1214. var self=this;
  1215. return smalltalk.withContext(function($ctx1) {
  1216. var $2,$3,$1;
  1217. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  1218. _st($2)._at_put_((1),(1));
  1219. _st($2)._at_put_("a",(2));
  1220. _st($2)._at_put_(true,(3));
  1221. _st($2)._at_put_((4),(-4));
  1222. $3=_st($2)._yourself();
  1223. $1=$3;
  1224. return $1;
  1225. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.DictionaryTest)});},
  1226. args: [],
  1227. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09yourself",
  1228. messageSends: ["at:put:", "new", "yourself"],
  1229. referencedClasses: ["Dictionary"]
  1230. }),
  1231. smalltalk.DictionaryTest);
  1232. smalltalk.addMethod(
  1233. "_collectionWithDuplicates",
  1234. smalltalk.method({
  1235. selector: "collectionWithDuplicates",
  1236. category: 'accessing',
  1237. fn: function () {
  1238. var self=this;
  1239. return smalltalk.withContext(function($ctx1) {
  1240. var $2,$3,$1;
  1241. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  1242. _st($2)._at_put_((1),(1));
  1243. _st($2)._at_put_("a",(2));
  1244. _st($2)._at_put_(true,(3));
  1245. _st($2)._at_put_((4),(-4));
  1246. _st($2)._at_put_("b",(1));
  1247. _st($2)._at_put_((3),(3));
  1248. _st($2)._at_put_(false,(12));
  1249. $3=_st($2)._yourself();
  1250. $1=$3;
  1251. return $1;
  1252. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.DictionaryTest)});},
  1253. args: [],
  1254. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  1255. messageSends: ["at:put:", "new", "yourself"],
  1256. referencedClasses: ["Dictionary"]
  1257. }),
  1258. smalltalk.DictionaryTest);
  1259. smalltalk.addMethod(
  1260. "_testAccessing",
  1261. smalltalk.method({
  1262. selector: "testAccessing",
  1263. category: 'tests',
  1264. fn: function (){
  1265. var self=this;
  1266. var d;
  1267. return smalltalk.withContext(function($ctx1) {
  1268. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1269. _st(d)._at_put_("hello","world");
  1270. _st(self)._assert_equals_(_st(d)._at_("hello"),"world");
  1271. _st(self)._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1272. return smalltalk.withContext(function($ctx2) {
  1273. return nil;
  1274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1275. _st(self)._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1276. return smalltalk.withContext(function($ctx2) {
  1277. return nil;
  1278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1279. _st(self)._assert_(_st(d)._includesKey_("hello"));
  1280. _st(self)._deny_(_st(d)._includesKey_("foo"));
  1281. _st(d)._at_put_((1),(2));
  1282. _st(self)._assert_equals_(_st(d)._at_((1)),(2));
  1283. _st(d)._at_put_(_st((1)).__at((3)),(3));
  1284. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((3))),(3));
  1285. _st(self)._assert_(_st(d)._includesKey_(_st((1)).__at((3))));
  1286. _st(self)._deny_(_st(d)._includesKey_(_st((3)).__at((1))));
  1287. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d}, smalltalk.DictionaryTest)})},
  1288. args: [],
  1289. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [nil]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)\x0a",
  1290. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1291. referencedClasses: ["Dictionary"]
  1292. }),
  1293. smalltalk.DictionaryTest);
  1294. smalltalk.addMethod(
  1295. "_testDynamicDictionaries",
  1296. smalltalk.method({
  1297. selector: "testDynamicDictionaries",
  1298. category: 'tests',
  1299. fn: function (){
  1300. var self=this;
  1301. return smalltalk.withContext(function($ctx1) {
  1302. _st(self)._assert_equals_(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary(),_st((smalltalk.Dictionary || Dictionary))._with_(_st("hello").__minus_gt((1))));
  1303. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{}, smalltalk.DictionaryTest)})},
  1304. args: [],
  1305. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1306. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1307. referencedClasses: ["Dictionary"]
  1308. }),
  1309. smalltalk.DictionaryTest);
  1310. smalltalk.addMethod(
  1311. "_testEquality",
  1312. smalltalk.method({
  1313. selector: "testEquality",
  1314. category: 'tests',
  1315. fn: function (){
  1316. var self=this;
  1317. var d1,d2;
  1318. return smalltalk.withContext(function($ctx1) {
  1319. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1320. _st(self)._assert_(_st(_st((smalltalk.Dictionary || Dictionary))._new()).__eq(_st((smalltalk.Dictionary || Dictionary))._new()));
  1321. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1322. _st($1)._at_put_((1),(2));
  1323. $2=_st($1)._yourself();
  1324. d1=$2;
  1325. $3=_st((smalltalk.Dictionary || Dictionary))._new();
  1326. _st($3)._at_put_((1),(2));
  1327. $4=_st($3)._yourself();
  1328. d2=$4;
  1329. _st(self)._assert_(_st(d1).__eq(d2));
  1330. $5=_st((smalltalk.Dictionary || Dictionary))._new();
  1331. _st($5)._at_put_((1),(3));
  1332. $6=_st($5)._yourself();
  1333. d2=$6;
  1334. _st(self)._deny_(_st(d1).__eq(d2));
  1335. $7=_st((smalltalk.Dictionary || Dictionary))._new();
  1336. _st($7)._at_put_((2),(2));
  1337. $8=_st($7)._yourself();
  1338. d2=$8;
  1339. _st(self)._deny_(_st(d1).__eq(d2));
  1340. $9=_st((smalltalk.Dictionary || Dictionary))._new();
  1341. _st($9)._at_put_((1),(2));
  1342. _st($9)._at_put_((3),(4));
  1343. $10=_st($9)._yourself();
  1344. d2=$10;
  1345. _st(self)._deny_(_st(d1).__eq(d2));
  1346. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2}, smalltalk.DictionaryTest)})},
  1347. args: [],
  1348. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  1349. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1350. referencedClasses: ["Dictionary"]
  1351. }),
  1352. smalltalk.DictionaryTest);
  1353. smalltalk.addMethod(
  1354. "_testIfAbsent",
  1355. smalltalk.method({
  1356. selector: "testIfAbsent",
  1357. category: 'tests',
  1358. fn: function () {
  1359. var self=this;
  1360. var d,visited;
  1361. return smalltalk.withContext(function($ctx1) {
  1362. visited=false;
  1363. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1364. _st(d)._at_ifAbsent_("hello",(function(){
  1365. return smalltalk.withContext(function($ctx2) {
  1366. visited=true;
  1367. return visited;
  1368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1369. _st(self)._assert_(visited);
  1370. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)});},
  1371. args: [],
  1372. source: "testIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1373. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1374. referencedClasses: ["Dictionary"]
  1375. }),
  1376. smalltalk.DictionaryTest);
  1377. smalltalk.addMethod(
  1378. "_testIfPresent",
  1379. smalltalk.method({
  1380. selector: "testIfPresent",
  1381. category: 'tests',
  1382. fn: function (){
  1383. var self=this;
  1384. var d,visited,absent;
  1385. return smalltalk.withContext(function($ctx1) {
  1386. visited=false;
  1387. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1388. _st(d)._at_put_("hello","world");
  1389. _st(d)._at_ifPresent_("hello",(function(value){
  1390. return smalltalk.withContext(function($ctx2) {
  1391. visited=value;
  1392. return visited;
  1393. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1394. _st(self)._assert_equals_(visited,"world");
  1395. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1396. return smalltalk.withContext(function($ctx2) {
  1397. visited=value;
  1398. return visited;
  1399. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1400. _st(self)._assert_(_st(absent)._isNil());
  1401. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent}, smalltalk.DictionaryTest)})},
  1402. args: [],
  1403. source: "testIfPresent\x0a\x0a\x09| d visited absent |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  1404. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  1405. referencedClasses: ["Dictionary"]
  1406. }),
  1407. smalltalk.DictionaryTest);
  1408. smalltalk.addMethod(
  1409. "_testIfPresentIfAbsent",
  1410. smalltalk.method({
  1411. selector: "testIfPresentIfAbsent",
  1412. category: 'tests',
  1413. fn: function (){
  1414. var self=this;
  1415. var d,visited;
  1416. return smalltalk.withContext(function($ctx1) {
  1417. visited=false;
  1418. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1419. _st(d)._at_put_("hello","world");
  1420. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1421. return smalltalk.withContext(function($ctx2) {
  1422. visited=value;
  1423. return visited;
  1424. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1425. return smalltalk.withContext(function($ctx2) {
  1426. visited=true;
  1427. return visited;
  1428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1429. _st(self)._assert_equals_(visited,"world");
  1430. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1431. return smalltalk.withContext(function($ctx2) {
  1432. visited=value;
  1433. return visited;
  1434. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1435. return smalltalk.withContext(function($ctx2) {
  1436. visited=true;
  1437. return visited;
  1438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1439. _st(self)._assert_(visited);
  1440. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)})},
  1441. args: [],
  1442. source: "testIfPresentIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1443. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  1444. referencedClasses: ["Dictionary"]
  1445. }),
  1446. smalltalk.DictionaryTest);
  1447. smalltalk.addMethod(
  1448. "_testKeys",
  1449. smalltalk.method({
  1450. selector: "testKeys",
  1451. category: 'tests',
  1452. fn: function (){
  1453. var self=this;
  1454. var d;
  1455. return smalltalk.withContext(function($ctx1) {
  1456. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1457. _st(d)._at_put_((1),(2));
  1458. _st(d)._at_put_((2),(3));
  1459. _st(d)._at_put_((3),(4));
  1460. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1461. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d}, smalltalk.DictionaryTest)})},
  1462. args: [],
  1463. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  1464. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  1465. referencedClasses: ["Dictionary"]
  1466. }),
  1467. smalltalk.DictionaryTest);
  1468. smalltalk.addMethod(
  1469. "_testPointKey",
  1470. smalltalk.method({
  1471. selector: "testPointKey",
  1472. category: 'tests',
  1473. fn: function (){
  1474. var self=this;
  1475. var d;
  1476. return smalltalk.withContext(function($ctx1) {
  1477. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1478. _st(d)._at_put_(_st((1)).__at((1)),"foo");
  1479. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"foo");
  1480. _st(d)._at_put_(_st((1)).__at((1)),"bar");
  1481. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"bar");
  1482. _st(d)._removeKey_(_st((1)).__at((1)));
  1483. _st(self)._assert_equals_(_st(d)._at_ifAbsent_(_st((1)).__at((1)),(function(){
  1484. return smalltalk.withContext(function($ctx2) {
  1485. return "baz";
  1486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1487. _st(self)._deny_(_st(d)._includesKey_(_st((1)).__at((1))));
  1488. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d}, smalltalk.DictionaryTest)})},
  1489. args: [],
  1490. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a \x0a d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a d removeKey: 1@1.\x0a self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a self deny: (d includesKey: 1@1)",
  1491. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  1492. referencedClasses: ["Dictionary"]
  1493. }),
  1494. smalltalk.DictionaryTest);
  1495. smalltalk.addMethod(
  1496. "_testPrintString",
  1497. smalltalk.method({
  1498. selector: "testPrintString",
  1499. category: 'tests',
  1500. fn: function (){
  1501. var self=this;
  1502. return smalltalk.withContext(function($ctx1) {
  1503. var $1,$2;
  1504. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1505. _st($1)._at_put_("firstname","James");
  1506. _st($1)._at_put_("lastname","Bond");
  1507. $2=_st($1)._printString();
  1508. _st(self)._assert_equals_($2,"a Dictionary('firstname'->'James' , 'lastname'->'Bond')");
  1509. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{}, smalltalk.DictionaryTest)})},
  1510. args: [],
  1511. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new \x0a \x09at:'firstname' put: 'James';\x0a \x09at:'lastname' put: 'Bond';\x0a \x09printString)\x0a\x09\x09equals: 'a Dictionary(''firstname''->''James'' , ''lastname''->''Bond'')' ",
  1512. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1513. referencedClasses: ["Dictionary"]
  1514. }),
  1515. smalltalk.DictionaryTest);
  1516. smalltalk.addMethod(
  1517. "_testRemoveKey",
  1518. smalltalk.method({
  1519. selector: "testRemoveKey",
  1520. category: 'tests',
  1521. fn: function (){
  1522. var self=this;
  1523. var d,key;
  1524. return smalltalk.withContext(function($ctx1) {
  1525. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1526. _st(d)._at_put_((1),(2));
  1527. _st(d)._at_put_((2),(3));
  1528. _st(d)._at_put_((3),(4));
  1529. key=(2);
  1530. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1531. _st(d)._removeKey_(key);
  1532. _st(self)._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1533. _st(self)._assert_equals_(_st(d)._values(),[(2), (4)]);
  1534. _st(self)._deny_(_st(d)._includesKey_((2)));
  1535. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key}, smalltalk.DictionaryTest)})},
  1536. args: [],
  1537. source: "testRemoveKey\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a\x0a self assert: d keys equals: #(1 2 3).\x0a\x0a d removeKey: key.\x0a self assert: d keys equals: #(1 3).\x0a self assert: d values equals: #(2 4).\x0a self deny: (d includesKey: 2)",
  1538. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1539. referencedClasses: ["Dictionary"]
  1540. }),
  1541. smalltalk.DictionaryTest);
  1542. smalltalk.addMethod(
  1543. "_testRemoveKeyIfAbsent",
  1544. smalltalk.method({
  1545. selector: "testRemoveKeyIfAbsent",
  1546. category: 'tests',
  1547. fn: function (){
  1548. var self=this;
  1549. var d,key;
  1550. return smalltalk.withContext(function($ctx1) {
  1551. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1552. _st(d)._at_put_((1),(2));
  1553. _st(d)._at_put_((2),(3));
  1554. _st(d)._at_put_((3),(4));
  1555. key=(2);
  1556. _st(self)._assert_equals_(_st(d)._removeKey_(key),(3));
  1557. key=(3);
  1558. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1559. return smalltalk.withContext(function($ctx2) {
  1560. return (42);
  1561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1562. key="why";
  1563. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1564. return smalltalk.withContext(function($ctx2) {
  1565. return (42);
  1566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1567. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key}, smalltalk.DictionaryTest)})},
  1568. args: [],
  1569. source: "testRemoveKeyIfAbsent\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a self assert: (d removeKey: key) equals: 3.\x0a\x0a key := 3.\x0a self assert: (d removeKey: key ifAbsent: [42]) equals: 4.\x0a\x0a key := 'why'.\x0a self assert: (d removeKey: key ifAbsent: [42] ) equals: 42.",
  1570. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  1571. referencedClasses: ["Dictionary"]
  1572. }),
  1573. smalltalk.DictionaryTest);
  1574. smalltalk.addMethod(
  1575. "_testSize",
  1576. smalltalk.method({
  1577. selector: "testSize",
  1578. category: 'tests',
  1579. fn: function (){
  1580. var self=this;
  1581. var d;
  1582. return smalltalk.withContext(function($ctx1) {
  1583. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1584. _st(self)._assert_equals_(_st(d)._size(),(0));
  1585. _st(d)._at_put_((1),(2));
  1586. _st(self)._assert_equals_(_st(d)._size(),(1));
  1587. _st(d)._at_put_((2),(3));
  1588. _st(self)._assert_equals_(_st(d)._size(),(2));
  1589. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d}, smalltalk.DictionaryTest)})},
  1590. args: [],
  1591. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size equals: 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size equals: 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size equals: 2.",
  1592. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  1593. referencedClasses: ["Dictionary"]
  1594. }),
  1595. smalltalk.DictionaryTest);
  1596. smalltalk.addMethod(
  1597. "_testValues",
  1598. smalltalk.method({
  1599. selector: "testValues",
  1600. category: 'tests',
  1601. fn: function (){
  1602. var self=this;
  1603. var d;
  1604. return smalltalk.withContext(function($ctx1) {
  1605. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1606. _st(d)._at_put_((1),(2));
  1607. _st(d)._at_put_((2),(3));
  1608. _st(d)._at_put_((3),(4));
  1609. _st(self)._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1610. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d}, smalltalk.DictionaryTest)})},
  1611. args: [],
  1612. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  1613. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  1614. referencedClasses: ["Dictionary"]
  1615. }),
  1616. smalltalk.DictionaryTest);
  1617. smalltalk.addMethod(
  1618. "_collectionClass",
  1619. smalltalk.method({
  1620. selector: "collectionClass",
  1621. category: 'accessing',
  1622. fn: function () {
  1623. var self=this;
  1624. return smalltalk.withContext(function($ctx1) {
  1625. var $1;
  1626. $1=(smalltalk.Dictionary || Dictionary);
  1627. return $1;
  1628. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.DictionaryTest.klass)});},
  1629. args: [],
  1630. source: "collectionClass\x0a\x09^ Dictionary",
  1631. messageSends: [],
  1632. referencedClasses: ["Dictionary"]
  1633. }),
  1634. smalltalk.DictionaryTest.klass);
  1635. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1636. smalltalk.addMethod(
  1637. "_testAt",
  1638. smalltalk.method({
  1639. selector: "testAt",
  1640. category: 'tests',
  1641. fn: function (){
  1642. var self=this;
  1643. return smalltalk.withContext(function($ctx1) {
  1644. _st(self)._assert_equals_(_st(_st(self)._collection())._at_((4)),(-4));
  1645. _st(self)._should_raise_((function(){
  1646. return smalltalk.withContext(function($ctx2) {
  1647. return _st(_st(self)._collection())._at_((5));
  1648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1649. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SequenceableCollectionTest)})},
  1650. args: [],
  1651. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1652. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1653. referencedClasses: ["Error"]
  1654. }),
  1655. smalltalk.SequenceableCollectionTest);
  1656. smalltalk.addMethod(
  1657. "_testAtIfAbsent",
  1658. smalltalk.method({
  1659. selector: "testAtIfAbsent",
  1660. category: 'tests',
  1661. fn: function (){
  1662. var self=this;
  1663. return smalltalk.withContext(function($ctx1) {
  1664. _st(self)._assert_equals_(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  1665. return smalltalk.withContext(function($ctx2) {
  1666. return "none";
  1667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  1668. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{}, smalltalk.SequenceableCollectionTest)})},
  1669. args: [],
  1670. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1671. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"],
  1672. referencedClasses: []
  1673. }),
  1674. smalltalk.SequenceableCollectionTest);
  1675. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1676. smalltalk.addMethod(
  1677. "_testAtIfAbsent",
  1678. smalltalk.method({
  1679. selector: "testAtIfAbsent",
  1680. category: 'tests',
  1681. fn: function () {
  1682. var self=this;
  1683. var array;
  1684. return smalltalk.withContext(function($ctx1) {
  1685. array=["hello", "world"];
  1686. _st(self)._assert_equals_(_st(array)._at_((1)),"hello");
  1687. _st(self)._assert_equals_(_st(array)._at_((2)),"world");
  1688. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1689. return smalltalk.withContext(function($ctx2) {
  1690. return "not found";
  1691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1692. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1693. return smalltalk.withContext(function($ctx2) {
  1694. return "not found";
  1695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1696. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1697. return smalltalk.withContext(function($ctx2) {
  1698. return "not found";
  1699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1700. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1701. return smalltalk.withContext(function($ctx2) {
  1702. return "not found";
  1703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1704. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array}, smalltalk.ArrayTest)});},
  1705. args: [],
  1706. source: "testAtIfAbsent\x0a\x09| array |\x0a\x09array := #('hello' 'world').\x0a\x09self assert: (array at: 1) equals: 'hello'.\x0a\x09self assert: (array at: 2) equals: 'world'.\x0a\x09self assert: (array at: 2 ifAbsent: ['not found']) equals: 'world'.\x0a\x09self assert: (array at: 0 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: -10 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: 3 ifAbsent: ['not found']) equals: 'not found'.",
  1707. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1708. referencedClasses: []
  1709. }),
  1710. smalltalk.ArrayTest);
  1711. smalltalk.addMethod(
  1712. "_testFirstN",
  1713. smalltalk.method({
  1714. selector: "testFirstN",
  1715. category: 'tests',
  1716. fn: function (){
  1717. var self=this;
  1718. return smalltalk.withContext(function($ctx1) {
  1719. _st(self)._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1720. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{}, smalltalk.ArrayTest)})},
  1721. args: [],
  1722. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  1723. messageSends: ["assert:equals:", "first:"],
  1724. referencedClasses: []
  1725. }),
  1726. smalltalk.ArrayTest);
  1727. smalltalk.addMethod(
  1728. "_testIfEmpty",
  1729. smalltalk.method({
  1730. selector: "testIfEmpty",
  1731. category: 'tests',
  1732. fn: function (){
  1733. var self=this;
  1734. return smalltalk.withContext(function($ctx1) {
  1735. _st(self)._assert_equals_(_st("")._ifEmpty_((function(){
  1736. return smalltalk.withContext(function($ctx2) {
  1737. return "zork";
  1738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1739. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{}, smalltalk.ArrayTest)})},
  1740. args: [],
  1741. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  1742. messageSends: ["assert:equals:", "ifEmpty:"],
  1743. referencedClasses: []
  1744. }),
  1745. smalltalk.ArrayTest);
  1746. smalltalk.addMethod(
  1747. "_testPrintString",
  1748. smalltalk.method({
  1749. selector: "testPrintString",
  1750. category: 'tests',
  1751. fn: function (){
  1752. var self=this;
  1753. var array;
  1754. return smalltalk.withContext(function($ctx1) {
  1755. var $1,$2,$3,$4;
  1756. array=_st((smalltalk.Array || Array))._new();
  1757. _st(self)._assert_equals_(_st(array)._printString(),"a Array ()");
  1758. $1=array;
  1759. _st($1)._add_((1));
  1760. $2=_st($1)._add_((3));
  1761. _st(self)._assert_equals_(_st(array)._printString(),"a Array (1 3)");
  1762. _st(array)._add_("foo");
  1763. _st(self)._assert_equals_(_st(array)._printString(),"a Array (1 3 'foo')");
  1764. $3=array;
  1765. _st($3)._remove_((1));
  1766. $4=_st($3)._remove_((3));
  1767. _st(self)._assert_equals_(_st(array)._printString(),"a Array ('foo')");
  1768. _st(array)._addLast_((3));
  1769. _st(self)._assert_equals_(_st(array)._printString(),"a Array ('foo' 3)");
  1770. _st(array)._addLast_((3));
  1771. _st(self)._assert_equals_(_st(array)._printString(),"a Array ('foo' 3 3)");
  1772. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array}, smalltalk.ArrayTest)})},
  1773. args: [],
  1774. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'a Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'a Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'a Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'a Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'a Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'a Array (''foo'' 3 3)'.",
  1775. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1776. referencedClasses: ["Array"]
  1777. }),
  1778. smalltalk.ArrayTest);
  1779. smalltalk.addMethod(
  1780. "_collectionClass",
  1781. smalltalk.method({
  1782. selector: "collectionClass",
  1783. category: 'accessing',
  1784. fn: function () {
  1785. var self=this;
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $1;
  1788. $1=(smalltalk.Array || Array);
  1789. return $1;
  1790. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.ArrayTest.klass)});},
  1791. args: [],
  1792. source: "collectionClass\x0a\x09^ Array",
  1793. messageSends: [],
  1794. referencedClasses: ["Array"]
  1795. }),
  1796. smalltalk.ArrayTest.klass);
  1797. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1798. smalltalk.addMethod(
  1799. "_collection",
  1800. smalltalk.method({
  1801. selector: "collection",
  1802. category: 'accessing',
  1803. fn: function () {
  1804. var self=this;
  1805. return smalltalk.withContext(function($ctx1) {
  1806. return "hello";
  1807. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.StringTest)});},
  1808. args: [],
  1809. source: "collection\x0a\x09^'hello'",
  1810. messageSends: [],
  1811. referencedClasses: []
  1812. }),
  1813. smalltalk.StringTest);
  1814. smalltalk.addMethod(
  1815. "_collectionWithDuplicates",
  1816. smalltalk.method({
  1817. selector: "collectionWithDuplicates",
  1818. category: 'accessing',
  1819. fn: function () {
  1820. var self=this;
  1821. return smalltalk.withContext(function($ctx1) {
  1822. return "abbaerte";
  1823. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.StringTest)});},
  1824. args: [],
  1825. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  1826. messageSends: [],
  1827. referencedClasses: []
  1828. }),
  1829. smalltalk.StringTest);
  1830. smalltalk.addMethod(
  1831. "_testAddRemove",
  1832. smalltalk.method({
  1833. selector: "testAddRemove",
  1834. category: 'tests',
  1835. fn: function () {
  1836. var self=this;
  1837. return smalltalk.withContext(function($ctx1) {
  1838. _st(self)._should_raise_((function(){
  1839. return smalltalk.withContext(function($ctx2) {
  1840. return _st("hello")._add_("a");
  1841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1842. _st(self)._should_raise_((function(){
  1843. return smalltalk.withContext(function($ctx2) {
  1844. return _st("hello")._remove_("h");
  1845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1846. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{}, smalltalk.StringTest)});},
  1847. args: [],
  1848. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  1849. messageSends: ["should:raise:", "add:", "remove:"],
  1850. referencedClasses: ["Error"]
  1851. }),
  1852. smalltalk.StringTest);
  1853. smalltalk.addMethod(
  1854. "_testAsArray",
  1855. smalltalk.method({
  1856. selector: "testAsArray",
  1857. category: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. return smalltalk.withContext(function($ctx1) {
  1861. _st(self)._assert_equals_(_st("hello")._asArray(),["h", "e", "l", "l", "o"]);
  1862. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.StringTest)})},
  1863. args: [],
  1864. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  1865. messageSends: ["assert:equals:", "asArray"],
  1866. referencedClasses: []
  1867. }),
  1868. smalltalk.StringTest);
  1869. smalltalk.addMethod(
  1870. "_testAt",
  1871. smalltalk.method({
  1872. selector: "testAt",
  1873. category: 'tests',
  1874. fn: function (){
  1875. var self=this;
  1876. return smalltalk.withContext(function($ctx1) {
  1877. _st(self)._assert_equals_(_st("hello")._at_((1)),"h");
  1878. _st(self)._assert_equals_(_st("hello")._at_((5)),"o");
  1879. _st(self)._assert_equals_(_st("hello")._at_ifAbsent_((6),(function(){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return nil;
  1882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1883. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.StringTest)})},
  1884. args: [],
  1885. source: "testAt\x0a\x09self assert: ('hello' at: 1) equals: 'h'.\x0a\x09self assert: ('hello' at: 5) equals: 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [nil]) equals: nil",
  1886. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1887. referencedClasses: []
  1888. }),
  1889. smalltalk.StringTest);
  1890. smalltalk.addMethod(
  1891. "_testAtPut",
  1892. smalltalk.method({
  1893. selector: "testAtPut",
  1894. category: 'tests',
  1895. fn: function () {
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. _st(self)._should_raise_((function(){
  1899. return smalltalk.withContext(function($ctx2) {
  1900. return _st("hello")._at_put_((1),"a");
  1901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1902. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.StringTest)});},
  1903. args: [],
  1904. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  1905. messageSends: ["should:raise:", "at:put:"],
  1906. referencedClasses: ["Error"]
  1907. }),
  1908. smalltalk.StringTest);
  1909. smalltalk.addMethod(
  1910. "_testCollect",
  1911. smalltalk.method({
  1912. selector: "testCollect",
  1913. category: 'tests',
  1914. fn: function () {
  1915. var self=this;
  1916. var newCollection;
  1917. return smalltalk.withContext(function($ctx1) {
  1918. newCollection="hheelllloo";
  1919. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1920. return smalltalk.withContext(function($ctx2) {
  1921. return _st(each).__comma(each);
  1922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1923. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.StringTest)});},
  1924. args: [],
  1925. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  1926. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  1927. referencedClasses: []
  1928. }),
  1929. smalltalk.StringTest);
  1930. smalltalk.addMethod(
  1931. "_testCopyWithoutAll",
  1932. smalltalk.method({
  1933. selector: "testCopyWithoutAll",
  1934. category: 'tests',
  1935. fn: function (){
  1936. var self=this;
  1937. return smalltalk.withContext(function($ctx1) {
  1938. _st(self)._assert_equals_(_st("*hello* *world*")._copyWithoutAll_("*"),"hello world");
  1939. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{}, smalltalk.StringTest)})},
  1940. args: [],
  1941. source: "testCopyWithoutAll\x0a\x09self \x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a equals: 'hello world'",
  1942. messageSends: ["assert:equals:", "copyWithoutAll:"],
  1943. referencedClasses: []
  1944. }),
  1945. smalltalk.StringTest);
  1946. smalltalk.addMethod(
  1947. "_testDetect",
  1948. smalltalk.method({
  1949. selector: "testDetect",
  1950. category: 'tests',
  1951. fn: function (){
  1952. var self=this;
  1953. return smalltalk.withContext(function($ctx1) {
  1954. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  1955. return smalltalk.withContext(function($ctx2) {
  1956. return _st(each).__eq("h");
  1957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  1958. _st(self)._should_raise_((function(){
  1959. return smalltalk.withContext(function($ctx2) {
  1960. return _st(_st(self)._collection())._detect_((function(each){
  1961. return smalltalk.withContext(function($ctx3) {
  1962. return _st(each).__eq((6));
  1963. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1965. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.StringTest)})},
  1966. args: [],
  1967. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1968. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  1969. referencedClasses: ["Error"]
  1970. }),
  1971. smalltalk.StringTest);
  1972. smalltalk.addMethod(
  1973. "_testEquality",
  1974. smalltalk.method({
  1975. selector: "testEquality",
  1976. category: 'tests',
  1977. fn: function (){
  1978. var self=this;
  1979. return smalltalk.withContext(function($ctx1) {
  1980. _st(self)._assert_equals_("hello","hello");
  1981. _st(self)._deny_(_st("hello").__eq("world"));
  1982. _st(self)._assert_equals_("hello",_st("hello")._yourself());
  1983. _st(self)._assert_equals_(_st("hello")._yourself(),"hello");
  1984. _st(self)._deny_(_st("").__eq((0)));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.StringTest)})},
  1986. args: [],
  1987. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  1988. messageSends: ["assert:equals:", "deny:", "=", "yourself"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.StringTest);
  1992. smalltalk.addMethod(
  1993. "_testIdentity",
  1994. smalltalk.method({
  1995. selector: "testIdentity",
  1996. category: 'tests',
  1997. fn: function () {
  1998. var self=this;
  1999. return smalltalk.withContext(function($ctx1) {
  2000. _st(self)._assert_(_st("hello").__eq_eq("hello"));
  2001. _st(self)._deny_(_st("hello").__eq_eq("world"));
  2002. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  2003. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  2004. _st(self)._deny_(_st("").__eq_eq((0)));
  2005. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.StringTest)});},
  2006. args: [],
  2007. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  2008. messageSends: ["assert:", "==", "deny:", "yourself"],
  2009. referencedClasses: []
  2010. }),
  2011. smalltalk.StringTest);
  2012. smalltalk.addMethod(
  2013. "_testIncludesSubString",
  2014. smalltalk.method({
  2015. selector: "testIncludesSubString",
  2016. category: 'tests',
  2017. fn: function () {
  2018. var self=this;
  2019. return smalltalk.withContext(function($ctx1) {
  2020. _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  2021. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  2022. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{}, smalltalk.StringTest)});},
  2023. args: [],
  2024. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2025. messageSends: ["assert:", "includesSubString:", "deny:"],
  2026. referencedClasses: []
  2027. }),
  2028. smalltalk.StringTest);
  2029. smalltalk.addMethod(
  2030. "_testJoin",
  2031. smalltalk.method({
  2032. selector: "testJoin",
  2033. category: 'tests',
  2034. fn: function (){
  2035. var self=this;
  2036. return smalltalk.withContext(function($ctx1) {
  2037. _st(self)._assert_equals_(_st(",")._join_(["hello", "world"]),"hello,world");
  2038. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{}, smalltalk.StringTest)})},
  2039. args: [],
  2040. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2041. messageSends: ["assert:equals:", "join:"],
  2042. referencedClasses: []
  2043. }),
  2044. smalltalk.StringTest);
  2045. smalltalk.addMethod(
  2046. "_testSelect",
  2047. smalltalk.method({
  2048. selector: "testSelect",
  2049. category: 'tests',
  2050. fn: function () {
  2051. var self=this;
  2052. var newCollection;
  2053. return smalltalk.withContext(function($ctx1) {
  2054. newCollection="o";
  2055. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  2056. return smalltalk.withContext(function($ctx2) {
  2057. return _st(each).__eq("o");
  2058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2059. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.StringTest)});},
  2060. args: [],
  2061. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  2062. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2063. referencedClasses: []
  2064. }),
  2065. smalltalk.StringTest);
  2066. smalltalk.addMethod(
  2067. "_testSize",
  2068. smalltalk.method({
  2069. selector: "testSize",
  2070. category: 'tests',
  2071. fn: function () {
  2072. var self=this;
  2073. return smalltalk.withContext(function($ctx1) {
  2074. _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  2075. _st(self)._assert_equals_(_st("")._size(),(0));
  2076. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.StringTest)});},
  2077. args: [],
  2078. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2079. messageSends: ["assert:equals:", "size"],
  2080. referencedClasses: []
  2081. }),
  2082. smalltalk.StringTest);
  2083. smalltalk.addMethod(
  2084. "_testStreamContents",
  2085. smalltalk.method({
  2086. selector: "testStreamContents",
  2087. category: 'tests',
  2088. fn: function (){
  2089. var self=this;
  2090. return smalltalk.withContext(function($ctx1) {
  2091. var $1,$2;
  2092. _st(self)._assert_equals_(_st((smalltalk.String || String))._streamContents_((function(aStream){
  2093. return smalltalk.withContext(function($ctx2) {
  2094. $1=aStream;
  2095. _st($1)._nextPutAll_("hello");
  2096. _st($1)._space();
  2097. $2=_st($1)._nextPutAll_("world");
  2098. return $2;
  2099. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  2100. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{}, smalltalk.StringTest)})},
  2101. args: [],
  2102. source: "testStreamContents\x0a\x09self \x0a\x09\x09assert: (String streamContents: [ :aStream | \x0a\x09\x09\x09aStream \x0a\x09\x09\x09\x09nextPutAll: 'hello'; space; \x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  2103. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2104. referencedClasses: ["String"]
  2105. }),
  2106. smalltalk.StringTest);
  2107. smalltalk.addMethod(
  2108. "_collectionClass",
  2109. smalltalk.method({
  2110. selector: "collectionClass",
  2111. category: 'accessing',
  2112. fn: function () {
  2113. var self=this;
  2114. return smalltalk.withContext(function($ctx1) {
  2115. var $1;
  2116. $1=(smalltalk.String || String);
  2117. return $1;
  2118. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.StringTest.klass)});},
  2119. args: [],
  2120. source: "collectionClass\x0a\x09^ String",
  2121. messageSends: [],
  2122. referencedClasses: ["String"]
  2123. }),
  2124. smalltalk.StringTest.klass);
  2125. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2126. smalltalk.addMethod(
  2127. "_collection",
  2128. smalltalk.method({
  2129. selector: "collection",
  2130. category: 'accessing',
  2131. fn: function () {
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) {
  2134. return smalltalk.symbolFor("hello");
  2135. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.SymbolTest)});},
  2136. args: [],
  2137. source: "collection\x0a\x09^ #hello",
  2138. messageSends: [],
  2139. referencedClasses: []
  2140. }),
  2141. smalltalk.SymbolTest);
  2142. smalltalk.addMethod(
  2143. "_collectionWithDuplicates",
  2144. smalltalk.method({
  2145. selector: "collectionWithDuplicates",
  2146. category: 'accessing',
  2147. fn: function () {
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. return smalltalk.symbolFor("phhaaarorra");
  2151. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.SymbolTest)});},
  2152. args: [],
  2153. source: "collectionWithDuplicates\x0a\x09^ #phhaaarorra",
  2154. messageSends: [],
  2155. referencedClasses: []
  2156. }),
  2157. smalltalk.SymbolTest);
  2158. smalltalk.addMethod(
  2159. "_testAsString",
  2160. smalltalk.method({
  2161. selector: "testAsString",
  2162. category: 'tests',
  2163. fn: function () {
  2164. var self=this;
  2165. return smalltalk.withContext(function($ctx1) {
  2166. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._asString(),"hello");
  2167. return self}, function($ctx1) {$ctx1.fill(self,"testAsString",{}, smalltalk.SymbolTest)});},
  2168. args: [],
  2169. source: "testAsString\x0a\x09self assert: #hello asString equals: 'hello'",
  2170. messageSends: ["assert:equals:", "asString"],
  2171. referencedClasses: []
  2172. }),
  2173. smalltalk.SymbolTest);
  2174. smalltalk.addMethod(
  2175. "_testAsSymbol",
  2176. smalltalk.method({
  2177. selector: "testAsSymbol",
  2178. category: 'tests',
  2179. fn: function () {
  2180. var self=this;
  2181. return smalltalk.withContext(function($ctx1) {
  2182. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(_st(smalltalk.symbolFor("hello"))._asSymbol()));
  2183. return self}, function($ctx1) {$ctx1.fill(self,"testAsSymbol",{}, smalltalk.SymbolTest)});},
  2184. args: [],
  2185. source: "testAsSymbol\x0a\x09self assert: #hello == #hello asSymbol",
  2186. messageSends: ["assert:", "==", "asSymbol"],
  2187. referencedClasses: []
  2188. }),
  2189. smalltalk.SymbolTest);
  2190. smalltalk.addMethod(
  2191. "_testAt",
  2192. smalltalk.method({
  2193. selector: "testAt",
  2194. category: 'tests',
  2195. fn: function (){
  2196. var self=this;
  2197. return smalltalk.withContext(function($ctx1) {
  2198. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._at_((1)),"h");
  2199. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._at_((5)),"o");
  2200. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._at_ifAbsent_((6),(function(){
  2201. return smalltalk.withContext(function($ctx2) {
  2202. return nil;
  2203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2204. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SymbolTest)})},
  2205. args: [],
  2206. source: "testAt\x0a\x09self assert: (#hello at: 1) equals: 'h'.\x0a\x09self assert: (#hello at: 5) equals: 'o'.\x0a\x09self assert: (#hello at: 6 ifAbsent: [nil]) equals: nil",
  2207. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2208. referencedClasses: []
  2209. }),
  2210. smalltalk.SymbolTest);
  2211. smalltalk.addMethod(
  2212. "_testAtPut",
  2213. smalltalk.method({
  2214. selector: "testAtPut",
  2215. category: 'tests',
  2216. fn: function () {
  2217. var self=this;
  2218. return smalltalk.withContext(function($ctx1) {
  2219. _st(self)._should_raise_((function(){
  2220. return smalltalk.withContext(function($ctx2) {
  2221. return _st("hello")._at_put_((1),"a");
  2222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.SymbolTest)});},
  2224. args: [],
  2225. source: "testAtPut\x0a\x09\x22Symbol instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2226. messageSends: ["should:raise:", "at:put:"],
  2227. referencedClasses: ["Error"]
  2228. }),
  2229. smalltalk.SymbolTest);
  2230. smalltalk.addMethod(
  2231. "_testCollect",
  2232. smalltalk.method({
  2233. selector: "testCollect",
  2234. category: 'tests',
  2235. fn: function () {
  2236. var self=this;
  2237. var newCollection;
  2238. return smalltalk.withContext(function($ctx1) {
  2239. newCollection=smalltalk.symbolFor("hheelllloo");
  2240. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  2241. return smalltalk.withContext(function($ctx2) {
  2242. return _st(each).__comma(each);
  2243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2244. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.SymbolTest)});},
  2245. args: [],
  2246. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #hheelllloo.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  2247. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2248. referencedClasses: []
  2249. }),
  2250. smalltalk.SymbolTest);
  2251. smalltalk.addMethod(
  2252. "_testComparing",
  2253. smalltalk.method({
  2254. selector: "testComparing",
  2255. category: 'tests',
  2256. fn: function () {
  2257. var self=this;
  2258. return smalltalk.withContext(function($ctx1) {
  2259. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("aa")));
  2260. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("ba")));
  2261. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt(smalltalk.symbolFor("ba")));
  2262. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt(smalltalk.symbolFor("ba")));
  2263. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("aa")));
  2264. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("ba")));
  2265. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt_eq(smalltalk.symbolFor("ba")));
  2266. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt_eq(smalltalk.symbolFor("ba")));
  2267. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SymbolTest)});},
  2268. args: [],
  2269. source: "testComparing\x0a\x09self assert: #ab > #aa.\x0a\x09self deny: #ab > #ba.\x0a\x0a\x09self assert: #ab < #ba.\x0a\x09self deny: #bb < #ba.\x0a\x0a\x09self assert: #ab >= #aa.\x0a\x09self deny: #ab >= #ba.\x0a\x0a\x09self assert: #ab <= #ba.\x0a\x09self deny: #bb <= #ba",
  2270. messageSends: ["assert:", ">", "deny:", "<", ">=", "<="],
  2271. referencedClasses: []
  2272. }),
  2273. smalltalk.SymbolTest);
  2274. smalltalk.addMethod(
  2275. "_testCopying",
  2276. smalltalk.method({
  2277. selector: "testCopying",
  2278. category: 'tests',
  2279. fn: function () {
  2280. var self=this;
  2281. return smalltalk.withContext(function($ctx1) {
  2282. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._copy()).__eq_eq(smalltalk.symbolFor("hello")));
  2283. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._deepCopy()).__eq_eq(smalltalk.symbolFor("hello")));
  2284. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.SymbolTest)});},
  2285. args: [],
  2286. source: "testCopying\x0a\x09self assert: #hello copy == #hello.\x0a\x09self assert: #hello deepCopy == #hello",
  2287. messageSends: ["assert:", "==", "copy", "deepCopy"],
  2288. referencedClasses: []
  2289. }),
  2290. smalltalk.SymbolTest);
  2291. smalltalk.addMethod(
  2292. "_testDetect",
  2293. smalltalk.method({
  2294. selector: "testDetect",
  2295. category: 'tests',
  2296. fn: function (){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  2300. return smalltalk.withContext(function($ctx2) {
  2301. return _st(each).__eq("h");
  2302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  2303. _st(self)._should_raise_((function(){
  2304. return smalltalk.withContext(function($ctx2) {
  2305. return _st(_st(self)._collection())._detect_((function(each){
  2306. return smalltalk.withContext(function($ctx3) {
  2307. return _st(each).__eq("z");
  2308. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  2309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2310. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.SymbolTest)})},
  2311. args: [],
  2312. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 'z' ] ]\x0a\x09\x09raise: Error",
  2313. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  2314. referencedClasses: ["Error"]
  2315. }),
  2316. smalltalk.SymbolTest);
  2317. smalltalk.addMethod(
  2318. "_testEquality",
  2319. smalltalk.method({
  2320. selector: "testEquality",
  2321. category: 'tests',
  2322. fn: function (){
  2323. var self=this;
  2324. return smalltalk.withContext(function($ctx1) {
  2325. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("hello")));
  2326. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("world")));
  2327. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  2328. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(smalltalk.symbolFor("hello")));
  2329. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq("hello"));
  2330. _st(self)._deny_(_st("hello").__eq(smalltalk.symbolFor("hello")));
  2331. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.SymbolTest)})},
  2332. args: [],
  2333. source: "testEquality\x0a\x09self assert: (#hello = #hello).\x0a\x09self deny: #hello = #world.\x0a\x0a\x09self assert: (#hello = #hello yourself).\x0a\x09self assert: (#hello yourself = #hello).\x0a\x0a\x09self deny: #hello = 'hello'.\x0a\x09self deny: 'hello' = #hello.",
  2334. messageSends: ["assert:", "=", "deny:", "yourself"],
  2335. referencedClasses: []
  2336. }),
  2337. smalltalk.SymbolTest);
  2338. smalltalk.addMethod(
  2339. "_testIdentity",
  2340. smalltalk.method({
  2341. selector: "testIdentity",
  2342. category: 'tests',
  2343. fn: function () {
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) {
  2346. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("hello")));
  2347. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("world")));
  2348. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  2349. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(_st(_st(smalltalk.symbolFor("hello"))._asString())._asSymbol()));
  2350. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.SymbolTest)});},
  2351. args: [],
  2352. source: "testIdentity\x0a\x09self assert: #hello == #hello.\x0a\x09self deny: #hello == #world.\x0a\x0a\x09self assert: #hello = #hello yourself.\x0a\x09self assert: #hello yourself = #hello asString asSymbol",
  2353. messageSends: ["assert:", "==", "deny:", "=", "yourself", "asSymbol", "asString"],
  2354. referencedClasses: []
  2355. }),
  2356. smalltalk.SymbolTest);
  2357. smalltalk.addMethod(
  2358. "_testIsEmpty",
  2359. smalltalk.method({
  2360. selector: "testIsEmpty",
  2361. category: 'tests',
  2362. fn: function () {
  2363. var self=this;
  2364. return smalltalk.withContext(function($ctx1) {
  2365. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  2366. _st(self)._assert_(_st(_st("")._asSymbol())._isEmpty());
  2367. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.SymbolTest)});},
  2368. args: [],
  2369. source: "testIsEmpty\x0a\x09self deny: self collection isEmpty.\x0a\x09self assert: '' asSymbol isEmpty",
  2370. messageSends: ["deny:", "isEmpty", "collection", "assert:", "asSymbol"],
  2371. referencedClasses: []
  2372. }),
  2373. smalltalk.SymbolTest);
  2374. smalltalk.addMethod(
  2375. "_testIsSymbolIsString",
  2376. smalltalk.method({
  2377. selector: "testIsSymbolIsString",
  2378. category: 'tests',
  2379. fn: function () {
  2380. var self=this;
  2381. return smalltalk.withContext(function($ctx1) {
  2382. _st(self)._assert_(_st(smalltalk.symbolFor("hello"))._isSymbol());
  2383. _st(self)._deny_(_st("hello")._isSymbol());
  2384. _st(self)._deny_(_st(smalltalk.symbolFor("hello"))._isString());
  2385. _st(self)._assert_(_st("hello")._isString());
  2386. return self}, function($ctx1) {$ctx1.fill(self,"testIsSymbolIsString",{}, smalltalk.SymbolTest)});},
  2387. args: [],
  2388. source: "testIsSymbolIsString\x0a\x09self assert: #hello isSymbol.\x0a\x09self deny: 'hello' isSymbol.\x0a\x09self deny: #hello isString.\x0a\x09self assert: 'hello' isString",
  2389. messageSends: ["assert:", "isSymbol", "deny:", "isString"],
  2390. referencedClasses: []
  2391. }),
  2392. smalltalk.SymbolTest);
  2393. smalltalk.addMethod(
  2394. "_testSelect",
  2395. smalltalk.method({
  2396. selector: "testSelect",
  2397. category: 'tests',
  2398. fn: function () {
  2399. var self=this;
  2400. var newCollection;
  2401. return smalltalk.withContext(function($ctx1) {
  2402. newCollection="o";
  2403. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  2404. return smalltalk.withContext(function($ctx2) {
  2405. return _st(each).__eq("o");
  2406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2407. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.SymbolTest)});},
  2408. args: [],
  2409. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  2410. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2411. referencedClasses: []
  2412. }),
  2413. smalltalk.SymbolTest);
  2414. smalltalk.addMethod(
  2415. "_testSize",
  2416. smalltalk.method({
  2417. selector: "testSize",
  2418. category: 'tests',
  2419. fn: function () {
  2420. var self=this;
  2421. return smalltalk.withContext(function($ctx1) {
  2422. _st(self)._assert_equals_(_st(smalltalk.symbolFor("a"))._size(),(1));
  2423. _st(self)._assert_equals_(_st(smalltalk.symbolFor("aaaaa"))._size(),(5));
  2424. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SymbolTest)});},
  2425. args: [],
  2426. source: "testSize\x0a\x09self assert: #a size equals: 1.\x0a\x09self assert: #aaaaa size equals: 5",
  2427. messageSends: ["assert:equals:", "size"],
  2428. referencedClasses: []
  2429. }),
  2430. smalltalk.SymbolTest);
  2431. smalltalk.addMethod(
  2432. "_collectionClass",
  2433. smalltalk.method({
  2434. selector: "collectionClass",
  2435. category: 'accessing',
  2436. fn: function () {
  2437. var self=this;
  2438. return smalltalk.withContext(function($ctx1) {
  2439. var $1;
  2440. $1=(smalltalk.Symbol || Symbol);
  2441. return $1;
  2442. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.SymbolTest.klass)});},
  2443. args: [],
  2444. source: "collectionClass\x0a\x09^ Symbol",
  2445. messageSends: [],
  2446. referencedClasses: ["Symbol"]
  2447. }),
  2448. smalltalk.SymbolTest.klass);
  2449. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2450. smalltalk.addMethod(
  2451. "_jsObject",
  2452. smalltalk.method({
  2453. selector: "jsObject",
  2454. category: 'accessing',
  2455. fn: function (){
  2456. var self=this;
  2457. return smalltalk.withContext(function($ctx1) {
  2458. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2459. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxyTest)})},
  2460. args: [],
  2461. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2462. messageSends: [],
  2463. referencedClasses: []
  2464. }),
  2465. smalltalk.JSObjectProxyTest);
  2466. smalltalk.addMethod(
  2467. "_testAtIfAbsent",
  2468. smalltalk.method({
  2469. selector: "testAtIfAbsent",
  2470. category: 'tests',
  2471. fn: function (){
  2472. var self=this;
  2473. var testObject;
  2474. return smalltalk.withContext(function($ctx1) {
  2475. testObject=_st(self)._jsObject();
  2476. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2477. return smalltalk.withContext(function($ctx2) {
  2478. return "Property does not exist";
  2479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  2480. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return "Property does not exist";
  2483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2484. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2485. return smalltalk.withContext(function($ctx2) {
  2486. return "Property does not exist";
  2487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  2488. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2489. return smalltalk.withContext(function($ctx2) {
  2490. return "Property does not exist";
  2491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2492. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject}, smalltalk.JSObjectProxyTest)})},
  2493. args: [],
  2494. source: "testAtIfAbsent\x0a\x09| testObject |\x0a testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: ['Property does not exist']) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: ['Property does not exist']) equals: nil.\x0a self assert: (testObject at: 'a' ifAbsent: ['Property does not exist']) equals: 1.\x0a self assert: (testObject at: 'f' ifAbsent: ['Property does not exist']) equals: nil.",
  2495. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2496. referencedClasses: []
  2497. }),
  2498. smalltalk.JSObjectProxyTest);
  2499. smalltalk.addMethod(
  2500. "_testDNU",
  2501. smalltalk.method({
  2502. selector: "testDNU",
  2503. category: 'tests',
  2504. fn: function () {
  2505. var self=this;
  2506. return smalltalk.withContext(function($ctx1) {
  2507. _st(self)._should_raise_((function(){
  2508. return smalltalk.withContext(function($ctx2) {
  2509. return _st(_st(self)._jsObject())._foo();
  2510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2511. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.JSObjectProxyTest)});},
  2512. args: [],
  2513. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2514. messageSends: ["should:raise:", "foo", "jsObject"],
  2515. referencedClasses: ["MessageNotUnderstood"]
  2516. }),
  2517. smalltalk.JSObjectProxyTest);
  2518. smalltalk.addMethod(
  2519. "_testMessageSend",
  2520. smalltalk.method({
  2521. selector: "testMessageSend",
  2522. category: 'tests',
  2523. fn: function () {
  2524. var self=this;
  2525. return smalltalk.withContext(function($ctx1) {
  2526. _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  2527. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  2528. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  2529. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{}, smalltalk.JSObjectProxyTest)});},
  2530. args: [],
  2531. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  2532. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2533. referencedClasses: []
  2534. }),
  2535. smalltalk.JSObjectProxyTest);
  2536. smalltalk.addMethod(
  2537. "_testMethodWithArguments",
  2538. smalltalk.method({
  2539. selector: "testMethodWithArguments",
  2540. category: 'tests',
  2541. fn: function () {
  2542. var self=this;
  2543. return smalltalk.withContext(function($ctx1) {
  2544. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  2545. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{}, smalltalk.JSObjectProxyTest)});},
  2546. args: [],
  2547. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2548. messageSends: ["assert:equals:", "c:", "jsObject"],
  2549. referencedClasses: []
  2550. }),
  2551. smalltalk.JSObjectProxyTest);
  2552. smalltalk.addMethod(
  2553. "_testPrinting",
  2554. smalltalk.method({
  2555. selector: "testPrinting",
  2556. category: 'tests',
  2557. fn: function (){
  2558. var self=this;
  2559. return smalltalk.withContext(function($ctx1) {
  2560. _st(self)._assert_equals_(_st(_st(self)._jsObject())._printString(),"[object Object]");
  2561. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{}, smalltalk.JSObjectProxyTest)})},
  2562. args: [],
  2563. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2564. messageSends: ["assert:equals:", "printString", "jsObject"],
  2565. referencedClasses: []
  2566. }),
  2567. smalltalk.JSObjectProxyTest);
  2568. smalltalk.addMethod(
  2569. "_testPropertyThatReturnsEmptyString",
  2570. smalltalk.method({
  2571. selector: "testPropertyThatReturnsEmptyString",
  2572. category: 'tests',
  2573. fn: function (){
  2574. var self=this;
  2575. var object;
  2576. return smalltalk.withContext(function($ctx1) {
  2577. object=_st(self)._jsObject();
  2578. _st(self)._assert_equals_(_st(object)._d(),"");
  2579. _st(object)._d_("hello");
  2580. _st(self)._assert_equals_(_st(object)._d(),"hello");
  2581. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object}, smalltalk.JSObjectProxyTest)})},
  2582. args: [],
  2583. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  2584. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2585. referencedClasses: []
  2586. }),
  2587. smalltalk.JSObjectProxyTest);
  2588. smalltalk.addMethod(
  2589. "_testPropertyThatReturnsUndefined",
  2590. smalltalk.method({
  2591. selector: "testPropertyThatReturnsUndefined",
  2592. category: 'tests',
  2593. fn: function () {
  2594. var self=this;
  2595. var object;
  2596. return smalltalk.withContext(function($ctx1) {
  2597. object=_st(self)._jsObject();
  2598. _st(self)._shouldnt_raise_((function(){
  2599. return smalltalk.withContext(function($ctx2) {
  2600. return _st(object)._e();
  2601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2602. _st(self)._assert_(_st(_st(object)._e())._isNil());
  2603. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object}, smalltalk.JSObjectProxyTest)});},
  2604. args: [],
  2605. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a self assert: object e isNil",
  2606. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2607. referencedClasses: ["MessageNotUnderstood"]
  2608. }),
  2609. smalltalk.JSObjectProxyTest);
  2610. smalltalk.addMethod(
  2611. "_testValue",
  2612. smalltalk.method({
  2613. selector: "testValue",
  2614. category: 'tests',
  2615. fn: function (){
  2616. var self=this;
  2617. var testObject;
  2618. return smalltalk.withContext(function($ctx1) {
  2619. testObject=_st(self)._jsObject();
  2620. _st(self)._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2621. _st(testObject)._at_put_("value","aValue");
  2622. _st(self)._assert_equals_(_st(testObject)._value(),"aValue");
  2623. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject}, smalltalk.JSObjectProxyTest)})},
  2624. args: [],
  2625. source: "testValue\x0a\x09| testObject |\x0a testObject := self jsObject.\x0a\x09self assert: testObject value printString equals: '[object Object]'.\x0a testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  2626. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2627. referencedClasses: []
  2628. }),
  2629. smalltalk.JSObjectProxyTest);
  2630. smalltalk.addMethod(
  2631. "_testYourself",
  2632. smalltalk.method({
  2633. selector: "testYourself",
  2634. category: 'tests',
  2635. fn: function () {
  2636. var self=this;
  2637. var object;
  2638. return smalltalk.withContext(function($ctx1) {
  2639. var $1,$2;
  2640. $1=_st(self)._jsObject();
  2641. _st($1)._d_("test");
  2642. $2=_st($1)._yourself();
  2643. object=$2;
  2644. _st(self)._assert_equals_(_st(object)._d(),"test");
  2645. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object}, smalltalk.JSObjectProxyTest)});},
  2646. args: [],
  2647. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2648. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2649. referencedClasses: []
  2650. }),
  2651. smalltalk.JSObjectProxyTest);
  2652. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2653. smalltalk.addMethod(
  2654. "_testCatchingException",
  2655. smalltalk.method({
  2656. selector: "testCatchingException",
  2657. category: 'tests',
  2658. fn: function () {
  2659. var self=this;
  2660. return smalltalk.withContext(function($ctx1) {
  2661. _st((function(){
  2662. return smalltalk.withContext(function($ctx2) {
  2663. return _st(self)._throwException();
  2664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(error){
  2665. return smalltalk.withContext(function($ctx2) {
  2666. return _st(self)._assert_(_st(_st(error)._exception()).__eq("test"));
  2667. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2668. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{}, smalltalk.JavaScriptExceptionTest)});},
  2669. args: [],
  2670. source: "testCatchingException\x0a\x09[ self throwException ]\x0a \x09\x09on: Error\x0a do: [ :error | \x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2671. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2672. referencedClasses: ["Error"]
  2673. }),
  2674. smalltalk.JavaScriptExceptionTest);
  2675. smalltalk.addMethod(
  2676. "_testRaisingException",
  2677. smalltalk.method({
  2678. selector: "testRaisingException",
  2679. category: 'tests',
  2680. fn: function () {
  2681. var self=this;
  2682. return smalltalk.withContext(function($ctx1) {
  2683. _st(self)._should_raise_((function(){
  2684. return smalltalk.withContext(function($ctx2) {
  2685. return _st(self)._throwException();
  2686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.JavaScriptException || JavaScriptException));
  2687. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{}, smalltalk.JavaScriptExceptionTest)});},
  2688. args: [],
  2689. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2690. messageSends: ["should:raise:", "throwException"],
  2691. referencedClasses: ["JavaScriptException"]
  2692. }),
  2693. smalltalk.JavaScriptExceptionTest);
  2694. smalltalk.addMethod(
  2695. "_throwException",
  2696. smalltalk.method({
  2697. selector: "throwException",
  2698. category: 'helpers',
  2699. fn: function () {
  2700. var self=this;
  2701. return smalltalk.withContext(function($ctx1) {
  2702. throw 'test';
  2703. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{}, smalltalk.JavaScriptExceptionTest)});},
  2704. args: [],
  2705. source: "throwException\x0a\x09<throw 'test'>",
  2706. messageSends: [],
  2707. referencedClasses: []
  2708. }),
  2709. smalltalk.JavaScriptExceptionTest);
  2710. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2711. smalltalk.addMethod(
  2712. "_testAbs",
  2713. smalltalk.method({
  2714. selector: "testAbs",
  2715. category: 'tests',
  2716. fn: function (){
  2717. var self=this;
  2718. return smalltalk.withContext(function($ctx1) {
  2719. _st(self)._assert_equals_(_st((4))._abs(),(4));
  2720. _st(self)._assert_equals_(_st((-4))._abs(),(4));
  2721. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{}, smalltalk.NumberTest)})},
  2722. args: [],
  2723. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  2724. messageSends: ["assert:equals:", "abs"],
  2725. referencedClasses: []
  2726. }),
  2727. smalltalk.NumberTest);
  2728. smalltalk.addMethod(
  2729. "_testArithmetic",
  2730. smalltalk.method({
  2731. selector: "testArithmetic",
  2732. category: 'tests',
  2733. fn: function (){
  2734. var self=this;
  2735. return smalltalk.withContext(function($ctx1) {
  2736. _st(self)._assert_equals_(_st((1.5)).__plus((1)),(2.5));
  2737. _st(self)._assert_equals_(_st((2)).__minus((1)),(1));
  2738. _st(self)._assert_equals_(_st((-2)).__minus((1)),(-3));
  2739. _st(self)._assert_equals_(_st((12)).__slash((2)),(6));
  2740. _st(self)._assert_equals_(_st((3)).__star((4)),(12));
  2741. _st(self)._assert_equals_(_st(_st((1)).__plus((2))).__star((3)),(9));
  2742. _st(self)._assert_equals_(_st((1)).__plus(_st((2)).__star((3))),(7));
  2743. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.NumberTest)})},
  2744. args: [],
  2745. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if \x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  2746. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  2747. referencedClasses: []
  2748. }),
  2749. smalltalk.NumberTest);
  2750. smalltalk.addMethod(
  2751. "_testComparison",
  2752. smalltalk.method({
  2753. selector: "testComparison",
  2754. category: 'tests',
  2755. fn: function () {
  2756. var self=this;
  2757. return smalltalk.withContext(function($ctx1) {
  2758. _st(self)._assert_(_st((3)).__gt((2)));
  2759. _st(self)._assert_(_st((2)).__lt((3)));
  2760. _st(self)._deny_(_st((3)).__lt((2)));
  2761. _st(self)._deny_(_st((2)).__gt((3)));
  2762. _st(self)._assert_(_st((3)).__gt_eq((3)));
  2763. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  2764. _st(self)._assert_(_st((3)).__lt_eq((3)));
  2765. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  2766. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{}, smalltalk.NumberTest)});},
  2767. args: [],
  2768. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  2769. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  2770. referencedClasses: []
  2771. }),
  2772. smalltalk.NumberTest);
  2773. smalltalk.addMethod(
  2774. "_testCopying",
  2775. smalltalk.method({
  2776. selector: "testCopying",
  2777. category: 'tests',
  2778. fn: function () {
  2779. var self=this;
  2780. return smalltalk.withContext(function($ctx1) {
  2781. _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  2782. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  2783. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.NumberTest)});},
  2784. args: [],
  2785. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  2786. messageSends: ["assert:", "==", "copy", "deepCopy"],
  2787. referencedClasses: []
  2788. }),
  2789. smalltalk.NumberTest);
  2790. smalltalk.addMethod(
  2791. "_testEquality",
  2792. smalltalk.method({
  2793. selector: "testEquality",
  2794. category: 'tests',
  2795. fn: function (){
  2796. var self=this;
  2797. return smalltalk.withContext(function($ctx1) {
  2798. _st(self)._assert_(_st((1)).__eq((1)));
  2799. _st(self)._assert_(_st((0)).__eq((0)));
  2800. _st(self)._deny_(_st((1)).__eq((0)));
  2801. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  2802. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  2803. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  2804. _st(self)._deny_(_st((0)).__eq(false));
  2805. _st(self)._deny_(_st(false).__eq((0)));
  2806. _st(self)._deny_(_st("").__eq((0)));
  2807. _st(self)._deny_(_st((0)).__eq(""));
  2808. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.NumberTest)})},
  2809. args: [],
  2810. source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  2811. messageSends: ["assert:", "=", "deny:", "yourself"],
  2812. referencedClasses: []
  2813. }),
  2814. smalltalk.NumberTest);
  2815. smalltalk.addMethod(
  2816. "_testHexNumbers",
  2817. smalltalk.method({
  2818. selector: "testHexNumbers",
  2819. category: 'tests',
  2820. fn: function (){
  2821. var self=this;
  2822. return smalltalk.withContext(function($ctx1) {
  2823. _st(self)._assert_equals_((9),(9));
  2824. _st(self)._assert_equals_(_st((10))._truncated(),(10));
  2825. _st(self)._assert_equals_(_st((11))._truncated(),(11));
  2826. _st(self)._assert_equals_(_st((12))._truncated(),(12));
  2827. _st(self)._assert_equals_(_st((13))._truncated(),(13));
  2828. _st(self)._assert_equals_(_st((14))._truncated(),(14));
  2829. _st(self)._assert_equals_(_st((15))._truncated(),(15));
  2830. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{}, smalltalk.NumberTest)})},
  2831. args: [],
  2832. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  2833. messageSends: ["assert:equals:", "truncated"],
  2834. referencedClasses: []
  2835. }),
  2836. smalltalk.NumberTest);
  2837. smalltalk.addMethod(
  2838. "_testIdentity",
  2839. smalltalk.method({
  2840. selector: "testIdentity",
  2841. category: 'tests',
  2842. fn: function () {
  2843. var self=this;
  2844. return smalltalk.withContext(function($ctx1) {
  2845. _st(self)._assert_(_st((1)).__eq_eq((1)));
  2846. _st(self)._assert_(_st((0)).__eq_eq((0)));
  2847. _st(self)._deny_(_st((1)).__eq_eq((0)));
  2848. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  2849. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  2850. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  2851. _st(self)._deny_(_st((1)).__eq_eq((2)));
  2852. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.NumberTest)});},
  2853. args: [],
  2854. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  2855. messageSends: ["assert:", "==", "deny:", "yourself"],
  2856. referencedClasses: []
  2857. }),
  2858. smalltalk.NumberTest);
  2859. smalltalk.addMethod(
  2860. "_testInvalidHexNumbers",
  2861. smalltalk.method({
  2862. selector: "testInvalidHexNumbers",
  2863. category: 'tests',
  2864. fn: function () {
  2865. var self=this;
  2866. return smalltalk.withContext(function($ctx1) {
  2867. _st(self)._should_raise_((function(){
  2868. return smalltalk.withContext(function($ctx2) {
  2869. return _st((16))._rG();
  2870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2871. _st(self)._should_raise_((function(){
  2872. return smalltalk.withContext(function($ctx2) {
  2873. return _st((16))._rg();
  2874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2875. _st(self)._should_raise_((function(){
  2876. return smalltalk.withContext(function($ctx2) {
  2877. return _st((16))._rH();
  2878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2879. _st(self)._should_raise_((function(){
  2880. return smalltalk.withContext(function($ctx2) {
  2881. return _st((16))._rh();
  2882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2883. _st(self)._should_raise_((function(){
  2884. return smalltalk.withContext(function($ctx2) {
  2885. return _st((16))._rI();
  2886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2887. _st(self)._should_raise_((function(){
  2888. return smalltalk.withContext(function($ctx2) {
  2889. return _st((16))._ri();
  2890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2891. _st(self)._should_raise_((function(){
  2892. return smalltalk.withContext(function($ctx2) {
  2893. return _st((16))._rJ();
  2894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2895. _st(self)._should_raise_((function(){
  2896. return smalltalk.withContext(function($ctx2) {
  2897. return _st((16))._rj();
  2898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2899. _st(self)._should_raise_((function(){
  2900. return smalltalk.withContext(function($ctx2) {
  2901. return _st((16))._rK();
  2902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2903. _st(self)._should_raise_((function(){
  2904. return smalltalk.withContext(function($ctx2) {
  2905. return _st((16))._rk();
  2906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2907. _st(self)._should_raise_((function(){
  2908. return smalltalk.withContext(function($ctx2) {
  2909. return _st((16))._rL();
  2910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2911. _st(self)._should_raise_((function(){
  2912. return smalltalk.withContext(function($ctx2) {
  2913. return _st((16))._rl();
  2914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2915. _st(self)._should_raise_((function(){
  2916. return smalltalk.withContext(function($ctx2) {
  2917. return _st((16))._rM();
  2918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2919. _st(self)._should_raise_((function(){
  2920. return smalltalk.withContext(function($ctx2) {
  2921. return _st((16))._rm();
  2922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2923. _st(self)._should_raise_((function(){
  2924. return smalltalk.withContext(function($ctx2) {
  2925. return _st((16))._rN();
  2926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2927. _st(self)._should_raise_((function(){
  2928. return smalltalk.withContext(function($ctx2) {
  2929. return _st((16))._rn();
  2930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2931. _st(self)._should_raise_((function(){
  2932. return smalltalk.withContext(function($ctx2) {
  2933. return _st((16))._rO();
  2934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2935. _st(self)._should_raise_((function(){
  2936. return smalltalk.withContext(function($ctx2) {
  2937. return _st((16))._ro();
  2938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2939. _st(self)._should_raise_((function(){
  2940. return smalltalk.withContext(function($ctx2) {
  2941. return _st((16))._rP();
  2942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2943. _st(self)._should_raise_((function(){
  2944. return smalltalk.withContext(function($ctx2) {
  2945. return _st((16))._rp();
  2946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2947. _st(self)._should_raise_((function(){
  2948. return smalltalk.withContext(function($ctx2) {
  2949. return _st((16))._rQ();
  2950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2951. _st(self)._should_raise_((function(){
  2952. return smalltalk.withContext(function($ctx2) {
  2953. return _st((16))._rq();
  2954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2955. _st(self)._should_raise_((function(){
  2956. return smalltalk.withContext(function($ctx2) {
  2957. return _st((16))._rR();
  2958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2959. _st(self)._should_raise_((function(){
  2960. return smalltalk.withContext(function($ctx2) {
  2961. return _st((16))._rr();
  2962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2963. _st(self)._should_raise_((function(){
  2964. return smalltalk.withContext(function($ctx2) {
  2965. return _st((16))._rS();
  2966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2967. _st(self)._should_raise_((function(){
  2968. return smalltalk.withContext(function($ctx2) {
  2969. return _st((16))._rs();
  2970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2971. _st(self)._should_raise_((function(){
  2972. return smalltalk.withContext(function($ctx2) {
  2973. return _st((16))._rT();
  2974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2975. _st(self)._should_raise_((function(){
  2976. return smalltalk.withContext(function($ctx2) {
  2977. return _st((16))._rt();
  2978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2979. _st(self)._should_raise_((function(){
  2980. return smalltalk.withContext(function($ctx2) {
  2981. return _st((16))._rU();
  2982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2983. _st(self)._should_raise_((function(){
  2984. return smalltalk.withContext(function($ctx2) {
  2985. return _st((16))._ru();
  2986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2987. _st(self)._should_raise_((function(){
  2988. return smalltalk.withContext(function($ctx2) {
  2989. return _st((16))._rV();
  2990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2991. _st(self)._should_raise_((function(){
  2992. return smalltalk.withContext(function($ctx2) {
  2993. return _st((16))._rv();
  2994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2995. _st(self)._should_raise_((function(){
  2996. return smalltalk.withContext(function($ctx2) {
  2997. return _st((16))._rW();
  2998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2999. _st(self)._should_raise_((function(){
  3000. return smalltalk.withContext(function($ctx2) {
  3001. return _st((16))._rw();
  3002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3003. _st(self)._should_raise_((function(){
  3004. return smalltalk.withContext(function($ctx2) {
  3005. return _st((16))._rX();
  3006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3007. _st(self)._should_raise_((function(){
  3008. return smalltalk.withContext(function($ctx2) {
  3009. return _st((16))._rx();
  3010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3011. _st(self)._should_raise_((function(){
  3012. return smalltalk.withContext(function($ctx2) {
  3013. return _st((16))._rY();
  3014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3015. _st(self)._should_raise_((function(){
  3016. return smalltalk.withContext(function($ctx2) {
  3017. return _st((16))._ry();
  3018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3019. _st(self)._should_raise_((function(){
  3020. return smalltalk.withContext(function($ctx2) {
  3021. return _st((16))._rZ();
  3022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3023. _st(self)._should_raise_((function(){
  3024. return smalltalk.withContext(function($ctx2) {
  3025. return _st((16))._rz();
  3026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3027. _st(self)._should_raise_((function(){
  3028. return smalltalk.withContext(function($ctx2) {
  3029. return _st((11259375))._Z();
  3030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3031. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{}, smalltalk.NumberTest)});},
  3032. args: [],
  3033. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [16rG] raise: MessageNotUnderstood.\x0a \x09self should: [16rg] raise: MessageNotUnderstood.\x0a\x09self should: [16rH] raise: MessageNotUnderstood.\x0a \x09self should: [16rh] raise: MessageNotUnderstood.\x0a\x09self should: [16rI] raise: MessageNotUnderstood.\x0a \x09self should: [16ri] raise: MessageNotUnderstood.\x0a\x09self should: [16rJ] raise: MessageNotUnderstood.\x0a \x09self should: [16rj] raise: MessageNotUnderstood.\x0a\x09self should: [16rK] raise: MessageNotUnderstood.\x0a \x09self should: [16rk] raise: MessageNotUnderstood.\x0a\x09self should: [16rL] raise: MessageNotUnderstood.\x0a \x09self should: [16rl] raise: MessageNotUnderstood.\x0a\x09self should: [16rM] raise: MessageNotUnderstood.\x0a \x09self should: [16rm] raise: MessageNotUnderstood.\x0a\x09self should: [16rN] raise: MessageNotUnderstood.\x0a \x09self should: [16rn] raise: MessageNotUnderstood.\x0a\x09self should: [16rO] raise: MessageNotUnderstood.\x0a \x09self should: [16ro] raise: MessageNotUnderstood.\x0a\x09self should: [16rP] raise: MessageNotUnderstood.\x0a \x09self should: [16rp] raise: MessageNotUnderstood.\x0a\x09self should: [16rQ] raise: MessageNotUnderstood.\x0a \x09self should: [16rq] raise: MessageNotUnderstood.\x0a\x09self should: [16rR] raise: MessageNotUnderstood.\x0a \x09self should: [16rr] raise: MessageNotUnderstood.\x0a\x09self should: [16rS] raise: MessageNotUnderstood.\x0a \x09self should: [16rs] raise: MessageNotUnderstood.\x0a\x09self should: [16rT] raise: MessageNotUnderstood.\x0a \x09self should: [16rt] raise: MessageNotUnderstood.\x0a\x09self should: [16rU] raise: MessageNotUnderstood.\x0a \x09self should: [16ru] raise: MessageNotUnderstood.\x0a\x09self should: [16rV] raise: MessageNotUnderstood.\x0a \x09self should: [16rv] raise: MessageNotUnderstood.\x0a\x09self should: [16rW] raise: MessageNotUnderstood.\x0a \x09self should: [16rw] raise: MessageNotUnderstood.\x0a\x09self should: [16rX] raise: MessageNotUnderstood.\x0a \x09self should: [16rx] raise: MessageNotUnderstood.\x0a\x09self should: [16rY] raise: MessageNotUnderstood.\x0a \x09self should: [16ry] raise: MessageNotUnderstood.\x0a\x09self should: [16rZ] raise: MessageNotUnderstood.\x0a \x09self should: [16rz] raise: MessageNotUnderstood.\x0a self should: [16rABcdEfZ] raise: MessageNotUnderstood.",
  3034. 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"],
  3035. referencedClasses: ["MessageNotUnderstood"]
  3036. }),
  3037. smalltalk.NumberTest);
  3038. smalltalk.addMethod(
  3039. "_testMinMax",
  3040. smalltalk.method({
  3041. selector: "testMinMax",
  3042. category: 'tests',
  3043. fn: function () {
  3044. var self=this;
  3045. return smalltalk.withContext(function($ctx1) {
  3046. _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  3047. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  3048. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{}, smalltalk.NumberTest)});},
  3049. args: [],
  3050. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3051. messageSends: ["assert:equals:", "max:", "min:"],
  3052. referencedClasses: []
  3053. }),
  3054. smalltalk.NumberTest);
  3055. smalltalk.addMethod(
  3056. "_testNegated",
  3057. smalltalk.method({
  3058. selector: "testNegated",
  3059. category: 'tests',
  3060. fn: function (){
  3061. var self=this;
  3062. return smalltalk.withContext(function($ctx1) {
  3063. _st(self)._assert_equals_(_st((3))._negated(),(-3));
  3064. _st(self)._assert_equals_(_st((-3))._negated(),(3));
  3065. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{}, smalltalk.NumberTest)})},
  3066. args: [],
  3067. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3068. messageSends: ["assert:equals:", "negated"],
  3069. referencedClasses: []
  3070. }),
  3071. smalltalk.NumberTest);
  3072. smalltalk.addMethod(
  3073. "_testPrintShowingDecimalPlaces",
  3074. smalltalk.method({
  3075. selector: "testPrintShowingDecimalPlaces",
  3076. category: 'tests',
  3077. fn: function (){
  3078. var self=this;
  3079. return smalltalk.withContext(function($ctx1) {
  3080. _st(self)._assert_equals_(_st((23))._printShowingDecimalPlaces_((2)),"23.00");
  3081. _st(self)._assert_equals_(_st((23.5698))._printShowingDecimalPlaces_((2)),"23.57");
  3082. _st(self)._assert_equals_(_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3083. _st(self)._assert_equals_(_st((23.4567))._printShowingDecimalPlaces_((0)),"23");
  3084. _st(self)._assert_equals_(_st((23.5567))._printShowingDecimalPlaces_((0)),"24");
  3085. _st(self)._assert_equals_(_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)),"-23");
  3086. _st(self)._assert_equals_(_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)),"-24");
  3087. _st(self)._assert_equals_(_st((100000000))._printShowingDecimalPlaces_((1)),"100000000.0");
  3088. _st(self)._assert_equals_(_st((0.98))._printShowingDecimalPlaces_((5)),"0.98000");
  3089. _st(self)._assert_equals_(_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3090. _st(self)._assert_equals_(_st((2.567))._printShowingDecimalPlaces_((2)),"2.57");
  3091. _st(self)._assert_equals_(_st((-2.567))._printShowingDecimalPlaces_((2)),"-2.57");
  3092. _st(self)._assert_equals_(_st((0))._printShowingDecimalPlaces_((2)),"0.00");
  3093. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{}, smalltalk.NumberTest)})},
  3094. args: [],
  3095. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  3096. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3097. referencedClasses: []
  3098. }),
  3099. smalltalk.NumberTest);
  3100. smalltalk.addMethod(
  3101. "_testRounded",
  3102. smalltalk.method({
  3103. selector: "testRounded",
  3104. category: 'tests',
  3105. fn: function (){
  3106. var self=this;
  3107. return smalltalk.withContext(function($ctx1) {
  3108. _st(self)._assert_equals_(_st((3))._rounded(),(3));
  3109. _st(self)._assert_equals_(_st((3.212))._rounded(),(3));
  3110. _st(self)._assert_equals_(_st((3.51))._rounded(),(4));
  3111. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{}, smalltalk.NumberTest)})},
  3112. args: [],
  3113. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  3114. messageSends: ["assert:equals:", "rounded"],
  3115. referencedClasses: []
  3116. }),
  3117. smalltalk.NumberTest);
  3118. smalltalk.addMethod(
  3119. "_testSqrt",
  3120. smalltalk.method({
  3121. selector: "testSqrt",
  3122. category: 'tests',
  3123. fn: function (){
  3124. var self=this;
  3125. return smalltalk.withContext(function($ctx1) {
  3126. _st(self)._assert_equals_(_st((4))._sqrt(),(2));
  3127. _st(self)._assert_equals_(_st((16))._sqrt(),(4));
  3128. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{}, smalltalk.NumberTest)})},
  3129. args: [],
  3130. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3131. messageSends: ["assert:equals:", "sqrt"],
  3132. referencedClasses: []
  3133. }),
  3134. smalltalk.NumberTest);
  3135. smalltalk.addMethod(
  3136. "_testSquared",
  3137. smalltalk.method({
  3138. selector: "testSquared",
  3139. category: 'tests',
  3140. fn: function (){
  3141. var self=this;
  3142. return smalltalk.withContext(function($ctx1) {
  3143. _st(self)._assert_equals_(_st((4))._squared(),(16));
  3144. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{}, smalltalk.NumberTest)})},
  3145. args: [],
  3146. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3147. messageSends: ["assert:equals:", "squared"],
  3148. referencedClasses: []
  3149. }),
  3150. smalltalk.NumberTest);
  3151. smalltalk.addMethod(
  3152. "_testTimesRepeat",
  3153. smalltalk.method({
  3154. selector: "testTimesRepeat",
  3155. category: 'tests',
  3156. fn: function () {
  3157. var self=this;
  3158. var i;
  3159. return smalltalk.withContext(function($ctx1) {
  3160. i=(0);
  3161. _st((0))._timesRepeat_((function(){
  3162. return smalltalk.withContext(function($ctx2) {
  3163. i=_st(i).__plus((1));
  3164. return i;
  3165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3166. _st(self)._assert_equals_(i,(0));
  3167. _st((5))._timesRepeat_((function(){
  3168. return smalltalk.withContext(function($ctx2) {
  3169. i=_st(i).__plus((1));
  3170. return i;
  3171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3172. _st(self)._assert_equals_(i,(5));
  3173. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i}, smalltalk.NumberTest)});},
  3174. args: [],
  3175. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [i := i + 1].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [i := i + 1].\x0a\x09self assert: i equals: 5",
  3176. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3177. referencedClasses: []
  3178. }),
  3179. smalltalk.NumberTest);
  3180. smalltalk.addMethod(
  3181. "_testTo",
  3182. smalltalk.method({
  3183. selector: "testTo",
  3184. category: 'tests',
  3185. fn: function () {
  3186. var self=this;
  3187. return smalltalk.withContext(function($ctx1) {
  3188. _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  3189. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{}, smalltalk.NumberTest)});},
  3190. args: [],
  3191. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3192. messageSends: ["assert:equals:", "to:"],
  3193. referencedClasses: []
  3194. }),
  3195. smalltalk.NumberTest);
  3196. smalltalk.addMethod(
  3197. "_testToBy",
  3198. smalltalk.method({
  3199. selector: "testToBy",
  3200. category: 'tests',
  3201. fn: function () {
  3202. var self=this;
  3203. return smalltalk.withContext(function($ctx1) {
  3204. _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3205. _st(self)._should_raise_((function(){
  3206. return smalltalk.withContext(function($ctx2) {
  3207. return _st((1))._to_by_((4),(0));
  3208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3209. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{}, smalltalk.NumberTest)});},
  3210. args: [],
  3211. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [1 to: 4 by: 0] raise: Error",
  3212. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3213. referencedClasses: ["Error"]
  3214. }),
  3215. smalltalk.NumberTest);
  3216. smalltalk.addMethod(
  3217. "_testTruncated",
  3218. smalltalk.method({
  3219. selector: "testTruncated",
  3220. category: 'tests',
  3221. fn: function (){
  3222. var self=this;
  3223. return smalltalk.withContext(function($ctx1) {
  3224. _st(self)._assert_equals_(_st((3))._truncated(),(3));
  3225. _st(self)._assert_equals_(_st((3.212))._truncated(),(3));
  3226. _st(self)._assert_equals_(_st((3.51))._truncated(),(3));
  3227. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{}, smalltalk.NumberTest)})},
  3228. args: [],
  3229. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  3230. messageSends: ["assert:equals:", "truncated"],
  3231. referencedClasses: []
  3232. }),
  3233. smalltalk.NumberTest);
  3234. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3235. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes."
  3236. smalltalk.addMethod(
  3237. "_foo",
  3238. smalltalk.method({
  3239. selector: "foo",
  3240. category: 'not yet classified',
  3241. fn: function () {
  3242. var self=this;
  3243. return smalltalk.withContext(function($ctx1) {
  3244. var $1;
  3245. $1=self["@foo"];
  3246. return $1;
  3247. }, function($ctx1) {$ctx1.fill(self,"foo",{}, smalltalk.ObjectMock)});},
  3248. args: [],
  3249. source: "foo\x0a\x09^foo",
  3250. messageSends: [],
  3251. referencedClasses: []
  3252. }),
  3253. smalltalk.ObjectMock);
  3254. smalltalk.addMethod(
  3255. "_foo_",
  3256. smalltalk.method({
  3257. selector: "foo:",
  3258. category: 'not yet classified',
  3259. fn: function (anObject) {
  3260. var self=this;
  3261. return smalltalk.withContext(function($ctx1) {
  3262. self["@foo"]=anObject;
  3263. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject}, smalltalk.ObjectMock)});},
  3264. args: ["anObject"],
  3265. source: "foo: anObject\x0a\x09foo := anObject",
  3266. messageSends: [],
  3267. referencedClasses: []
  3268. }),
  3269. smalltalk.ObjectMock);
  3270. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3271. smalltalk.addMethod(
  3272. "_notDefined",
  3273. smalltalk.method({
  3274. selector: "notDefined",
  3275. category: 'tests',
  3276. fn: function () {
  3277. var self=this;
  3278. return smalltalk.withContext(function($ctx1) {
  3279. return undefined;;
  3280. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{}, smalltalk.ObjectTest)});},
  3281. args: [],
  3282. source: "notDefined\x0a\x09<return undefined;>",
  3283. messageSends: [],
  3284. referencedClasses: []
  3285. }),
  3286. smalltalk.ObjectTest);
  3287. smalltalk.addMethod(
  3288. "_testBasicAccess",
  3289. smalltalk.method({
  3290. selector: "testBasicAccess",
  3291. category: 'tests',
  3292. fn: function () {
  3293. var self=this;
  3294. var o;
  3295. return smalltalk.withContext(function($ctx1) {
  3296. o=_st((smalltalk.Object || Object))._new();
  3297. _st(o)._basicAt_put_("a",(1));
  3298. _st(self)._assert_equals_(_st(o)._basicAt_("a"),(1));
  3299. _st(self)._assert_equals_(_st(o)._basicAt_("b"),nil);
  3300. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o}, smalltalk.ObjectTest)});},
  3301. args: [],
  3302. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  3303. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  3304. referencedClasses: ["Object"]
  3305. }),
  3306. smalltalk.ObjectTest);
  3307. smalltalk.addMethod(
  3308. "_testBasicPerform",
  3309. smalltalk.method({
  3310. selector: "testBasicPerform",
  3311. category: 'tests',
  3312. fn: function (){
  3313. var self=this;
  3314. var o;
  3315. return smalltalk.withContext(function($ctx1) {
  3316. o=_st((smalltalk.Object || Object))._new();
  3317. _st(o)._basicAt_put_("func",(function(){
  3318. return smalltalk.withContext(function($ctx2) {
  3319. return "hello";
  3320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3321. _st(o)._basicAt_put_("func2",(function(a){
  3322. return smalltalk.withContext(function($ctx2) {
  3323. return _st(a).__plus((1));
  3324. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  3325. _st(self)._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  3326. _st(self)._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  3327. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o}, smalltalk.ObjectTest)})},
  3328. args: [],
  3329. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: ['hello'].\x09\x0a\x09o basicAt: 'func2' put: [:a | a + 1].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  3330. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  3331. referencedClasses: ["Object"]
  3332. }),
  3333. smalltalk.ObjectTest);
  3334. smalltalk.addMethod(
  3335. "_testDNU",
  3336. smalltalk.method({
  3337. selector: "testDNU",
  3338. category: 'tests',
  3339. fn: function () {
  3340. var self=this;
  3341. return smalltalk.withContext(function($ctx1) {
  3342. _st(self)._should_raise_((function(){
  3343. return smalltalk.withContext(function($ctx2) {
  3344. return _st(_st((smalltalk.Object || Object))._new())._foo();
  3345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3346. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.ObjectTest)});},
  3347. args: [],
  3348. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  3349. messageSends: ["should:raise:", "foo", "new"],
  3350. referencedClasses: ["Object", "MessageNotUnderstood"]
  3351. }),
  3352. smalltalk.ObjectTest);
  3353. smalltalk.addMethod(
  3354. "_testEquality",
  3355. smalltalk.method({
  3356. selector: "testEquality",
  3357. category: 'tests',
  3358. fn: function (){
  3359. var self=this;
  3360. var o;
  3361. return smalltalk.withContext(function($ctx1) {
  3362. o=_st((smalltalk.Object || Object))._new();
  3363. _st(self)._deny_(_st(o).__eq(_st((smalltalk.Object || Object))._new()));
  3364. _st(self)._assert_(_st(o).__eq(o));
  3365. _st(self)._assert_(_st(_st(o)._yourself()).__eq(o));
  3366. _st(self)._assert_(_st(o).__eq(_st(o)._yourself()));
  3367. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o}, smalltalk.ObjectTest)})},
  3368. args: [],
  3369. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)",
  3370. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  3371. referencedClasses: ["Object"]
  3372. }),
  3373. smalltalk.ObjectTest);
  3374. smalltalk.addMethod(
  3375. "_testHalt",
  3376. smalltalk.method({
  3377. selector: "testHalt",
  3378. category: 'tests',
  3379. fn: function () {
  3380. var self=this;
  3381. return smalltalk.withContext(function($ctx1) {
  3382. _st(self)._should_raise_((function(){
  3383. return smalltalk.withContext(function($ctx2) {
  3384. return _st(_st((smalltalk.Object || Object))._new())._halt();
  3385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3386. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{}, smalltalk.ObjectTest)});},
  3387. args: [],
  3388. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  3389. messageSends: ["should:raise:", "halt", "new"],
  3390. referencedClasses: ["Object", "Error"]
  3391. }),
  3392. smalltalk.ObjectTest);
  3393. smalltalk.addMethod(
  3394. "_testIdentity",
  3395. smalltalk.method({
  3396. selector: "testIdentity",
  3397. category: 'tests',
  3398. fn: function () {
  3399. var self=this;
  3400. var o;
  3401. return smalltalk.withContext(function($ctx1) {
  3402. o=_st((smalltalk.Object || Object))._new();
  3403. _st(self)._deny_(_st(o).__eq_eq(_st((smalltalk.Object || Object))._new()));
  3404. _st(self)._assert_(_st(o).__eq_eq(o));
  3405. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3406. _st(self)._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  3407. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o}, smalltalk.ObjectTest)});},
  3408. args: [],
  3409. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  3410. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  3411. referencedClasses: ["Object"]
  3412. }),
  3413. smalltalk.ObjectTest);
  3414. smalltalk.addMethod(
  3415. "_testIfNil",
  3416. smalltalk.method({
  3417. selector: "testIfNil",
  3418. category: 'tests',
  3419. fn: function (){
  3420. var self=this;
  3421. return smalltalk.withContext(function($ctx1) {
  3422. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9;
  3423. _st(self)._deny_(_st(_st((smalltalk.Object || Object))._new())._isNil());
  3424. $1=self;
  3425. $4=_st((smalltalk.Object || Object))._new();
  3426. if(($receiver = $4) == nil || $receiver == undefined){
  3427. $3=true;
  3428. } else {
  3429. $3=$4;
  3430. };
  3431. $2=_st($3).__eq(true);
  3432. _st($1)._deny_($2);
  3433. $5=self;
  3434. $7=_st((smalltalk.Object || Object))._new();
  3435. if(($receiver = $7) == nil || $receiver == undefined){
  3436. $6=$7;
  3437. } else {
  3438. $6=true;
  3439. };
  3440. _st($5)._assert_equals_($6,true);
  3441. $8=self;
  3442. $10=_st((smalltalk.Object || Object))._new();
  3443. if(($receiver = $10) == nil || $receiver == undefined){
  3444. $9=false;
  3445. } else {
  3446. $9=true;
  3447. };
  3448. _st($8)._assert_equals_($9,true);
  3449. _st(self)._assert_equals_(_st(_st((smalltalk.Object || Object))._new())._ifNotNil_ifNil_((function(){
  3450. return smalltalk.withContext(function($ctx2) {
  3451. return true;
  3452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  3453. return smalltalk.withContext(function($ctx2) {
  3454. return false;
  3455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),true);
  3456. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.ObjectTest)})},
  3457. args: [],
  3458. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [false] ifNotNil: [true]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [true] ifNil: [false]) equals: true",
  3459. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3460. referencedClasses: ["Object"]
  3461. }),
  3462. smalltalk.ObjectTest);
  3463. smalltalk.addMethod(
  3464. "_testInstVars",
  3465. smalltalk.method({
  3466. selector: "testInstVars",
  3467. category: 'tests',
  3468. fn: function () {
  3469. var self=this;
  3470. var o;
  3471. return smalltalk.withContext(function($ctx1) {
  3472. o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  3473. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),nil);
  3474. _st(o)._instVarAt_put_(smalltalk.symbolFor("foo"),(1));
  3475. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),(1));
  3476. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3477. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o}, smalltalk.ObjectTest)});},
  3478. args: [],
  3479. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  3480. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  3481. referencedClasses: ["ObjectMock"]
  3482. }),
  3483. smalltalk.ObjectTest);
  3484. smalltalk.addMethod(
  3485. "_testNilUndefined",
  3486. smalltalk.method({
  3487. selector: "testNilUndefined",
  3488. category: 'tests',
  3489. fn: function (){
  3490. var self=this;
  3491. return smalltalk.withContext(function($ctx1) {
  3492. _st(self)._assert_equals_(_st(self)._notDefined(),nil);
  3493. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{}, smalltalk.ObjectTest)})},
  3494. args: [],
  3495. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  3496. messageSends: ["assert:equals:", "notDefined"],
  3497. referencedClasses: []
  3498. }),
  3499. smalltalk.ObjectTest);
  3500. smalltalk.addMethod(
  3501. "_testYourself",
  3502. smalltalk.method({
  3503. selector: "testYourself",
  3504. category: 'tests',
  3505. fn: function () {
  3506. var self=this;
  3507. var o;
  3508. return smalltalk.withContext(function($ctx1) {
  3509. o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  3510. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3511. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o}, smalltalk.ObjectTest)});},
  3512. args: [],
  3513. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  3514. messageSends: ["new", "assert:", "==", "yourself"],
  3515. referencedClasses: ["ObjectMock"]
  3516. }),
  3517. smalltalk.ObjectTest);
  3518. smalltalk.addMethod(
  3519. "_testidentityHash",
  3520. smalltalk.method({
  3521. selector: "testidentityHash",
  3522. category: 'tests',
  3523. fn: function () {
  3524. var self=this;
  3525. var o1,o2;
  3526. return smalltalk.withContext(function($ctx1) {
  3527. o1=_st((smalltalk.Object || Object))._new();
  3528. o2=_st((smalltalk.Object || Object))._new();
  3529. _st(self)._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  3530. _st(self)._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  3531. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2}, smalltalk.ObjectTest)});},
  3532. args: [],
  3533. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  3534. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  3535. referencedClasses: ["Object"]
  3536. }),
  3537. smalltalk.ObjectTest);
  3538. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  3539. smalltalk.addMethod(
  3540. "_setUp",
  3541. smalltalk.method({
  3542. selector: "setUp",
  3543. category: 'running',
  3544. fn: function () {
  3545. var self=this;
  3546. return smalltalk.withContext(function($ctx1) {
  3547. var $1,$2;
  3548. self["@backUpCommitPathJs"]=_st((smalltalk.Package || Package))._defaultCommitPathJs();
  3549. self["@backUpCommitPathSt"]=_st((smalltalk.Package || Package))._defaultCommitPathSt();
  3550. _st((smalltalk.Package || Package))._resetCommitPaths();
  3551. self["@zorkPackage"]=_st(_st((smalltalk.Package || Package))._new())._name_("Zork");
  3552. $1=_st((smalltalk.Package || Package))._new();
  3553. _st($1)._name_("Grul");
  3554. _st($1)._commitPathJs_("server/grul/js");
  3555. _st($1)._commitPathSt_("grul/st");
  3556. $2=_st($1)._yourself();
  3557. self["@grulPackage"]=$2;
  3558. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageTest)});},
  3559. args: [],
  3560. source: "setUp\x0a\x09backUpCommitPathJs := Package defaultCommitPathJs.\x0a\x09backUpCommitPathSt := Package defaultCommitPathSt.\x0a\x0a\x09Package resetCommitPaths.\x0a\x0a\x09zorkPackage := Package new name: 'Zork'.\x0a\x09grulPackage := Package new \x0a\x09\x09\x09\x09\x09name: 'Grul';\x0a\x09\x09\x09\x09\x09commitPathJs: 'server/grul/js';\x0a\x09\x09\x09\x09\x09commitPathSt: 'grul/st';\x0a\x09\x09\x09\x09\x09yourself",
  3561. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  3562. referencedClasses: ["Package"]
  3563. }),
  3564. smalltalk.PackageTest);
  3565. smalltalk.addMethod(
  3566. "_tearDown",
  3567. smalltalk.method({
  3568. selector: "tearDown",
  3569. category: 'running',
  3570. fn: function () {
  3571. var self=this;
  3572. return smalltalk.withContext(function($ctx1) {
  3573. var $1,$2;
  3574. $1=(smalltalk.Package || Package);
  3575. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  3576. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  3577. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.PackageTest)});},
  3578. args: [],
  3579. source: "tearDown\x0a\x09 Package \x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  3580. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  3581. referencedClasses: ["Package"]
  3582. }),
  3583. smalltalk.PackageTest);
  3584. smalltalk.addMethod(
  3585. "_testGrulCommitPathJsShouldBeServerGrulJs",
  3586. smalltalk.method({
  3587. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  3588. category: 'tests',
  3589. fn: function (){
  3590. var self=this;
  3591. return smalltalk.withContext(function($ctx1) {
  3592. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  3593. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageTest)})},
  3594. args: [],
  3595. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  3596. messageSends: ["assert:equals:", "commitPathJs"],
  3597. referencedClasses: []
  3598. }),
  3599. smalltalk.PackageTest);
  3600. smalltalk.addMethod(
  3601. "_testGrulCommitPathStShouldBeGrulSt",
  3602. smalltalk.method({
  3603. selector: "testGrulCommitPathStShouldBeGrulSt",
  3604. category: 'tests',
  3605. fn: function (){
  3606. var self=this;
  3607. return smalltalk.withContext(function($ctx1) {
  3608. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  3609. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageTest)})},
  3610. args: [],
  3611. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  3612. messageSends: ["assert:equals:", "commitPathSt"],
  3613. referencedClasses: []
  3614. }),
  3615. smalltalk.PackageTest);
  3616. smalltalk.addMethod(
  3617. "_testZorkCommitPathJsShouldBeJs",
  3618. smalltalk.method({
  3619. selector: "testZorkCommitPathJsShouldBeJs",
  3620. category: 'tests',
  3621. fn: function (){
  3622. var self=this;
  3623. return smalltalk.withContext(function($ctx1) {
  3624. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  3625. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{}, smalltalk.PackageTest)})},
  3626. args: [],
  3627. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  3628. messageSends: ["assert:equals:", "commitPathJs"],
  3629. referencedClasses: []
  3630. }),
  3631. smalltalk.PackageTest);
  3632. smalltalk.addMethod(
  3633. "_testZorkCommitPathStShouldBeSt",
  3634. smalltalk.method({
  3635. selector: "testZorkCommitPathStShouldBeSt",
  3636. category: 'tests',
  3637. fn: function (){
  3638. var self=this;
  3639. return smalltalk.withContext(function($ctx1) {
  3640. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  3641. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{}, smalltalk.PackageTest)})},
  3642. args: [],
  3643. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  3644. messageSends: ["assert:equals:", "commitPathSt"],
  3645. referencedClasses: []
  3646. }),
  3647. smalltalk.PackageTest);
  3648. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  3649. smalltalk.addMethod(
  3650. "_setUp",
  3651. smalltalk.method({
  3652. selector: "setUp",
  3653. category: 'running',
  3654. fn: function () {
  3655. var self=this;
  3656. return smalltalk.withContext(function($ctx1) {
  3657. var $1,$2;
  3658. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  3659. $1=(smalltalk.Package || Package);
  3660. _st($1)._defaultCommitPathJs_("javascripts/");
  3661. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  3662. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});},
  3663. args: [],
  3664. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  3665. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  3666. referencedClasses: ["Package"]
  3667. }),
  3668. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3669. smalltalk.addMethod(
  3670. "_testGrulCommitPathJsShouldBeServerGrulJs",
  3671. smalltalk.method({
  3672. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  3673. category: 'tests',
  3674. fn: function (){
  3675. var self=this;
  3676. return smalltalk.withContext(function($ctx1) {
  3677. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  3678. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3679. args: [],
  3680. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  3681. messageSends: ["assert:equals:", "commitPathJs"],
  3682. referencedClasses: []
  3683. }),
  3684. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3685. smalltalk.addMethod(
  3686. "_testGrulCommitPathStShouldBeGrulSt",
  3687. smalltalk.method({
  3688. selector: "testGrulCommitPathStShouldBeGrulSt",
  3689. category: 'tests',
  3690. fn: function (){
  3691. var self=this;
  3692. return smalltalk.withContext(function($ctx1) {
  3693. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  3694. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3695. args: [],
  3696. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  3697. messageSends: ["assert:equals:", "commitPathSt"],
  3698. referencedClasses: []
  3699. }),
  3700. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3701. smalltalk.addMethod(
  3702. "_testZorkCommitPathJsShouldBeJavascript",
  3703. smalltalk.method({
  3704. selector: "testZorkCommitPathJsShouldBeJavascript",
  3705. category: 'tests',
  3706. fn: function (){
  3707. var self=this;
  3708. return smalltalk.withContext(function($ctx1) {
  3709. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  3710. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3711. args: [],
  3712. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  3713. messageSends: ["assert:equals:", "commitPathJs"],
  3714. referencedClasses: []
  3715. }),
  3716. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3717. smalltalk.addMethod(
  3718. "_testZorkCommitPathStShouldBeSmalltalk",
  3719. smalltalk.method({
  3720. selector: "testZorkCommitPathStShouldBeSmalltalk",
  3721. category: 'tests',
  3722. fn: function (){
  3723. var self=this;
  3724. return smalltalk.withContext(function($ctx1) {
  3725. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  3726. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3727. args: [],
  3728. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  3729. messageSends: ["assert:equals:", "commitPathSt"],
  3730. referencedClasses: []
  3731. }),
  3732. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3733. smalltalk.addMethod(
  3734. "_shouldInheritSelectors",
  3735. smalltalk.method({
  3736. selector: "shouldInheritSelectors",
  3737. category: 'accessing',
  3738. fn: function () {
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. return false;
  3742. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{}, smalltalk.PackageWithDefaultCommitPathChangedTest.klass)});},
  3743. args: [],
  3744. source: "shouldInheritSelectors\x0a\x09^ false",
  3745. messageSends: [],
  3746. referencedClasses: []
  3747. }),
  3748. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  3749. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3750. smalltalk.addMethod(
  3751. "_testAccessing",
  3752. smalltalk.method({
  3753. selector: "testAccessing",
  3754. category: 'tests',
  3755. fn: function () {
  3756. var self=this;
  3757. return smalltalk.withContext(function($ctx1) {
  3758. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._x(),(3));
  3759. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._y(),(4));
  3760. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._x_((3)))._x(),(3));
  3761. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._y_((4)))._y(),(4));
  3762. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{}, smalltalk.PointTest)});},
  3763. args: [],
  3764. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  3765. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  3766. referencedClasses: ["Point"]
  3767. }),
  3768. smalltalk.PointTest);
  3769. smalltalk.addMethod(
  3770. "_testArithmetic",
  3771. smalltalk.method({
  3772. selector: "testArithmetic",
  3773. category: 'tests',
  3774. fn: function () {
  3775. var self=this;
  3776. return smalltalk.withContext(function($ctx1) {
  3777. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((9),(16)));
  3778. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((6),(8)));
  3779. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((0),(0)));
  3780. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((2),(2)));
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.PointTest)});},
  3782. args: [],
  3783. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  3784. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  3785. referencedClasses: ["Point"]
  3786. }),
  3787. smalltalk.PointTest);
  3788. smalltalk.addMethod(
  3789. "_testAt",
  3790. smalltalk.method({
  3791. selector: "testAt",
  3792. category: 'tests',
  3793. fn: function () {
  3794. var self=this;
  3795. return smalltalk.withContext(function($ctx1) {
  3796. _st(self)._assert_equals_(_st((3)).__at((4)),_st((smalltalk.Point || Point))._x_y_((3),(4)));
  3797. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.PointTest)});},
  3798. args: [],
  3799. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  3800. messageSends: ["assert:equals:", "@", "x:y:"],
  3801. referencedClasses: ["Point"]
  3802. }),
  3803. smalltalk.PointTest);
  3804. smalltalk.addMethod(
  3805. "_testEgality",
  3806. smalltalk.method({
  3807. selector: "testEgality",
  3808. category: 'tests',
  3809. fn: function (){
  3810. var self=this;
  3811. return smalltalk.withContext(function($ctx1) {
  3812. _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  3813. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  3814. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{}, smalltalk.PointTest)})},
  3815. args: [],
  3816. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  3817. messageSends: ["assert:", "=", "@", "deny:"],
  3818. referencedClasses: []
  3819. }),
  3820. smalltalk.PointTest);
  3821. smalltalk.addMethod(
  3822. "_testTranslateBy",
  3823. smalltalk.method({
  3824. selector: "testTranslateBy",
  3825. category: 'tests',
  3826. fn: function (){
  3827. var self=this;
  3828. return smalltalk.withContext(function($ctx1) {
  3829. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))),_st((3)).__at((4)));
  3830. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())),_st((3)).__at((2)));
  3831. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))),_st((5)).__at((6)));
  3832. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))),_st((0)).__at((3)));
  3833. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{}, smalltalk.PointTest)})},
  3834. args: [],
  3835. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  3836. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  3837. referencedClasses: []
  3838. }),
  3839. smalltalk.PointTest);
  3840. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3841. smalltalk.addMethod(
  3842. "_textNext",
  3843. smalltalk.method({
  3844. selector: "textNext",
  3845. category: 'tests',
  3846. fn: function (){
  3847. var self=this;
  3848. return smalltalk.withContext(function($ctx1) {
  3849. _st((10000))._timesRepeat_((function(){
  3850. var current,next;
  3851. return smalltalk.withContext(function($ctx2) {
  3852. next=_st(_st((smalltalk.Random || Random))._new())._next();
  3853. next;
  3854. _st(self)._assert_(_st(next).__gt_eq((0)));
  3855. _st(self)._assert_(_st(next).__lt((1)));
  3856. _st(self)._deny_(_st(current).__eq(next));
  3857. return _st(next).__eq(current);
  3858. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  3859. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{}, smalltalk.RandomTest)})},
  3860. args: [],
  3861. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next | \x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current]",
  3862. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  3863. referencedClasses: ["Random"]
  3864. }),
  3865. smalltalk.RandomTest);
  3866. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3867. smalltalk.addMethod(
  3868. "_testAddRemove",
  3869. smalltalk.method({
  3870. selector: "testAddRemove",
  3871. category: 'tests',
  3872. fn: function () {
  3873. var self=this;
  3874. var set;
  3875. return smalltalk.withContext(function($ctx1) {
  3876. set=_st((smalltalk.Set || Set))._new();
  3877. _st(self)._assert_(_st(set)._isEmpty());
  3878. _st(set)._add_((3));
  3879. _st(self)._assert_(_st(set)._includes_((3)));
  3880. _st(set)._add_((5));
  3881. _st(self)._assert_(_st(set)._includes_((5)));
  3882. _st(set)._remove_((3));
  3883. _st(self)._deny_(_st(set)._includes_((3)));
  3884. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set}, smalltalk.SetTest)});},
  3885. args: [],
  3886. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  3887. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  3888. referencedClasses: ["Set"]
  3889. }),
  3890. smalltalk.SetTest);
  3891. smalltalk.addMethod(
  3892. "_testAt",
  3893. smalltalk.method({
  3894. selector: "testAt",
  3895. category: 'tests',
  3896. fn: function () {
  3897. var self=this;
  3898. return smalltalk.withContext(function($ctx1) {
  3899. _st(self)._should_raise_((function(){
  3900. return smalltalk.withContext(function($ctx2) {
  3901. return _st(_st((smalltalk.Set || Set))._new())._at_put_((1),(2));
  3902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3903. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SetTest)});},
  3904. args: [],
  3905. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  3906. messageSends: ["should:raise:", "at:put:", "new"],
  3907. referencedClasses: ["Set", "Error"]
  3908. }),
  3909. smalltalk.SetTest);
  3910. smalltalk.addMethod(
  3911. "_testCollect",
  3912. smalltalk.method({
  3913. selector: "testCollect",
  3914. category: 'tests',
  3915. fn: function (){
  3916. var self=this;
  3917. return smalltalk.withContext(function($ctx1) {
  3918. _st(self)._assert_equals_(_st(_st([(5), (6), (8)])._asSet())._collect_((function(x){
  3919. return smalltalk.withContext(function($ctx2) {
  3920. return _st(x).__backslash_backslash((3));
  3921. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),_st([(0), (2)])._asSet());
  3922. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{}, smalltalk.SetTest)})},
  3923. args: [],
  3924. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  3925. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"],
  3926. referencedClasses: []
  3927. }),
  3928. smalltalk.SetTest);
  3929. smalltalk.addMethod(
  3930. "_testComparing",
  3931. smalltalk.method({
  3932. selector: "testComparing",
  3933. category: 'tests',
  3934. fn: function () {
  3935. var self=this;
  3936. return smalltalk.withContext(function($ctx1) {
  3937. _st(self)._assert_equals_(_st([(0), (2)])._asSet(),_st([(0), (2)])._asSet());
  3938. _st(self)._assert_equals_(_st([(2), (0)])._asSet(),_st([(0), (2)])._asSet());
  3939. _st(self)._deny_(_st(_st([(0), (2), (3)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3940. _st(self)._deny_(_st(_st([(1), (2)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3941. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SetTest)});},
  3942. args: [],
  3943. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a self deny: #(1 2) asSet = #(0 2) asSet",
  3944. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  3945. referencedClasses: []
  3946. }),
  3947. smalltalk.SetTest);
  3948. smalltalk.addMethod(
  3949. "_testPrintString",
  3950. smalltalk.method({
  3951. selector: "testPrintString",
  3952. category: 'tests',
  3953. fn: function (){
  3954. var self=this;
  3955. var set;
  3956. return smalltalk.withContext(function($ctx1) {
  3957. var $1,$2,$3,$4;
  3958. set=_st((smalltalk.Set || Set))._new();
  3959. _st(self)._assert_equals_(_st(set)._printString(),"a Set ()");
  3960. $1=set;
  3961. _st($1)._add_((1));
  3962. $2=_st($1)._add_((3));
  3963. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3964. _st(set)._add_("foo");
  3965. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3966. $3=set;
  3967. _st($3)._remove_((1));
  3968. $4=_st($3)._remove_((3));
  3969. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3970. _st(set)._add_((3));
  3971. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3972. _st(set)._add_((3));
  3973. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3974. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set}, smalltalk.SetTest)})},
  3975. args: [],
  3976. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  3977. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  3978. referencedClasses: ["Set"]
  3979. }),
  3980. smalltalk.SetTest);
  3981. smalltalk.addMethod(
  3982. "_testSize",
  3983. smalltalk.method({
  3984. selector: "testSize",
  3985. category: 'tests',
  3986. fn: function () {
  3987. var self=this;
  3988. return smalltalk.withContext(function($ctx1) {
  3989. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._new())._size(),(0));
  3990. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (2), (3), (4)]))._size(),(4));
  3991. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (1), (1), (1)]))._size(),(1));
  3992. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SetTest)});},
  3993. args: [],
  3994. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  3995. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  3996. referencedClasses: ["Set"]
  3997. }),
  3998. smalltalk.SetTest);
  3999. smalltalk.addMethod(
  4000. "_testUnicity",
  4001. smalltalk.method({
  4002. selector: "testUnicity",
  4003. category: 'tests',
  4004. fn: function (){
  4005. var self=this;
  4006. var set;
  4007. return smalltalk.withContext(function($ctx1) {
  4008. set=_st((smalltalk.Set || Set))._new();
  4009. _st(set)._add_((21));
  4010. _st(set)._add_("hello");
  4011. _st(set)._add_((21));
  4012. _st(self)._assert_equals_(_st(set)._size(),(2));
  4013. _st(set)._add_("hello");
  4014. _st(self)._assert_equals_(_st(set)._size(),(2));
  4015. _st(self)._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  4016. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set}, smalltalk.SetTest)})},
  4017. args: [],
  4018. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  4019. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4020. referencedClasses: ["Set"]
  4021. }),
  4022. smalltalk.SetTest);
  4023. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4024. smalltalk.addMethod(
  4025. "_testCopying",
  4026. smalltalk.method({
  4027. selector: "testCopying",
  4028. category: 'tests',
  4029. fn: function () {
  4030. var self=this;
  4031. return smalltalk.withContext(function($ctx1) {
  4032. _st(self)._assert_equals_(_st(nil)._copy(),nil);
  4033. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.UndefinedTest)});},
  4034. args: [],
  4035. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4036. messageSends: ["assert:equals:", "copy"],
  4037. referencedClasses: []
  4038. }),
  4039. smalltalk.UndefinedTest);
  4040. smalltalk.addMethod(
  4041. "_testDeepCopy",
  4042. smalltalk.method({
  4043. selector: "testDeepCopy",
  4044. category: 'tests',
  4045. fn: function () {
  4046. var self=this;
  4047. return smalltalk.withContext(function($ctx1) {
  4048. _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  4049. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{}, smalltalk.UndefinedTest)});},
  4050. args: [],
  4051. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4052. messageSends: ["assert:", "=", "deepCopy"],
  4053. referencedClasses: []
  4054. }),
  4055. smalltalk.UndefinedTest);
  4056. smalltalk.addMethod(
  4057. "_testIfNil",
  4058. smalltalk.method({
  4059. selector: "testIfNil",
  4060. category: 'tests',
  4061. fn: function () {
  4062. var self=this;
  4063. return smalltalk.withContext(function($ctx1) {
  4064. var $1,$2,$3,$5,$4,$6,$7;
  4065. $1=self;
  4066. if(($receiver = nil) == nil || $receiver == undefined){
  4067. $2=true;
  4068. } else {
  4069. $2=nil;
  4070. };
  4071. _st($1)._assert_equals_($2,true);
  4072. $3=self;
  4073. if(($receiver = nil) == nil || $receiver == undefined){
  4074. $5=nil;
  4075. } else {
  4076. $5=true;
  4077. };
  4078. $4=_st($5).__eq(true);
  4079. _st($3)._deny_($4);
  4080. $6=self;
  4081. if(($receiver = nil) == nil || $receiver == undefined){
  4082. $7=true;
  4083. } else {
  4084. $7=false;
  4085. };
  4086. _st($6)._assert_equals_($7,true);
  4087. _st(self)._deny_(_st(_st(nil)._ifNotNil_ifNil_((function(){
  4088. return smalltalk.withContext(function($ctx2) {
  4089. return true;
  4090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  4091. return smalltalk.withContext(function($ctx2) {
  4092. return false;
  4093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(true));
  4094. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.UndefinedTest)});},
  4095. args: [],
  4096. source: "testIfNil\x0a\x09self assert: (nil ifNil: [true]) equals: true.\x0a\x09self deny: (nil ifNotNil: [true]) = true.\x0a\x09self assert: (nil ifNil: [true] ifNotNil: [false]) equals: true.\x0a\x09self deny: (nil ifNotNil: [true] ifNil: [false]) = true",
  4097. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4098. referencedClasses: []
  4099. }),
  4100. smalltalk.UndefinedTest);
  4101. smalltalk.addMethod(
  4102. "_testIsNil",
  4103. smalltalk.method({
  4104. selector: "testIsNil",
  4105. category: 'tests',
  4106. fn: function () {
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. _st(self)._assert_(_st(nil)._isNil());
  4110. _st(self)._deny_(_st(nil)._notNil());
  4111. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{}, smalltalk.UndefinedTest)});},
  4112. args: [],
  4113. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4114. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4115. referencedClasses: []
  4116. }),
  4117. smalltalk.UndefinedTest);