Kernel-Tests.js 177 KB

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