Kernel-Tests.js 267 KB

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