1
0

Kernel-Tests.js 187 KB

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