1
0

Kernel-Tests.js 264 KB

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