Kernel-Tests.js 275 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269
  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. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. 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.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. category: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. category: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. category: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. category: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. category: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. category: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. 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 protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. category: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. category: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. category: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. 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",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. category: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. 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>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. category: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. category: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. category: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. 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",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. category: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. 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.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. category: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. 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",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. category: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. 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",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. category: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. 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)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. category: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. 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",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. category: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. 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'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. category: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. 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'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. category: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. 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))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. category: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. 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 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. category: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. category: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. category: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. category: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. 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",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. category: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. 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",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. category: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. 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",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. category: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. 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 ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. category: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. category: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. 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)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. category: 'accessing',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. var $1;
  1233. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  1234. return $1;
  1235. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1236. args: [],
  1237. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  1238. messageSends: ["withAll:", "collectionClass", "defaultValues"],
  1239. referencedClasses: []
  1240. }),
  1241. smalltalk.CollectionTest);
  1242. smalltalk.addMethod(
  1243. smalltalk.method({
  1244. selector: "collectionClass",
  1245. category: 'accessing',
  1246. fn: function (){
  1247. var self=this;
  1248. return smalltalk.withContext(function($ctx1) {
  1249. var $1;
  1250. $1=_st(self._class())._collectionClass();
  1251. return $1;
  1252. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1253. args: [],
  1254. source: "collectionClass\x0a\x09^ self class collectionClass",
  1255. messageSends: ["collectionClass", "class"],
  1256. referencedClasses: []
  1257. }),
  1258. smalltalk.CollectionTest);
  1259. smalltalk.addMethod(
  1260. smalltalk.method({
  1261. selector: "collectionWithDuplicates",
  1262. category: 'accessing',
  1263. fn: function (){
  1264. var self=this;
  1265. return smalltalk.withContext(function($ctx1) {
  1266. var $1;
  1267. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  1268. return $1;
  1269. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1270. args: [],
  1271. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  1272. messageSends: ["withAll:", "collectionClass"],
  1273. referencedClasses: []
  1274. }),
  1275. smalltalk.CollectionTest);
  1276. smalltalk.addMethod(
  1277. smalltalk.method({
  1278. selector: "defaultValues",
  1279. category: 'accessing',
  1280. fn: function (){
  1281. var self=this;
  1282. return smalltalk.withContext(function($ctx1) {
  1283. var $1;
  1284. $1=[(1), (2), (3), (-4)];
  1285. return $1;
  1286. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  1287. args: [],
  1288. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  1289. messageSends: [],
  1290. referencedClasses: []
  1291. }),
  1292. smalltalk.CollectionTest);
  1293. smalltalk.addMethod(
  1294. smalltalk.method({
  1295. selector: "isCollectionReadOnly",
  1296. category: 'testing',
  1297. fn: function (){
  1298. var self=this;
  1299. return smalltalk.withContext(function($ctx1) {
  1300. return false;
  1301. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1302. args: [],
  1303. source: "isCollectionReadOnly\x0a\x09^ false",
  1304. messageSends: [],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.CollectionTest);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "testAllSatisfy",
  1311. category: 'tests',
  1312. fn: function (){
  1313. var self=this;
  1314. var collection,anyOne;
  1315. return smalltalk.withContext(function($ctx1) {
  1316. var $1;
  1317. collection=self._collection();
  1318. anyOne=_st(collection)._anyOne();
  1319. $1=_st(collection)._allSatisfy_((function(each){
  1320. return smalltalk.withContext(function($ctx2) {
  1321. return _st(collection)._includes_(each);
  1322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1323. $ctx1.sendIdx["allSatisfy:"]=1;
  1324. self._assert_($1);
  1325. self._deny_(_st(collection)._allSatisfy_((function(each){
  1326. return smalltalk.withContext(function($ctx2) {
  1327. return _st(each).__tild_eq(anyOne);
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1329. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1330. args: [],
  1331. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1332. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1333. referencedClasses: []
  1334. }),
  1335. smalltalk.CollectionTest);
  1336. smalltalk.addMethod(
  1337. smalltalk.method({
  1338. selector: "testAnyOne",
  1339. category: 'tests',
  1340. fn: function (){
  1341. var self=this;
  1342. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1343. return smalltalk.withContext(function($ctx1) {
  1344. var $2,$1;
  1345. self._should_raise_((function(){
  1346. return smalltalk.withContext(function($ctx2) {
  1347. return _st(_st(self._collectionClass())._new())._anyOne();
  1348. $ctx2.sendIdx["anyOne"]=1;
  1349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1350. $2=self._collection();
  1351. $ctx1.sendIdx["collection"]=1;
  1352. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1353. self._assert_($1);
  1354. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1355. args: [],
  1356. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1357. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1358. referencedClasses: ["Error"]
  1359. }),
  1360. smalltalk.CollectionTest);
  1361. smalltalk.addMethod(
  1362. smalltalk.method({
  1363. selector: "testAnySatisfy",
  1364. category: 'tests',
  1365. fn: function (){
  1366. var self=this;
  1367. var anyOne;
  1368. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1369. return smalltalk.withContext(function($ctx1) {
  1370. var $1,$3,$2;
  1371. $1=self._collection();
  1372. $ctx1.sendIdx["collection"]=1;
  1373. anyOne=_st($1)._anyOne();
  1374. $3=self._collection();
  1375. $ctx1.sendIdx["collection"]=2;
  1376. $2=_st($3)._anySatisfy_((function(each){
  1377. return smalltalk.withContext(function($ctx2) {
  1378. return _st(each).__eq(anyOne);
  1379. $ctx2.sendIdx["="]=1;
  1380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1381. $ctx1.sendIdx["anySatisfy:"]=1;
  1382. self._assert_($2);
  1383. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1384. return smalltalk.withContext(function($ctx2) {
  1385. return _st(each).__eq(_st($Object())._new());
  1386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1387. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1388. args: [],
  1389. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1390. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1391. referencedClasses: ["Object"]
  1392. }),
  1393. smalltalk.CollectionTest);
  1394. smalltalk.addMethod(
  1395. smalltalk.method({
  1396. selector: "testAsArray",
  1397. category: 'tests',
  1398. fn: function (){
  1399. var self=this;
  1400. return smalltalk.withContext(function($ctx1) {
  1401. var $1;
  1402. $1=self._collection();
  1403. $ctx1.sendIdx["collection"]=1;
  1404. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1405. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1406. args: [],
  1407. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1408. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1409. referencedClasses: []
  1410. }),
  1411. smalltalk.CollectionTest);
  1412. smalltalk.addMethod(
  1413. smalltalk.method({
  1414. selector: "testAsOrderedCollection",
  1415. category: 'tests',
  1416. fn: function (){
  1417. var self=this;
  1418. return smalltalk.withContext(function($ctx1) {
  1419. var $1;
  1420. $1=self._collection();
  1421. $ctx1.sendIdx["collection"]=1;
  1422. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1423. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1424. args: [],
  1425. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1426. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1427. referencedClasses: []
  1428. }),
  1429. smalltalk.CollectionTest);
  1430. smalltalk.addMethod(
  1431. smalltalk.method({
  1432. selector: "testAsSet",
  1433. category: 'tests',
  1434. fn: function (){
  1435. var self=this;
  1436. var c,set;
  1437. return smalltalk.withContext(function($ctx1) {
  1438. c=self._collectionWithDuplicates();
  1439. set=_st(c)._asSet();
  1440. self._assert_equals_(_st(set)._size(),(5));
  1441. _st(c)._do_((function(each){
  1442. return smalltalk.withContext(function($ctx2) {
  1443. return self._assert_(_st(set)._includes_(each));
  1444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1445. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1446. args: [],
  1447. 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) ]",
  1448. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1449. referencedClasses: []
  1450. }),
  1451. smalltalk.CollectionTest);
  1452. smalltalk.addMethod(
  1453. smalltalk.method({
  1454. selector: "testCollect",
  1455. category: 'tests',
  1456. fn: function (){
  1457. var self=this;
  1458. var newCollection;
  1459. return smalltalk.withContext(function($ctx1) {
  1460. newCollection=[(1), (2), (3), (4)];
  1461. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each)._abs();
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. 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",
  1468. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testDetect",
  1475. category: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. $2=self._collection();
  1482. $ctx1.sendIdx["collection"]=1;
  1483. $1=_st($2)._detect_((function(each){
  1484. return smalltalk.withContext(function($ctx2) {
  1485. return _st(each).__lt((0));
  1486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1487. $ctx1.sendIdx["detect:"]=1;
  1488. self._assert_equals_($1,(-4));
  1489. self._should_raise_((function(){
  1490. return smalltalk.withContext(function($ctx2) {
  1491. return _st(self._collection())._detect_((function(each){
  1492. return smalltalk.withContext(function($ctx3) {
  1493. return _st(each).__eq((6));
  1494. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1496. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1497. args: [],
  1498. 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",
  1499. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1500. referencedClasses: ["Error"]
  1501. }),
  1502. smalltalk.CollectionTest);
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "testDo",
  1506. category: 'tests',
  1507. fn: function (){
  1508. var self=this;
  1509. var newCollection;
  1510. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1511. return smalltalk.withContext(function($ctx1) {
  1512. var $1;
  1513. newCollection=_st($OrderedCollection())._new();
  1514. $1=self._collection();
  1515. $ctx1.sendIdx["collection"]=1;
  1516. _st($1)._do_((function(each){
  1517. return smalltalk.withContext(function($ctx2) {
  1518. return _st(newCollection)._add_(each);
  1519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1520. self._assertSameContents_as_(self._collection(),newCollection);
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1522. args: [],
  1523. 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",
  1524. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1525. referencedClasses: ["OrderedCollection"]
  1526. }),
  1527. smalltalk.CollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testIfEmptyFamily",
  1531. category: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. return smalltalk.withContext(function($ctx1) {
  1535. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1536. $3=self._collectionClass();
  1537. $ctx1.sendIdx["collectionClass"]=1;
  1538. $2=_st($3)._new();
  1539. $ctx1.sendIdx["new"]=1;
  1540. $1=_st($2)._ifEmpty_((function(){
  1541. return smalltalk.withContext(function($ctx2) {
  1542. return (42);
  1543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1544. $ctx1.sendIdx["ifEmpty:"]=1;
  1545. self._assert_equals_($1,(42));
  1546. $ctx1.sendIdx["assert:equals:"]=1;
  1547. $5=self._collection();
  1548. $ctx1.sendIdx["collection"]=1;
  1549. $4=_st($5)._ifEmpty_((function(){
  1550. return smalltalk.withContext(function($ctx2) {
  1551. return (42);
  1552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1553. $6=self._collection();
  1554. $ctx1.sendIdx["collection"]=2;
  1555. self._assert_equals_($4,$6);
  1556. $ctx1.sendIdx["assert:equals:"]=2;
  1557. $9=self._collectionClass();
  1558. $ctx1.sendIdx["collectionClass"]=2;
  1559. $8=_st($9)._new();
  1560. $ctx1.sendIdx["new"]=2;
  1561. $7=_st($8)._ifNotEmpty_((function(){
  1562. return smalltalk.withContext(function($ctx2) {
  1563. return (42);
  1564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1565. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1566. $11=self._collectionClass();
  1567. $ctx1.sendIdx["collectionClass"]=3;
  1568. $10=_st($11)._new();
  1569. $ctx1.sendIdx["new"]=3;
  1570. self._assert_equals_($7,$10);
  1571. $ctx1.sendIdx["assert:equals:"]=3;
  1572. $13=self._collection();
  1573. $ctx1.sendIdx["collection"]=3;
  1574. $12=_st($13)._ifNotEmpty_((function(){
  1575. return smalltalk.withContext(function($ctx2) {
  1576. return (42);
  1577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1578. self._assert_equals_($12,(42));
  1579. $ctx1.sendIdx["assert:equals:"]=4;
  1580. $16=self._collectionClass();
  1581. $ctx1.sendIdx["collectionClass"]=4;
  1582. $15=_st($16)._new();
  1583. $ctx1.sendIdx["new"]=4;
  1584. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1585. return smalltalk.withContext(function($ctx2) {
  1586. return (42);
  1587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1588. return smalltalk.withContext(function($ctx2) {
  1589. return (999);
  1590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1591. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1592. self._assert_equals_($14,(42));
  1593. $ctx1.sendIdx["assert:equals:"]=5;
  1594. $18=self._collection();
  1595. $ctx1.sendIdx["collection"]=4;
  1596. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1597. return smalltalk.withContext(function($ctx2) {
  1598. return (42);
  1599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1600. return smalltalk.withContext(function($ctx2) {
  1601. return (999);
  1602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1603. self._assert_equals_($17,(999));
  1604. $ctx1.sendIdx["assert:equals:"]=6;
  1605. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1606. return smalltalk.withContext(function($ctx2) {
  1607. return (42);
  1608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1609. return smalltalk.withContext(function($ctx2) {
  1610. return (999);
  1611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1612. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1613. self._assert_equals_($19,(999));
  1614. $ctx1.sendIdx["assert:equals:"]=7;
  1615. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1616. return smalltalk.withContext(function($ctx2) {
  1617. return (42);
  1618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1619. return smalltalk.withContext(function($ctx2) {
  1620. return (999);
  1621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1622. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1623. args: [],
  1624. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1625. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1626. referencedClasses: []
  1627. }),
  1628. smalltalk.CollectionTest);
  1629. smalltalk.addMethod(
  1630. smalltalk.method({
  1631. selector: "testIsEmpty",
  1632. category: 'tests',
  1633. fn: function (){
  1634. var self=this;
  1635. return smalltalk.withContext(function($ctx1) {
  1636. var $1;
  1637. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1638. $ctx1.sendIdx["isEmpty"]=1;
  1639. self._assert_($1);
  1640. self._deny_(_st(self._collection())._isEmpty());
  1641. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1642. args: [],
  1643. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1644. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.CollectionTest);
  1648. smalltalk.addMethod(
  1649. smalltalk.method({
  1650. selector: "testNoneSatisfy",
  1651. category: 'tests',
  1652. fn: function (){
  1653. var self=this;
  1654. var anyOne;
  1655. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1656. return smalltalk.withContext(function($ctx1) {
  1657. var $1,$3,$2;
  1658. $1=self._collection();
  1659. $ctx1.sendIdx["collection"]=1;
  1660. anyOne=_st($1)._anyOne();
  1661. $3=self._collection();
  1662. $ctx1.sendIdx["collection"]=2;
  1663. $2=_st($3)._noneSatisfy_((function(each){
  1664. return smalltalk.withContext(function($ctx2) {
  1665. return _st(each).__eq(anyOne);
  1666. $ctx2.sendIdx["="]=1;
  1667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1668. $ctx1.sendIdx["noneSatisfy:"]=1;
  1669. self._deny_($2);
  1670. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1671. return smalltalk.withContext(function($ctx2) {
  1672. return _st(each).__eq(_st($Object())._new());
  1673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1674. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1675. args: [],
  1676. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  1677. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1678. referencedClasses: ["Object"]
  1679. }),
  1680. smalltalk.CollectionTest);
  1681. smalltalk.addMethod(
  1682. smalltalk.method({
  1683. selector: "testRemoveAll",
  1684. category: 'tests',
  1685. fn: function (){
  1686. var self=this;
  1687. return smalltalk.withContext(function($ctx1) {
  1688. var $1,$2;
  1689. $1=self._collection();
  1690. _st($1)._removeAll();
  1691. $2=_st($1)._yourself();
  1692. self._assert_equals_($2,_st(self._collectionClass())._new());
  1693. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1694. args: [],
  1695. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1696. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1697. referencedClasses: []
  1698. }),
  1699. smalltalk.CollectionTest);
  1700. smalltalk.addMethod(
  1701. smalltalk.method({
  1702. selector: "testSelect",
  1703. category: 'tests',
  1704. fn: function (){
  1705. var self=this;
  1706. var newCollection;
  1707. return smalltalk.withContext(function($ctx1) {
  1708. newCollection=[(2), (-4)];
  1709. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1710. return smalltalk.withContext(function($ctx2) {
  1711. return _st(each)._even();
  1712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1713. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1714. args: [],
  1715. 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",
  1716. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1717. referencedClasses: []
  1718. }),
  1719. smalltalk.CollectionTest);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "testSize",
  1723. category: 'tests',
  1724. fn: function (){
  1725. var self=this;
  1726. return smalltalk.withContext(function($ctx1) {
  1727. var $1;
  1728. $1=_st(_st(self._collectionClass())._new())._size();
  1729. $ctx1.sendIdx["size"]=1;
  1730. self._assert_equals_($1,(0));
  1731. $ctx1.sendIdx["assert:equals:"]=1;
  1732. self._assert_equals_(_st(self._collection())._size(),(4));
  1733. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1734. args: [],
  1735. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1736. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1737. referencedClasses: []
  1738. }),
  1739. smalltalk.CollectionTest);
  1740. smalltalk.addMethod(
  1741. smalltalk.method({
  1742. selector: "collectionClass",
  1743. category: 'accessing',
  1744. fn: function (){
  1745. var self=this;
  1746. return smalltalk.withContext(function($ctx1) {
  1747. return nil;
  1748. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1749. args: [],
  1750. source: "collectionClass\x0a\x09^ nil",
  1751. messageSends: [],
  1752. referencedClasses: []
  1753. }),
  1754. smalltalk.CollectionTest.klass);
  1755. smalltalk.addMethod(
  1756. smalltalk.method({
  1757. selector: "isAbstract",
  1758. category: 'testing',
  1759. fn: function (){
  1760. var self=this;
  1761. return smalltalk.withContext(function($ctx1) {
  1762. var $1;
  1763. $1=_st(self._collectionClass())._isNil();
  1764. return $1;
  1765. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1766. args: [],
  1767. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1768. messageSends: ["isNil", "collectionClass"],
  1769. referencedClasses: []
  1770. }),
  1771. smalltalk.CollectionTest.klass);
  1772. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1773. smalltalk.addMethod(
  1774. smalltalk.method({
  1775. selector: "testAt",
  1776. category: 'tests',
  1777. fn: function (){
  1778. var self=this;
  1779. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1780. return smalltalk.withContext(function($ctx1) {
  1781. var $2,$1;
  1782. $2=self._collection();
  1783. $ctx1.sendIdx["collection"]=1;
  1784. $1=_st($2)._at_((4));
  1785. $ctx1.sendIdx["at:"]=1;
  1786. self._assert_equals_($1,(-4));
  1787. self._should_raise_((function(){
  1788. return smalltalk.withContext(function($ctx2) {
  1789. return _st(self._collection())._at_((5));
  1790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1791. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1792. args: [],
  1793. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1794. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1795. referencedClasses: ["Error"]
  1796. }),
  1797. smalltalk.IndexableCollectionTest);
  1798. smalltalk.addMethod(
  1799. smalltalk.method({
  1800. selector: "testAtIfAbsent",
  1801. category: 'tests',
  1802. fn: function (){
  1803. var self=this;
  1804. return smalltalk.withContext(function($ctx1) {
  1805. var $2,$1;
  1806. $2=self._collection();
  1807. $ctx1.sendIdx["collection"]=1;
  1808. $1=_st($2)._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1809. return smalltalk.withContext(function($ctx2) {
  1810. return "none";
  1811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1812. self._assert_equals_($1,"none");
  1813. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1814. args: [],
  1815. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1816. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1817. referencedClasses: []
  1818. }),
  1819. smalltalk.IndexableCollectionTest);
  1820. smalltalk.addMethod(
  1821. smalltalk.method({
  1822. selector: "testIndexOf",
  1823. category: 'tests',
  1824. fn: function (){
  1825. var self=this;
  1826. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1827. return smalltalk.withContext(function($ctx1) {
  1828. var $2,$1,$3;
  1829. $2=self._collection();
  1830. $ctx1.sendIdx["collection"]=1;
  1831. $1=_st($2)._indexOf_((2));
  1832. $ctx1.sendIdx["indexOf:"]=1;
  1833. self._assert_equals_($1,(2));
  1834. $ctx1.sendIdx["assert:equals:"]=1;
  1835. self._should_raise_((function(){
  1836. return smalltalk.withContext(function($ctx2) {
  1837. $3=self._collection();
  1838. $ctx2.sendIdx["collection"]=2;
  1839. return _st($3)._indexOf_((999));
  1840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1841. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1842. return smalltalk.withContext(function($ctx2) {
  1843. return "sentinel";
  1844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1845. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1846. args: [],
  1847. 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'",
  1848. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1849. referencedClasses: ["Error"]
  1850. }),
  1851. smalltalk.IndexableCollectionTest);
  1852. smalltalk.addMethod(
  1853. smalltalk.method({
  1854. selector: "testWithIndexDo",
  1855. category: 'tests',
  1856. fn: function (){
  1857. var self=this;
  1858. var collection;
  1859. return smalltalk.withContext(function($ctx1) {
  1860. collection=self._collection();
  1861. $ctx1.sendIdx["collection"]=1;
  1862. _st(self._collection())._withIndexDo_((function(each,index){
  1863. return smalltalk.withContext(function($ctx2) {
  1864. return self._assert_equals_(_st(collection)._at_(index),each);
  1865. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1866. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1867. args: [],
  1868. 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 ]",
  1869. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1870. referencedClasses: []
  1871. }),
  1872. smalltalk.IndexableCollectionTest);
  1873. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1874. smalltalk.addMethod(
  1875. smalltalk.method({
  1876. selector: "collection",
  1877. category: 'accessing',
  1878. fn: function (){
  1879. var self=this;
  1880. return smalltalk.withContext(function($ctx1) {
  1881. var $2,$3,$4,$1;
  1882. $2="b".__minus_gt((1));
  1883. $ctx1.sendIdx["->"]=1;
  1884. $3="a".__minus_gt((2));
  1885. $ctx1.sendIdx["->"]=2;
  1886. $4="c".__minus_gt((3));
  1887. $ctx1.sendIdx["->"]=3;
  1888. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  1889. return $1;
  1890. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1891. args: [],
  1892. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1893. messageSends: ["->"],
  1894. referencedClasses: []
  1895. }),
  1896. smalltalk.HashedCollectionTest);
  1897. smalltalk.addMethod(
  1898. smalltalk.method({
  1899. selector: "collectionWithDuplicates",
  1900. category: 'accessing',
  1901. fn: function (){
  1902. var self=this;
  1903. return smalltalk.withContext(function($ctx1) {
  1904. var $2,$3,$4,$5,$6,$7,$1;
  1905. $2="b".__minus_gt((1));
  1906. $ctx1.sendIdx["->"]=1;
  1907. $3="a".__minus_gt((2));
  1908. $ctx1.sendIdx["->"]=2;
  1909. $4="c".__minus_gt((3));
  1910. $ctx1.sendIdx["->"]=3;
  1911. $5="d".__minus_gt((-4));
  1912. $ctx1.sendIdx["->"]=4;
  1913. $6="e".__minus_gt((1));
  1914. $ctx1.sendIdx["->"]=5;
  1915. $7="f".__minus_gt((2));
  1916. $ctx1.sendIdx["->"]=6;
  1917. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  1918. return $1;
  1919. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1920. args: [],
  1921. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1922. messageSends: ["->"],
  1923. referencedClasses: []
  1924. }),
  1925. smalltalk.HashedCollectionTest);
  1926. smalltalk.addMethod(
  1927. smalltalk.method({
  1928. selector: "testAsDictionary",
  1929. category: 'tests',
  1930. fn: function (){
  1931. var self=this;
  1932. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1933. return smalltalk.withContext(function($ctx1) {
  1934. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1935. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1936. args: [],
  1937. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1938. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1939. referencedClasses: ["Dictionary"]
  1940. }),
  1941. smalltalk.HashedCollectionTest);
  1942. smalltalk.addMethod(
  1943. smalltalk.method({
  1944. selector: "testAt",
  1945. category: 'tests',
  1946. fn: function (){
  1947. var self=this;
  1948. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1949. return smalltalk.withContext(function($ctx1) {
  1950. var $2,$1;
  1951. $2=self._collection();
  1952. $ctx1.sendIdx["collection"]=1;
  1953. $1=_st($2)._at_("a");
  1954. $ctx1.sendIdx["at:"]=1;
  1955. self._assert_equals_($1,(2));
  1956. self._should_raise_((function(){
  1957. return smalltalk.withContext(function($ctx2) {
  1958. return _st(self._collection())._at_((5));
  1959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1960. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1961. args: [],
  1962. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1963. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1964. referencedClasses: ["Error"]
  1965. }),
  1966. smalltalk.HashedCollectionTest);
  1967. smalltalk.addMethod(
  1968. smalltalk.method({
  1969. selector: "testFrom",
  1970. category: 'tests',
  1971. fn: function (){
  1972. var self=this;
  1973. var associations;
  1974. return smalltalk.withContext(function($ctx1) {
  1975. var $1,$2,$3,$5,$4;
  1976. $1="a".__minus_gt((1));
  1977. $ctx1.sendIdx["->"]=1;
  1978. $2="b".__minus_gt((2));
  1979. $ctx1.sendIdx["->"]=2;
  1980. associations=[$1,$2];
  1981. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1982. $5="a".__minus_gt((1));
  1983. $ctx1.sendIdx["->"]=3;
  1984. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  1985. self._assertSameContents_as_($3,$4);
  1986. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1987. args: [],
  1988. 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 }.",
  1989. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1990. referencedClasses: []
  1991. }),
  1992. smalltalk.HashedCollectionTest);
  1993. smalltalk.addMethod(
  1994. smalltalk.method({
  1995. selector: "testIndexOf",
  1996. category: 'tests',
  1997. fn: function (){
  1998. var self=this;
  1999. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2000. return smalltalk.withContext(function($ctx1) {
  2001. var $2,$1,$3;
  2002. $2=self._collection();
  2003. $ctx1.sendIdx["collection"]=1;
  2004. $1=_st($2)._indexOf_((2));
  2005. $ctx1.sendIdx["indexOf:"]=1;
  2006. self._assert_equals_($1,"a");
  2007. $ctx1.sendIdx["assert:equals:"]=1;
  2008. self._should_raise_((function(){
  2009. return smalltalk.withContext(function($ctx2) {
  2010. $3=self._collection();
  2011. $ctx2.sendIdx["collection"]=2;
  2012. return _st($3)._indexOf_((999));
  2013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2014. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  2015. return smalltalk.withContext(function($ctx2) {
  2016. return "sentinel";
  2017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  2018. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  2019. args: [],
  2020. 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'",
  2021. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2022. referencedClasses: ["Error"]
  2023. }),
  2024. smalltalk.HashedCollectionTest);
  2025. smalltalk.addMethod(
  2026. smalltalk.method({
  2027. selector: "testNewFromPairs",
  2028. category: 'tests',
  2029. fn: function (){
  2030. var self=this;
  2031. var flattenedAssociations;
  2032. return smalltalk.withContext(function($ctx1) {
  2033. var $1,$3,$2;
  2034. flattenedAssociations=["a",(1),"b",(2)];
  2035. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2036. $3="a".__minus_gt((1));
  2037. $ctx1.sendIdx["->"]=1;
  2038. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2039. self._assertSameContents_as_($1,$2);
  2040. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2041. args: [],
  2042. 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 }.",
  2043. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2044. referencedClasses: []
  2045. }),
  2046. smalltalk.HashedCollectionTest);
  2047. smalltalk.addMethod(
  2048. smalltalk.method({
  2049. selector: "collectionClass",
  2050. category: 'accessing',
  2051. fn: function (){
  2052. var self=this;
  2053. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2054. return smalltalk.withContext(function($ctx1) {
  2055. return $HashedCollection();
  2056. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2057. args: [],
  2058. source: "collectionClass\x0a\x09^ HashedCollection",
  2059. messageSends: [],
  2060. referencedClasses: ["HashedCollection"]
  2061. }),
  2062. smalltalk.HashedCollectionTest.klass);
  2063. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2064. smalltalk.addMethod(
  2065. smalltalk.method({
  2066. selector: "collection",
  2067. category: 'accessing',
  2068. fn: function (){
  2069. var self=this;
  2070. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2071. return smalltalk.withContext(function($ctx1) {
  2072. var $2,$3,$1;
  2073. $2=_st($Dictionary())._new();
  2074. _st($2)._at_put_((1),(1));
  2075. $ctx1.sendIdx["at:put:"]=1;
  2076. _st($2)._at_put_("a",(2));
  2077. $ctx1.sendIdx["at:put:"]=2;
  2078. _st($2)._at_put_(true,(3));
  2079. $ctx1.sendIdx["at:put:"]=3;
  2080. _st($2)._at_put_((4),(-4));
  2081. $3=_st($2)._yourself();
  2082. $1=$3;
  2083. return $1;
  2084. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2085. args: [],
  2086. 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",
  2087. messageSends: ["at:put:", "new", "yourself"],
  2088. referencedClasses: ["Dictionary"]
  2089. }),
  2090. smalltalk.DictionaryTest);
  2091. smalltalk.addMethod(
  2092. smalltalk.method({
  2093. selector: "collectionWithDuplicates",
  2094. category: 'accessing',
  2095. fn: function (){
  2096. var self=this;
  2097. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2098. return smalltalk.withContext(function($ctx1) {
  2099. var $2,$3,$1;
  2100. $2=_st($Dictionary())._new();
  2101. _st($2)._at_put_((1),(1));
  2102. $ctx1.sendIdx["at:put:"]=1;
  2103. _st($2)._at_put_("a",(2));
  2104. $ctx1.sendIdx["at:put:"]=2;
  2105. _st($2)._at_put_(true,(3));
  2106. $ctx1.sendIdx["at:put:"]=3;
  2107. _st($2)._at_put_((4),(-4));
  2108. $ctx1.sendIdx["at:put:"]=4;
  2109. _st($2)._at_put_("b",(1));
  2110. $ctx1.sendIdx["at:put:"]=5;
  2111. _st($2)._at_put_((3),(3));
  2112. $ctx1.sendIdx["at:put:"]=6;
  2113. _st($2)._at_put_(false,(12));
  2114. $3=_st($2)._yourself();
  2115. $1=$3;
  2116. return $1;
  2117. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2118. args: [],
  2119. 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",
  2120. messageSends: ["at:put:", "new", "yourself"],
  2121. referencedClasses: ["Dictionary"]
  2122. }),
  2123. smalltalk.DictionaryTest);
  2124. smalltalk.addMethod(
  2125. smalltalk.method({
  2126. selector: "testAccessing",
  2127. category: 'tests',
  2128. fn: function (){
  2129. var self=this;
  2130. var d;
  2131. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2132. return smalltalk.withContext(function($ctx1) {
  2133. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2134. d=_st($Dictionary())._new();
  2135. _st(d)._at_put_("hello","world");
  2136. $ctx1.sendIdx["at:put:"]=1;
  2137. $1=_st(d)._at_("hello");
  2138. $ctx1.sendIdx["at:"]=1;
  2139. self._assert_equals_($1,"world");
  2140. $ctx1.sendIdx["assert:equals:"]=1;
  2141. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2142. return smalltalk.withContext(function($ctx2) {
  2143. return nil;
  2144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2145. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2146. self._assert_equals_($2,"world");
  2147. $ctx1.sendIdx["assert:equals:"]=2;
  2148. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2149. return smalltalk.withContext(function($ctx2) {
  2150. return nil;
  2151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2152. $ctx1.sendIdx["deny:"]=1;
  2153. $3=_st(d)._includesKey_("hello");
  2154. $ctx1.sendIdx["includesKey:"]=1;
  2155. self._assert_($3);
  2156. $ctx1.sendIdx["assert:"]=1;
  2157. $4=_st(d)._includesKey_("foo");
  2158. $ctx1.sendIdx["includesKey:"]=2;
  2159. self._deny_($4);
  2160. $ctx1.sendIdx["deny:"]=2;
  2161. _st(d)._at_put_((1),(2));
  2162. $ctx1.sendIdx["at:put:"]=2;
  2163. $5=_st(d)._at_((1));
  2164. $ctx1.sendIdx["at:"]=2;
  2165. self._assert_equals_($5,(2));
  2166. $ctx1.sendIdx["assert:equals:"]=3;
  2167. $6=d;
  2168. $7=(1).__at((3));
  2169. $ctx1.sendIdx["@"]=1;
  2170. _st($6)._at_put_($7,(3));
  2171. $9=d;
  2172. $10=(1).__at((3));
  2173. $ctx1.sendIdx["@"]=2;
  2174. $8=_st($9)._at_($10);
  2175. self._assert_equals_($8,(3));
  2176. $12=d;
  2177. $13=(1).__at((3));
  2178. $ctx1.sendIdx["@"]=3;
  2179. $11=_st($12)._includesKey_($13);
  2180. $ctx1.sendIdx["includesKey:"]=3;
  2181. self._assert_($11);
  2182. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2183. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2184. args: [],
  2185. 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)",
  2186. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2187. referencedClasses: ["Dictionary"]
  2188. }),
  2189. smalltalk.DictionaryTest);
  2190. smalltalk.addMethod(
  2191. smalltalk.method({
  2192. selector: "testAsHashedCollection",
  2193. category: 'tests',
  2194. fn: function (){
  2195. var self=this;
  2196. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2197. return smalltalk.withContext(function($ctx1) {
  2198. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2200. args: [],
  2201. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2202. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2203. referencedClasses: ["HashedCollection"]
  2204. }),
  2205. smalltalk.DictionaryTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testDynamicDictionaries",
  2209. category: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2213. return smalltalk.withContext(function($ctx1) {
  2214. var $3,$2,$1;
  2215. $3="hello".__minus_gt((1));
  2216. $ctx1.sendIdx["->"]=1;
  2217. $2=smalltalk.HashedCollection._from_([$3]);
  2218. $1=_st($2)._asDictionary();
  2219. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  2220. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2221. args: [],
  2222. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2223. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2224. referencedClasses: ["Dictionary"]
  2225. }),
  2226. smalltalk.DictionaryTest);
  2227. smalltalk.addMethod(
  2228. smalltalk.method({
  2229. selector: "testEquality",
  2230. category: 'tests',
  2231. fn: function (){
  2232. var self=this;
  2233. var d1,d2;
  2234. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2235. return smalltalk.withContext(function($ctx1) {
  2236. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  2237. $2=_st($Dictionary())._new();
  2238. $ctx1.sendIdx["new"]=1;
  2239. $3=_st($Dictionary())._new();
  2240. $ctx1.sendIdx["new"]=2;
  2241. $1=_st($2).__eq($3);
  2242. $ctx1.sendIdx["="]=1;
  2243. self._assert_($1);
  2244. $ctx1.sendIdx["assert:"]=1;
  2245. $4=_st($Dictionary())._new();
  2246. $ctx1.sendIdx["new"]=3;
  2247. _st($4)._at_put_((1),(2));
  2248. $ctx1.sendIdx["at:put:"]=1;
  2249. $5=_st($4)._yourself();
  2250. $ctx1.sendIdx["yourself"]=1;
  2251. d1=$5;
  2252. $6=_st($Dictionary())._new();
  2253. $ctx1.sendIdx["new"]=4;
  2254. _st($6)._at_put_((1),(2));
  2255. $ctx1.sendIdx["at:put:"]=2;
  2256. $7=_st($6)._yourself();
  2257. $ctx1.sendIdx["yourself"]=2;
  2258. d2=$7;
  2259. $8=_st(d1).__eq(d2);
  2260. $ctx1.sendIdx["="]=2;
  2261. self._assert_($8);
  2262. $9=_st($Dictionary())._new();
  2263. $ctx1.sendIdx["new"]=5;
  2264. _st($9)._at_put_((1),(3));
  2265. $ctx1.sendIdx["at:put:"]=3;
  2266. $10=_st($9)._yourself();
  2267. $ctx1.sendIdx["yourself"]=3;
  2268. d2=$10;
  2269. $11=_st(d1).__eq(d2);
  2270. $ctx1.sendIdx["="]=3;
  2271. self._deny_($11);
  2272. $ctx1.sendIdx["deny:"]=1;
  2273. $12=_st($Dictionary())._new();
  2274. $ctx1.sendIdx["new"]=6;
  2275. _st($12)._at_put_((2),(2));
  2276. $ctx1.sendIdx["at:put:"]=4;
  2277. $13=_st($12)._yourself();
  2278. $ctx1.sendIdx["yourself"]=4;
  2279. d2=$13;
  2280. $14=_st(d1).__eq(d2);
  2281. $ctx1.sendIdx["="]=4;
  2282. self._deny_($14);
  2283. $ctx1.sendIdx["deny:"]=2;
  2284. $15=_st($Dictionary())._new();
  2285. _st($15)._at_put_((1),(2));
  2286. $ctx1.sendIdx["at:put:"]=5;
  2287. _st($15)._at_put_((3),(4));
  2288. $16=_st($15)._yourself();
  2289. d2=$16;
  2290. self._deny_(_st(d1).__eq(d2));
  2291. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2292. args: [],
  2293. 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.",
  2294. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2295. referencedClasses: ["Dictionary"]
  2296. }),
  2297. smalltalk.DictionaryTest);
  2298. smalltalk.addMethod(
  2299. smalltalk.method({
  2300. selector: "testIfAbsent",
  2301. category: 'tests',
  2302. fn: function (){
  2303. var self=this;
  2304. var d,visited;
  2305. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2306. return smalltalk.withContext(function($ctx1) {
  2307. visited=false;
  2308. d=_st($Dictionary())._new();
  2309. _st(d)._at_ifAbsent_("hello",(function(){
  2310. return smalltalk.withContext(function($ctx2) {
  2311. visited=true;
  2312. return visited;
  2313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2314. self._assert_(visited);
  2315. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2316. args: [],
  2317. 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.",
  2318. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2319. referencedClasses: ["Dictionary"]
  2320. }),
  2321. smalltalk.DictionaryTest);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "testIfPresent",
  2325. category: 'tests',
  2326. fn: function (){
  2327. var self=this;
  2328. var d,visited,absent;
  2329. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2330. return smalltalk.withContext(function($ctx1) {
  2331. visited=false;
  2332. d=_st($Dictionary())._new();
  2333. _st(d)._at_put_("hello","world");
  2334. _st(d)._at_ifPresent_("hello",(function(value){
  2335. return smalltalk.withContext(function($ctx2) {
  2336. visited=value;
  2337. return visited;
  2338. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2339. $ctx1.sendIdx["at:ifPresent:"]=1;
  2340. self._assert_equals_(visited,"world");
  2341. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. visited=value;
  2344. return visited;
  2345. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2346. self._assert_(_st(absent)._isNil());
  2347. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2348. args: [],
  2349. 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.",
  2350. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2351. referencedClasses: ["Dictionary"]
  2352. }),
  2353. smalltalk.DictionaryTest);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "testIfPresentIfAbsent",
  2357. category: 'tests',
  2358. fn: function (){
  2359. var self=this;
  2360. var d,visited;
  2361. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2362. return smalltalk.withContext(function($ctx1) {
  2363. visited=false;
  2364. d=_st($Dictionary())._new();
  2365. _st(d)._at_put_("hello","world");
  2366. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2367. return smalltalk.withContext(function($ctx2) {
  2368. visited=value;
  2369. return visited;
  2370. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2371. return smalltalk.withContext(function($ctx2) {
  2372. visited=true;
  2373. return visited;
  2374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2375. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2376. self._assert_equals_(visited,"world");
  2377. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2378. return smalltalk.withContext(function($ctx2) {
  2379. visited=value;
  2380. return visited;
  2381. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2382. return smalltalk.withContext(function($ctx2) {
  2383. visited=true;
  2384. return visited;
  2385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2386. self._assert_(visited);
  2387. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2388. args: [],
  2389. 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.",
  2390. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2391. referencedClasses: ["Dictionary"]
  2392. }),
  2393. smalltalk.DictionaryTest);
  2394. smalltalk.addMethod(
  2395. smalltalk.method({
  2396. selector: "testKeys",
  2397. category: 'tests',
  2398. fn: function (){
  2399. var self=this;
  2400. var d;
  2401. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2402. return smalltalk.withContext(function($ctx1) {
  2403. d=_st($Dictionary())._new();
  2404. _st(d)._at_put_((1),(2));
  2405. $ctx1.sendIdx["at:put:"]=1;
  2406. _st(d)._at_put_((2),(3));
  2407. $ctx1.sendIdx["at:put:"]=2;
  2408. _st(d)._at_put_((3),(4));
  2409. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2410. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2411. args: [],
  2412. 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)",
  2413. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2414. referencedClasses: ["Dictionary"]
  2415. }),
  2416. smalltalk.DictionaryTest);
  2417. smalltalk.addMethod(
  2418. smalltalk.method({
  2419. selector: "testPointKey",
  2420. category: 'tests',
  2421. fn: function (){
  2422. var self=this;
  2423. var d;
  2424. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2425. return smalltalk.withContext(function($ctx1) {
  2426. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2427. d=_st($Dictionary())._new();
  2428. $1=d;
  2429. $2=(1).__at((1));
  2430. $ctx1.sendIdx["@"]=1;
  2431. _st($1)._at_put_($2,"foo");
  2432. $ctx1.sendIdx["at:put:"]=1;
  2433. $4=d;
  2434. $5=(1).__at((1));
  2435. $ctx1.sendIdx["@"]=2;
  2436. $3=_st($4)._at_($5);
  2437. $ctx1.sendIdx["at:"]=1;
  2438. self._assert_equals_($3,"foo");
  2439. $ctx1.sendIdx["assert:equals:"]=1;
  2440. $6=d;
  2441. $7=(1).__at((1));
  2442. $ctx1.sendIdx["@"]=3;
  2443. _st($6)._at_put_($7,"bar");
  2444. $9=d;
  2445. $10=(1).__at((1));
  2446. $ctx1.sendIdx["@"]=4;
  2447. $8=_st($9)._at_($10);
  2448. self._assert_equals_($8,"bar");
  2449. $ctx1.sendIdx["assert:equals:"]=2;
  2450. $11=d;
  2451. $12=(1).__at((1));
  2452. $ctx1.sendIdx["@"]=5;
  2453. _st($11)._removeKey_($12);
  2454. $14=d;
  2455. $15=(1).__at((1));
  2456. $ctx1.sendIdx["@"]=6;
  2457. $13=_st($14)._at_ifAbsent_($15,(function(){
  2458. return smalltalk.withContext(function($ctx2) {
  2459. return "baz";
  2460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2461. self._assert_equals_($13,"baz");
  2462. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2463. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2464. args: [],
  2465. 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)",
  2466. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2467. referencedClasses: ["Dictionary"]
  2468. }),
  2469. smalltalk.DictionaryTest);
  2470. smalltalk.addMethod(
  2471. smalltalk.method({
  2472. selector: "testPrintString",
  2473. category: 'tests',
  2474. fn: function (){
  2475. var self=this;
  2476. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2477. return smalltalk.withContext(function($ctx1) {
  2478. var $2,$3,$1;
  2479. $2=_st($Dictionary())._new();
  2480. _st($2)._at_put_("firstname","James");
  2481. $ctx1.sendIdx["at:put:"]=1;
  2482. _st($2)._at_put_("lastname","Bond");
  2483. $3=_st($2)._printString();
  2484. $1=$3;
  2485. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2486. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2487. args: [],
  2488. 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'')'",
  2489. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2490. referencedClasses: ["Dictionary"]
  2491. }),
  2492. smalltalk.DictionaryTest);
  2493. smalltalk.addMethod(
  2494. smalltalk.method({
  2495. selector: "testRemoveKey",
  2496. category: 'tests',
  2497. fn: function (){
  2498. var self=this;
  2499. var d,key;
  2500. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2501. return smalltalk.withContext(function($ctx1) {
  2502. var $1;
  2503. d=_st($Dictionary())._new();
  2504. _st(d)._at_put_((1),(2));
  2505. $ctx1.sendIdx["at:put:"]=1;
  2506. _st(d)._at_put_((2),(3));
  2507. $ctx1.sendIdx["at:put:"]=2;
  2508. _st(d)._at_put_((3),(4));
  2509. key=(2);
  2510. $1=_st(d)._keys();
  2511. $ctx1.sendIdx["keys"]=1;
  2512. self._assert_equals_($1,[(1), (2), (3)]);
  2513. $ctx1.sendIdx["assert:equals:"]=1;
  2514. _st(d)._removeKey_(key);
  2515. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  2516. $ctx1.sendIdx["assert:equals:"]=2;
  2517. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2518. self._deny_(_st(d)._includesKey_((2)));
  2519. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2520. args: [],
  2521. 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)",
  2522. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2523. referencedClasses: ["Dictionary"]
  2524. }),
  2525. smalltalk.DictionaryTest);
  2526. smalltalk.addMethod(
  2527. smalltalk.method({
  2528. selector: "testRemoveKeyIfAbsent",
  2529. category: 'tests',
  2530. fn: function (){
  2531. var self=this;
  2532. var d,key;
  2533. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2534. return smalltalk.withContext(function($ctx1) {
  2535. var $1;
  2536. d=_st($Dictionary())._new();
  2537. _st(d)._at_put_((1),(2));
  2538. $ctx1.sendIdx["at:put:"]=1;
  2539. _st(d)._at_put_((2),(3));
  2540. $ctx1.sendIdx["at:put:"]=2;
  2541. _st(d)._at_put_((3),(4));
  2542. key=(2);
  2543. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2544. $ctx1.sendIdx["assert:equals:"]=1;
  2545. key=(3);
  2546. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2547. return smalltalk.withContext(function($ctx2) {
  2548. return (42);
  2549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2550. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2551. self._assert_equals_($1,(4));
  2552. $ctx1.sendIdx["assert:equals:"]=2;
  2553. key="why";
  2554. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  2555. return smalltalk.withContext(function($ctx2) {
  2556. return (42);
  2557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  2558. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2559. args: [],
  2560. 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.",
  2561. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2562. referencedClasses: ["Dictionary"]
  2563. }),
  2564. smalltalk.DictionaryTest);
  2565. smalltalk.addMethod(
  2566. smalltalk.method({
  2567. selector: "testSize",
  2568. category: 'tests',
  2569. fn: function (){
  2570. var self=this;
  2571. var d;
  2572. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2573. return smalltalk.withContext(function($ctx1) {
  2574. var $1,$2;
  2575. d=_st($Dictionary())._new();
  2576. $1=_st(d)._size();
  2577. $ctx1.sendIdx["size"]=1;
  2578. self._assert_equals_($1,(0));
  2579. $ctx1.sendIdx["assert:equals:"]=1;
  2580. _st(d)._at_put_((1),(2));
  2581. $ctx1.sendIdx["at:put:"]=1;
  2582. $2=_st(d)._size();
  2583. $ctx1.sendIdx["size"]=2;
  2584. self._assert_equals_($2,(1));
  2585. $ctx1.sendIdx["assert:equals:"]=2;
  2586. _st(d)._at_put_((2),(3));
  2587. self._assert_equals_(_st(d)._size(),(2));
  2588. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2589. args: [],
  2590. 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.",
  2591. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2592. referencedClasses: ["Dictionary"]
  2593. }),
  2594. smalltalk.DictionaryTest);
  2595. smalltalk.addMethod(
  2596. smalltalk.method({
  2597. selector: "testValues",
  2598. category: 'tests',
  2599. fn: function (){
  2600. var self=this;
  2601. var d;
  2602. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2603. return smalltalk.withContext(function($ctx1) {
  2604. d=_st($Dictionary())._new();
  2605. _st(d)._at_put_((1),(2));
  2606. $ctx1.sendIdx["at:put:"]=1;
  2607. _st(d)._at_put_((2),(3));
  2608. $ctx1.sendIdx["at:put:"]=2;
  2609. _st(d)._at_put_((3),(4));
  2610. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2611. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2612. args: [],
  2613. 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)",
  2614. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2615. referencedClasses: ["Dictionary"]
  2616. }),
  2617. smalltalk.DictionaryTest);
  2618. smalltalk.addMethod(
  2619. smalltalk.method({
  2620. selector: "collectionClass",
  2621. category: 'accessing',
  2622. fn: function (){
  2623. var self=this;
  2624. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2625. return smalltalk.withContext(function($ctx1) {
  2626. return $Dictionary();
  2627. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2628. args: [],
  2629. source: "collectionClass\x0a\x09^ Dictionary",
  2630. messageSends: [],
  2631. referencedClasses: ["Dictionary"]
  2632. }),
  2633. smalltalk.DictionaryTest.klass);
  2634. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2635. smalltalk.addMethod(
  2636. smalltalk.method({
  2637. selector: "testFirst",
  2638. category: 'tests',
  2639. fn: function (){
  2640. var self=this;
  2641. return smalltalk.withContext(function($ctx1) {
  2642. var $2,$1;
  2643. $2=self._collection();
  2644. $ctx1.sendIdx["collection"]=1;
  2645. $1=_st($2)._first();
  2646. self._assert_equals_($1,_st(self._collection())._at_((1)));
  2647. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2648. args: [],
  2649. source: "testFirst\x0a\x09self assert: (self collection first) equals: (self collection at: 1)",
  2650. messageSends: ["assert:equals:", "first", "collection", "at:"],
  2651. referencedClasses: []
  2652. }),
  2653. smalltalk.SequenceableCollectionTest);
  2654. smalltalk.addMethod(
  2655. smalltalk.method({
  2656. selector: "testFourth",
  2657. category: 'tests',
  2658. fn: function (){
  2659. var self=this;
  2660. return smalltalk.withContext(function($ctx1) {
  2661. var $2,$1;
  2662. $2=self._collection();
  2663. $ctx1.sendIdx["collection"]=1;
  2664. $1=_st($2)._fourth();
  2665. self._assert_equals_($1,_st(self._collection())._at_((4)));
  2666. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2667. args: [],
  2668. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2669. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2670. referencedClasses: []
  2671. }),
  2672. smalltalk.SequenceableCollectionTest);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "testLast",
  2676. category: 'tests',
  2677. fn: function (){
  2678. var self=this;
  2679. return smalltalk.withContext(function($ctx1) {
  2680. var $2,$1,$4,$3;
  2681. $2=self._collection();
  2682. $ctx1.sendIdx["collection"]=1;
  2683. $1=_st($2)._last();
  2684. $4=self._collection();
  2685. $ctx1.sendIdx["collection"]=2;
  2686. $3=_st($4)._at_(_st(self._collection())._size());
  2687. self._assert_equals_($1,$3);
  2688. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2689. args: [],
  2690. source: "testLast\x0a\x09self assert: (self collection last) equals: (self collection at: self collection size)",
  2691. messageSends: ["assert:equals:", "last", "collection", "at:", "size"],
  2692. referencedClasses: []
  2693. }),
  2694. smalltalk.SequenceableCollectionTest);
  2695. smalltalk.addMethod(
  2696. smalltalk.method({
  2697. selector: "testSecond",
  2698. category: 'tests',
  2699. fn: function (){
  2700. var self=this;
  2701. return smalltalk.withContext(function($ctx1) {
  2702. var $2,$1;
  2703. $2=self._collection();
  2704. $ctx1.sendIdx["collection"]=1;
  2705. $1=_st($2)._second();
  2706. self._assert_equals_($1,_st(self._collection())._at_((2)));
  2707. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2708. args: [],
  2709. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2710. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2711. referencedClasses: []
  2712. }),
  2713. smalltalk.SequenceableCollectionTest);
  2714. smalltalk.addMethod(
  2715. smalltalk.method({
  2716. selector: "testThird",
  2717. category: 'tests',
  2718. fn: function (){
  2719. var self=this;
  2720. return smalltalk.withContext(function($ctx1) {
  2721. var $2,$1;
  2722. $2=self._collection();
  2723. $ctx1.sendIdx["collection"]=1;
  2724. $1=_st($2)._third();
  2725. self._assert_equals_($1,_st(self._collection())._at_((3)));
  2726. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2727. args: [],
  2728. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2729. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2730. referencedClasses: []
  2731. }),
  2732. smalltalk.SequenceableCollectionTest);
  2733. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2734. smalltalk.addMethod(
  2735. smalltalk.method({
  2736. selector: "testAdd",
  2737. category: 'tests',
  2738. fn: function (){
  2739. var self=this;
  2740. var array;
  2741. return smalltalk.withContext(function($ctx1) {
  2742. array=self._collection();
  2743. _st(array)._add_((6));
  2744. self._assert_equals_(_st(array)._last(),(6));
  2745. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2746. args: [],
  2747. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  2748. messageSends: ["collection", "add:", "assert:equals:", "last"],
  2749. referencedClasses: []
  2750. }),
  2751. smalltalk.ArrayTest);
  2752. smalltalk.addMethod(
  2753. smalltalk.method({
  2754. selector: "testAddFirst",
  2755. category: 'tests',
  2756. fn: function (){
  2757. var self=this;
  2758. return smalltalk.withContext(function($ctx1) {
  2759. var $1,$2;
  2760. $1=self._collection();
  2761. _st($1)._addFirst_((0));
  2762. $2=_st($1)._yourself();
  2763. self._assert_equals_(_st($2)._first(),(0));
  2764. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2765. args: [],
  2766. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  2767. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  2768. referencedClasses: []
  2769. }),
  2770. smalltalk.ArrayTest);
  2771. smalltalk.addMethod(
  2772. smalltalk.method({
  2773. selector: "testAtIfAbsent",
  2774. category: 'tests',
  2775. fn: function (){
  2776. var self=this;
  2777. var array;
  2778. return smalltalk.withContext(function($ctx1) {
  2779. var $1,$2,$3,$4;
  2780. array=["hello", "world"];
  2781. $1=_st(array)._at_((1));
  2782. $ctx1.sendIdx["at:"]=1;
  2783. self._assert_equals_($1,"hello");
  2784. $ctx1.sendIdx["assert:equals:"]=1;
  2785. self._assert_equals_(_st(array)._at_((2)),"world");
  2786. $ctx1.sendIdx["assert:equals:"]=2;
  2787. $2=_st(array)._at_ifAbsent_((2),(function(){
  2788. return smalltalk.withContext(function($ctx2) {
  2789. return "not found";
  2790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2791. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2792. self._assert_equals_($2,"world");
  2793. $ctx1.sendIdx["assert:equals:"]=3;
  2794. $3=_st(array)._at_ifAbsent_((0),(function(){
  2795. return smalltalk.withContext(function($ctx2) {
  2796. return "not found";
  2797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2798. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2799. self._assert_equals_($3,"not found");
  2800. $ctx1.sendIdx["assert:equals:"]=4;
  2801. $4=_st(array)._at_ifAbsent_((-10),(function(){
  2802. return smalltalk.withContext(function($ctx2) {
  2803. return "not found";
  2804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2805. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2806. self._assert_equals_($4,"not found");
  2807. $ctx1.sendIdx["assert:equals:"]=5;
  2808. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  2809. return smalltalk.withContext(function($ctx2) {
  2810. return "not found";
  2811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"not found");
  2812. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2813. args: [],
  2814. 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'.",
  2815. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2816. referencedClasses: []
  2817. }),
  2818. smalltalk.ArrayTest);
  2819. smalltalk.addMethod(
  2820. smalltalk.method({
  2821. selector: "testFirstN",
  2822. category: 'tests',
  2823. fn: function (){
  2824. var self=this;
  2825. return smalltalk.withContext(function($ctx1) {
  2826. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2827. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2828. args: [],
  2829. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2830. messageSends: ["assert:equals:", "first:"],
  2831. referencedClasses: []
  2832. }),
  2833. smalltalk.ArrayTest);
  2834. smalltalk.addMethod(
  2835. smalltalk.method({
  2836. selector: "testIfEmpty",
  2837. category: 'tests',
  2838. fn: function (){
  2839. var self=this;
  2840. return smalltalk.withContext(function($ctx1) {
  2841. self._assert_equals_(""._ifEmpty_((function(){
  2842. return smalltalk.withContext(function($ctx2) {
  2843. return "zork";
  2844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2845. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2846. args: [],
  2847. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: [ 'zork' ] ) equals: 'zork'",
  2848. messageSends: ["assert:equals:", "ifEmpty:"],
  2849. referencedClasses: []
  2850. }),
  2851. smalltalk.ArrayTest);
  2852. smalltalk.addMethod(
  2853. smalltalk.method({
  2854. selector: "testPrintString",
  2855. category: 'tests',
  2856. fn: function (){
  2857. var self=this;
  2858. var array;
  2859. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2860. return smalltalk.withContext(function($ctx1) {
  2861. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  2862. array=_st($Array())._new();
  2863. $1=_st(array)._printString();
  2864. $ctx1.sendIdx["printString"]=1;
  2865. self._assert_equals_($1,"an Array ()");
  2866. $ctx1.sendIdx["assert:equals:"]=1;
  2867. $2=array;
  2868. _st($2)._add_((1));
  2869. $ctx1.sendIdx["add:"]=1;
  2870. $3=_st($2)._add_((3));
  2871. $ctx1.sendIdx["add:"]=2;
  2872. $4=_st(array)._printString();
  2873. $ctx1.sendIdx["printString"]=2;
  2874. self._assert_equals_($4,"an Array (1 3)");
  2875. $ctx1.sendIdx["assert:equals:"]=2;
  2876. _st(array)._add_("foo");
  2877. $5=_st(array)._printString();
  2878. $ctx1.sendIdx["printString"]=3;
  2879. self._assert_equals_($5,"an Array (1 3 'foo')");
  2880. $ctx1.sendIdx["assert:equals:"]=3;
  2881. $6=array;
  2882. _st($6)._remove_((1));
  2883. $ctx1.sendIdx["remove:"]=1;
  2884. $7=_st($6)._remove_((3));
  2885. $8=_st(array)._printString();
  2886. $ctx1.sendIdx["printString"]=4;
  2887. self._assert_equals_($8,"an Array ('foo')");
  2888. $ctx1.sendIdx["assert:equals:"]=4;
  2889. _st(array)._addLast_((3));
  2890. $ctx1.sendIdx["addLast:"]=1;
  2891. $9=_st(array)._printString();
  2892. $ctx1.sendIdx["printString"]=5;
  2893. self._assert_equals_($9,"an Array ('foo' 3)");
  2894. $ctx1.sendIdx["assert:equals:"]=5;
  2895. _st(array)._addLast_((3));
  2896. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  2897. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2898. args: [],
  2899. 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)'.",
  2900. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2901. referencedClasses: ["Array"]
  2902. }),
  2903. smalltalk.ArrayTest);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "testRemove",
  2907. category: 'tests',
  2908. fn: function (){
  2909. var self=this;
  2910. var array;
  2911. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2912. return smalltalk.withContext(function($ctx1) {
  2913. array=[(1), (2), (3), (4), (5)];
  2914. _st(array)._remove_((3));
  2915. $ctx1.sendIdx["remove:"]=1;
  2916. self._assert_equals_(array,[(1), (2), (4), (5)]);
  2917. self._should_raise_((function(){
  2918. return smalltalk.withContext(function($ctx2) {
  2919. return _st(array)._remove_((3));
  2920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2921. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  2922. args: [],
  2923. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  2924. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  2925. referencedClasses: ["Error"]
  2926. }),
  2927. smalltalk.ArrayTest);
  2928. smalltalk.addMethod(
  2929. smalltalk.method({
  2930. selector: "testRemoveFromTo",
  2931. category: 'tests',
  2932. fn: function (){
  2933. var self=this;
  2934. return smalltalk.withContext(function($ctx1) {
  2935. var $1,$2;
  2936. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2937. $ctx1.sendIdx["removeFrom:to:"]=1;
  2938. self._assert_equals_($1,[(4)]);
  2939. $ctx1.sendIdx["assert:equals:"]=1;
  2940. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2941. $ctx1.sendIdx["removeFrom:to:"]=2;
  2942. self._assert_equals_($2,[(1), (4)]);
  2943. $ctx1.sendIdx["assert:equals:"]=2;
  2944. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  2945. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2946. args: [],
  2947. 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)",
  2948. messageSends: ["assert:equals:", "removeFrom:to:"],
  2949. referencedClasses: []
  2950. }),
  2951. smalltalk.ArrayTest);
  2952. smalltalk.addMethod(
  2953. smalltalk.method({
  2954. selector: "testRemoveIndex",
  2955. category: 'tests',
  2956. fn: function (){
  2957. var self=this;
  2958. return smalltalk.withContext(function($ctx1) {
  2959. var $1,$2;
  2960. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  2961. $ctx1.sendIdx["removeIndex:"]=1;
  2962. self._assert_equals_($1,[(1), (3), (4)]);
  2963. $ctx1.sendIdx["assert:equals:"]=1;
  2964. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  2965. $ctx1.sendIdx["removeIndex:"]=2;
  2966. self._assert_equals_($2,[(2), (3), (4)]);
  2967. $ctx1.sendIdx["assert:equals:"]=2;
  2968. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  2969. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2970. args: [],
  2971. 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: #()",
  2972. messageSends: ["assert:equals:", "removeIndex:"],
  2973. referencedClasses: []
  2974. }),
  2975. smalltalk.ArrayTest);
  2976. smalltalk.addMethod(
  2977. smalltalk.method({
  2978. selector: "testRemoveLast",
  2979. category: 'tests',
  2980. fn: function (){
  2981. var self=this;
  2982. var array;
  2983. return smalltalk.withContext(function($ctx1) {
  2984. array=[(1), (2)];
  2985. _st(array)._removeLast();
  2986. self._assert_equals_(_st(array)._last(),(1));
  2987. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  2988. args: [],
  2989. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  2990. messageSends: ["removeLast", "assert:equals:", "last"],
  2991. referencedClasses: []
  2992. }),
  2993. smalltalk.ArrayTest);
  2994. smalltalk.addMethod(
  2995. smalltalk.method({
  2996. selector: "testReversed",
  2997. category: 'tests',
  2998. fn: function (){
  2999. var self=this;
  3000. var array;
  3001. return smalltalk.withContext(function($ctx1) {
  3002. array=[(5), (4), (3), (2), (1)];
  3003. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  3004. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  3005. args: [],
  3006. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  3007. messageSends: ["assert:equals:", "reversed"],
  3008. referencedClasses: []
  3009. }),
  3010. smalltalk.ArrayTest);
  3011. smalltalk.addMethod(
  3012. smalltalk.method({
  3013. selector: "testSort",
  3014. category: 'tests',
  3015. fn: function (){
  3016. var self=this;
  3017. var array;
  3018. return smalltalk.withContext(function($ctx1) {
  3019. array=[(3), (1), (4), (5), (2)];
  3020. _st(array)._sort();
  3021. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  3022. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  3023. args: [],
  3024. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  3025. messageSends: ["sort", "assert:equals:"],
  3026. referencedClasses: []
  3027. }),
  3028. smalltalk.ArrayTest);
  3029. smalltalk.addMethod(
  3030. smalltalk.method({
  3031. selector: "collectionClass",
  3032. category: 'accessing',
  3033. fn: function (){
  3034. var self=this;
  3035. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3036. return smalltalk.withContext(function($ctx1) {
  3037. return $Array();
  3038. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  3039. args: [],
  3040. source: "collectionClass\x0a\x09^ Array",
  3041. messageSends: [],
  3042. referencedClasses: ["Array"]
  3043. }),
  3044. smalltalk.ArrayTest.klass);
  3045. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3046. smalltalk.addMethod(
  3047. smalltalk.method({
  3048. selector: "collection",
  3049. category: 'accessing',
  3050. fn: function (){
  3051. var self=this;
  3052. return smalltalk.withContext(function($ctx1) {
  3053. return "hello";
  3054. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  3055. args: [],
  3056. source: "collection\x0a\x09^ 'hello'",
  3057. messageSends: [],
  3058. referencedClasses: []
  3059. }),
  3060. smalltalk.StringTest);
  3061. smalltalk.addMethod(
  3062. smalltalk.method({
  3063. selector: "collectionWithDuplicates",
  3064. category: 'accessing',
  3065. fn: function (){
  3066. var self=this;
  3067. return smalltalk.withContext(function($ctx1) {
  3068. return "abbaerte";
  3069. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  3070. args: [],
  3071. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  3072. messageSends: [],
  3073. referencedClasses: []
  3074. }),
  3075. smalltalk.StringTest);
  3076. smalltalk.addMethod(
  3077. smalltalk.method({
  3078. selector: "testAddRemove",
  3079. category: 'tests',
  3080. fn: function (){
  3081. var self=this;
  3082. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3083. return smalltalk.withContext(function($ctx1) {
  3084. self._should_raise_((function(){
  3085. return smalltalk.withContext(function($ctx2) {
  3086. return "hello"._add_("a");
  3087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3088. $ctx1.sendIdx["should:raise:"]=1;
  3089. self._should_raise_((function(){
  3090. return smalltalk.withContext(function($ctx2) {
  3091. return "hello"._remove_("h");
  3092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3093. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  3094. args: [],
  3095. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  3096. messageSends: ["should:raise:", "add:", "remove:"],
  3097. referencedClasses: ["Error"]
  3098. }),
  3099. smalltalk.StringTest);
  3100. smalltalk.addMethod(
  3101. smalltalk.method({
  3102. selector: "testAsArray",
  3103. category: 'tests',
  3104. fn: function (){
  3105. var self=this;
  3106. return smalltalk.withContext(function($ctx1) {
  3107. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  3108. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  3109. args: [],
  3110. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  3111. messageSends: ["assert:equals:", "asArray"],
  3112. referencedClasses: []
  3113. }),
  3114. smalltalk.StringTest);
  3115. smalltalk.addMethod(
  3116. smalltalk.method({
  3117. selector: "testAsLowerCase",
  3118. category: 'tests',
  3119. fn: function (){
  3120. var self=this;
  3121. return smalltalk.withContext(function($ctx1) {
  3122. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  3123. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  3124. args: [],
  3125. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  3126. messageSends: ["assert:equals:", "asLowercase"],
  3127. referencedClasses: []
  3128. }),
  3129. smalltalk.StringTest);
  3130. smalltalk.addMethod(
  3131. smalltalk.method({
  3132. selector: "testAsNumber",
  3133. category: 'tests',
  3134. fn: function (){
  3135. var self=this;
  3136. return smalltalk.withContext(function($ctx1) {
  3137. var $1,$2;
  3138. $1="3"._asNumber();
  3139. $ctx1.sendIdx["asNumber"]=1;
  3140. self._assert_equals_($1,(3));
  3141. $ctx1.sendIdx["assert:equals:"]=1;
  3142. $2="-3"._asNumber();
  3143. $ctx1.sendIdx["asNumber"]=2;
  3144. self._assert_equals_($2,(-3));
  3145. $ctx1.sendIdx["assert:equals:"]=2;
  3146. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  3147. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  3148. args: [],
  3149. 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.",
  3150. messageSends: ["assert:equals:", "asNumber"],
  3151. referencedClasses: []
  3152. }),
  3153. smalltalk.StringTest);
  3154. smalltalk.addMethod(
  3155. smalltalk.method({
  3156. selector: "testAsUpperCase",
  3157. category: 'tests',
  3158. fn: function (){
  3159. var self=this;
  3160. return smalltalk.withContext(function($ctx1) {
  3161. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3162. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3163. args: [],
  3164. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3165. messageSends: ["assert:equals:", "asUppercase"],
  3166. referencedClasses: []
  3167. }),
  3168. smalltalk.StringTest);
  3169. smalltalk.addMethod(
  3170. smalltalk.method({
  3171. selector: "testAsciiValue",
  3172. category: 'tests',
  3173. fn: function (){
  3174. var self=this;
  3175. var characterA,characterU;
  3176. return smalltalk.withContext(function($ctx1) {
  3177. var $1;
  3178. characterA="A";
  3179. characterU="U";
  3180. $1=_st(characterA)._asciiValue();
  3181. $ctx1.sendIdx["asciiValue"]=1;
  3182. self._assert_equals_($1,(65));
  3183. $ctx1.sendIdx["assert:equals:"]=1;
  3184. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  3185. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3186. args: [],
  3187. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  3188. messageSends: ["assert:equals:", "asciiValue"],
  3189. referencedClasses: []
  3190. }),
  3191. smalltalk.StringTest);
  3192. smalltalk.addMethod(
  3193. smalltalk.method({
  3194. selector: "testAt",
  3195. category: 'tests',
  3196. fn: function (){
  3197. var self=this;
  3198. return smalltalk.withContext(function($ctx1) {
  3199. var $1;
  3200. $1="hello"._at_((1));
  3201. $ctx1.sendIdx["at:"]=1;
  3202. self._assert_equals_($1,"h");
  3203. $ctx1.sendIdx["assert:equals:"]=1;
  3204. self._assert_equals_("hello"._at_((5)),"o");
  3205. $ctx1.sendIdx["assert:equals:"]=2;
  3206. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  3207. return smalltalk.withContext(function($ctx2) {
  3208. return nil;
  3209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  3210. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  3211. args: [],
  3212. 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",
  3213. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  3214. referencedClasses: []
  3215. }),
  3216. smalltalk.StringTest);
  3217. smalltalk.addMethod(
  3218. smalltalk.method({
  3219. selector: "testAtPut",
  3220. category: 'tests',
  3221. fn: function (){
  3222. var self=this;
  3223. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3224. return smalltalk.withContext(function($ctx1) {
  3225. self._should_raise_((function(){
  3226. return smalltalk.withContext(function($ctx2) {
  3227. return "hello"._at_put_((1),"a");
  3228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3229. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3230. args: [],
  3231. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  3232. messageSends: ["should:raise:", "at:put:"],
  3233. referencedClasses: ["Error"]
  3234. }),
  3235. smalltalk.StringTest);
  3236. smalltalk.addMethod(
  3237. smalltalk.method({
  3238. selector: "testCapitalized",
  3239. category: 'tests',
  3240. fn: function (){
  3241. var self=this;
  3242. return smalltalk.withContext(function($ctx1) {
  3243. var $1,$2,$3;
  3244. $1="test"._capitalized();
  3245. $ctx1.sendIdx["capitalized"]=1;
  3246. self._assert_equals_($1,"Test");
  3247. $ctx1.sendIdx["assert:equals:"]=1;
  3248. $2="Test"._capitalized();
  3249. $ctx1.sendIdx["capitalized"]=2;
  3250. self._assert_equals_($2,"Test");
  3251. $ctx1.sendIdx["assert:equals:"]=2;
  3252. self._assert_equals_(""._capitalized(),"");
  3253. $ctx1.sendIdx["assert:equals:"]=3;
  3254. $3="Test"._isCapitalized();
  3255. $ctx1.sendIdx["isCapitalized"]=1;
  3256. self._assert_equals_($3,true);
  3257. $ctx1.sendIdx["assert:equals:"]=4;
  3258. self._assert_equals_("test"._isCapitalized(),false);
  3259. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3260. args: [],
  3261. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  3262. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3263. referencedClasses: []
  3264. }),
  3265. smalltalk.StringTest);
  3266. smalltalk.addMethod(
  3267. smalltalk.method({
  3268. selector: "testCharCodeAt",
  3269. category: 'tests',
  3270. fn: function (){
  3271. var self=this;
  3272. return smalltalk.withContext(function($ctx1) {
  3273. var $1,$2,$3,$4,$5;
  3274. $1="jackie"._charCodeAt_((1));
  3275. $ctx1.sendIdx["charCodeAt:"]=1;
  3276. self._assert_equals_($1,(106));
  3277. $ctx1.sendIdx["assert:equals:"]=1;
  3278. $2="jackie"._charCodeAt_((2));
  3279. $ctx1.sendIdx["charCodeAt:"]=2;
  3280. self._assert_equals_($2,(97));
  3281. $ctx1.sendIdx["assert:equals:"]=2;
  3282. $3="jackie"._charCodeAt_((3));
  3283. $ctx1.sendIdx["charCodeAt:"]=3;
  3284. self._assert_equals_($3,(99));
  3285. $ctx1.sendIdx["assert:equals:"]=3;
  3286. $4="jackie"._charCodeAt_((4));
  3287. $ctx1.sendIdx["charCodeAt:"]=4;
  3288. self._assert_equals_($4,(107));
  3289. $ctx1.sendIdx["assert:equals:"]=4;
  3290. $5="jackie"._charCodeAt_((5));
  3291. $ctx1.sendIdx["charCodeAt:"]=5;
  3292. self._assert_equals_($5,(105));
  3293. $ctx1.sendIdx["assert:equals:"]=5;
  3294. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3295. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3296. args: [],
  3297. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  3298. messageSends: ["assert:equals:", "charCodeAt:"],
  3299. referencedClasses: []
  3300. }),
  3301. smalltalk.StringTest);
  3302. smalltalk.addMethod(
  3303. smalltalk.method({
  3304. selector: "testCollect",
  3305. category: 'tests',
  3306. fn: function (){
  3307. var self=this;
  3308. var newCollection;
  3309. return smalltalk.withContext(function($ctx1) {
  3310. newCollection="hheelllloo";
  3311. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3312. return smalltalk.withContext(function($ctx2) {
  3313. return _st(each).__comma(each);
  3314. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3315. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3316. args: [],
  3317. 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",
  3318. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3319. referencedClasses: []
  3320. }),
  3321. smalltalk.StringTest);
  3322. smalltalk.addMethod(
  3323. smalltalk.method({
  3324. selector: "testCopyFromTo",
  3325. category: 'tests',
  3326. fn: function (){
  3327. var self=this;
  3328. return smalltalk.withContext(function($ctx1) {
  3329. var $1;
  3330. $1="jackie"._copyFrom_to_((1),(3));
  3331. $ctx1.sendIdx["copyFrom:to:"]=1;
  3332. self._assert_equals_($1,"jac");
  3333. $ctx1.sendIdx["assert:equals:"]=1;
  3334. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3335. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3336. args: [],
  3337. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3338. messageSends: ["assert:equals:", "copyFrom:to:"],
  3339. referencedClasses: []
  3340. }),
  3341. smalltalk.StringTest);
  3342. smalltalk.addMethod(
  3343. smalltalk.method({
  3344. selector: "testCopyWithoutAll",
  3345. category: 'tests',
  3346. fn: function (){
  3347. var self=this;
  3348. return smalltalk.withContext(function($ctx1) {
  3349. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3350. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3351. args: [],
  3352. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3353. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3354. referencedClasses: []
  3355. }),
  3356. smalltalk.StringTest);
  3357. smalltalk.addMethod(
  3358. smalltalk.method({
  3359. selector: "testDetect",
  3360. category: 'tests',
  3361. fn: function (){
  3362. var self=this;
  3363. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3364. return smalltalk.withContext(function($ctx1) {
  3365. var $2,$1;
  3366. $2=self._collection();
  3367. $ctx1.sendIdx["collection"]=1;
  3368. $1=_st($2)._detect_((function(each){
  3369. return smalltalk.withContext(function($ctx2) {
  3370. return _st(each).__eq("h");
  3371. $ctx2.sendIdx["="]=1;
  3372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3373. $ctx1.sendIdx["detect:"]=1;
  3374. self._assert_equals_($1,"h");
  3375. self._should_raise_((function(){
  3376. return smalltalk.withContext(function($ctx2) {
  3377. return _st(self._collection())._detect_((function(each){
  3378. return smalltalk.withContext(function($ctx3) {
  3379. return _st(each).__eq((6));
  3380. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3382. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3383. args: [],
  3384. 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",
  3385. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3386. referencedClasses: ["Error"]
  3387. }),
  3388. smalltalk.StringTest);
  3389. smalltalk.addMethod(
  3390. smalltalk.method({
  3391. selector: "testEquality",
  3392. category: 'tests',
  3393. fn: function (){
  3394. var self=this;
  3395. return smalltalk.withContext(function($ctx1) {
  3396. var $1,$2,$3;
  3397. self._assert_equals_("hello","hello");
  3398. $ctx1.sendIdx["assert:equals:"]=1;
  3399. $1="hello".__eq("world");
  3400. $ctx1.sendIdx["="]=1;
  3401. self._deny_($1);
  3402. $ctx1.sendIdx["deny:"]=1;
  3403. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3404. return smalltalk.withContext(function($ctx2) {
  3405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3406. $ctx1.sendIdx["="]=2;
  3407. self._deny_($2);
  3408. $ctx1.sendIdx["deny:"]=2;
  3409. $3="hello"._yourself();
  3410. $ctx1.sendIdx["yourself"]=1;
  3411. self._assert_equals_("hello",$3);
  3412. $ctx1.sendIdx["assert:equals:"]=2;
  3413. self._assert_equals_("hello"._yourself(),"hello");
  3414. self._deny_("".__eq((0)));
  3415. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3416. args: [],
  3417. 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",
  3418. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3419. referencedClasses: []
  3420. }),
  3421. smalltalk.StringTest);
  3422. smalltalk.addMethod(
  3423. smalltalk.method({
  3424. selector: "testIdentity",
  3425. category: 'tests',
  3426. fn: function (){
  3427. var self=this;
  3428. return smalltalk.withContext(function($ctx1) {
  3429. var $1,$2,$4,$3,$5;
  3430. $1="hello".__eq_eq("hello");
  3431. $ctx1.sendIdx["=="]=1;
  3432. self._assert_($1);
  3433. $ctx1.sendIdx["assert:"]=1;
  3434. $2="hello".__eq_eq("world");
  3435. $ctx1.sendIdx["=="]=2;
  3436. self._deny_($2);
  3437. $ctx1.sendIdx["deny:"]=1;
  3438. $4="hello"._yourself();
  3439. $ctx1.sendIdx["yourself"]=1;
  3440. $3="hello".__eq_eq($4);
  3441. $ctx1.sendIdx["=="]=3;
  3442. self._assert_($3);
  3443. $ctx1.sendIdx["assert:"]=2;
  3444. $5=_st("hello"._yourself()).__eq_eq("hello");
  3445. $ctx1.sendIdx["=="]=4;
  3446. self._assert_($5);
  3447. self._deny_("".__eq_eq((0)));
  3448. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3449. args: [],
  3450. 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",
  3451. messageSends: ["assert:", "==", "deny:", "yourself"],
  3452. referencedClasses: []
  3453. }),
  3454. smalltalk.StringTest);
  3455. smalltalk.addMethod(
  3456. smalltalk.method({
  3457. selector: "testIdentityHash",
  3458. category: 'tests',
  3459. fn: function (){
  3460. var self=this;
  3461. return smalltalk.withContext(function($ctx1) {
  3462. var $1,$2,$4,$3;
  3463. $1="foo"._identityHash();
  3464. $ctx1.sendIdx["identityHash"]=1;
  3465. $2="foo"._identityHash();
  3466. $ctx1.sendIdx["identityHash"]=2;
  3467. self._assert_equals_($1,$2);
  3468. $4="foo"._identityHash();
  3469. $ctx1.sendIdx["identityHash"]=3;
  3470. $3=_st($4).__eq("bar"._identityHash());
  3471. self._deny_($3);
  3472. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3473. args: [],
  3474. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3475. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3476. referencedClasses: []
  3477. }),
  3478. smalltalk.StringTest);
  3479. smalltalk.addMethod(
  3480. smalltalk.method({
  3481. selector: "testIncludesSubString",
  3482. category: 'tests',
  3483. fn: function (){
  3484. var self=this;
  3485. return smalltalk.withContext(function($ctx1) {
  3486. var $1;
  3487. $1="amber"._includesSubString_("ber");
  3488. $ctx1.sendIdx["includesSubString:"]=1;
  3489. self._assert_($1);
  3490. self._deny_("amber"._includesSubString_("zork"));
  3491. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3492. args: [],
  3493. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3494. messageSends: ["assert:", "includesSubString:", "deny:"],
  3495. referencedClasses: []
  3496. }),
  3497. smalltalk.StringTest);
  3498. smalltalk.addMethod(
  3499. smalltalk.method({
  3500. selector: "testIndexOf",
  3501. category: 'tests',
  3502. fn: function (){
  3503. var self=this;
  3504. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3505. return smalltalk.withContext(function($ctx1) {
  3506. var $2,$1,$3;
  3507. $2=self._collection();
  3508. $ctx1.sendIdx["collection"]=1;
  3509. $1=_st($2)._indexOf_("e");
  3510. $ctx1.sendIdx["indexOf:"]=1;
  3511. self._assert_equals_($1,(2));
  3512. $ctx1.sendIdx["assert:equals:"]=1;
  3513. self._should_raise_((function(){
  3514. return smalltalk.withContext(function($ctx2) {
  3515. $3=self._collection();
  3516. $ctx2.sendIdx["collection"]=2;
  3517. return _st($3)._indexOf_((999));
  3518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3519. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  3520. return smalltalk.withContext(function($ctx2) {
  3521. return "sentinel";
  3522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  3523. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3524. args: [],
  3525. 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'",
  3526. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3527. referencedClasses: ["Error"]
  3528. }),
  3529. smalltalk.StringTest);
  3530. smalltalk.addMethod(
  3531. smalltalk.method({
  3532. selector: "testIsVowel",
  3533. category: 'tests',
  3534. fn: function (){
  3535. var self=this;
  3536. var vowel,consonant;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. var $1;
  3539. vowel="u";
  3540. consonant="z";
  3541. $1=_st(vowel)._isVowel();
  3542. $ctx1.sendIdx["isVowel"]=1;
  3543. self._assert_equals_($1,true);
  3544. $ctx1.sendIdx["assert:equals:"]=1;
  3545. self._assert_equals_(_st(consonant)._isVowel(),false);
  3546. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3547. args: [],
  3548. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  3549. messageSends: ["assert:equals:", "isVowel"],
  3550. referencedClasses: []
  3551. }),
  3552. smalltalk.StringTest);
  3553. smalltalk.addMethod(
  3554. smalltalk.method({
  3555. selector: "testJoin",
  3556. category: 'tests',
  3557. fn: function (){
  3558. var self=this;
  3559. return smalltalk.withContext(function($ctx1) {
  3560. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3561. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3562. args: [],
  3563. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3564. messageSends: ["assert:equals:", "join:"],
  3565. referencedClasses: []
  3566. }),
  3567. smalltalk.StringTest);
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "testRemoveAll",
  3571. category: 'tests',
  3572. fn: function (){
  3573. var self=this;
  3574. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3575. return smalltalk.withContext(function($ctx1) {
  3576. self._should_raise_((function(){
  3577. return smalltalk.withContext(function($ctx2) {
  3578. return _st(self._collection())._removeAll();
  3579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3580. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  3581. args: [],
  3582. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  3583. messageSends: ["should:raise:", "removeAll", "collection"],
  3584. referencedClasses: ["Error"]
  3585. }),
  3586. smalltalk.StringTest);
  3587. smalltalk.addMethod(
  3588. smalltalk.method({
  3589. selector: "testReversed",
  3590. category: 'tests',
  3591. fn: function (){
  3592. var self=this;
  3593. return smalltalk.withContext(function($ctx1) {
  3594. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3595. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3596. args: [],
  3597. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3598. messageSends: ["assert:equals:", "reversed"],
  3599. referencedClasses: []
  3600. }),
  3601. smalltalk.StringTest);
  3602. smalltalk.addMethod(
  3603. smalltalk.method({
  3604. selector: "testSelect",
  3605. category: 'tests',
  3606. fn: function (){
  3607. var self=this;
  3608. var newCollection;
  3609. return smalltalk.withContext(function($ctx1) {
  3610. newCollection="o";
  3611. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3612. return smalltalk.withContext(function($ctx2) {
  3613. return _st(each).__eq("o");
  3614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3615. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3616. args: [],
  3617. 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",
  3618. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3619. referencedClasses: []
  3620. }),
  3621. smalltalk.StringTest);
  3622. smalltalk.addMethod(
  3623. smalltalk.method({
  3624. selector: "testSize",
  3625. category: 'tests',
  3626. fn: function (){
  3627. var self=this;
  3628. return smalltalk.withContext(function($ctx1) {
  3629. var $1;
  3630. $1="smalltalk"._size();
  3631. $ctx1.sendIdx["size"]=1;
  3632. self._assert_equals_($1,(9));
  3633. $ctx1.sendIdx["assert:equals:"]=1;
  3634. self._assert_equals_(""._size(),(0));
  3635. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3636. args: [],
  3637. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3638. messageSends: ["assert:equals:", "size"],
  3639. referencedClasses: []
  3640. }),
  3641. smalltalk.StringTest);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "testStreamContents",
  3645. category: 'tests',
  3646. fn: function (){
  3647. var self=this;
  3648. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3649. return smalltalk.withContext(function($ctx1) {
  3650. var $1;
  3651. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3652. return smalltalk.withContext(function($ctx2) {
  3653. _st(aStream)._nextPutAll_("hello");
  3654. $ctx2.sendIdx["nextPutAll:"]=1;
  3655. _st(aStream)._space();
  3656. $1=_st(aStream)._nextPutAll_("world");
  3657. return $1;
  3658. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3659. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3660. args: [],
  3661. 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'",
  3662. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3663. referencedClasses: ["String"]
  3664. }),
  3665. smalltalk.StringTest);
  3666. smalltalk.addMethod(
  3667. smalltalk.method({
  3668. selector: "testSubStrings",
  3669. category: 'tests',
  3670. fn: function (){
  3671. var self=this;
  3672. return smalltalk.withContext(function($ctx1) {
  3673. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3674. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3675. args: [],
  3676. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3677. messageSends: ["assert:equals:", "subStrings:"],
  3678. referencedClasses: []
  3679. }),
  3680. smalltalk.StringTest);
  3681. smalltalk.addMethod(
  3682. smalltalk.method({
  3683. selector: "testTrim",
  3684. category: 'tests',
  3685. fn: function (){
  3686. var self=this;
  3687. return smalltalk.withContext(function($ctx1) {
  3688. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3689. $ctx1.sendIdx["assert:equals:"]=1;
  3690. self._assert_equals_("jackie "._trimRight(),"jackie");
  3691. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3692. args: [],
  3693. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3694. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3695. referencedClasses: []
  3696. }),
  3697. smalltalk.StringTest);
  3698. smalltalk.addMethod(
  3699. smalltalk.method({
  3700. selector: "collectionClass",
  3701. category: 'accessing',
  3702. fn: function (){
  3703. var self=this;
  3704. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3705. return smalltalk.withContext(function($ctx1) {
  3706. return $String();
  3707. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3708. args: [],
  3709. source: "collectionClass\x0a\x09^ String",
  3710. messageSends: [],
  3711. referencedClasses: ["String"]
  3712. }),
  3713. smalltalk.StringTest.klass);
  3714. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3715. smalltalk.addMethod(
  3716. smalltalk.method({
  3717. selector: "testShow",
  3718. category: 'tests',
  3719. fn: function (){
  3720. var self=this;
  3721. var originalTranscript;
  3722. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3723. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3724. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3725. return smalltalk.withContext(function($ctx1) {
  3726. originalTranscript=_st($Transcript())._current();
  3727. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3728. $ctx1.sendIdx["register:"]=1;
  3729. self._shouldnt_raise_((function(){
  3730. return smalltalk.withContext(function($ctx2) {
  3731. return _st($Transcript())._show_("Hello console!");
  3732. $ctx2.sendIdx["show:"]=1;
  3733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3734. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3735. self._shouldnt_raise_((function(){
  3736. return smalltalk.withContext(function($ctx2) {
  3737. return _st($Transcript())._show_(console);
  3738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3739. _st($Transcript())._register_(originalTranscript);
  3740. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3741. args: [],
  3742. 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.",
  3743. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3744. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3745. }),
  3746. smalltalk.ConsoleTranscriptTest);
  3747. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3748. smalltalk.addMethod(
  3749. smalltalk.method({
  3750. selector: "jsObject",
  3751. category: 'accessing',
  3752. fn: function (){
  3753. var self=this;
  3754. return smalltalk.withContext(function($ctx1) {
  3755. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3756. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3757. args: [],
  3758. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3759. messageSends: [],
  3760. referencedClasses: []
  3761. }),
  3762. smalltalk.JSObjectProxyTest);
  3763. smalltalk.addMethod(
  3764. smalltalk.method({
  3765. selector: "testAtIfAbsent",
  3766. category: 'tests',
  3767. fn: function (){
  3768. var self=this;
  3769. var testObject;
  3770. return smalltalk.withContext(function($ctx1) {
  3771. var $1,$2,$3;
  3772. testObject=self._jsObject();
  3773. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  3774. return smalltalk.withContext(function($ctx2) {
  3775. return "Property does not exist";
  3776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3777. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3778. self._assert_equals_($1,"Property does not exist");
  3779. $ctx1.sendIdx["assert:equals:"]=1;
  3780. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  3781. return smalltalk.withContext(function($ctx2) {
  3782. return "Property does not exist";
  3783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3784. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3785. self._assert_equals_($2,nil);
  3786. $ctx1.sendIdx["assert:equals:"]=2;
  3787. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  3788. return smalltalk.withContext(function($ctx2) {
  3789. return "Property does not exist";
  3790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3791. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3792. self._assert_equals_($3,(1));
  3793. $ctx1.sendIdx["assert:equals:"]=3;
  3794. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  3795. return smalltalk.withContext(function($ctx2) {
  3796. return "Property does not exist";
  3797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  3798. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3799. args: [],
  3800. 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.",
  3801. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3802. referencedClasses: []
  3803. }),
  3804. smalltalk.JSObjectProxyTest);
  3805. smalltalk.addMethod(
  3806. smalltalk.method({
  3807. selector: "testAtIfPresent",
  3808. category: 'tests',
  3809. fn: function (){
  3810. var self=this;
  3811. var testObject;
  3812. return smalltalk.withContext(function($ctx1) {
  3813. var $2,$1,$4,$3,$6,$5;
  3814. testObject=self._jsObject();
  3815. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  3816. return smalltalk.withContext(function($ctx2) {
  3817. $2=_st(x)._asString();
  3818. $ctx2.sendIdx["asString"]=1;
  3819. return "hello ".__comma($2);
  3820. $ctx2.sendIdx[","]=1;
  3821. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3822. $ctx1.sendIdx["at:ifPresent:"]=1;
  3823. self._assert_equals_($1,nil);
  3824. $ctx1.sendIdx["assert:equals:"]=1;
  3825. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  3826. return smalltalk.withContext(function($ctx2) {
  3827. $4=_st(x)._asString();
  3828. $ctx2.sendIdx["asString"]=2;
  3829. return "hello ".__comma($4);
  3830. $ctx2.sendIdx[","]=2;
  3831. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3832. $ctx1.sendIdx["at:ifPresent:"]=2;
  3833. self._assert_equals_($3,"hello nil");
  3834. $ctx1.sendIdx["assert:equals:"]=2;
  3835. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  3836. return smalltalk.withContext(function($ctx2) {
  3837. $6=_st(x)._asString();
  3838. $ctx2.sendIdx["asString"]=3;
  3839. return "hello ".__comma($6);
  3840. $ctx2.sendIdx[","]=3;
  3841. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3842. $ctx1.sendIdx["at:ifPresent:"]=3;
  3843. self._assert_equals_($5,"hello 1");
  3844. $ctx1.sendIdx["assert:equals:"]=3;
  3845. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  3846. return smalltalk.withContext(function($ctx2) {
  3847. return "hello ".__comma(_st(x)._asString());
  3848. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  3849. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3850. args: [],
  3851. 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'.",
  3852. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3853. referencedClasses: []
  3854. }),
  3855. smalltalk.JSObjectProxyTest);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: "testAtIfPresentIfAbsent",
  3859. category: 'tests',
  3860. fn: function (){
  3861. var self=this;
  3862. var testObject;
  3863. return smalltalk.withContext(function($ctx1) {
  3864. var $2,$1,$4,$3,$6,$5;
  3865. testObject=self._jsObject();
  3866. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3867. return smalltalk.withContext(function($ctx2) {
  3868. $2=_st(x)._asString();
  3869. $ctx2.sendIdx["asString"]=1;
  3870. return "hello ".__comma($2);
  3871. $ctx2.sendIdx[","]=1;
  3872. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3873. return smalltalk.withContext(function($ctx2) {
  3874. return "not present";
  3875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3876. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3877. self._assert_equals_($1,"not present");
  3878. $ctx1.sendIdx["assert:equals:"]=1;
  3879. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3880. return smalltalk.withContext(function($ctx2) {
  3881. $4=_st(x)._asString();
  3882. $ctx2.sendIdx["asString"]=2;
  3883. return "hello ".__comma($4);
  3884. $ctx2.sendIdx[","]=2;
  3885. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3886. return smalltalk.withContext(function($ctx2) {
  3887. return "not present";
  3888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3889. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3890. self._assert_equals_($3,"hello nil");
  3891. $ctx1.sendIdx["assert:equals:"]=2;
  3892. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3893. return smalltalk.withContext(function($ctx2) {
  3894. $6=_st(x)._asString();
  3895. $ctx2.sendIdx["asString"]=3;
  3896. return "hello ".__comma($6);
  3897. $ctx2.sendIdx[","]=3;
  3898. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3899. return smalltalk.withContext(function($ctx2) {
  3900. return "not present";
  3901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3902. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3903. self._assert_equals_($5,"hello 1");
  3904. $ctx1.sendIdx["assert:equals:"]=3;
  3905. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3906. return smalltalk.withContext(function($ctx2) {
  3907. return "hello ".__comma(_st(x)._asString());
  3908. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3909. return smalltalk.withContext(function($ctx2) {
  3910. return "not present";
  3911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  3912. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3913. args: [],
  3914. 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'.",
  3915. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3916. referencedClasses: []
  3917. }),
  3918. smalltalk.JSObjectProxyTest);
  3919. smalltalk.addMethod(
  3920. smalltalk.method({
  3921. selector: "testAtPut",
  3922. category: 'tests',
  3923. fn: function (){
  3924. var self=this;
  3925. var testObject;
  3926. return smalltalk.withContext(function($ctx1) {
  3927. var $2,$1;
  3928. testObject=self._jsObject();
  3929. $2=_st(testObject)._at_("abc");
  3930. $ctx1.sendIdx["at:"]=1;
  3931. $1=_st($2).__tild_eq("xyz");
  3932. self._assert_($1);
  3933. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  3934. $ctx1.sendIdx["assert:equals:"]=1;
  3935. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  3936. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3937. args: [],
  3938. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  3939. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  3940. referencedClasses: []
  3941. }),
  3942. smalltalk.JSObjectProxyTest);
  3943. smalltalk.addMethod(
  3944. smalltalk.method({
  3945. selector: "testDNU",
  3946. category: 'tests',
  3947. fn: function (){
  3948. var self=this;
  3949. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3950. return smalltalk.withContext(function($ctx1) {
  3951. self._should_raise_((function(){
  3952. return smalltalk.withContext(function($ctx2) {
  3953. return _st(self._jsObject())._foo();
  3954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3955. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3956. args: [],
  3957. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  3958. messageSends: ["should:raise:", "foo", "jsObject"],
  3959. referencedClasses: ["MessageNotUnderstood"]
  3960. }),
  3961. smalltalk.JSObjectProxyTest);
  3962. smalltalk.addMethod(
  3963. smalltalk.method({
  3964. selector: "testMessageSend",
  3965. category: 'tests',
  3966. fn: function (){
  3967. var self=this;
  3968. return smalltalk.withContext(function($ctx1) {
  3969. var $2,$1,$4,$3;
  3970. $2=self._jsObject();
  3971. $ctx1.sendIdx["jsObject"]=1;
  3972. $1=_st($2)._a();
  3973. self._assert_equals_($1,(1));
  3974. $ctx1.sendIdx["assert:equals:"]=1;
  3975. $4=self._jsObject();
  3976. $ctx1.sendIdx["jsObject"]=2;
  3977. $3=_st($4)._b();
  3978. self._assert_equals_($3,(2));
  3979. $ctx1.sendIdx["assert:equals:"]=2;
  3980. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  3981. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3982. args: [],
  3983. 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",
  3984. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3985. referencedClasses: []
  3986. }),
  3987. smalltalk.JSObjectProxyTest);
  3988. smalltalk.addMethod(
  3989. smalltalk.method({
  3990. selector: "testMethodWithArguments",
  3991. category: 'tests',
  3992. fn: function (){
  3993. var self=this;
  3994. return smalltalk.withContext(function($ctx1) {
  3995. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3996. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3997. args: [],
  3998. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3999. messageSends: ["assert:equals:", "c:", "jsObject"],
  4000. referencedClasses: []
  4001. }),
  4002. smalltalk.JSObjectProxyTest);
  4003. smalltalk.addMethod(
  4004. smalltalk.method({
  4005. selector: "testPrinting",
  4006. category: 'tests',
  4007. fn: function (){
  4008. var self=this;
  4009. return smalltalk.withContext(function($ctx1) {
  4010. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  4011. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  4012. args: [],
  4013. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  4014. messageSends: ["assert:equals:", "printString", "jsObject"],
  4015. referencedClasses: []
  4016. }),
  4017. smalltalk.JSObjectProxyTest);
  4018. smalltalk.addMethod(
  4019. smalltalk.method({
  4020. selector: "testPropertyThatReturnsEmptyString",
  4021. category: 'tests',
  4022. fn: function (){
  4023. var self=this;
  4024. var object;
  4025. return smalltalk.withContext(function($ctx1) {
  4026. var $1;
  4027. object=self._jsObject();
  4028. $1=_st(object)._d();
  4029. $ctx1.sendIdx["d"]=1;
  4030. self._assert_equals_($1,"");
  4031. $ctx1.sendIdx["assert:equals:"]=1;
  4032. _st(object)._d_("hello");
  4033. self._assert_equals_(_st(object)._d(),"hello");
  4034. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  4035. args: [],
  4036. 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'",
  4037. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  4038. referencedClasses: []
  4039. }),
  4040. smalltalk.JSObjectProxyTest);
  4041. smalltalk.addMethod(
  4042. smalltalk.method({
  4043. selector: "testPropertyThatReturnsUndefined",
  4044. category: 'tests',
  4045. fn: function (){
  4046. var self=this;
  4047. var object;
  4048. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4049. return smalltalk.withContext(function($ctx1) {
  4050. object=self._jsObject();
  4051. self._shouldnt_raise_((function(){
  4052. return smalltalk.withContext(function($ctx2) {
  4053. return _st(object)._e();
  4054. $ctx2.sendIdx["e"]=1;
  4055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4056. self._assert_(_st(_st(object)._e())._isNil());
  4057. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  4058. args: [],
  4059. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  4060. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  4061. referencedClasses: ["MessageNotUnderstood"]
  4062. }),
  4063. smalltalk.JSObjectProxyTest);
  4064. smalltalk.addMethod(
  4065. smalltalk.method({
  4066. selector: "testValue",
  4067. category: 'tests',
  4068. fn: function (){
  4069. var self=this;
  4070. var testObject;
  4071. return smalltalk.withContext(function($ctx1) {
  4072. testObject=self._jsObject();
  4073. _st(testObject)._at_put_("value","aValue");
  4074. self._assert_equals_(_st(testObject)._value(),"aValue");
  4075. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4076. args: [],
  4077. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  4078. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  4079. referencedClasses: []
  4080. }),
  4081. smalltalk.JSObjectProxyTest);
  4082. smalltalk.addMethod(
  4083. smalltalk.method({
  4084. selector: "testYourself",
  4085. category: 'tests',
  4086. fn: function (){
  4087. var self=this;
  4088. var object;
  4089. return smalltalk.withContext(function($ctx1) {
  4090. var $1,$2;
  4091. $1=self._jsObject();
  4092. _st($1)._d_("test");
  4093. $2=_st($1)._yourself();
  4094. object=$2;
  4095. self._assert_equals_(_st(object)._d(),"test");
  4096. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4097. args: [],
  4098. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4099. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4100. referencedClasses: []
  4101. }),
  4102. smalltalk.JSObjectProxyTest);
  4103. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4104. smalltalk.addMethod(
  4105. smalltalk.method({
  4106. selector: "testCatchingException",
  4107. category: 'tests',
  4108. fn: function (){
  4109. var self=this;
  4110. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4111. return smalltalk.withContext(function($ctx1) {
  4112. _st((function(){
  4113. return smalltalk.withContext(function($ctx2) {
  4114. return self._throwException();
  4115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4116. return smalltalk.withContext(function($ctx2) {
  4117. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4118. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4119. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4120. args: [],
  4121. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4122. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4123. referencedClasses: ["Error"]
  4124. }),
  4125. smalltalk.JavaScriptExceptionTest);
  4126. smalltalk.addMethod(
  4127. smalltalk.method({
  4128. selector: "testRaisingException",
  4129. category: 'tests',
  4130. fn: function (){
  4131. var self=this;
  4132. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4133. return smalltalk.withContext(function($ctx1) {
  4134. self._should_raise_((function(){
  4135. return smalltalk.withContext(function($ctx2) {
  4136. return self._throwException();
  4137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  4138. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  4139. args: [],
  4140. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  4141. messageSends: ["should:raise:", "throwException"],
  4142. referencedClasses: ["JavaScriptException"]
  4143. }),
  4144. smalltalk.JavaScriptExceptionTest);
  4145. smalltalk.addMethod(
  4146. smalltalk.method({
  4147. selector: "throwException",
  4148. category: 'helpers',
  4149. fn: function (){
  4150. var self=this;
  4151. return smalltalk.withContext(function($ctx1) {
  4152. throw 'test';
  4153. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4154. args: [],
  4155. source: "throwException\x0a\x09<throw 'test'>",
  4156. messageSends: [],
  4157. referencedClasses: []
  4158. }),
  4159. smalltalk.JavaScriptExceptionTest);
  4160. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4161. smalltalk.addMethod(
  4162. smalltalk.method({
  4163. selector: "testValue",
  4164. category: 'tests',
  4165. fn: function (){
  4166. var self=this;
  4167. var messageSend;
  4168. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4169. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4170. return smalltalk.withContext(function($ctx1) {
  4171. var $1,$2;
  4172. $1=_st($MessageSend())._new();
  4173. $ctx1.sendIdx["new"]=1;
  4174. _st($1)._receiver_(_st($Object())._new());
  4175. _st($1)._selector_("asString");
  4176. $2=_st($1)._yourself();
  4177. messageSend=$2;
  4178. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4179. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4180. args: [],
  4181. 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'",
  4182. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4183. referencedClasses: ["MessageSend", "Object"]
  4184. }),
  4185. smalltalk.MessageSendTest);
  4186. smalltalk.addMethod(
  4187. smalltalk.method({
  4188. selector: "testValueWithArguments",
  4189. category: 'tests',
  4190. fn: function (){
  4191. var self=this;
  4192. var messageSend;
  4193. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4194. return smalltalk.withContext(function($ctx1) {
  4195. var $1,$2;
  4196. $1=_st($MessageSend())._new();
  4197. _st($1)._receiver_((2));
  4198. _st($1)._selector_("+");
  4199. $2=_st($1)._yourself();
  4200. messageSend=$2;
  4201. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4202. $ctx1.sendIdx["assert:equals:"]=1;
  4203. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4204. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4205. args: [],
  4206. 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",
  4207. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4208. referencedClasses: ["MessageSend"]
  4209. }),
  4210. smalltalk.MessageSendTest);
  4211. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4212. smalltalk.addMethod(
  4213. smalltalk.method({
  4214. selector: "codeGeneratorClass",
  4215. category: 'accessing',
  4216. fn: function (){
  4217. var self=this;
  4218. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4219. return smalltalk.withContext(function($ctx1) {
  4220. return $CodeGenerator();
  4221. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4222. args: [],
  4223. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4224. messageSends: [],
  4225. referencedClasses: ["CodeGenerator"]
  4226. }),
  4227. smalltalk.MethodInheritanceTest);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "compiler",
  4231. category: 'factory',
  4232. fn: function (){
  4233. var self=this;
  4234. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4235. return smalltalk.withContext(function($ctx1) {
  4236. var $2,$3,$1;
  4237. $2=_st($Compiler())._new();
  4238. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4239. $3=_st($2)._yourself();
  4240. $1=$3;
  4241. return $1;
  4242. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4243. args: [],
  4244. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4245. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4246. referencedClasses: ["Compiler"]
  4247. }),
  4248. smalltalk.MethodInheritanceTest);
  4249. smalltalk.addMethod(
  4250. smalltalk.method({
  4251. selector: "deinstallBottom",
  4252. category: 'testing',
  4253. fn: function (){
  4254. var self=this;
  4255. return smalltalk.withContext(function($ctx1) {
  4256. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4257. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4258. args: [],
  4259. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4260. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4261. referencedClasses: []
  4262. }),
  4263. smalltalk.MethodInheritanceTest);
  4264. smalltalk.addMethod(
  4265. smalltalk.method({
  4266. selector: "deinstallMiddle",
  4267. category: 'testing',
  4268. fn: function (){
  4269. var self=this;
  4270. return smalltalk.withContext(function($ctx1) {
  4271. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4272. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4273. args: [],
  4274. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4275. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4276. referencedClasses: []
  4277. }),
  4278. smalltalk.MethodInheritanceTest);
  4279. smalltalk.addMethod(
  4280. smalltalk.method({
  4281. selector: "deinstallTop",
  4282. category: 'testing',
  4283. fn: function (){
  4284. var self=this;
  4285. return smalltalk.withContext(function($ctx1) {
  4286. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4287. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4288. args: [],
  4289. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4290. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4291. referencedClasses: []
  4292. }),
  4293. smalltalk.MethodInheritanceTest);
  4294. smalltalk.addMethod(
  4295. smalltalk.method({
  4296. selector: "installBottom:",
  4297. category: 'testing',
  4298. fn: function (aString){
  4299. var self=this;
  4300. return smalltalk.withContext(function($ctx1) {
  4301. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  4302. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4303. args: ["aString"],
  4304. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  4305. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  4306. referencedClasses: []
  4307. }),
  4308. smalltalk.MethodInheritanceTest);
  4309. smalltalk.addMethod(
  4310. smalltalk.method({
  4311. selector: "installMiddle:",
  4312. category: 'testing',
  4313. fn: function (aString){
  4314. var self=this;
  4315. return smalltalk.withContext(function($ctx1) {
  4316. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  4317. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4318. args: ["aString"],
  4319. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  4320. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  4321. referencedClasses: []
  4322. }),
  4323. smalltalk.MethodInheritanceTest);
  4324. smalltalk.addMethod(
  4325. smalltalk.method({
  4326. selector: "installTop:",
  4327. category: 'testing',
  4328. fn: function (aString){
  4329. var self=this;
  4330. return smalltalk.withContext(function($ctx1) {
  4331. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  4332. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4333. args: ["aString"],
  4334. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  4335. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  4336. referencedClasses: []
  4337. }),
  4338. smalltalk.MethodInheritanceTest);
  4339. smalltalk.addMethod(
  4340. smalltalk.method({
  4341. selector: "setUp",
  4342. category: 'initialization',
  4343. fn: function (){
  4344. var self=this;
  4345. return smalltalk.withContext(function($ctx1) {
  4346. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4347. $ctx1.sendIdx["new"]=1;
  4348. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4349. $ctx1.sendIdx["new"]=2;
  4350. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4351. self["@method"]=nil;
  4352. self["@performBlock"]=(function(){
  4353. return smalltalk.withContext(function($ctx2) {
  4354. return self._error_("performBlock not initialized");
  4355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4356. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4357. args: [],
  4358. 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' ]",
  4359. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4360. referencedClasses: []
  4361. }),
  4362. smalltalk.MethodInheritanceTest);
  4363. smalltalk.addMethod(
  4364. smalltalk.method({
  4365. selector: "shouldMNU",
  4366. category: 'testing',
  4367. fn: function (){
  4368. var self=this;
  4369. return smalltalk.withContext(function($ctx1) {
  4370. self._shouldMNUTop();
  4371. self._shouldMNUMiddle();
  4372. self._shouldMNUBottom();
  4373. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4374. args: [],
  4375. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4376. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4377. referencedClasses: []
  4378. }),
  4379. smalltalk.MethodInheritanceTest);
  4380. smalltalk.addMethod(
  4381. smalltalk.method({
  4382. selector: "shouldMNUBottom",
  4383. category: 'testing',
  4384. fn: function (){
  4385. var self=this;
  4386. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4387. return smalltalk.withContext(function($ctx1) {
  4388. self._should_raise_((function(){
  4389. return smalltalk.withContext(function($ctx2) {
  4390. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4392. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4393. args: [],
  4394. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4395. messageSends: ["should:raise:", "value:"],
  4396. referencedClasses: ["MessageNotUnderstood"]
  4397. }),
  4398. smalltalk.MethodInheritanceTest);
  4399. smalltalk.addMethod(
  4400. smalltalk.method({
  4401. selector: "shouldMNUMiddle",
  4402. category: 'testing',
  4403. fn: function (){
  4404. var self=this;
  4405. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4406. return smalltalk.withContext(function($ctx1) {
  4407. self._should_raise_((function(){
  4408. return smalltalk.withContext(function($ctx2) {
  4409. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4411. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4412. args: [],
  4413. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4414. messageSends: ["should:raise:", "value:"],
  4415. referencedClasses: ["MessageNotUnderstood"]
  4416. }),
  4417. smalltalk.MethodInheritanceTest);
  4418. smalltalk.addMethod(
  4419. smalltalk.method({
  4420. selector: "shouldMNUTop",
  4421. category: 'testing',
  4422. fn: function (){
  4423. var self=this;
  4424. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4425. return smalltalk.withContext(function($ctx1) {
  4426. self._should_raise_((function(){
  4427. return smalltalk.withContext(function($ctx2) {
  4428. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4430. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4431. args: [],
  4432. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4433. messageSends: ["should:raise:", "value:"],
  4434. referencedClasses: ["MessageNotUnderstood"]
  4435. }),
  4436. smalltalk.MethodInheritanceTest);
  4437. smalltalk.addMethod(
  4438. smalltalk.method({
  4439. selector: "shouldReturn:",
  4440. category: 'testing',
  4441. fn: function (anObject){
  4442. var self=this;
  4443. var result;
  4444. return smalltalk.withContext(function($ctx1) {
  4445. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4446. $ctx1.sendIdx["value:"]=1;
  4447. self._assert_equals_(["top",anObject],["top",result]);
  4448. $ctx1.sendIdx["assert:equals:"]=1;
  4449. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4450. $ctx1.sendIdx["value:"]=2;
  4451. self._assert_equals_(["middle",anObject],["middle",result]);
  4452. $ctx1.sendIdx["assert:equals:"]=2;
  4453. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4454. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4455. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4456. args: ["anObject"],
  4457. 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 }",
  4458. messageSends: ["value:", "assert:equals:"],
  4459. referencedClasses: []
  4460. }),
  4461. smalltalk.MethodInheritanceTest);
  4462. smalltalk.addMethod(
  4463. smalltalk.method({
  4464. selector: "shouldReturn:and:and:",
  4465. category: 'testing',
  4466. fn: function (anObject,anObject2,anObject3){
  4467. var self=this;
  4468. var result;
  4469. return smalltalk.withContext(function($ctx1) {
  4470. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4471. $ctx1.sendIdx["value:"]=1;
  4472. self._assert_equals_(["top",anObject],["top",result]);
  4473. $ctx1.sendIdx["assert:equals:"]=1;
  4474. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4475. $ctx1.sendIdx["value:"]=2;
  4476. self._assert_equals_(["middle",anObject2],["middle",result]);
  4477. $ctx1.sendIdx["assert:equals:"]=2;
  4478. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4479. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4480. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4481. args: ["anObject", "anObject2", "anObject3"],
  4482. 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 }",
  4483. messageSends: ["value:", "assert:equals:"],
  4484. referencedClasses: []
  4485. }),
  4486. smalltalk.MethodInheritanceTest);
  4487. smalltalk.addMethod(
  4488. smalltalk.method({
  4489. selector: "targetClassBottom",
  4490. category: 'accessing',
  4491. fn: function (){
  4492. var self=this;
  4493. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4494. return smalltalk.withContext(function($ctx1) {
  4495. return $JavaScriptException();
  4496. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4497. args: [],
  4498. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4499. messageSends: [],
  4500. referencedClasses: ["JavaScriptException"]
  4501. }),
  4502. smalltalk.MethodInheritanceTest);
  4503. smalltalk.addMethod(
  4504. smalltalk.method({
  4505. selector: "targetClassMiddle",
  4506. category: 'accessing',
  4507. fn: function (){
  4508. var self=this;
  4509. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4510. return smalltalk.withContext(function($ctx1) {
  4511. return $Error();
  4512. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4513. args: [],
  4514. source: "targetClassMiddle\x0a\x09^ Error",
  4515. messageSends: [],
  4516. referencedClasses: ["Error"]
  4517. }),
  4518. smalltalk.MethodInheritanceTest);
  4519. smalltalk.addMethod(
  4520. smalltalk.method({
  4521. selector: "targetClassTop",
  4522. category: 'accessing',
  4523. fn: function (){
  4524. var self=this;
  4525. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4526. return smalltalk.withContext(function($ctx1) {
  4527. return $Object();
  4528. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4529. args: [],
  4530. source: "targetClassTop\x0a\x09^ Object",
  4531. messageSends: [],
  4532. referencedClasses: ["Object"]
  4533. }),
  4534. smalltalk.MethodInheritanceTest);
  4535. smalltalk.addMethod(
  4536. smalltalk.method({
  4537. selector: "tearDown",
  4538. category: 'initialization',
  4539. fn: function (){
  4540. var self=this;
  4541. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4542. return smalltalk.withContext(function($ctx1) {
  4543. _st((function(){
  4544. return smalltalk.withContext(function($ctx2) {
  4545. return self._deinstallTop();
  4546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4547. return smalltalk.withContext(function($ctx2) {
  4548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4549. $ctx1.sendIdx["on:do:"]=1;
  4550. _st((function(){
  4551. return smalltalk.withContext(function($ctx2) {
  4552. return self._deinstallMiddle();
  4553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4554. return smalltalk.withContext(function($ctx2) {
  4555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4556. $ctx1.sendIdx["on:do:"]=2;
  4557. _st((function(){
  4558. return smalltalk.withContext(function($ctx2) {
  4559. return self._deinstallBottom();
  4560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4561. return smalltalk.withContext(function($ctx2) {
  4562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4563. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4564. args: [],
  4565. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  4566. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4567. referencedClasses: ["Error"]
  4568. }),
  4569. smalltalk.MethodInheritanceTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testMNU11",
  4573. category: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. self["@performBlock"]=(function(x){
  4578. return smalltalk.withContext(function($ctx2) {
  4579. return _st(x)._foo();
  4580. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4581. self._shouldMNU();
  4582. $ctx1.sendIdx["shouldMNU"]=1;
  4583. self._installTop_("foo ^ false");
  4584. $ctx1.sendIdx["installTop:"]=1;
  4585. self._installTop_("foo ^ true");
  4586. self._deinstallTop();
  4587. self._shouldMNU();
  4588. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4589. args: [],
  4590. 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",
  4591. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4592. referencedClasses: []
  4593. }),
  4594. smalltalk.MethodInheritanceTest);
  4595. smalltalk.addMethod(
  4596. smalltalk.method({
  4597. selector: "testMNU22",
  4598. category: 'tests',
  4599. fn: function (){
  4600. var self=this;
  4601. return smalltalk.withContext(function($ctx1) {
  4602. self["@performBlock"]=(function(x){
  4603. return smalltalk.withContext(function($ctx2) {
  4604. return _st(x)._foo();
  4605. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4606. self._shouldMNU();
  4607. $ctx1.sendIdx["shouldMNU"]=1;
  4608. self._installMiddle_("foo ^ false");
  4609. $ctx1.sendIdx["installMiddle:"]=1;
  4610. self._installMiddle_("foo ^ true");
  4611. self._deinstallMiddle();
  4612. self._shouldMNU();
  4613. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4614. args: [],
  4615. 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",
  4616. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4617. referencedClasses: []
  4618. }),
  4619. smalltalk.MethodInheritanceTest);
  4620. smalltalk.addMethod(
  4621. smalltalk.method({
  4622. selector: "testReturns1",
  4623. category: 'tests',
  4624. fn: function (){
  4625. var self=this;
  4626. return smalltalk.withContext(function($ctx1) {
  4627. self["@performBlock"]=(function(x){
  4628. return smalltalk.withContext(function($ctx2) {
  4629. return _st(x)._foo();
  4630. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4631. self._installTop_("foo ^ false");
  4632. $ctx1.sendIdx["installTop:"]=1;
  4633. self._shouldReturn_(false);
  4634. $ctx1.sendIdx["shouldReturn:"]=1;
  4635. self._installTop_("foo ^ true");
  4636. self._shouldReturn_(true);
  4637. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4638. args: [],
  4639. 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",
  4640. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4641. referencedClasses: []
  4642. }),
  4643. smalltalk.MethodInheritanceTest);
  4644. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4645. smalltalk.addMethod(
  4646. smalltalk.method({
  4647. selector: "testAbs",
  4648. category: 'tests',
  4649. fn: function (){
  4650. var self=this;
  4651. return smalltalk.withContext(function($ctx1) {
  4652. var $1;
  4653. $1=(4)._abs();
  4654. $ctx1.sendIdx["abs"]=1;
  4655. self._assert_equals_($1,(4));
  4656. $ctx1.sendIdx["assert:equals:"]=1;
  4657. self._assert_equals_((-4)._abs(),(4));
  4658. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4659. args: [],
  4660. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4661. messageSends: ["assert:equals:", "abs"],
  4662. referencedClasses: []
  4663. }),
  4664. smalltalk.NumberTest);
  4665. smalltalk.addMethod(
  4666. smalltalk.method({
  4667. selector: "testArithmetic",
  4668. category: 'tests',
  4669. fn: function (){
  4670. var self=this;
  4671. return smalltalk.withContext(function($ctx1) {
  4672. var $1,$2,$3,$5,$4;
  4673. $1=(1.5).__plus((1));
  4674. $ctx1.sendIdx["+"]=1;
  4675. self._assert_equals_($1,(2.5));
  4676. $ctx1.sendIdx["assert:equals:"]=1;
  4677. $2=(2).__minus((1));
  4678. $ctx1.sendIdx["-"]=1;
  4679. self._assert_equals_($2,(1));
  4680. $ctx1.sendIdx["assert:equals:"]=2;
  4681. self._assert_equals_((-2).__minus((1)),(-3));
  4682. $ctx1.sendIdx["assert:equals:"]=3;
  4683. self._assert_equals_((12).__slash((2)),(6));
  4684. $ctx1.sendIdx["assert:equals:"]=4;
  4685. $3=(3).__star((4));
  4686. $ctx1.sendIdx["*"]=1;
  4687. self._assert_equals_($3,(12));
  4688. $ctx1.sendIdx["assert:equals:"]=5;
  4689. self._assert_equals_((7).__slash_slash((2)),(3));
  4690. $ctx1.sendIdx["assert:equals:"]=6;
  4691. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4692. $ctx1.sendIdx["assert:equals:"]=7;
  4693. $5=(1).__plus((2));
  4694. $ctx1.sendIdx["+"]=2;
  4695. $4=_st($5).__star((3));
  4696. $ctx1.sendIdx["*"]=2;
  4697. self._assert_equals_($4,(9));
  4698. $ctx1.sendIdx["assert:equals:"]=8;
  4699. self._assert_equals_((1).__plus((2).__star((3))),(7));
  4700. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4701. args: [],
  4702. 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\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\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",
  4703. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4704. referencedClasses: []
  4705. }),
  4706. smalltalk.NumberTest);
  4707. smalltalk.addMethod(
  4708. smalltalk.method({
  4709. selector: "testAsNumber",
  4710. category: 'tests',
  4711. fn: function (){
  4712. var self=this;
  4713. return smalltalk.withContext(function($ctx1) {
  4714. self._assert_equals_((3)._asNumber(),(3));
  4715. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4716. args: [],
  4717. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4718. messageSends: ["assert:equals:", "asNumber"],
  4719. referencedClasses: []
  4720. }),
  4721. smalltalk.NumberTest);
  4722. smalltalk.addMethod(
  4723. smalltalk.method({
  4724. selector: "testCeiling",
  4725. category: 'tests',
  4726. fn: function (){
  4727. var self=this;
  4728. return smalltalk.withContext(function($ctx1) {
  4729. var $1,$2;
  4730. $1=(1.2)._ceiling();
  4731. $ctx1.sendIdx["ceiling"]=1;
  4732. self._assert_equals_($1,(2));
  4733. $ctx1.sendIdx["assert:equals:"]=1;
  4734. $2=(-1.2)._ceiling();
  4735. $ctx1.sendIdx["ceiling"]=2;
  4736. self._assert_equals_($2,(-1));
  4737. $ctx1.sendIdx["assert:equals:"]=2;
  4738. self._assert_equals_((1)._ceiling(),(1));
  4739. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4740. args: [],
  4741. 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.",
  4742. messageSends: ["assert:equals:", "ceiling"],
  4743. referencedClasses: []
  4744. }),
  4745. smalltalk.NumberTest);
  4746. smalltalk.addMethod(
  4747. smalltalk.method({
  4748. selector: "testComparison",
  4749. category: 'tests',
  4750. fn: function (){
  4751. var self=this;
  4752. return smalltalk.withContext(function($ctx1) {
  4753. var $1,$2,$3,$4;
  4754. $1=(3).__gt((2));
  4755. $ctx1.sendIdx[">"]=1;
  4756. self._assert_($1);
  4757. $ctx1.sendIdx["assert:"]=1;
  4758. $2=(2).__lt((3));
  4759. $ctx1.sendIdx["<"]=1;
  4760. self._assert_($2);
  4761. $ctx1.sendIdx["assert:"]=2;
  4762. self._deny_((3).__lt((2)));
  4763. $ctx1.sendIdx["deny:"]=1;
  4764. self._deny_((2).__gt((3)));
  4765. $3=(3).__gt_eq((3));
  4766. $ctx1.sendIdx[">="]=1;
  4767. self._assert_($3);
  4768. $ctx1.sendIdx["assert:"]=3;
  4769. self._assert_((3.1).__gt_eq((3)));
  4770. $ctx1.sendIdx["assert:"]=4;
  4771. $4=(3).__lt_eq((3));
  4772. $ctx1.sendIdx["<="]=1;
  4773. self._assert_($4);
  4774. $ctx1.sendIdx["assert:"]=5;
  4775. self._assert_((3).__lt_eq((3.1)));
  4776. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4777. args: [],
  4778. 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",
  4779. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4780. referencedClasses: []
  4781. }),
  4782. smalltalk.NumberTest);
  4783. smalltalk.addMethod(
  4784. smalltalk.method({
  4785. selector: "testCopying",
  4786. category: 'tests',
  4787. fn: function (){
  4788. var self=this;
  4789. return smalltalk.withContext(function($ctx1) {
  4790. var $1;
  4791. $1=_st((1)._copy()).__eq_eq((1));
  4792. $ctx1.sendIdx["=="]=1;
  4793. self._assert_($1);
  4794. $ctx1.sendIdx["assert:"]=1;
  4795. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4797. args: [],
  4798. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4799. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4800. referencedClasses: []
  4801. }),
  4802. smalltalk.NumberTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testEquality",
  4806. category: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  4811. $1=(1).__eq((1));
  4812. $ctx1.sendIdx["="]=1;
  4813. self._assert_($1);
  4814. $ctx1.sendIdx["assert:"]=1;
  4815. $2=(0).__eq((0));
  4816. $ctx1.sendIdx["="]=2;
  4817. self._assert_($2);
  4818. $ctx1.sendIdx["assert:"]=2;
  4819. $3=(1).__eq((0));
  4820. $ctx1.sendIdx["="]=3;
  4821. self._deny_($3);
  4822. $ctx1.sendIdx["deny:"]=1;
  4823. $5=(1)._yourself();
  4824. $ctx1.sendIdx["yourself"]=1;
  4825. $4=_st($5).__eq((1));
  4826. $ctx1.sendIdx["="]=4;
  4827. self._assert_($4);
  4828. $ctx1.sendIdx["assert:"]=3;
  4829. $7=(1)._yourself();
  4830. $ctx1.sendIdx["yourself"]=2;
  4831. $6=(1).__eq($7);
  4832. $ctx1.sendIdx["="]=5;
  4833. self._assert_($6);
  4834. $ctx1.sendIdx["assert:"]=4;
  4835. $9=(1)._yourself();
  4836. $ctx1.sendIdx["yourself"]=3;
  4837. $8=_st($9).__eq((1)._yourself());
  4838. $ctx1.sendIdx["="]=6;
  4839. self._assert_($8);
  4840. $10=(0).__eq(false);
  4841. $ctx1.sendIdx["="]=7;
  4842. self._deny_($10);
  4843. $ctx1.sendIdx["deny:"]=2;
  4844. $11=false.__eq((0));
  4845. $ctx1.sendIdx["="]=8;
  4846. self._deny_($11);
  4847. $ctx1.sendIdx["deny:"]=3;
  4848. $12="".__eq((0));
  4849. $ctx1.sendIdx["="]=9;
  4850. self._deny_($12);
  4851. $ctx1.sendIdx["deny:"]=4;
  4852. self._deny_((0).__eq(""));
  4853. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4854. args: [],
  4855. 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 = ''",
  4856. messageSends: ["assert:", "=", "deny:", "yourself"],
  4857. referencedClasses: []
  4858. }),
  4859. smalltalk.NumberTest);
  4860. smalltalk.addMethod(
  4861. smalltalk.method({
  4862. selector: "testFloor",
  4863. category: 'tests',
  4864. fn: function (){
  4865. var self=this;
  4866. return smalltalk.withContext(function($ctx1) {
  4867. var $1,$2;
  4868. $1=(1.2)._floor();
  4869. $ctx1.sendIdx["floor"]=1;
  4870. self._assert_equals_($1,(1));
  4871. $ctx1.sendIdx["assert:equals:"]=1;
  4872. $2=(-1.2)._floor();
  4873. $ctx1.sendIdx["floor"]=2;
  4874. self._assert_equals_($2,(-2));
  4875. $ctx1.sendIdx["assert:equals:"]=2;
  4876. self._assert_equals_((1)._floor(),(1));
  4877. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4878. args: [],
  4879. 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.",
  4880. messageSends: ["assert:equals:", "floor"],
  4881. referencedClasses: []
  4882. }),
  4883. smalltalk.NumberTest);
  4884. smalltalk.addMethod(
  4885. smalltalk.method({
  4886. selector: "testHexNumbers",
  4887. category: 'tests',
  4888. fn: function (){
  4889. var self=this;
  4890. return smalltalk.withContext(function($ctx1) {
  4891. var $1,$2,$3,$4,$5;
  4892. self._assert_equals_((9),(9));
  4893. $ctx1.sendIdx["assert:equals:"]=1;
  4894. $1=(10)._truncated();
  4895. $ctx1.sendIdx["truncated"]=1;
  4896. self._assert_equals_($1,(10));
  4897. $ctx1.sendIdx["assert:equals:"]=2;
  4898. $2=(11)._truncated();
  4899. $ctx1.sendIdx["truncated"]=2;
  4900. self._assert_equals_($2,(11));
  4901. $ctx1.sendIdx["assert:equals:"]=3;
  4902. $3=(12)._truncated();
  4903. $ctx1.sendIdx["truncated"]=3;
  4904. self._assert_equals_($3,(12));
  4905. $ctx1.sendIdx["assert:equals:"]=4;
  4906. $4=(13)._truncated();
  4907. $ctx1.sendIdx["truncated"]=4;
  4908. self._assert_equals_($4,(13));
  4909. $ctx1.sendIdx["assert:equals:"]=5;
  4910. $5=(14)._truncated();
  4911. $ctx1.sendIdx["truncated"]=5;
  4912. self._assert_equals_($5,(14));
  4913. $ctx1.sendIdx["assert:equals:"]=6;
  4914. self._assert_equals_((15)._truncated(),(15));
  4915. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4916. args: [],
  4917. 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",
  4918. messageSends: ["assert:equals:", "truncated"],
  4919. referencedClasses: []
  4920. }),
  4921. smalltalk.NumberTest);
  4922. smalltalk.addMethod(
  4923. smalltalk.method({
  4924. selector: "testIdentity",
  4925. category: 'tests',
  4926. fn: function (){
  4927. var self=this;
  4928. return smalltalk.withContext(function($ctx1) {
  4929. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  4930. $1=(1).__eq_eq((1));
  4931. $ctx1.sendIdx["=="]=1;
  4932. self._assert_($1);
  4933. $ctx1.sendIdx["assert:"]=1;
  4934. $2=(0).__eq_eq((0));
  4935. $ctx1.sendIdx["=="]=2;
  4936. self._assert_($2);
  4937. $ctx1.sendIdx["assert:"]=2;
  4938. $3=(1).__eq_eq((0));
  4939. $ctx1.sendIdx["=="]=3;
  4940. self._deny_($3);
  4941. $ctx1.sendIdx["deny:"]=1;
  4942. $5=(1)._yourself();
  4943. $ctx1.sendIdx["yourself"]=1;
  4944. $4=_st($5).__eq_eq((1));
  4945. $ctx1.sendIdx["=="]=4;
  4946. self._assert_($4);
  4947. $ctx1.sendIdx["assert:"]=3;
  4948. $7=(1)._yourself();
  4949. $ctx1.sendIdx["yourself"]=2;
  4950. $6=(1).__eq_eq($7);
  4951. $ctx1.sendIdx["=="]=5;
  4952. self._assert_($6);
  4953. $ctx1.sendIdx["assert:"]=4;
  4954. $9=(1)._yourself();
  4955. $ctx1.sendIdx["yourself"]=3;
  4956. $8=_st($9).__eq_eq((1)._yourself());
  4957. $ctx1.sendIdx["=="]=6;
  4958. self._assert_($8);
  4959. self._deny_((1).__eq_eq((2)));
  4960. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4961. args: [],
  4962. 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",
  4963. messageSends: ["assert:", "==", "deny:", "yourself"],
  4964. referencedClasses: []
  4965. }),
  4966. smalltalk.NumberTest);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "testInvalidHexNumbers",
  4970. category: 'tests',
  4971. fn: function (){
  4972. var self=this;
  4973. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4974. return smalltalk.withContext(function($ctx1) {
  4975. self._should_raise_((function(){
  4976. return smalltalk.withContext(function($ctx2) {
  4977. return (16)._rG();
  4978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4979. $ctx1.sendIdx["should:raise:"]=1;
  4980. self._should_raise_((function(){
  4981. return smalltalk.withContext(function($ctx2) {
  4982. return (16)._rg();
  4983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4984. $ctx1.sendIdx["should:raise:"]=2;
  4985. self._should_raise_((function(){
  4986. return smalltalk.withContext(function($ctx2) {
  4987. return (16)._rH();
  4988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4989. $ctx1.sendIdx["should:raise:"]=3;
  4990. self._should_raise_((function(){
  4991. return smalltalk.withContext(function($ctx2) {
  4992. return (16)._rh();
  4993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4994. $ctx1.sendIdx["should:raise:"]=4;
  4995. self._should_raise_((function(){
  4996. return smalltalk.withContext(function($ctx2) {
  4997. return (16)._rI();
  4998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4999. $ctx1.sendIdx["should:raise:"]=5;
  5000. self._should_raise_((function(){
  5001. return smalltalk.withContext(function($ctx2) {
  5002. return (16)._ri();
  5003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  5004. $ctx1.sendIdx["should:raise:"]=6;
  5005. self._should_raise_((function(){
  5006. return smalltalk.withContext(function($ctx2) {
  5007. return (16)._rJ();
  5008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  5009. $ctx1.sendIdx["should:raise:"]=7;
  5010. self._should_raise_((function(){
  5011. return smalltalk.withContext(function($ctx2) {
  5012. return (16)._rj();
  5013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  5014. $ctx1.sendIdx["should:raise:"]=8;
  5015. self._should_raise_((function(){
  5016. return smalltalk.withContext(function($ctx2) {
  5017. return (16)._rK();
  5018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  5019. $ctx1.sendIdx["should:raise:"]=9;
  5020. self._should_raise_((function(){
  5021. return smalltalk.withContext(function($ctx2) {
  5022. return (16)._rk();
  5023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  5024. $ctx1.sendIdx["should:raise:"]=10;
  5025. self._should_raise_((function(){
  5026. return smalltalk.withContext(function($ctx2) {
  5027. return (16)._rL();
  5028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  5029. $ctx1.sendIdx["should:raise:"]=11;
  5030. self._should_raise_((function(){
  5031. return smalltalk.withContext(function($ctx2) {
  5032. return (16)._rl();
  5033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  5034. $ctx1.sendIdx["should:raise:"]=12;
  5035. self._should_raise_((function(){
  5036. return smalltalk.withContext(function($ctx2) {
  5037. return (16)._rM();
  5038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  5039. $ctx1.sendIdx["should:raise:"]=13;
  5040. self._should_raise_((function(){
  5041. return smalltalk.withContext(function($ctx2) {
  5042. return (16)._rm();
  5043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  5044. $ctx1.sendIdx["should:raise:"]=14;
  5045. self._should_raise_((function(){
  5046. return smalltalk.withContext(function($ctx2) {
  5047. return (16)._rN();
  5048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  5049. $ctx1.sendIdx["should:raise:"]=15;
  5050. self._should_raise_((function(){
  5051. return smalltalk.withContext(function($ctx2) {
  5052. return (16)._rn();
  5053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  5054. $ctx1.sendIdx["should:raise:"]=16;
  5055. self._should_raise_((function(){
  5056. return smalltalk.withContext(function($ctx2) {
  5057. return (16)._rO();
  5058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  5059. $ctx1.sendIdx["should:raise:"]=17;
  5060. self._should_raise_((function(){
  5061. return smalltalk.withContext(function($ctx2) {
  5062. return (16)._ro();
  5063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  5064. $ctx1.sendIdx["should:raise:"]=18;
  5065. self._should_raise_((function(){
  5066. return smalltalk.withContext(function($ctx2) {
  5067. return (16)._rP();
  5068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5069. $ctx1.sendIdx["should:raise:"]=19;
  5070. self._should_raise_((function(){
  5071. return smalltalk.withContext(function($ctx2) {
  5072. return (16)._rp();
  5073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5074. $ctx1.sendIdx["should:raise:"]=20;
  5075. self._should_raise_((function(){
  5076. return smalltalk.withContext(function($ctx2) {
  5077. return (16)._rQ();
  5078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5079. $ctx1.sendIdx["should:raise:"]=21;
  5080. self._should_raise_((function(){
  5081. return smalltalk.withContext(function($ctx2) {
  5082. return (16)._rq();
  5083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5084. $ctx1.sendIdx["should:raise:"]=22;
  5085. self._should_raise_((function(){
  5086. return smalltalk.withContext(function($ctx2) {
  5087. return (16)._rR();
  5088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5089. $ctx1.sendIdx["should:raise:"]=23;
  5090. self._should_raise_((function(){
  5091. return smalltalk.withContext(function($ctx2) {
  5092. return (16)._rr();
  5093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5094. $ctx1.sendIdx["should:raise:"]=24;
  5095. self._should_raise_((function(){
  5096. return smalltalk.withContext(function($ctx2) {
  5097. return (16)._rS();
  5098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5099. $ctx1.sendIdx["should:raise:"]=25;
  5100. self._should_raise_((function(){
  5101. return smalltalk.withContext(function($ctx2) {
  5102. return (16)._rs();
  5103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5104. $ctx1.sendIdx["should:raise:"]=26;
  5105. self._should_raise_((function(){
  5106. return smalltalk.withContext(function($ctx2) {
  5107. return (16)._rT();
  5108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5109. $ctx1.sendIdx["should:raise:"]=27;
  5110. self._should_raise_((function(){
  5111. return smalltalk.withContext(function($ctx2) {
  5112. return (16)._rt();
  5113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5114. $ctx1.sendIdx["should:raise:"]=28;
  5115. self._should_raise_((function(){
  5116. return smalltalk.withContext(function($ctx2) {
  5117. return (16)._rU();
  5118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5119. $ctx1.sendIdx["should:raise:"]=29;
  5120. self._should_raise_((function(){
  5121. return smalltalk.withContext(function($ctx2) {
  5122. return (16)._ru();
  5123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5124. $ctx1.sendIdx["should:raise:"]=30;
  5125. self._should_raise_((function(){
  5126. return smalltalk.withContext(function($ctx2) {
  5127. return (16)._rV();
  5128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5129. $ctx1.sendIdx["should:raise:"]=31;
  5130. self._should_raise_((function(){
  5131. return smalltalk.withContext(function($ctx2) {
  5132. return (16)._rv();
  5133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5134. $ctx1.sendIdx["should:raise:"]=32;
  5135. self._should_raise_((function(){
  5136. return smalltalk.withContext(function($ctx2) {
  5137. return (16)._rW();
  5138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5139. $ctx1.sendIdx["should:raise:"]=33;
  5140. self._should_raise_((function(){
  5141. return smalltalk.withContext(function($ctx2) {
  5142. return (16)._rw();
  5143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5144. $ctx1.sendIdx["should:raise:"]=34;
  5145. self._should_raise_((function(){
  5146. return smalltalk.withContext(function($ctx2) {
  5147. return (16)._rX();
  5148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5149. $ctx1.sendIdx["should:raise:"]=35;
  5150. self._should_raise_((function(){
  5151. return smalltalk.withContext(function($ctx2) {
  5152. return (16)._rx();
  5153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5154. $ctx1.sendIdx["should:raise:"]=36;
  5155. self._should_raise_((function(){
  5156. return smalltalk.withContext(function($ctx2) {
  5157. return (16)._rY();
  5158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5159. $ctx1.sendIdx["should:raise:"]=37;
  5160. self._should_raise_((function(){
  5161. return smalltalk.withContext(function($ctx2) {
  5162. return (16)._ry();
  5163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5164. $ctx1.sendIdx["should:raise:"]=38;
  5165. self._should_raise_((function(){
  5166. return smalltalk.withContext(function($ctx2) {
  5167. return (16)._rZ();
  5168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5169. $ctx1.sendIdx["should:raise:"]=39;
  5170. self._should_raise_((function(){
  5171. return smalltalk.withContext(function($ctx2) {
  5172. return (16)._rz();
  5173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5174. $ctx1.sendIdx["should:raise:"]=40;
  5175. self._should_raise_((function(){
  5176. return smalltalk.withContext(function($ctx2) {
  5177. return (11259375)._Z();
  5178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5179. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5180. args: [],
  5181. 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.",
  5182. 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"],
  5183. referencedClasses: ["MessageNotUnderstood"]
  5184. }),
  5185. smalltalk.NumberTest);
  5186. smalltalk.addMethod(
  5187. smalltalk.method({
  5188. selector: "testLog",
  5189. category: 'tests',
  5190. fn: function (){
  5191. var self=this;
  5192. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5193. return smalltalk.withContext(function($ctx1) {
  5194. self._assert_equals_((10000)._log(),(4));
  5195. $ctx1.sendIdx["assert:equals:"]=1;
  5196. self._assert_equals_((512)._log_((2)),(9));
  5197. $ctx1.sendIdx["assert:equals:"]=2;
  5198. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5199. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5200. args: [],
  5201. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  5202. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5203. referencedClasses: ["Number"]
  5204. }),
  5205. smalltalk.NumberTest);
  5206. smalltalk.addMethod(
  5207. smalltalk.method({
  5208. selector: "testMinMax",
  5209. category: 'tests',
  5210. fn: function (){
  5211. var self=this;
  5212. return smalltalk.withContext(function($ctx1) {
  5213. self._assert_equals_((2)._max_((5)),(5));
  5214. $ctx1.sendIdx["assert:equals:"]=1;
  5215. self._assert_equals_((2)._min_((5)),(2));
  5216. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5217. args: [],
  5218. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5219. messageSends: ["assert:equals:", "max:", "min:"],
  5220. referencedClasses: []
  5221. }),
  5222. smalltalk.NumberTest);
  5223. smalltalk.addMethod(
  5224. smalltalk.method({
  5225. selector: "testNegated",
  5226. category: 'tests',
  5227. fn: function (){
  5228. var self=this;
  5229. return smalltalk.withContext(function($ctx1) {
  5230. var $1;
  5231. $1=(3)._negated();
  5232. $ctx1.sendIdx["negated"]=1;
  5233. self._assert_equals_($1,(-3));
  5234. $ctx1.sendIdx["assert:equals:"]=1;
  5235. self._assert_equals_((-3)._negated(),(3));
  5236. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5237. args: [],
  5238. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5239. messageSends: ["assert:equals:", "negated"],
  5240. referencedClasses: []
  5241. }),
  5242. smalltalk.NumberTest);
  5243. smalltalk.addMethod(
  5244. smalltalk.method({
  5245. selector: "testPrintShowingDecimalPlaces",
  5246. category: 'tests',
  5247. fn: function (){
  5248. var self=this;
  5249. return smalltalk.withContext(function($ctx1) {
  5250. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  5251. $1=(23)._printShowingDecimalPlaces_((2));
  5252. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5253. self._assert_equals_($1,"23.00");
  5254. $ctx1.sendIdx["assert:equals:"]=1;
  5255. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5256. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5257. self._assert_equals_($2,"23.57");
  5258. $ctx1.sendIdx["assert:equals:"]=2;
  5259. $4=(234.567)._negated();
  5260. $ctx1.sendIdx["negated"]=1;
  5261. $3=_st($4)._printShowingDecimalPlaces_((5));
  5262. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5263. self._assert_equals_($3,"-234.56700");
  5264. $ctx1.sendIdx["assert:equals:"]=3;
  5265. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5266. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5267. self._assert_equals_($5,"23");
  5268. $ctx1.sendIdx["assert:equals:"]=4;
  5269. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5270. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5271. self._assert_equals_($6,"24");
  5272. $ctx1.sendIdx["assert:equals:"]=5;
  5273. $8=(23.4567)._negated();
  5274. $ctx1.sendIdx["negated"]=2;
  5275. $7=_st($8)._printShowingDecimalPlaces_((0));
  5276. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5277. self._assert_equals_($7,"-23");
  5278. $ctx1.sendIdx["assert:equals:"]=6;
  5279. $10=(23.5567)._negated();
  5280. $ctx1.sendIdx["negated"]=3;
  5281. $9=_st($10)._printShowingDecimalPlaces_((0));
  5282. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5283. self._assert_equals_($9,"-24");
  5284. $ctx1.sendIdx["assert:equals:"]=7;
  5285. $11=(100000000)._printShowingDecimalPlaces_((1));
  5286. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5287. self._assert_equals_($11,"100000000.0");
  5288. $ctx1.sendIdx["assert:equals:"]=8;
  5289. $12=(0.98)._printShowingDecimalPlaces_((5));
  5290. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5291. self._assert_equals_($12,"0.98000");
  5292. $ctx1.sendIdx["assert:equals:"]=9;
  5293. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5294. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5295. self._assert_equals_($13,"-0.98");
  5296. $ctx1.sendIdx["assert:equals:"]=10;
  5297. $14=(2.567)._printShowingDecimalPlaces_((2));
  5298. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5299. self._assert_equals_($14,"2.57");
  5300. $ctx1.sendIdx["assert:equals:"]=11;
  5301. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5302. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5303. self._assert_equals_($15,"-2.57");
  5304. $ctx1.sendIdx["assert:equals:"]=12;
  5305. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5306. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5307. args: [],
  5308. 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'.",
  5309. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5310. referencedClasses: []
  5311. }),
  5312. smalltalk.NumberTest);
  5313. smalltalk.addMethod(
  5314. smalltalk.method({
  5315. selector: "testRaisedTo",
  5316. category: 'tests',
  5317. fn: function (){
  5318. var self=this;
  5319. return smalltalk.withContext(function($ctx1) {
  5320. var $1,$2,$3;
  5321. $1=(2)._raisedTo_((4));
  5322. $ctx1.sendIdx["raisedTo:"]=1;
  5323. self._assert_equals_($1,(16));
  5324. $ctx1.sendIdx["assert:equals:"]=1;
  5325. $2=(2)._raisedTo_((0));
  5326. $ctx1.sendIdx["raisedTo:"]=2;
  5327. self._assert_equals_($2,(1));
  5328. $ctx1.sendIdx["assert:equals:"]=2;
  5329. $3=(2)._raisedTo_((-3));
  5330. $ctx1.sendIdx["raisedTo:"]=3;
  5331. self._assert_equals_($3,(0.125));
  5332. $ctx1.sendIdx["assert:equals:"]=3;
  5333. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5334. $ctx1.sendIdx["assert:equals:"]=4;
  5335. self._assert_equals_((2).__star_star((4)),(16));
  5336. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5337. args: [],
  5338. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  5339. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5340. referencedClasses: []
  5341. }),
  5342. smalltalk.NumberTest);
  5343. smalltalk.addMethod(
  5344. smalltalk.method({
  5345. selector: "testRounded",
  5346. category: 'tests',
  5347. fn: function (){
  5348. var self=this;
  5349. return smalltalk.withContext(function($ctx1) {
  5350. var $1,$2;
  5351. $1=(3)._rounded();
  5352. $ctx1.sendIdx["rounded"]=1;
  5353. self._assert_equals_($1,(3));
  5354. $ctx1.sendIdx["assert:equals:"]=1;
  5355. $2=(3.212)._rounded();
  5356. $ctx1.sendIdx["rounded"]=2;
  5357. self._assert_equals_($2,(3));
  5358. $ctx1.sendIdx["assert:equals:"]=2;
  5359. self._assert_equals_((3.51)._rounded(),(4));
  5360. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5361. args: [],
  5362. 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",
  5363. messageSends: ["assert:equals:", "rounded"],
  5364. referencedClasses: []
  5365. }),
  5366. smalltalk.NumberTest);
  5367. smalltalk.addMethod(
  5368. smalltalk.method({
  5369. selector: "testSign",
  5370. category: 'tests',
  5371. fn: function (){
  5372. var self=this;
  5373. return smalltalk.withContext(function($ctx1) {
  5374. var $1,$2;
  5375. $1=(5)._sign();
  5376. $ctx1.sendIdx["sign"]=1;
  5377. self._assert_equals_($1,(1));
  5378. $ctx1.sendIdx["assert:equals:"]=1;
  5379. $2=(0)._sign();
  5380. $ctx1.sendIdx["sign"]=2;
  5381. self._assert_equals_($2,(0));
  5382. $ctx1.sendIdx["assert:equals:"]=2;
  5383. self._assert_equals_((-1.4)._sign(),(-1));
  5384. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5385. args: [],
  5386. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5387. messageSends: ["assert:equals:", "sign"],
  5388. referencedClasses: []
  5389. }),
  5390. smalltalk.NumberTest);
  5391. smalltalk.addMethod(
  5392. smalltalk.method({
  5393. selector: "testSqrt",
  5394. category: 'tests',
  5395. fn: function (){
  5396. var self=this;
  5397. return smalltalk.withContext(function($ctx1) {
  5398. var $1;
  5399. $1=(4)._sqrt();
  5400. $ctx1.sendIdx["sqrt"]=1;
  5401. self._assert_equals_($1,(2));
  5402. $ctx1.sendIdx["assert:equals:"]=1;
  5403. self._assert_equals_((16)._sqrt(),(4));
  5404. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5405. args: [],
  5406. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5407. messageSends: ["assert:equals:", "sqrt"],
  5408. referencedClasses: []
  5409. }),
  5410. smalltalk.NumberTest);
  5411. smalltalk.addMethod(
  5412. smalltalk.method({
  5413. selector: "testSquared",
  5414. category: 'tests',
  5415. fn: function (){
  5416. var self=this;
  5417. return smalltalk.withContext(function($ctx1) {
  5418. self._assert_equals_((4)._squared(),(16));
  5419. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5420. args: [],
  5421. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5422. messageSends: ["assert:equals:", "squared"],
  5423. referencedClasses: []
  5424. }),
  5425. smalltalk.NumberTest);
  5426. smalltalk.addMethod(
  5427. smalltalk.method({
  5428. selector: "testTimesRepeat",
  5429. category: 'tests',
  5430. fn: function (){
  5431. var self=this;
  5432. var i;
  5433. return smalltalk.withContext(function($ctx1) {
  5434. i=(0);
  5435. (0)._timesRepeat_((function(){
  5436. return smalltalk.withContext(function($ctx2) {
  5437. i=_st(i).__plus((1));
  5438. $ctx2.sendIdx["+"]=1;
  5439. return i;
  5440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5441. $ctx1.sendIdx["timesRepeat:"]=1;
  5442. self._assert_equals_(i,(0));
  5443. $ctx1.sendIdx["assert:equals:"]=1;
  5444. (5)._timesRepeat_((function(){
  5445. return smalltalk.withContext(function($ctx2) {
  5446. i=_st(i).__plus((1));
  5447. return i;
  5448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5449. self._assert_equals_(i,(5));
  5450. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5451. args: [],
  5452. 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",
  5453. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5454. referencedClasses: []
  5455. }),
  5456. smalltalk.NumberTest);
  5457. smalltalk.addMethod(
  5458. smalltalk.method({
  5459. selector: "testTo",
  5460. category: 'tests',
  5461. fn: function (){
  5462. var self=this;
  5463. return smalltalk.withContext(function($ctx1) {
  5464. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5465. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5466. args: [],
  5467. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5468. messageSends: ["assert:equals:", "to:"],
  5469. referencedClasses: []
  5470. }),
  5471. smalltalk.NumberTest);
  5472. smalltalk.addMethod(
  5473. smalltalk.method({
  5474. selector: "testToBy",
  5475. category: 'tests',
  5476. fn: function (){
  5477. var self=this;
  5478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5479. return smalltalk.withContext(function($ctx1) {
  5480. var $1;
  5481. $1=(0)._to_by_((6),(2));
  5482. $ctx1.sendIdx["to:by:"]=1;
  5483. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5484. self._should_raise_((function(){
  5485. return smalltalk.withContext(function($ctx2) {
  5486. return (1)._to_by_((4),(0));
  5487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5488. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5489. args: [],
  5490. 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",
  5491. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5492. referencedClasses: ["Error"]
  5493. }),
  5494. smalltalk.NumberTest);
  5495. smalltalk.addMethod(
  5496. smalltalk.method({
  5497. selector: "testTrigonometry",
  5498. category: 'tests',
  5499. fn: function (){
  5500. var self=this;
  5501. return smalltalk.withContext(function($ctx1) {
  5502. self._assert_equals_((0)._cos(),(1));
  5503. $ctx1.sendIdx["assert:equals:"]=1;
  5504. self._assert_equals_((0)._sin(),(0));
  5505. $ctx1.sendIdx["assert:equals:"]=2;
  5506. self._assert_equals_((0)._tan(),(0));
  5507. $ctx1.sendIdx["assert:equals:"]=3;
  5508. self._assert_equals_((1)._arcCos(),(0));
  5509. $ctx1.sendIdx["assert:equals:"]=4;
  5510. self._assert_equals_((0)._arcSin(),(0));
  5511. $ctx1.sendIdx["assert:equals:"]=5;
  5512. self._assert_equals_((0)._arcTan(),(0));
  5513. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5514. args: [],
  5515. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  5516. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5517. referencedClasses: []
  5518. }),
  5519. smalltalk.NumberTest);
  5520. smalltalk.addMethod(
  5521. smalltalk.method({
  5522. selector: "testTruncated",
  5523. category: 'tests',
  5524. fn: function (){
  5525. var self=this;
  5526. return smalltalk.withContext(function($ctx1) {
  5527. var $1,$2;
  5528. $1=(3)._truncated();
  5529. $ctx1.sendIdx["truncated"]=1;
  5530. self._assert_equals_($1,(3));
  5531. $ctx1.sendIdx["assert:equals:"]=1;
  5532. $2=(3.212)._truncated();
  5533. $ctx1.sendIdx["truncated"]=2;
  5534. self._assert_equals_($2,(3));
  5535. $ctx1.sendIdx["assert:equals:"]=2;
  5536. self._assert_equals_((3.51)._truncated(),(3));
  5537. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5538. args: [],
  5539. 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",
  5540. messageSends: ["assert:equals:", "truncated"],
  5541. referencedClasses: []
  5542. }),
  5543. smalltalk.NumberTest);
  5544. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5545. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5546. smalltalk.addMethod(
  5547. smalltalk.method({
  5548. selector: "foo",
  5549. category: 'not yet classified',
  5550. fn: function (){
  5551. var self=this;
  5552. return smalltalk.withContext(function($ctx1) {
  5553. var $1;
  5554. $1=self["@foo"];
  5555. return $1;
  5556. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5557. args: [],
  5558. source: "foo\x0a\x09^ foo",
  5559. messageSends: [],
  5560. referencedClasses: []
  5561. }),
  5562. smalltalk.ObjectMock);
  5563. smalltalk.addMethod(
  5564. smalltalk.method({
  5565. selector: "foo:",
  5566. category: 'not yet classified',
  5567. fn: function (anObject){
  5568. var self=this;
  5569. return smalltalk.withContext(function($ctx1) {
  5570. self["@foo"]=anObject;
  5571. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5572. args: ["anObject"],
  5573. source: "foo: anObject\x0a\x09foo := anObject",
  5574. messageSends: [],
  5575. referencedClasses: []
  5576. }),
  5577. smalltalk.ObjectMock);
  5578. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5579. smalltalk.addMethod(
  5580. smalltalk.method({
  5581. selector: "notDefined",
  5582. category: 'tests',
  5583. fn: function (){
  5584. var self=this;
  5585. return smalltalk.withContext(function($ctx1) {
  5586. return void 0;;
  5587. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5588. args: [],
  5589. source: "notDefined\x0a\x09<return void 0;>",
  5590. messageSends: [],
  5591. referencedClasses: []
  5592. }),
  5593. smalltalk.ObjectTest);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "testBasicAccess",
  5597. category: 'tests',
  5598. fn: function (){
  5599. var self=this;
  5600. var o;
  5601. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5602. return smalltalk.withContext(function($ctx1) {
  5603. var $1;
  5604. o=_st($Object())._new();
  5605. _st(o)._basicAt_put_("a",(1));
  5606. $1=_st(o)._basicAt_("a");
  5607. $ctx1.sendIdx["basicAt:"]=1;
  5608. self._assert_equals_($1,(1));
  5609. $ctx1.sendIdx["assert:equals:"]=1;
  5610. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  5611. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5612. args: [],
  5613. 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",
  5614. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5615. referencedClasses: ["Object"]
  5616. }),
  5617. smalltalk.ObjectTest);
  5618. smalltalk.addMethod(
  5619. smalltalk.method({
  5620. selector: "testBasicPerform",
  5621. category: 'tests',
  5622. fn: function (){
  5623. var self=this;
  5624. var o;
  5625. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5626. return smalltalk.withContext(function($ctx1) {
  5627. o=_st($Object())._new();
  5628. _st(o)._basicAt_put_("func",(function(){
  5629. return smalltalk.withContext(function($ctx2) {
  5630. return "hello";
  5631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5632. $ctx1.sendIdx["basicAt:put:"]=1;
  5633. _st(o)._basicAt_put_("func2",(function(a){
  5634. return smalltalk.withContext(function($ctx2) {
  5635. return _st(a).__plus((1));
  5636. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5637. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5638. $ctx1.sendIdx["assert:equals:"]=1;
  5639. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5640. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5641. args: [],
  5642. 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",
  5643. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5644. referencedClasses: ["Object"]
  5645. }),
  5646. smalltalk.ObjectTest);
  5647. smalltalk.addMethod(
  5648. smalltalk.method({
  5649. selector: "testDNU",
  5650. category: 'tests',
  5651. fn: function (){
  5652. var self=this;
  5653. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5654. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5655. return smalltalk.withContext(function($ctx1) {
  5656. self._should_raise_((function(){
  5657. return smalltalk.withContext(function($ctx2) {
  5658. return _st(_st($Object())._new())._foo();
  5659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5660. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5661. args: [],
  5662. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  5663. messageSends: ["should:raise:", "foo", "new"],
  5664. referencedClasses: ["Object", "MessageNotUnderstood"]
  5665. }),
  5666. smalltalk.ObjectTest);
  5667. smalltalk.addMethod(
  5668. smalltalk.method({
  5669. selector: "testEquality",
  5670. category: 'tests',
  5671. fn: function (){
  5672. var self=this;
  5673. var o;
  5674. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5675. return smalltalk.withContext(function($ctx1) {
  5676. var $1,$2,$4,$3;
  5677. o=_st($Object())._new();
  5678. $ctx1.sendIdx["new"]=1;
  5679. $1=_st(o).__eq(_st($Object())._new());
  5680. $ctx1.sendIdx["="]=1;
  5681. self._deny_($1);
  5682. $2=_st(o).__eq(o);
  5683. $ctx1.sendIdx["="]=2;
  5684. self._assert_($2);
  5685. $ctx1.sendIdx["assert:"]=1;
  5686. $4=_st(o)._yourself();
  5687. $ctx1.sendIdx["yourself"]=1;
  5688. $3=_st($4).__eq(o);
  5689. $ctx1.sendIdx["="]=3;
  5690. self._assert_($3);
  5691. $ctx1.sendIdx["assert:"]=2;
  5692. self._assert_(_st(o).__eq(_st(o)._yourself()));
  5693. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5694. args: [],
  5695. 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)",
  5696. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5697. referencedClasses: ["Object"]
  5698. }),
  5699. smalltalk.ObjectTest);
  5700. smalltalk.addMethod(
  5701. smalltalk.method({
  5702. selector: "testHalt",
  5703. category: 'tests',
  5704. fn: function (){
  5705. var self=this;
  5706. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5707. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5708. return smalltalk.withContext(function($ctx1) {
  5709. self._should_raise_((function(){
  5710. return smalltalk.withContext(function($ctx2) {
  5711. return _st(_st($Object())._new())._halt();
  5712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5713. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5714. args: [],
  5715. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  5716. messageSends: ["should:raise:", "halt", "new"],
  5717. referencedClasses: ["Object", "Error"]
  5718. }),
  5719. smalltalk.ObjectTest);
  5720. smalltalk.addMethod(
  5721. smalltalk.method({
  5722. selector: "testIdentity",
  5723. category: 'tests',
  5724. fn: function (){
  5725. var self=this;
  5726. var o;
  5727. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5728. return smalltalk.withContext(function($ctx1) {
  5729. var $1,$2,$4,$3;
  5730. o=_st($Object())._new();
  5731. $ctx1.sendIdx["new"]=1;
  5732. $1=_st(o).__eq_eq(_st($Object())._new());
  5733. $ctx1.sendIdx["=="]=1;
  5734. self._deny_($1);
  5735. $2=_st(o).__eq_eq(o);
  5736. $ctx1.sendIdx["=="]=2;
  5737. self._assert_($2);
  5738. $ctx1.sendIdx["assert:"]=1;
  5739. $4=_st(o)._yourself();
  5740. $ctx1.sendIdx["yourself"]=1;
  5741. $3=_st($4).__eq_eq(o);
  5742. $ctx1.sendIdx["=="]=3;
  5743. self._assert_($3);
  5744. $ctx1.sendIdx["assert:"]=2;
  5745. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  5746. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5747. args: [],
  5748. 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",
  5749. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5750. referencedClasses: ["Object"]
  5751. }),
  5752. smalltalk.ObjectTest);
  5753. smalltalk.addMethod(
  5754. smalltalk.method({
  5755. selector: "testIfNil",
  5756. category: 'tests',
  5757. fn: function (){
  5758. var self=this;
  5759. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5760. return smalltalk.withContext(function($ctx1) {
  5761. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  5762. $2=_st($Object())._new();
  5763. $ctx1.sendIdx["new"]=1;
  5764. $1=_st($2)._isNil();
  5765. self._deny_($1);
  5766. $ctx1.sendIdx["deny:"]=1;
  5767. $5=_st($Object())._new();
  5768. $ctx1.sendIdx["new"]=2;
  5769. if(($receiver = $5) == nil || $receiver == null){
  5770. $4=true;
  5771. } else {
  5772. $4=$5;
  5773. };
  5774. $3=_st($4).__eq(true);
  5775. self._deny_($3);
  5776. $7=_st($Object())._new();
  5777. $ctx1.sendIdx["new"]=3;
  5778. if(($receiver = $7) == nil || $receiver == null){
  5779. $6=$7;
  5780. } else {
  5781. $6=true;
  5782. };
  5783. self._assert_equals_($6,true);
  5784. $ctx1.sendIdx["assert:equals:"]=1;
  5785. $9=_st($Object())._new();
  5786. $ctx1.sendIdx["new"]=4;
  5787. if(($receiver = $9) == nil || $receiver == null){
  5788. $8=false;
  5789. } else {
  5790. $8=true;
  5791. };
  5792. self._assert_equals_($8,true);
  5793. $ctx1.sendIdx["assert:equals:"]=2;
  5794. $11=_st($Object())._new();
  5795. if(($receiver = $11) == nil || $receiver == null){
  5796. $10=false;
  5797. } else {
  5798. $10=true;
  5799. };
  5800. self._assert_equals_($10,true);
  5801. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5802. args: [],
  5803. 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",
  5804. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5805. referencedClasses: ["Object"]
  5806. }),
  5807. smalltalk.ObjectTest);
  5808. smalltalk.addMethod(
  5809. smalltalk.method({
  5810. selector: "testInstVars",
  5811. category: 'tests',
  5812. fn: function (){
  5813. var self=this;
  5814. var o;
  5815. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5816. return smalltalk.withContext(function($ctx1) {
  5817. var $1,$2;
  5818. o=_st($ObjectMock())._new();
  5819. $1=_st(o)._instVarAt_("foo");
  5820. $ctx1.sendIdx["instVarAt:"]=1;
  5821. self._assert_equals_($1,nil);
  5822. $ctx1.sendIdx["assert:equals:"]=1;
  5823. _st(o)._instVarAt_put_("foo",(1));
  5824. $2=_st(o)._instVarAt_("foo");
  5825. $ctx1.sendIdx["instVarAt:"]=2;
  5826. self._assert_equals_($2,(1));
  5827. $ctx1.sendIdx["assert:equals:"]=2;
  5828. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  5829. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5830. args: [],
  5831. 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",
  5832. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5833. referencedClasses: ["ObjectMock"]
  5834. }),
  5835. smalltalk.ObjectTest);
  5836. smalltalk.addMethod(
  5837. smalltalk.method({
  5838. selector: "testNilUndefined",
  5839. category: 'tests',
  5840. fn: function (){
  5841. var self=this;
  5842. return smalltalk.withContext(function($ctx1) {
  5843. self._assert_equals_(self._notDefined(),nil);
  5844. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5845. args: [],
  5846. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5847. messageSends: ["assert:equals:", "notDefined"],
  5848. referencedClasses: []
  5849. }),
  5850. smalltalk.ObjectTest);
  5851. smalltalk.addMethod(
  5852. smalltalk.method({
  5853. selector: "testYourself",
  5854. category: 'tests',
  5855. fn: function (){
  5856. var self=this;
  5857. var o;
  5858. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5859. return smalltalk.withContext(function($ctx1) {
  5860. o=_st($ObjectMock())._new();
  5861. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5862. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5863. args: [],
  5864. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5865. messageSends: ["new", "assert:", "==", "yourself"],
  5866. referencedClasses: ["ObjectMock"]
  5867. }),
  5868. smalltalk.ObjectTest);
  5869. smalltalk.addMethod(
  5870. smalltalk.method({
  5871. selector: "testidentityHash",
  5872. category: 'tests',
  5873. fn: function (){
  5874. var self=this;
  5875. var o1,o2;
  5876. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5877. return smalltalk.withContext(function($ctx1) {
  5878. var $2,$3,$1,$5,$4;
  5879. o1=_st($Object())._new();
  5880. $ctx1.sendIdx["new"]=1;
  5881. o2=_st($Object())._new();
  5882. $2=_st(o1)._identityHash();
  5883. $ctx1.sendIdx["identityHash"]=1;
  5884. $3=_st(o1)._identityHash();
  5885. $ctx1.sendIdx["identityHash"]=2;
  5886. $1=_st($2).__eq_eq($3);
  5887. $ctx1.sendIdx["=="]=1;
  5888. self._assert_($1);
  5889. $5=_st(o1)._identityHash();
  5890. $ctx1.sendIdx["identityHash"]=3;
  5891. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  5892. self._deny_($4);
  5893. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5894. args: [],
  5895. 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",
  5896. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5897. referencedClasses: ["Object"]
  5898. }),
  5899. smalltalk.ObjectTest);
  5900. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5901. smalltalk.addMethod(
  5902. smalltalk.method({
  5903. selector: "testAccessing",
  5904. category: 'tests',
  5905. fn: function (){
  5906. var self=this;
  5907. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5908. return smalltalk.withContext(function($ctx1) {
  5909. var $2,$1,$3,$6,$5,$4;
  5910. $2=_st($Point())._x_y_((3),(4));
  5911. $ctx1.sendIdx["x:y:"]=1;
  5912. $1=_st($2)._x();
  5913. $ctx1.sendIdx["x"]=1;
  5914. self._assert_equals_($1,(3));
  5915. $ctx1.sendIdx["assert:equals:"]=1;
  5916. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  5917. $ctx1.sendIdx["y"]=1;
  5918. self._assert_equals_($3,(4));
  5919. $ctx1.sendIdx["assert:equals:"]=2;
  5920. $6=_st($Point())._new();
  5921. $ctx1.sendIdx["new"]=1;
  5922. $5=_st($6)._x_((3));
  5923. $4=_st($5)._x();
  5924. self._assert_equals_($4,(3));
  5925. $ctx1.sendIdx["assert:equals:"]=3;
  5926. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  5927. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5928. args: [],
  5929. 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",
  5930. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5931. referencedClasses: ["Point"]
  5932. }),
  5933. smalltalk.PointTest);
  5934. smalltalk.addMethod(
  5935. smalltalk.method({
  5936. selector: "testArithmetic",
  5937. category: 'tests',
  5938. fn: function (){
  5939. var self=this;
  5940. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5941. return smalltalk.withContext(function($ctx1) {
  5942. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  5943. $2=(3).__at((4));
  5944. $ctx1.sendIdx["@"]=1;
  5945. $3=(3).__at((4));
  5946. $ctx1.sendIdx["@"]=2;
  5947. $1=_st($2).__star($3);
  5948. $4=_st($Point())._x_y_((9),(16));
  5949. $ctx1.sendIdx["x:y:"]=1;
  5950. self._assert_equals_($1,$4);
  5951. $ctx1.sendIdx["assert:equals:"]=1;
  5952. $6=(3).__at((4));
  5953. $ctx1.sendIdx["@"]=3;
  5954. $7=(3).__at((4));
  5955. $ctx1.sendIdx["@"]=4;
  5956. $5=_st($6).__plus($7);
  5957. $8=_st($Point())._x_y_((6),(8));
  5958. $ctx1.sendIdx["x:y:"]=2;
  5959. self._assert_equals_($5,$8);
  5960. $ctx1.sendIdx["assert:equals:"]=2;
  5961. $10=(3).__at((4));
  5962. $ctx1.sendIdx["@"]=5;
  5963. $11=(3).__at((4));
  5964. $ctx1.sendIdx["@"]=6;
  5965. $9=_st($10).__minus($11);
  5966. $12=_st($Point())._x_y_((0),(0));
  5967. $ctx1.sendIdx["x:y:"]=3;
  5968. self._assert_equals_($9,$12);
  5969. $ctx1.sendIdx["assert:equals:"]=3;
  5970. $14=(6).__at((8));
  5971. $ctx1.sendIdx["@"]=7;
  5972. $13=_st($14).__slash((3).__at((4)));
  5973. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  5974. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5975. args: [],
  5976. 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)",
  5977. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5978. referencedClasses: ["Point"]
  5979. }),
  5980. smalltalk.PointTest);
  5981. smalltalk.addMethod(
  5982. smalltalk.method({
  5983. selector: "testAt",
  5984. category: 'tests',
  5985. fn: function (){
  5986. var self=this;
  5987. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5988. return smalltalk.withContext(function($ctx1) {
  5989. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5990. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5991. args: [],
  5992. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5993. messageSends: ["assert:equals:", "@", "x:y:"],
  5994. referencedClasses: ["Point"]
  5995. }),
  5996. smalltalk.PointTest);
  5997. smalltalk.addMethod(
  5998. smalltalk.method({
  5999. selector: "testEgality",
  6000. category: 'tests',
  6001. fn: function (){
  6002. var self=this;
  6003. return smalltalk.withContext(function($ctx1) {
  6004. var $2,$3,$1,$5,$4;
  6005. $2=(3).__at((4));
  6006. $ctx1.sendIdx["@"]=1;
  6007. $3=(3).__at((4));
  6008. $ctx1.sendIdx["@"]=2;
  6009. $1=_st($2).__eq($3);
  6010. $ctx1.sendIdx["="]=1;
  6011. self._assert_($1);
  6012. $5=(3).__at((5));
  6013. $ctx1.sendIdx["@"]=3;
  6014. $4=_st($5).__eq((3).__at((6)));
  6015. self._deny_($4);
  6016. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  6017. args: [],
  6018. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  6019. messageSends: ["assert:", "=", "@", "deny:"],
  6020. referencedClasses: []
  6021. }),
  6022. smalltalk.PointTest);
  6023. smalltalk.addMethod(
  6024. smalltalk.method({
  6025. selector: "testNew",
  6026. category: 'tests',
  6027. fn: function (){
  6028. var self=this;
  6029. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6030. return smalltalk.withContext(function($ctx1) {
  6031. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  6032. $3=_st($Point())._new();
  6033. $ctx1.sendIdx["new"]=1;
  6034. $2=_st($3)._x_((3));
  6035. $ctx1.sendIdx["x:"]=1;
  6036. $1=_st($2)._y();
  6037. $ctx1.sendIdx["y"]=1;
  6038. self._assert_equals_($1,nil);
  6039. $ctx1.sendIdx["assert:equals:"]=1;
  6040. $7=_st($Point())._new();
  6041. $ctx1.sendIdx["new"]=2;
  6042. $6=_st($7)._x_((3));
  6043. $5=_st($6)._x();
  6044. $ctx1.sendIdx["x"]=1;
  6045. $4=_st($5).__eq((0));
  6046. $ctx1.sendIdx["="]=1;
  6047. self._deny_($4);
  6048. $ctx1.sendIdx["deny:"]=1;
  6049. $10=_st($Point())._new();
  6050. $ctx1.sendIdx["new"]=3;
  6051. $9=_st($10)._y_((4));
  6052. $ctx1.sendIdx["y:"]=1;
  6053. $8=_st($9)._x();
  6054. self._assert_equals_($8,nil);
  6055. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  6056. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  6057. args: [],
  6058. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  6059. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  6060. referencedClasses: ["Point"]
  6061. }),
  6062. smalltalk.PointTest);
  6063. smalltalk.addMethod(
  6064. smalltalk.method({
  6065. selector: "testTranslateBy",
  6066. category: 'tests',
  6067. fn: function (){
  6068. var self=this;
  6069. return smalltalk.withContext(function($ctx1) {
  6070. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6071. $2=(3).__at((3));
  6072. $ctx1.sendIdx["@"]=1;
  6073. $3=(0).__at((1));
  6074. $ctx1.sendIdx["@"]=2;
  6075. $1=_st($2)._translateBy_($3);
  6076. $ctx1.sendIdx["translateBy:"]=1;
  6077. $4=(3).__at((4));
  6078. $ctx1.sendIdx["@"]=3;
  6079. self._assert_equals_($1,$4);
  6080. $ctx1.sendIdx["assert:equals:"]=1;
  6081. $6=(3).__at((3));
  6082. $ctx1.sendIdx["@"]=4;
  6083. $8=(1)._negated();
  6084. $ctx1.sendIdx["negated"]=1;
  6085. $7=(0).__at($8);
  6086. $ctx1.sendIdx["@"]=5;
  6087. $5=_st($6)._translateBy_($7);
  6088. $ctx1.sendIdx["translateBy:"]=2;
  6089. $9=(3).__at((2));
  6090. $ctx1.sendIdx["@"]=6;
  6091. self._assert_equals_($5,$9);
  6092. $ctx1.sendIdx["assert:equals:"]=2;
  6093. $11=(3).__at((3));
  6094. $ctx1.sendIdx["@"]=7;
  6095. $12=(2).__at((3));
  6096. $ctx1.sendIdx["@"]=8;
  6097. $10=_st($11)._translateBy_($12);
  6098. $ctx1.sendIdx["translateBy:"]=3;
  6099. $13=(5).__at((6));
  6100. $ctx1.sendIdx["@"]=9;
  6101. self._assert_equals_($10,$13);
  6102. $ctx1.sendIdx["assert:equals:"]=3;
  6103. $15=(3).__at((3));
  6104. $ctx1.sendIdx["@"]=10;
  6105. $16=_st((3)._negated()).__at((0));
  6106. $ctx1.sendIdx["@"]=11;
  6107. $14=_st($15)._translateBy_($16);
  6108. self._assert_equals_($14,(0).__at((3)));
  6109. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6110. args: [],
  6111. 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.",
  6112. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6113. referencedClasses: []
  6114. }),
  6115. smalltalk.PointTest);
  6116. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6117. smalltalk.addMethod(
  6118. smalltalk.method({
  6119. selector: "testNextIfAbsent",
  6120. category: 'tests',
  6121. fn: function (){
  6122. var self=this;
  6123. var queue;
  6124. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6125. return smalltalk.withContext(function($ctx1) {
  6126. var $2,$1;
  6127. queue=_st($Queue())._new();
  6128. _st(queue)._nextPut_("index1");
  6129. $2=_st(queue)._nextIfAbsent_("empty");
  6130. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6131. $1=_st($2).__eq("index1");
  6132. $ctx1.sendIdx["="]=1;
  6133. self._assert_($1);
  6134. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  6135. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6136. args: [],
  6137. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  6138. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6139. referencedClasses: ["Queue"]
  6140. }),
  6141. smalltalk.QueueTest);
  6142. smalltalk.addMethod(
  6143. smalltalk.method({
  6144. selector: "testQueueNext",
  6145. category: 'tests',
  6146. fn: function (){
  6147. var self=this;
  6148. var queue;
  6149. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6150. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6151. return smalltalk.withContext(function($ctx1) {
  6152. var $1,$2,$4,$3,$6,$5;
  6153. queue=_st($Queue())._new();
  6154. $1=queue;
  6155. _st($1)._nextPut_("index1");
  6156. $ctx1.sendIdx["nextPut:"]=1;
  6157. $2=_st($1)._nextPut_("index2");
  6158. $4=_st(queue)._next();
  6159. $ctx1.sendIdx["next"]=1;
  6160. $3=_st($4).__eq("index1");
  6161. $ctx1.sendIdx["="]=1;
  6162. self._assert_($3);
  6163. $6=_st(queue)._next();
  6164. $ctx1.sendIdx["next"]=2;
  6165. $5=_st($6).__eq("index");
  6166. self._deny_($5);
  6167. self._should_raise_((function(){
  6168. return smalltalk.withContext(function($ctx2) {
  6169. return _st(queue)._next();
  6170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6171. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6172. args: [],
  6173. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  6174. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6175. referencedClasses: ["Queue", "Error"]
  6176. }),
  6177. smalltalk.QueueTest);
  6178. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6179. smalltalk.addMethod(
  6180. smalltalk.method({
  6181. selector: "testAtRandomNumber",
  6182. category: 'tests',
  6183. fn: function (){
  6184. var self=this;
  6185. var val;
  6186. return smalltalk.withContext(function($ctx1) {
  6187. (100)._timesRepeat_((function(){
  6188. return smalltalk.withContext(function($ctx2) {
  6189. val=(10)._atRandom();
  6190. val;
  6191. self._assert_(_st(val).__gt((0)));
  6192. $ctx2.sendIdx["assert:"]=1;
  6193. return self._assert_(_st(val).__lt((11)));
  6194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6195. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6196. args: [],
  6197. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  6198. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6199. referencedClasses: []
  6200. }),
  6201. smalltalk.RandomTest);
  6202. smalltalk.addMethod(
  6203. smalltalk.method({
  6204. selector: "testAtRandomSequenceableCollection",
  6205. category: 'tests',
  6206. fn: function (){
  6207. var self=this;
  6208. var val;
  6209. return smalltalk.withContext(function($ctx1) {
  6210. var $3,$4,$2,$1;
  6211. (100)._timesRepeat_((function(){
  6212. return smalltalk.withContext(function($ctx2) {
  6213. val="abc"._atRandom();
  6214. val;
  6215. $3=_st(val).__eq("a");
  6216. $ctx2.sendIdx["="]=1;
  6217. $4=_st(val).__eq("b");
  6218. $ctx2.sendIdx["="]=2;
  6219. $2=_st($3).__or($4);
  6220. $1=_st($2).__or(_st(val).__eq("c"));
  6221. $ctx2.sendIdx["|"]=1;
  6222. return self._assert_($1);
  6223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6224. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6225. args: [],
  6226. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  6227. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6228. referencedClasses: []
  6229. }),
  6230. smalltalk.RandomTest);
  6231. smalltalk.addMethod(
  6232. smalltalk.method({
  6233. selector: "textNext",
  6234. category: 'tests',
  6235. fn: function (){
  6236. var self=this;
  6237. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6238. return smalltalk.withContext(function($ctx1) {
  6239. var $1;
  6240. (10000)._timesRepeat_((function(){
  6241. var current,next;
  6242. return smalltalk.withContext(function($ctx2) {
  6243. next=_st(_st($Random())._new())._next();
  6244. next;
  6245. self._assert_(_st(next).__gt_eq((0)));
  6246. $ctx2.sendIdx["assert:"]=1;
  6247. self._assert_(_st(next).__lt((1)));
  6248. $1=_st(current).__eq(next);
  6249. $ctx2.sendIdx["="]=1;
  6250. self._deny_($1);
  6251. return _st(next).__eq(current);
  6252. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6253. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6254. args: [],
  6255. 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 ]",
  6256. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6257. referencedClasses: ["Random"]
  6258. }),
  6259. smalltalk.RandomTest);
  6260. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6261. smalltalk.addMethod(
  6262. smalltalk.method({
  6263. selector: "testAddRemove",
  6264. category: 'tests',
  6265. fn: function (){
  6266. var self=this;
  6267. var set;
  6268. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6269. return smalltalk.withContext(function($ctx1) {
  6270. var $1,$2;
  6271. set=_st($Set())._new();
  6272. self._assert_(_st(set)._isEmpty());
  6273. $ctx1.sendIdx["assert:"]=1;
  6274. _st(set)._add_((3));
  6275. $ctx1.sendIdx["add:"]=1;
  6276. $1=_st(set)._includes_((3));
  6277. $ctx1.sendIdx["includes:"]=1;
  6278. self._assert_($1);
  6279. $ctx1.sendIdx["assert:"]=2;
  6280. _st(set)._add_((5));
  6281. $2=_st(set)._includes_((5));
  6282. $ctx1.sendIdx["includes:"]=2;
  6283. self._assert_($2);
  6284. _st(set)._remove_((3));
  6285. self._deny_(_st(set)._includes_((3)));
  6286. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6287. args: [],
  6288. 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)",
  6289. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6290. referencedClasses: ["Set"]
  6291. }),
  6292. smalltalk.SetTest);
  6293. smalltalk.addMethod(
  6294. smalltalk.method({
  6295. selector: "testAt",
  6296. category: 'tests',
  6297. fn: function (){
  6298. var self=this;
  6299. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6300. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6301. return smalltalk.withContext(function($ctx1) {
  6302. self._should_raise_((function(){
  6303. return smalltalk.withContext(function($ctx2) {
  6304. return _st(_st($Set())._new())._at_put_((1),(2));
  6305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6306. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6307. args: [],
  6308. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6309. messageSends: ["should:raise:", "at:put:", "new"],
  6310. referencedClasses: ["Set", "Error"]
  6311. }),
  6312. smalltalk.SetTest);
  6313. smalltalk.addMethod(
  6314. smalltalk.method({
  6315. selector: "testCollect",
  6316. category: 'tests',
  6317. fn: function (){
  6318. var self=this;
  6319. return smalltalk.withContext(function($ctx1) {
  6320. var $2,$1;
  6321. $2=[(5), (6), (8)]._asSet();
  6322. $ctx1.sendIdx["asSet"]=1;
  6323. $1=_st($2)._collect_((function(x){
  6324. return smalltalk.withContext(function($ctx2) {
  6325. return _st(x).__backslash_backslash((3));
  6326. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6327. self._assert_equals_($1,[(0), (2)]._asSet());
  6328. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6329. args: [],
  6330. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6331. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6332. referencedClasses: []
  6333. }),
  6334. smalltalk.SetTest);
  6335. smalltalk.addMethod(
  6336. smalltalk.method({
  6337. selector: "testComparing",
  6338. category: 'tests',
  6339. fn: function (){
  6340. var self=this;
  6341. return smalltalk.withContext(function($ctx1) {
  6342. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6343. $1=[(0), (2)]._asSet();
  6344. $ctx1.sendIdx["asSet"]=1;
  6345. $2=[(0), (2)]._asSet();
  6346. $ctx1.sendIdx["asSet"]=2;
  6347. self._assert_equals_($1,$2);
  6348. $ctx1.sendIdx["assert:equals:"]=1;
  6349. $3=[(2), (0)]._asSet();
  6350. $ctx1.sendIdx["asSet"]=3;
  6351. $4=[(0), (2)]._asSet();
  6352. $ctx1.sendIdx["asSet"]=4;
  6353. self._assert_equals_($3,$4);
  6354. $6=[(0), (2), (3)]._asSet();
  6355. $ctx1.sendIdx["asSet"]=5;
  6356. $7=[(0), (2)]._asSet();
  6357. $ctx1.sendIdx["asSet"]=6;
  6358. $5=_st($6).__eq($7);
  6359. $ctx1.sendIdx["="]=1;
  6360. self._deny_($5);
  6361. $ctx1.sendIdx["deny:"]=1;
  6362. $9=[(1), (2)]._asSet();
  6363. $ctx1.sendIdx["asSet"]=7;
  6364. $8=_st($9).__eq([(0), (2)]._asSet());
  6365. self._deny_($8);
  6366. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6367. args: [],
  6368. 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",
  6369. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6370. referencedClasses: []
  6371. }),
  6372. smalltalk.SetTest);
  6373. smalltalk.addMethod(
  6374. smalltalk.method({
  6375. selector: "testPrintString",
  6376. category: 'tests',
  6377. fn: function (){
  6378. var self=this;
  6379. var set;
  6380. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6381. return smalltalk.withContext(function($ctx1) {
  6382. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  6383. set=_st($Set())._new();
  6384. $1=_st(set)._printString();
  6385. $ctx1.sendIdx["printString"]=1;
  6386. self._assert_equals_($1,"a Set ()");
  6387. $ctx1.sendIdx["assert:equals:"]=1;
  6388. $2=set;
  6389. _st($2)._add_((1));
  6390. $ctx1.sendIdx["add:"]=1;
  6391. $3=_st($2)._add_((3));
  6392. $ctx1.sendIdx["add:"]=2;
  6393. $4=_st(set)._printString();
  6394. $ctx1.sendIdx["printString"]=2;
  6395. self._assert_equals_($4,"a Set (1 3)");
  6396. $ctx1.sendIdx["assert:equals:"]=2;
  6397. _st(set)._add_("foo");
  6398. $ctx1.sendIdx["add:"]=3;
  6399. $5=_st(set)._printString();
  6400. $ctx1.sendIdx["printString"]=3;
  6401. self._assert_equals_($5,"a Set (1 3 'foo')");
  6402. $ctx1.sendIdx["assert:equals:"]=3;
  6403. $6=set;
  6404. _st($6)._remove_((1));
  6405. $ctx1.sendIdx["remove:"]=1;
  6406. $7=_st($6)._remove_((3));
  6407. $8=_st(set)._printString();
  6408. $ctx1.sendIdx["printString"]=4;
  6409. self._assert_equals_($8,"a Set ('foo')");
  6410. $ctx1.sendIdx["assert:equals:"]=4;
  6411. _st(set)._add_((3));
  6412. $ctx1.sendIdx["add:"]=4;
  6413. $9=_st(set)._printString();
  6414. $ctx1.sendIdx["printString"]=5;
  6415. self._assert_equals_($9,"a Set ('foo' 3)");
  6416. $ctx1.sendIdx["assert:equals:"]=5;
  6417. _st(set)._add_((3));
  6418. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6419. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6420. args: [],
  6421. 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)'",
  6422. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6423. referencedClasses: ["Set"]
  6424. }),
  6425. smalltalk.SetTest);
  6426. smalltalk.addMethod(
  6427. smalltalk.method({
  6428. selector: "testSize",
  6429. category: 'tests',
  6430. fn: function (){
  6431. var self=this;
  6432. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6433. return smalltalk.withContext(function($ctx1) {
  6434. var $1,$3,$2;
  6435. $1=_st(_st($Set())._new())._size();
  6436. $ctx1.sendIdx["size"]=1;
  6437. self._assert_equals_($1,(0));
  6438. $ctx1.sendIdx["assert:equals:"]=1;
  6439. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6440. $ctx1.sendIdx["withAll:"]=1;
  6441. $2=_st($3)._size();
  6442. $ctx1.sendIdx["size"]=2;
  6443. self._assert_equals_($2,(4));
  6444. $ctx1.sendIdx["assert:equals:"]=2;
  6445. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6446. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6447. args: [],
  6448. 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",
  6449. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6450. referencedClasses: ["Set"]
  6451. }),
  6452. smalltalk.SetTest);
  6453. smalltalk.addMethod(
  6454. smalltalk.method({
  6455. selector: "testUnboxedObjects",
  6456. category: 'tests',
  6457. fn: function (){
  6458. var self=this;
  6459. return smalltalk.withContext(function($ctx1) {
  6460. var $4,$3,$2,$1;
  6461. $4="foo"._yourself();
  6462. $ctx1.sendIdx["yourself"]=1;
  6463. $3=[$4,"foo"._yourself()];
  6464. $2=_st($3)._asSet();
  6465. $1=_st($2)._asArray();
  6466. self._assert_equals_($1,["foo"]);
  6467. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6468. args: [],
  6469. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6470. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6471. referencedClasses: []
  6472. }),
  6473. smalltalk.SetTest);
  6474. smalltalk.addMethod(
  6475. smalltalk.method({
  6476. selector: "testUnicity",
  6477. category: 'tests',
  6478. fn: function (){
  6479. var self=this;
  6480. var set;
  6481. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6482. return smalltalk.withContext(function($ctx1) {
  6483. var $1;
  6484. set=_st($Set())._new();
  6485. _st(set)._add_((21));
  6486. $ctx1.sendIdx["add:"]=1;
  6487. _st(set)._add_("hello");
  6488. $ctx1.sendIdx["add:"]=2;
  6489. _st(set)._add_((21));
  6490. $ctx1.sendIdx["add:"]=3;
  6491. $1=_st(set)._size();
  6492. $ctx1.sendIdx["size"]=1;
  6493. self._assert_equals_($1,(2));
  6494. $ctx1.sendIdx["assert:equals:"]=1;
  6495. _st(set)._add_("hello");
  6496. self._assert_equals_(_st(set)._size(),(2));
  6497. $ctx1.sendIdx["assert:equals:"]=2;
  6498. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6499. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6500. args: [],
  6501. 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')",
  6502. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6503. referencedClasses: ["Set"]
  6504. }),
  6505. smalltalk.SetTest);
  6506. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6507. smalltalk.addMethod(
  6508. smalltalk.method({
  6509. selector: "collectionClass",
  6510. category: 'accessing',
  6511. fn: function (){
  6512. var self=this;
  6513. return smalltalk.withContext(function($ctx1) {
  6514. var $1;
  6515. $1=_st(self._class())._collectionClass();
  6516. return $1;
  6517. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6518. args: [],
  6519. source: "collectionClass\x0a\x09^ self class collectionClass",
  6520. messageSends: ["collectionClass", "class"],
  6521. referencedClasses: []
  6522. }),
  6523. smalltalk.StreamTest);
  6524. smalltalk.addMethod(
  6525. smalltalk.method({
  6526. selector: "newCollection",
  6527. category: 'accessing',
  6528. fn: function (){
  6529. var self=this;
  6530. return smalltalk.withContext(function($ctx1) {
  6531. var $1;
  6532. $1=_st(self._collectionClass())._new();
  6533. return $1;
  6534. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6535. args: [],
  6536. source: "newCollection\x0a\x09^ self collectionClass new",
  6537. messageSends: ["new", "collectionClass"],
  6538. referencedClasses: []
  6539. }),
  6540. smalltalk.StreamTest);
  6541. smalltalk.addMethod(
  6542. smalltalk.method({
  6543. selector: "newStream",
  6544. category: 'accessing',
  6545. fn: function (){
  6546. var self=this;
  6547. return smalltalk.withContext(function($ctx1) {
  6548. var $1;
  6549. $1=_st(_st(self._collectionClass())._new())._stream();
  6550. return $1;
  6551. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6552. args: [],
  6553. source: "newStream\x0a\x09^ self collectionClass new stream",
  6554. messageSends: ["stream", "new", "collectionClass"],
  6555. referencedClasses: []
  6556. }),
  6557. smalltalk.StreamTest);
  6558. smalltalk.addMethod(
  6559. smalltalk.method({
  6560. selector: "testAtStartAtEnd",
  6561. category: 'tests',
  6562. fn: function (){
  6563. var self=this;
  6564. var stream;
  6565. return smalltalk.withContext(function($ctx1) {
  6566. var $1,$2,$3,$4;
  6567. stream=self._newStream();
  6568. $1=_st(stream)._atStart();
  6569. $ctx1.sendIdx["atStart"]=1;
  6570. self._assert_($1);
  6571. $ctx1.sendIdx["assert:"]=1;
  6572. $2=_st(stream)._atEnd();
  6573. $ctx1.sendIdx["atEnd"]=1;
  6574. self._assert_($2);
  6575. $ctx1.sendIdx["assert:"]=2;
  6576. _st(stream)._nextPutAll_(self._newCollection());
  6577. $3=_st(stream)._atEnd();
  6578. $ctx1.sendIdx["atEnd"]=2;
  6579. self._assert_($3);
  6580. $4=_st(stream)._atStart();
  6581. $ctx1.sendIdx["atStart"]=2;
  6582. self._deny_($4);
  6583. $ctx1.sendIdx["deny:"]=1;
  6584. _st(stream)._position_((1));
  6585. self._deny_(_st(stream)._atEnd());
  6586. $ctx1.sendIdx["deny:"]=2;
  6587. self._deny_(_st(stream)._atStart());
  6588. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6589. args: [],
  6590. 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",
  6591. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6592. referencedClasses: []
  6593. }),
  6594. smalltalk.StreamTest);
  6595. smalltalk.addMethod(
  6596. smalltalk.method({
  6597. selector: "testContents",
  6598. category: 'tests',
  6599. fn: function (){
  6600. var self=this;
  6601. var stream;
  6602. return smalltalk.withContext(function($ctx1) {
  6603. var $1,$2;
  6604. stream=self._newStream();
  6605. $1=stream;
  6606. $2=self._newCollection();
  6607. $ctx1.sendIdx["newCollection"]=1;
  6608. _st($1)._nextPutAll_($2);
  6609. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  6610. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6611. args: [],
  6612. 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",
  6613. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6614. referencedClasses: []
  6615. }),
  6616. smalltalk.StreamTest);
  6617. smalltalk.addMethod(
  6618. smalltalk.method({
  6619. selector: "testIsEmpty",
  6620. category: 'tests',
  6621. fn: function (){
  6622. var self=this;
  6623. var stream;
  6624. return smalltalk.withContext(function($ctx1) {
  6625. var $1;
  6626. stream=self._newStream();
  6627. $1=_st(stream)._isEmpty();
  6628. $ctx1.sendIdx["isEmpty"]=1;
  6629. self._assert_($1);
  6630. _st(stream)._nextPutAll_(self._newCollection());
  6631. self._deny_(_st(stream)._isEmpty());
  6632. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6633. args: [],
  6634. 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",
  6635. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6636. referencedClasses: []
  6637. }),
  6638. smalltalk.StreamTest);
  6639. smalltalk.addMethod(
  6640. smalltalk.method({
  6641. selector: "testPosition",
  6642. category: 'tests',
  6643. fn: function (){
  6644. var self=this;
  6645. var collection,stream;
  6646. return smalltalk.withContext(function($ctx1) {
  6647. var $1,$2,$3;
  6648. collection=self._newCollection();
  6649. stream=self._newStream();
  6650. _st(stream)._nextPutAll_(collection);
  6651. $1=_st(stream)._position();
  6652. $ctx1.sendIdx["position"]=1;
  6653. self._assert_equals_($1,_st(collection)._size());
  6654. $ctx1.sendIdx["assert:equals:"]=1;
  6655. _st(stream)._position_((0));
  6656. $2=_st(stream)._position();
  6657. $ctx1.sendIdx["position"]=2;
  6658. self._assert_equals_($2,(0));
  6659. $ctx1.sendIdx["assert:equals:"]=2;
  6660. _st(stream)._next();
  6661. $ctx1.sendIdx["next"]=1;
  6662. $3=_st(stream)._position();
  6663. $ctx1.sendIdx["position"]=3;
  6664. self._assert_equals_($3,(1));
  6665. $ctx1.sendIdx["assert:equals:"]=3;
  6666. _st(stream)._next();
  6667. self._assert_equals_(_st(stream)._position(),(2));
  6668. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6669. args: [],
  6670. 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",
  6671. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6672. referencedClasses: []
  6673. }),
  6674. smalltalk.StreamTest);
  6675. smalltalk.addMethod(
  6676. smalltalk.method({
  6677. selector: "testReading",
  6678. category: 'tests',
  6679. fn: function (){
  6680. var self=this;
  6681. var stream,collection;
  6682. return smalltalk.withContext(function($ctx1) {
  6683. var $1,$2,$3;
  6684. collection=self._newCollection();
  6685. stream=self._newStream();
  6686. $1=stream;
  6687. _st($1)._nextPutAll_(collection);
  6688. $2=_st($1)._position_((0));
  6689. _st(collection)._do_((function(each){
  6690. return smalltalk.withContext(function($ctx2) {
  6691. $3=_st(stream)._next();
  6692. $ctx2.sendIdx["next"]=1;
  6693. return self._assert_equals_($3,each);
  6694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6695. self._assert_(_st(_st(stream)._next())._isNil());
  6696. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6697. args: [],
  6698. 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",
  6699. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6700. referencedClasses: []
  6701. }),
  6702. smalltalk.StreamTest);
  6703. smalltalk.addMethod(
  6704. smalltalk.method({
  6705. selector: "testStreamContents",
  6706. category: 'tests',
  6707. fn: function (){
  6708. var self=this;
  6709. return smalltalk.withContext(function($ctx1) {
  6710. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6711. args: [],
  6712. source: "testStreamContents",
  6713. messageSends: [],
  6714. referencedClasses: []
  6715. }),
  6716. smalltalk.StreamTest);
  6717. smalltalk.addMethod(
  6718. smalltalk.method({
  6719. selector: "testWrite",
  6720. category: 'tests',
  6721. fn: function (){
  6722. var self=this;
  6723. var stream,collection;
  6724. return smalltalk.withContext(function($ctx1) {
  6725. collection=self._newCollection();
  6726. stream=self._newStream();
  6727. _st(collection)._do_((function(each){
  6728. return smalltalk.withContext(function($ctx2) {
  6729. return _st(stream).__lt_lt(each);
  6730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6731. self._assert_equals_(_st(stream)._contents(),collection);
  6732. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6733. args: [],
  6734. 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",
  6735. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6736. referencedClasses: []
  6737. }),
  6738. smalltalk.StreamTest);
  6739. smalltalk.addMethod(
  6740. smalltalk.method({
  6741. selector: "testWriting",
  6742. category: 'tests',
  6743. fn: function (){
  6744. var self=this;
  6745. var stream,collection;
  6746. return smalltalk.withContext(function($ctx1) {
  6747. var $1;
  6748. collection=self._newCollection();
  6749. stream=self._newStream();
  6750. $ctx1.sendIdx["newStream"]=1;
  6751. _st(collection)._do_((function(each){
  6752. return smalltalk.withContext(function($ctx2) {
  6753. return _st(stream)._nextPut_(each);
  6754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6755. $1=_st(stream)._contents();
  6756. $ctx1.sendIdx["contents"]=1;
  6757. self._assert_equals_($1,collection);
  6758. $ctx1.sendIdx["assert:equals:"]=1;
  6759. stream=self._newStream();
  6760. _st(stream)._nextPutAll_(collection);
  6761. self._assert_equals_(_st(stream)._contents(),collection);
  6762. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6763. args: [],
  6764. 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",
  6765. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6766. referencedClasses: []
  6767. }),
  6768. smalltalk.StreamTest);
  6769. smalltalk.addMethod(
  6770. smalltalk.method({
  6771. selector: "collectionClass",
  6772. category: 'accessing',
  6773. fn: function (){
  6774. var self=this;
  6775. return smalltalk.withContext(function($ctx1) {
  6776. return nil;
  6777. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6778. args: [],
  6779. source: "collectionClass\x0a\x09^ nil",
  6780. messageSends: [],
  6781. referencedClasses: []
  6782. }),
  6783. smalltalk.StreamTest.klass);
  6784. smalltalk.addMethod(
  6785. smalltalk.method({
  6786. selector: "isAbstract",
  6787. category: 'testing',
  6788. fn: function (){
  6789. var self=this;
  6790. return smalltalk.withContext(function($ctx1) {
  6791. var $1;
  6792. $1=_st(self._collectionClass())._isNil();
  6793. return $1;
  6794. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6795. args: [],
  6796. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6797. messageSends: ["isNil", "collectionClass"],
  6798. referencedClasses: []
  6799. }),
  6800. smalltalk.StreamTest.klass);
  6801. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6802. smalltalk.addMethod(
  6803. smalltalk.method({
  6804. selector: "newCollection",
  6805. category: 'accessing',
  6806. fn: function (){
  6807. var self=this;
  6808. return smalltalk.withContext(function($ctx1) {
  6809. var $1;
  6810. $1=[true,(1),(3).__at((4)),"foo"];
  6811. return $1;
  6812. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6813. args: [],
  6814. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6815. messageSends: ["@"],
  6816. referencedClasses: []
  6817. }),
  6818. smalltalk.ArrayStreamTest);
  6819. smalltalk.addMethod(
  6820. smalltalk.method({
  6821. selector: "collectionClass",
  6822. category: 'accessing',
  6823. fn: function (){
  6824. var self=this;
  6825. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6826. return smalltalk.withContext(function($ctx1) {
  6827. return $Array();
  6828. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6829. args: [],
  6830. source: "collectionClass\x0a\x09^ Array",
  6831. messageSends: [],
  6832. referencedClasses: ["Array"]
  6833. }),
  6834. smalltalk.ArrayStreamTest.klass);
  6835. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6836. smalltalk.addMethod(
  6837. smalltalk.method({
  6838. selector: "newCollection",
  6839. category: 'accessing',
  6840. fn: function (){
  6841. var self=this;
  6842. return smalltalk.withContext(function($ctx1) {
  6843. return "hello world";
  6844. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6845. args: [],
  6846. source: "newCollection\x0a\x09^ 'hello world'",
  6847. messageSends: [],
  6848. referencedClasses: []
  6849. }),
  6850. smalltalk.StringStreamTest);
  6851. smalltalk.addMethod(
  6852. smalltalk.method({
  6853. selector: "collectionClass",
  6854. category: 'accessing',
  6855. fn: function (){
  6856. var self=this;
  6857. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6858. return smalltalk.withContext(function($ctx1) {
  6859. return $String();
  6860. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6861. args: [],
  6862. source: "collectionClass\x0a\x09^ String",
  6863. messageSends: [],
  6864. referencedClasses: ["String"]
  6865. }),
  6866. smalltalk.StringStreamTest.klass);
  6867. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6868. smalltalk.addMethod(
  6869. smalltalk.method({
  6870. selector: "testCopying",
  6871. category: 'tests',
  6872. fn: function (){
  6873. var self=this;
  6874. return smalltalk.withContext(function($ctx1) {
  6875. self._assert_equals_(nil._copy(),nil);
  6876. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6877. args: [],
  6878. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6879. messageSends: ["assert:equals:", "copy"],
  6880. referencedClasses: []
  6881. }),
  6882. smalltalk.UndefinedTest);
  6883. smalltalk.addMethod(
  6884. smalltalk.method({
  6885. selector: "testDeepCopy",
  6886. category: 'tests',
  6887. fn: function (){
  6888. var self=this;
  6889. return smalltalk.withContext(function($ctx1) {
  6890. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6891. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6892. args: [],
  6893. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6894. messageSends: ["assert:", "=", "deepCopy"],
  6895. referencedClasses: []
  6896. }),
  6897. smalltalk.UndefinedTest);
  6898. smalltalk.addMethod(
  6899. smalltalk.method({
  6900. selector: "testIfNil",
  6901. category: 'tests',
  6902. fn: function (){
  6903. var self=this;
  6904. return smalltalk.withContext(function($ctx1) {
  6905. var $1,$3,$2,$4,$6,$5;
  6906. if(($receiver = nil) == nil || $receiver == null){
  6907. $1=true;
  6908. } else {
  6909. $1=nil;
  6910. };
  6911. self._assert_equals_($1,true);
  6912. $ctx1.sendIdx["assert:equals:"]=1;
  6913. if(($receiver = nil) == nil || $receiver == null){
  6914. $3=nil;
  6915. } else {
  6916. $3=true;
  6917. };
  6918. $2=_st($3).__eq(true);
  6919. $ctx1.sendIdx["="]=1;
  6920. self._deny_($2);
  6921. $ctx1.sendIdx["deny:"]=1;
  6922. if(($receiver = nil) == nil || $receiver == null){
  6923. $4=true;
  6924. } else {
  6925. $4=false;
  6926. };
  6927. self._assert_equals_($4,true);
  6928. if(($receiver = nil) == nil || $receiver == null){
  6929. $6=false;
  6930. } else {
  6931. $6=true;
  6932. };
  6933. $5=_st($6).__eq(true);
  6934. self._deny_($5);
  6935. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6936. args: [],
  6937. 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",
  6938. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6939. referencedClasses: []
  6940. }),
  6941. smalltalk.UndefinedTest);
  6942. smalltalk.addMethod(
  6943. smalltalk.method({
  6944. selector: "testIsNil",
  6945. category: 'tests',
  6946. fn: function (){
  6947. var self=this;
  6948. return smalltalk.withContext(function($ctx1) {
  6949. self._assert_(nil._isNil());
  6950. self._deny_(nil._notNil());
  6951. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6952. args: [],
  6953. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6954. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6955. referencedClasses: []
  6956. }),
  6957. smalltalk.UndefinedTest);
  6958. });