Kernel-Tests.js 198 KB

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