Kernel-Tests.js 213 KB

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