Kernel-Tests.js 266 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111
  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.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2480. smalltalk.addMethod(
  2481. smalltalk.method({
  2482. selector: "testAdd",
  2483. category: 'tests',
  2484. fn: function (){
  2485. var self=this;
  2486. var array;
  2487. return smalltalk.withContext(function($ctx1) {
  2488. array=[(1), (2), (3), (4), (5)];
  2489. _st(array)._add_((6));
  2490. self._assert_equals_(array,[(1), (2), (3), (4), (5), (6)]);
  2491. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2492. args: [],
  2493. source: "testAdd \x0a\x09|array| \x0a\x09array := #(1 2 3 4 5). \x0a\x09array add:6 . \x0a\x09\x0a\x09self assert: array equals: #(1 2 3 4 5 6).",
  2494. messageSends: ["add:", "assert:equals:"],
  2495. referencedClasses: []
  2496. }),
  2497. smalltalk.ArrayTest);
  2498. smalltalk.addMethod(
  2499. smalltalk.method({
  2500. selector: "testAddFirst",
  2501. category: 'tests',
  2502. fn: function (){
  2503. var self=this;
  2504. return smalltalk.withContext(function($ctx1) {
  2505. var $1,$2;
  2506. $1=[(2), (3), (4), (5)];
  2507. _st($1)._addFirst_((1));
  2508. $2=_st($1)._yourself();
  2509. self._assert_equals_($2,[(1), (2), (3), (4), (5)]);
  2510. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2511. args: [],
  2512. source: "testAddFirst\x0a\x09self assert: (#(2 3 4 5) addFirst: 1; yourself) equals: #(1 2 3 4 5)",
  2513. messageSends: ["assert:equals:", "addFirst:", "yourself"],
  2514. referencedClasses: []
  2515. }),
  2516. smalltalk.ArrayTest);
  2517. smalltalk.addMethod(
  2518. smalltalk.method({
  2519. selector: "testAtIfAbsent",
  2520. category: 'tests',
  2521. fn: function (){
  2522. var self=this;
  2523. var array;
  2524. return smalltalk.withContext(function($ctx1) {
  2525. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  2526. array=["hello", "world"];
  2527. $2=_st(array)._at_((1));
  2528. $ctx1.sendIdx["at:"]=1;
  2529. $1=self._assert_equals_($2,"hello");
  2530. $ctx1.sendIdx["assert:equals:"]=1;
  2531. $4=_st(array)._at_((2));
  2532. $3=self._assert_equals_($4,"world");
  2533. $ctx1.sendIdx["assert:equals:"]=2;
  2534. $6=_st(array)._at_ifAbsent_((2),(function(){
  2535. return smalltalk.withContext(function($ctx2) {
  2536. return "not found";
  2537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2538. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2539. $5=self._assert_equals_($6,"world");
  2540. $ctx1.sendIdx["assert:equals:"]=3;
  2541. $8=_st(array)._at_ifAbsent_((0),(function(){
  2542. return smalltalk.withContext(function($ctx2) {
  2543. return "not found";
  2544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2545. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2546. $7=self._assert_equals_($8,"not found");
  2547. $ctx1.sendIdx["assert:equals:"]=4;
  2548. $10=_st(array)._at_ifAbsent_((-10),(function(){
  2549. return smalltalk.withContext(function($ctx2) {
  2550. return "not found";
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2552. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2553. $9=self._assert_equals_($10,"not found");
  2554. $ctx1.sendIdx["assert:equals:"]=5;
  2555. $12=_st(array)._at_ifAbsent_((3),(function(){
  2556. return smalltalk.withContext(function($ctx2) {
  2557. return "not found";
  2558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2559. $11=self._assert_equals_($12,"not found");
  2560. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2561. args: [],
  2562. 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'.",
  2563. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2564. referencedClasses: []
  2565. }),
  2566. smalltalk.ArrayTest);
  2567. smalltalk.addMethod(
  2568. smalltalk.method({
  2569. selector: "testFirst",
  2570. category: 'tests',
  2571. fn: function (){
  2572. var self=this;
  2573. var array;
  2574. return smalltalk.withContext(function($ctx1) {
  2575. array=[(1), (2), (3), (4), (5)];
  2576. self._assert_equals_(_st(array)._first(),_st(array)._at_((1)));
  2577. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{array:array},smalltalk.ArrayTest)})},
  2578. args: [],
  2579. source: "testFirst\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array first) equals: (array at:1)",
  2580. messageSends: ["assert:equals:", "first", "at:"],
  2581. referencedClasses: []
  2582. }),
  2583. smalltalk.ArrayTest);
  2584. smalltalk.addMethod(
  2585. smalltalk.method({
  2586. selector: "testFirstN",
  2587. category: 'tests',
  2588. fn: function (){
  2589. var self=this;
  2590. return smalltalk.withContext(function($ctx1) {
  2591. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2592. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2593. args: [],
  2594. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2595. messageSends: ["assert:equals:", "first:"],
  2596. referencedClasses: []
  2597. }),
  2598. smalltalk.ArrayTest);
  2599. smalltalk.addMethod(
  2600. smalltalk.method({
  2601. selector: "testFourth",
  2602. category: 'tests',
  2603. fn: function (){
  2604. var self=this;
  2605. var array;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. array=[(1), (2), (3), (4), (5)];
  2608. self._assert_equals_(_st(array)._fourth(),_st(array)._at_((4)));
  2609. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{array:array},smalltalk.ArrayTest)})},
  2610. args: [],
  2611. source: "testFourth\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array fourth) equals: (array at:4)",
  2612. messageSends: ["assert:equals:", "fourth", "at:"],
  2613. referencedClasses: []
  2614. }),
  2615. smalltalk.ArrayTest);
  2616. smalltalk.addMethod(
  2617. smalltalk.method({
  2618. selector: "testIfEmpty",
  2619. category: 'tests',
  2620. fn: function (){
  2621. var self=this;
  2622. return smalltalk.withContext(function($ctx1) {
  2623. self._assert_equals_(""._ifEmpty_((function(){
  2624. return smalltalk.withContext(function($ctx2) {
  2625. return "zork";
  2626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2627. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2628. args: [],
  2629. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  2630. messageSends: ["assert:equals:", "ifEmpty:"],
  2631. referencedClasses: []
  2632. }),
  2633. smalltalk.ArrayTest);
  2634. smalltalk.addMethod(
  2635. smalltalk.method({
  2636. selector: "testLast",
  2637. category: 'tests',
  2638. fn: function (){
  2639. var self=this;
  2640. var array;
  2641. return smalltalk.withContext(function($ctx1) {
  2642. array=[(1), (2), (3), (4), (5)];
  2643. self._assert_equals_(_st(array)._last(),_st(array)._at_((5)));
  2644. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{array:array},smalltalk.ArrayTest)})},
  2645. args: [],
  2646. source: "testLast\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09\x0a\x09self assert: (array last) equals: (array at:5)",
  2647. messageSends: ["assert:equals:", "last", "at:"],
  2648. referencedClasses: []
  2649. }),
  2650. smalltalk.ArrayTest);
  2651. smalltalk.addMethod(
  2652. smalltalk.method({
  2653. selector: "testPrintString",
  2654. category: 'tests',
  2655. fn: function (){
  2656. var self=this;
  2657. var array;
  2658. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2659. return smalltalk.withContext(function($ctx1) {
  2660. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10,$11,$13,$12,$14,$16,$15,$17,$19,$18;
  2661. array=_st($Array())._new();
  2662. $2=_st(array)._printString();
  2663. $ctx1.sendIdx["printString"]=1;
  2664. $1=self._assert_equals_($2,"an Array ()");
  2665. $ctx1.sendIdx["assert:equals:"]=1;
  2666. $3=array;
  2667. _st($3)._add_((1));
  2668. $ctx1.sendIdx["add:"]=1;
  2669. $4=_st($3)._add_((3));
  2670. $ctx1.sendIdx["add:"]=2;
  2671. $6=_st(array)._printString();
  2672. $ctx1.sendIdx["printString"]=2;
  2673. $5=self._assert_equals_($6,"an Array (1 3)");
  2674. $ctx1.sendIdx["assert:equals:"]=2;
  2675. $7=_st(array)._add_("foo");
  2676. $9=_st(array)._printString();
  2677. $ctx1.sendIdx["printString"]=3;
  2678. $8=self._assert_equals_($9,"an Array (1 3 'foo')");
  2679. $ctx1.sendIdx["assert:equals:"]=3;
  2680. $10=array;
  2681. _st($10)._remove_((1));
  2682. $ctx1.sendIdx["remove:"]=1;
  2683. $11=_st($10)._remove_((3));
  2684. $13=_st(array)._printString();
  2685. $ctx1.sendIdx["printString"]=4;
  2686. $12=self._assert_equals_($13,"an Array ('foo')");
  2687. $ctx1.sendIdx["assert:equals:"]=4;
  2688. $14=_st(array)._addLast_((3));
  2689. $ctx1.sendIdx["addLast:"]=1;
  2690. $16=_st(array)._printString();
  2691. $ctx1.sendIdx["printString"]=5;
  2692. $15=self._assert_equals_($16,"an Array ('foo' 3)");
  2693. $ctx1.sendIdx["assert:equals:"]=5;
  2694. $17=_st(array)._addLast_((3));
  2695. $19=_st(array)._printString();
  2696. $18=self._assert_equals_($19,"an Array ('foo' 3 3)");
  2697. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2698. args: [],
  2699. 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)'.",
  2700. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2701. referencedClasses: ["Array"]
  2702. }),
  2703. smalltalk.ArrayTest);
  2704. smalltalk.addMethod(
  2705. smalltalk.method({
  2706. selector: "testRemove",
  2707. category: 'tests',
  2708. fn: function (){
  2709. var self=this;
  2710. var array;
  2711. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2712. return smalltalk.withContext(function($ctx1) {
  2713. array=[(1), (2), (3), (4), (5)];
  2714. _st(array)._remove_((3));
  2715. self._assert_equals_(array,[(1), (2), (4), (5)]);
  2716. self._should_raise_((function(){
  2717. return smalltalk.withContext(function($ctx2) {
  2718. return _st(array)._remove_((3));
  2719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2720. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  2721. args: [],
  2722. 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.",
  2723. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  2724. referencedClasses: ["Error"]
  2725. }),
  2726. smalltalk.ArrayTest);
  2727. smalltalk.addMethod(
  2728. smalltalk.method({
  2729. selector: "testRemoveFromTo",
  2730. category: 'tests',
  2731. fn: function (){
  2732. var self=this;
  2733. return smalltalk.withContext(function($ctx1) {
  2734. var $2,$1,$4,$3,$6,$5;
  2735. $2=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2736. $ctx1.sendIdx["removeFrom:to:"]=1;
  2737. $1=self._assert_equals_($2,[(4)]);
  2738. $ctx1.sendIdx["assert:equals:"]=1;
  2739. $4=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2740. $ctx1.sendIdx["removeFrom:to:"]=2;
  2741. $3=self._assert_equals_($4,[(1), (4)]);
  2742. $ctx1.sendIdx["assert:equals:"]=2;
  2743. $6=[(1), (2), (3), (4)]._removeFrom_to_((2),(4));
  2744. $5=self._assert_equals_($6,[(1)]);
  2745. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2746. args: [],
  2747. 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)",
  2748. messageSends: ["assert:equals:", "removeFrom:to:"],
  2749. referencedClasses: []
  2750. }),
  2751. smalltalk.ArrayTest);
  2752. smalltalk.addMethod(
  2753. smalltalk.method({
  2754. selector: "testRemoveIndex",
  2755. category: 'tests',
  2756. fn: function (){
  2757. var self=this;
  2758. return smalltalk.withContext(function($ctx1) {
  2759. var $2,$1,$4,$3,$6,$5;
  2760. $2=[(1), (2), (3), (4)]._removeIndex_((2));
  2761. $ctx1.sendIdx["removeIndex:"]=1;
  2762. $1=self._assert_equals_($2,[(1), (3), (4)]);
  2763. $ctx1.sendIdx["assert:equals:"]=1;
  2764. $4=[(1), (2), (3), (4)]._removeIndex_((1));
  2765. $ctx1.sendIdx["removeIndex:"]=2;
  2766. $3=self._assert_equals_($4,[(2), (3), (4)]);
  2767. $ctx1.sendIdx["assert:equals:"]=2;
  2768. $6=["hello"]._removeIndex_((1));
  2769. $5=self._assert_equals_($6,[]);
  2770. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2771. args: [],
  2772. 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: #()",
  2773. messageSends: ["assert:equals:", "removeIndex:"],
  2774. referencedClasses: []
  2775. }),
  2776. smalltalk.ArrayTest);
  2777. smalltalk.addMethod(
  2778. smalltalk.method({
  2779. selector: "testRemoveLast",
  2780. category: 'tests',
  2781. fn: function (){
  2782. var self=this;
  2783. var array;
  2784. return smalltalk.withContext(function($ctx1) {
  2785. array=[(1), (2)];
  2786. _st(array)._removeLast();
  2787. self._assert_equals_(_st(array)._last(),(1));
  2788. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  2789. args: [],
  2790. source: "testRemoveLast \x0a\x09|array|\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1.",
  2791. messageSends: ["removeLast", "assert:equals:", "last"],
  2792. referencedClasses: []
  2793. }),
  2794. smalltalk.ArrayTest);
  2795. smalltalk.addMethod(
  2796. smalltalk.method({
  2797. selector: "testReversed",
  2798. category: 'tests',
  2799. fn: function (){
  2800. var self=this;
  2801. var array;
  2802. return smalltalk.withContext(function($ctx1) {
  2803. array=[(5), (4), (3), (2), (1)];
  2804. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  2805. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  2806. args: [],
  2807. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  2808. messageSends: ["assert:equals:", "reversed"],
  2809. referencedClasses: []
  2810. }),
  2811. smalltalk.ArrayTest);
  2812. smalltalk.addMethod(
  2813. smalltalk.method({
  2814. selector: "testSize",
  2815. category: 'tests',
  2816. fn: function (){
  2817. var self=this;
  2818. var array;
  2819. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2820. return smalltalk.withContext(function($ctx1) {
  2821. array=["hello", "world"];
  2822. self._assert_equals_(_st(array)._size(),(2));
  2823. self._assert_equals_(_st(_st($Array())._new())._size(),(0));
  2824. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{array:array},smalltalk.ArrayTest)})},
  2825. args: [],
  2826. source: "testSize\x0a\x09|array| \x0a\x09array := #('hello' 'world'). \x0a\x09\x0a\x09self assert: array size equals: 2. \x0a\x09self assert: Array new size equals: 0.",
  2827. messageSends: ["assert:equals:", "size", "new"],
  2828. referencedClasses: ["Array"]
  2829. }),
  2830. smalltalk.ArrayTest);
  2831. smalltalk.addMethod(
  2832. smalltalk.method({
  2833. selector: "testSort",
  2834. category: 'tests',
  2835. fn: function (){
  2836. var self=this;
  2837. var array;
  2838. return smalltalk.withContext(function($ctx1) {
  2839. array=[(3), (1), (4), (5), (2)];
  2840. _st(array)._sort();
  2841. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  2842. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  2843. args: [],
  2844. 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)",
  2845. messageSends: ["sort", "assert:equals:"],
  2846. referencedClasses: []
  2847. }),
  2848. smalltalk.ArrayTest);
  2849. smalltalk.addMethod(
  2850. smalltalk.method({
  2851. selector: "testThird",
  2852. category: 'tests',
  2853. fn: function (){
  2854. var self=this;
  2855. var array;
  2856. return smalltalk.withContext(function($ctx1) {
  2857. array=[(1), (2), (3), (4), (5)];
  2858. self._assert_equals_(_st(array)._third(),_st(array)._at_((3)));
  2859. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{array:array},smalltalk.ArrayTest)})},
  2860. args: [],
  2861. source: "testThird\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array third) equals: (array at:3)",
  2862. messageSends: ["assert:equals:", "third", "at:"],
  2863. referencedClasses: []
  2864. }),
  2865. smalltalk.ArrayTest);
  2866. smalltalk.addMethod(
  2867. smalltalk.method({
  2868. selector: "collectionClass",
  2869. category: 'accessing',
  2870. fn: function (){
  2871. var self=this;
  2872. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2873. return smalltalk.withContext(function($ctx1) {
  2874. var $1;
  2875. $1=$Array();
  2876. return $1;
  2877. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2878. args: [],
  2879. source: "collectionClass\x0a\x09^ Array",
  2880. messageSends: [],
  2881. referencedClasses: ["Array"]
  2882. }),
  2883. smalltalk.ArrayTest.klass);
  2884. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2885. smalltalk.addMethod(
  2886. smalltalk.method({
  2887. selector: "collection",
  2888. category: 'accessing',
  2889. fn: function (){
  2890. var self=this;
  2891. return smalltalk.withContext(function($ctx1) {
  2892. return "hello";
  2893. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2894. args: [],
  2895. source: "collection\x0a\x09^'hello'",
  2896. messageSends: [],
  2897. referencedClasses: []
  2898. }),
  2899. smalltalk.StringTest);
  2900. smalltalk.addMethod(
  2901. smalltalk.method({
  2902. selector: "collectionWithDuplicates",
  2903. category: 'accessing',
  2904. fn: function (){
  2905. var self=this;
  2906. return smalltalk.withContext(function($ctx1) {
  2907. return "abbaerte";
  2908. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2909. args: [],
  2910. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2911. messageSends: [],
  2912. referencedClasses: []
  2913. }),
  2914. smalltalk.StringTest);
  2915. smalltalk.addMethod(
  2916. smalltalk.method({
  2917. selector: "testAddRemove",
  2918. category: 'tests',
  2919. fn: function (){
  2920. var self=this;
  2921. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2922. return smalltalk.withContext(function($ctx1) {
  2923. var $1,$2;
  2924. $1=self._should_raise_((function(){
  2925. return smalltalk.withContext(function($ctx2) {
  2926. return "hello"._add_("a");
  2927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2928. $ctx1.sendIdx["should:raise:"]=1;
  2929. $2=self._should_raise_((function(){
  2930. return smalltalk.withContext(function($ctx2) {
  2931. return "hello"._remove_("h");
  2932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2933. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2934. args: [],
  2935. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2936. messageSends: ["should:raise:", "add:", "remove:"],
  2937. referencedClasses: ["Error"]
  2938. }),
  2939. smalltalk.StringTest);
  2940. smalltalk.addMethod(
  2941. smalltalk.method({
  2942. selector: "testAsArray",
  2943. category: 'tests',
  2944. fn: function (){
  2945. var self=this;
  2946. return smalltalk.withContext(function($ctx1) {
  2947. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2948. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2949. args: [],
  2950. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2951. messageSends: ["assert:equals:", "asArray"],
  2952. referencedClasses: []
  2953. }),
  2954. smalltalk.StringTest);
  2955. smalltalk.addMethod(
  2956. smalltalk.method({
  2957. selector: "testAsLowerCase",
  2958. category: 'tests',
  2959. fn: function (){
  2960. var self=this;
  2961. return smalltalk.withContext(function($ctx1) {
  2962. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  2963. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  2964. args: [],
  2965. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  2966. messageSends: ["assert:equals:", "asLowercase"],
  2967. referencedClasses: []
  2968. }),
  2969. smalltalk.StringTest);
  2970. smalltalk.addMethod(
  2971. smalltalk.method({
  2972. selector: "testAsNumber",
  2973. category: 'tests',
  2974. fn: function (){
  2975. var self=this;
  2976. return smalltalk.withContext(function($ctx1) {
  2977. var $2,$1,$4,$3,$6,$5;
  2978. $2="3"._asNumber();
  2979. $ctx1.sendIdx["asNumber"]=1;
  2980. $1=self._assert_equals_($2,(3));
  2981. $ctx1.sendIdx["assert:equals:"]=1;
  2982. $4="-3"._asNumber();
  2983. $ctx1.sendIdx["asNumber"]=2;
  2984. $3=self._assert_equals_($4,(-3));
  2985. $ctx1.sendIdx["assert:equals:"]=2;
  2986. $6="-1.5"._asNumber();
  2987. $5=self._assert_equals_($6,(-1.5));
  2988. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  2989. args: [],
  2990. 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.",
  2991. messageSends: ["assert:equals:", "asNumber"],
  2992. referencedClasses: []
  2993. }),
  2994. smalltalk.StringTest);
  2995. smalltalk.addMethod(
  2996. smalltalk.method({
  2997. selector: "testAsUpperCase",
  2998. category: 'tests',
  2999. fn: function (){
  3000. var self=this;
  3001. return smalltalk.withContext(function($ctx1) {
  3002. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3003. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3004. args: [],
  3005. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3006. messageSends: ["assert:equals:", "asUppercase"],
  3007. referencedClasses: []
  3008. }),
  3009. smalltalk.StringTest);
  3010. smalltalk.addMethod(
  3011. smalltalk.method({
  3012. selector: "testAsciiValue",
  3013. category: 'tests',
  3014. fn: function (){
  3015. var self=this;
  3016. var characterA,characterU;
  3017. return smalltalk.withContext(function($ctx1) {
  3018. characterA="A";
  3019. characterU="U";
  3020. self._assert_equals_(_st(characterA)._asciiValue(),(65));
  3021. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  3022. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3023. args: [],
  3024. 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",
  3025. messageSends: ["assert:equals:", "asciiValue"],
  3026. referencedClasses: []
  3027. }),
  3028. smalltalk.StringTest);
  3029. smalltalk.addMethod(
  3030. smalltalk.method({
  3031. selector: "testAt",
  3032. category: 'tests',
  3033. fn: function (){
  3034. var self=this;
  3035. return smalltalk.withContext(function($ctx1) {
  3036. var $2,$1,$4,$3,$5;
  3037. $2="hello"._at_((1));
  3038. $ctx1.sendIdx["at:"]=1;
  3039. $1=self._assert_equals_($2,"h");
  3040. $ctx1.sendIdx["assert:equals:"]=1;
  3041. $4="hello"._at_((5));
  3042. $3=self._assert_equals_($4,"o");
  3043. $ctx1.sendIdx["assert:equals:"]=2;
  3044. $5=self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  3045. return smalltalk.withContext(function($ctx2) {
  3046. return nil;
  3047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  3048. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  3049. args: [],
  3050. 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",
  3051. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  3052. referencedClasses: []
  3053. }),
  3054. smalltalk.StringTest);
  3055. smalltalk.addMethod(
  3056. smalltalk.method({
  3057. selector: "testAtPut",
  3058. category: 'tests',
  3059. fn: function (){
  3060. var self=this;
  3061. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3062. return smalltalk.withContext(function($ctx1) {
  3063. self._should_raise_((function(){
  3064. return smalltalk.withContext(function($ctx2) {
  3065. return "hello"._at_put_((1),"a");
  3066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3067. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3068. args: [],
  3069. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  3070. messageSends: ["should:raise:", "at:put:"],
  3071. referencedClasses: ["Error"]
  3072. }),
  3073. smalltalk.StringTest);
  3074. smalltalk.addMethod(
  3075. smalltalk.method({
  3076. selector: "testCapitalized",
  3077. category: 'tests',
  3078. fn: function (){
  3079. var self=this;
  3080. return smalltalk.withContext(function($ctx1) {
  3081. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9;
  3082. $2="test"._capitalized();
  3083. $ctx1.sendIdx["capitalized"]=1;
  3084. $1=self._assert_equals_($2,"Test");
  3085. $ctx1.sendIdx["assert:equals:"]=1;
  3086. $4="Test"._capitalized();
  3087. $ctx1.sendIdx["capitalized"]=2;
  3088. $3=self._assert_equals_($4,"Test");
  3089. $ctx1.sendIdx["assert:equals:"]=2;
  3090. $6=""._capitalized();
  3091. $5=self._assert_equals_($6,"");
  3092. $ctx1.sendIdx["assert:equals:"]=3;
  3093. $8="Test"._isCapitalized();
  3094. $ctx1.sendIdx["isCapitalized"]=1;
  3095. $7=self._assert_equals_($8,true);
  3096. $ctx1.sendIdx["assert:equals:"]=4;
  3097. $10="test"._isCapitalized();
  3098. $9=self._assert_equals_($10,false);
  3099. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3100. args: [],
  3101. 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.",
  3102. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3103. referencedClasses: []
  3104. }),
  3105. smalltalk.StringTest);
  3106. smalltalk.addMethod(
  3107. smalltalk.method({
  3108. selector: "testCharCodeAt",
  3109. category: 'tests',
  3110. fn: function (){
  3111. var self=this;
  3112. var s;
  3113. return smalltalk.withContext(function($ctx1) {
  3114. s="jackie";
  3115. self._assert_equals_("jackie"._charCodeAt_((1)),(106));
  3116. self._assert_equals_("jackie"._charCodeAt_((2)),(97));
  3117. self._assert_equals_("jackie"._charCodeAt_((3)),(99));
  3118. self._assert_equals_("jackie"._charCodeAt_((4)),(107));
  3119. self._assert_equals_("jackie"._charCodeAt_((5)),(105));
  3120. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3121. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{s:s},smalltalk.StringTest)})},
  3122. args: [],
  3123. 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.",
  3124. messageSends: ["assert:equals:", "charCodeAt:"],
  3125. referencedClasses: []
  3126. }),
  3127. smalltalk.StringTest);
  3128. smalltalk.addMethod(
  3129. smalltalk.method({
  3130. selector: "testCollect",
  3131. category: 'tests',
  3132. fn: function (){
  3133. var self=this;
  3134. var newCollection;
  3135. return smalltalk.withContext(function($ctx1) {
  3136. newCollection="hheelllloo";
  3137. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3138. return smalltalk.withContext(function($ctx2) {
  3139. return _st(each).__comma(each);
  3140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3141. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3142. args: [],
  3143. 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",
  3144. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3145. referencedClasses: []
  3146. }),
  3147. smalltalk.StringTest);
  3148. smalltalk.addMethod(
  3149. smalltalk.method({
  3150. selector: "testCopyFromTo",
  3151. category: 'tests',
  3152. fn: function (){
  3153. var self=this;
  3154. return smalltalk.withContext(function($ctx1) {
  3155. self._assert_equals_("jackie"._copyFrom_to_((1),(3)),"jac");
  3156. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3157. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3158. args: [],
  3159. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3160. messageSends: ["assert:equals:", "copyFrom:to:"],
  3161. referencedClasses: []
  3162. }),
  3163. smalltalk.StringTest);
  3164. smalltalk.addMethod(
  3165. smalltalk.method({
  3166. selector: "testCopyWithoutAll",
  3167. category: 'tests',
  3168. fn: function (){
  3169. var self=this;
  3170. return smalltalk.withContext(function($ctx1) {
  3171. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3172. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3173. args: [],
  3174. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3175. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3176. referencedClasses: []
  3177. }),
  3178. smalltalk.StringTest);
  3179. smalltalk.addMethod(
  3180. smalltalk.method({
  3181. selector: "testDetect",
  3182. category: 'tests',
  3183. fn: function (){
  3184. var self=this;
  3185. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3186. return smalltalk.withContext(function($ctx1) {
  3187. var $2,$1,$3;
  3188. $2=self._collection();
  3189. $ctx1.sendIdx["collection"]=1;
  3190. $1=_st($2)._detect_((function(each){
  3191. return smalltalk.withContext(function($ctx2) {
  3192. return _st(each).__eq("h");
  3193. $ctx2.sendIdx["="]=1;
  3194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3195. $ctx1.sendIdx["detect:"]=1;
  3196. self._assert_equals_($1,"h");
  3197. self._should_raise_((function(){
  3198. return smalltalk.withContext(function($ctx2) {
  3199. $3=self._collection();
  3200. return _st($3)._detect_((function(each){
  3201. return smalltalk.withContext(function($ctx3) {
  3202. return _st(each).__eq((6));
  3203. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3205. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3206. args: [],
  3207. 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",
  3208. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3209. referencedClasses: ["Error"]
  3210. }),
  3211. smalltalk.StringTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "testEquality",
  3215. category: 'tests',
  3216. fn: function (){
  3217. var self=this;
  3218. return smalltalk.withContext(function($ctx1) {
  3219. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$11,$10;
  3220. $1=self._assert_equals_("hello","hello");
  3221. $ctx1.sendIdx["assert:equals:"]=1;
  3222. $3="hello".__eq("world");
  3223. $ctx1.sendIdx["="]=1;
  3224. $2=self._deny_($3);
  3225. $ctx1.sendIdx["deny:"]=1;
  3226. $5="hello".__eq([]._at_ifAbsent_((1),(function(){
  3227. return smalltalk.withContext(function($ctx2) {
  3228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3229. $ctx1.sendIdx["="]=2;
  3230. $4=self._deny_($5);
  3231. $ctx1.sendIdx["deny:"]=2;
  3232. $7="hello"._yourself();
  3233. $ctx1.sendIdx["yourself"]=1;
  3234. $6=self._assert_equals_("hello",$7);
  3235. $ctx1.sendIdx["assert:equals:"]=2;
  3236. $9="hello"._yourself();
  3237. $8=self._assert_equals_($9,"hello");
  3238. $11="".__eq((0));
  3239. $10=self._deny_($11);
  3240. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3241. args: [],
  3242. 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",
  3243. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3244. referencedClasses: []
  3245. }),
  3246. smalltalk.StringTest);
  3247. smalltalk.addMethod(
  3248. smalltalk.method({
  3249. selector: "testIdentity",
  3250. category: 'tests',
  3251. fn: function (){
  3252. var self=this;
  3253. return smalltalk.withContext(function($ctx1) {
  3254. var $2,$1,$4,$3,$7,$6,$5,$10,$9,$8,$12,$11;
  3255. $2="hello".__eq_eq("hello");
  3256. $ctx1.sendIdx["=="]=1;
  3257. $1=self._assert_($2);
  3258. $ctx1.sendIdx["assert:"]=1;
  3259. $4="hello".__eq_eq("world");
  3260. $ctx1.sendIdx["=="]=2;
  3261. $3=self._deny_($4);
  3262. $ctx1.sendIdx["deny:"]=1;
  3263. $7="hello"._yourself();
  3264. $ctx1.sendIdx["yourself"]=1;
  3265. $6="hello".__eq_eq($7);
  3266. $ctx1.sendIdx["=="]=3;
  3267. $5=self._assert_($6);
  3268. $ctx1.sendIdx["assert:"]=2;
  3269. $10="hello"._yourself();
  3270. $9=_st($10).__eq_eq("hello");
  3271. $ctx1.sendIdx["=="]=4;
  3272. $8=self._assert_($9);
  3273. $12="".__eq_eq((0));
  3274. $11=self._deny_($12);
  3275. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3276. args: [],
  3277. 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",
  3278. messageSends: ["assert:", "==", "deny:", "yourself"],
  3279. referencedClasses: []
  3280. }),
  3281. smalltalk.StringTest);
  3282. smalltalk.addMethod(
  3283. smalltalk.method({
  3284. selector: "testIdentityHash",
  3285. category: 'tests',
  3286. fn: function (){
  3287. var self=this;
  3288. return smalltalk.withContext(function($ctx1) {
  3289. var $1,$2,$4,$5,$3;
  3290. $1="foo"._identityHash();
  3291. $ctx1.sendIdx["identityHash"]=1;
  3292. $2="foo"._identityHash();
  3293. $ctx1.sendIdx["identityHash"]=2;
  3294. self._assert_equals_($1,$2);
  3295. $4="foo"._identityHash();
  3296. $ctx1.sendIdx["identityHash"]=3;
  3297. $5="bar"._identityHash();
  3298. $3=_st($4).__eq($5);
  3299. self._deny_($3);
  3300. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3301. args: [],
  3302. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3303. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3304. referencedClasses: []
  3305. }),
  3306. smalltalk.StringTest);
  3307. smalltalk.addMethod(
  3308. smalltalk.method({
  3309. selector: "testIncludesSubString",
  3310. category: 'tests',
  3311. fn: function (){
  3312. var self=this;
  3313. return smalltalk.withContext(function($ctx1) {
  3314. var $1,$2;
  3315. $1="amber"._includesSubString_("ber");
  3316. $ctx1.sendIdx["includesSubString:"]=1;
  3317. self._assert_($1);
  3318. $2="amber"._includesSubString_("zork");
  3319. self._deny_($2);
  3320. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3321. args: [],
  3322. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3323. messageSends: ["assert:", "includesSubString:", "deny:"],
  3324. referencedClasses: []
  3325. }),
  3326. smalltalk.StringTest);
  3327. smalltalk.addMethod(
  3328. smalltalk.method({
  3329. selector: "testIndexOf",
  3330. category: 'tests',
  3331. fn: function (){
  3332. var self=this;
  3333. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3334. return smalltalk.withContext(function($ctx1) {
  3335. var $3,$2,$1,$4,$7,$6,$5;
  3336. $3=self._collection();
  3337. $ctx1.sendIdx["collection"]=1;
  3338. $2=_st($3)._indexOf_("e");
  3339. $ctx1.sendIdx["indexOf:"]=1;
  3340. $1=self._assert_equals_($2,(2));
  3341. $ctx1.sendIdx["assert:equals:"]=1;
  3342. self._should_raise_((function(){
  3343. return smalltalk.withContext(function($ctx2) {
  3344. $4=self._collection();
  3345. $ctx2.sendIdx["collection"]=2;
  3346. return _st($4)._indexOf_((999));
  3347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3348. $7=self._collection();
  3349. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  3350. return smalltalk.withContext(function($ctx2) {
  3351. return "sentinel";
  3352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3353. $5=self._assert_equals_($6,"sentinel");
  3354. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3355. args: [],
  3356. 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'",
  3357. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3358. referencedClasses: ["Error"]
  3359. }),
  3360. smalltalk.StringTest);
  3361. smalltalk.addMethod(
  3362. smalltalk.method({
  3363. selector: "testIsVowel",
  3364. category: 'tests',
  3365. fn: function (){
  3366. var self=this;
  3367. var vowel,consonant;
  3368. return smalltalk.withContext(function($ctx1) {
  3369. vowel="u";
  3370. consonant="z";
  3371. self._assert_equals_(_st(vowel)._isVowel(),true);
  3372. self._assert_equals_(_st(consonant)._isVowel(),false);
  3373. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3374. args: [],
  3375. 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",
  3376. messageSends: ["assert:equals:", "isVowel"],
  3377. referencedClasses: []
  3378. }),
  3379. smalltalk.StringTest);
  3380. smalltalk.addMethod(
  3381. smalltalk.method({
  3382. selector: "testJoin",
  3383. category: 'tests',
  3384. fn: function (){
  3385. var self=this;
  3386. return smalltalk.withContext(function($ctx1) {
  3387. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3388. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3389. args: [],
  3390. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3391. messageSends: ["assert:equals:", "join:"],
  3392. referencedClasses: []
  3393. }),
  3394. smalltalk.StringTest);
  3395. smalltalk.addMethod(
  3396. smalltalk.method({
  3397. selector: "testReversed",
  3398. category: 'tests',
  3399. fn: function (){
  3400. var self=this;
  3401. return smalltalk.withContext(function($ctx1) {
  3402. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3403. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3404. args: [],
  3405. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3406. messageSends: ["assert:equals:", "reversed"],
  3407. referencedClasses: []
  3408. }),
  3409. smalltalk.StringTest);
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "testSelect",
  3413. category: 'tests',
  3414. fn: function (){
  3415. var self=this;
  3416. var newCollection;
  3417. return smalltalk.withContext(function($ctx1) {
  3418. newCollection="o";
  3419. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3420. return smalltalk.withContext(function($ctx2) {
  3421. return _st(each).__eq("o");
  3422. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3423. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3424. args: [],
  3425. 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",
  3426. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3427. referencedClasses: []
  3428. }),
  3429. smalltalk.StringTest);
  3430. smalltalk.addMethod(
  3431. smalltalk.method({
  3432. selector: "testSize",
  3433. category: 'tests',
  3434. fn: function (){
  3435. var self=this;
  3436. return smalltalk.withContext(function($ctx1) {
  3437. var $2,$1,$4,$3;
  3438. $2="smalltalk"._size();
  3439. $ctx1.sendIdx["size"]=1;
  3440. $1=self._assert_equals_($2,(9));
  3441. $ctx1.sendIdx["assert:equals:"]=1;
  3442. $4=""._size();
  3443. $3=self._assert_equals_($4,(0));
  3444. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3445. args: [],
  3446. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3447. messageSends: ["assert:equals:", "size"],
  3448. referencedClasses: []
  3449. }),
  3450. smalltalk.StringTest);
  3451. smalltalk.addMethod(
  3452. smalltalk.method({
  3453. selector: "testStreamContents",
  3454. category: 'tests',
  3455. fn: function (){
  3456. var self=this;
  3457. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3458. return smalltalk.withContext(function($ctx1) {
  3459. var $1,$2;
  3460. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3461. return smalltalk.withContext(function($ctx2) {
  3462. $1=aStream;
  3463. _st($1)._nextPutAll_("hello");
  3464. $ctx2.sendIdx["nextPutAll:"]=1;
  3465. _st($1)._space();
  3466. $2=_st($1)._nextPutAll_("world");
  3467. return $2;
  3468. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3469. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3470. args: [],
  3471. 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'",
  3472. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3473. referencedClasses: ["String"]
  3474. }),
  3475. smalltalk.StringTest);
  3476. smalltalk.addMethod(
  3477. smalltalk.method({
  3478. selector: "testSubStrings",
  3479. category: 'tests',
  3480. fn: function (){
  3481. var self=this;
  3482. return smalltalk.withContext(function($ctx1) {
  3483. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3484. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3485. args: [],
  3486. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3487. messageSends: ["assert:equals:", "subStrings:"],
  3488. referencedClasses: []
  3489. }),
  3490. smalltalk.StringTest);
  3491. smalltalk.addMethod(
  3492. smalltalk.method({
  3493. selector: "testTrim",
  3494. category: 'tests',
  3495. fn: function (){
  3496. var self=this;
  3497. return smalltalk.withContext(function($ctx1) {
  3498. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3499. self._assert_equals_("jackie "._trimRight(),"jackie");
  3500. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3501. args: [],
  3502. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3503. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3504. referencedClasses: []
  3505. }),
  3506. smalltalk.StringTest);
  3507. smalltalk.addMethod(
  3508. smalltalk.method({
  3509. selector: "collectionClass",
  3510. category: 'accessing',
  3511. fn: function (){
  3512. var self=this;
  3513. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3514. return smalltalk.withContext(function($ctx1) {
  3515. var $1;
  3516. $1=$String();
  3517. return $1;
  3518. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3519. args: [],
  3520. source: "collectionClass\x0a\x09^ String",
  3521. messageSends: [],
  3522. referencedClasses: ["String"]
  3523. }),
  3524. smalltalk.StringTest.klass);
  3525. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3526. smalltalk.addMethod(
  3527. smalltalk.method({
  3528. selector: "testShow",
  3529. category: 'tests',
  3530. fn: function (){
  3531. var self=this;
  3532. var originalTranscript;
  3533. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3534. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3535. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3536. return smalltalk.withContext(function($ctx1) {
  3537. var $1,$2,$3,$4;
  3538. originalTranscript=_st($Transcript())._current();
  3539. $1=_st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3540. $ctx1.sendIdx["register:"]=1;
  3541. $2=self._shouldnt_raise_((function(){
  3542. return smalltalk.withContext(function($ctx2) {
  3543. return _st($Transcript())._show_("Hello console!");
  3544. $ctx2.sendIdx["show:"]=1;
  3545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3546. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3547. $3=self._shouldnt_raise_((function(){
  3548. return smalltalk.withContext(function($ctx2) {
  3549. return _st($Transcript())._show_(console);
  3550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3551. $4=_st($Transcript())._register_(originalTranscript);
  3552. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3553. args: [],
  3554. 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.",
  3555. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3556. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3557. }),
  3558. smalltalk.ConsoleTranscriptTest);
  3559. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3560. smalltalk.addMethod(
  3561. smalltalk.method({
  3562. selector: "jsObject",
  3563. category: 'accessing',
  3564. fn: function (){
  3565. var self=this;
  3566. return smalltalk.withContext(function($ctx1) {
  3567. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3568. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3569. args: [],
  3570. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3571. messageSends: [],
  3572. referencedClasses: []
  3573. }),
  3574. smalltalk.JSObjectProxyTest);
  3575. smalltalk.addMethod(
  3576. smalltalk.method({
  3577. selector: "testAtIfAbsent",
  3578. category: 'tests',
  3579. fn: function (){
  3580. var self=this;
  3581. var testObject;
  3582. return smalltalk.withContext(function($ctx1) {
  3583. var $2,$1,$4,$3,$6,$5,$8,$7;
  3584. testObject=self._jsObject();
  3585. $2=_st(testObject)._at_ifAbsent_("abc",(function(){
  3586. return smalltalk.withContext(function($ctx2) {
  3587. return "Property does not exist";
  3588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3589. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3590. $1=self._assert_equals_($2,"Property does not exist");
  3591. $ctx1.sendIdx["assert:equals:"]=1;
  3592. $4=_st(testObject)._at_ifAbsent_("e",(function(){
  3593. return smalltalk.withContext(function($ctx2) {
  3594. return "Property does not exist";
  3595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3596. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3597. $3=self._assert_equals_($4,nil);
  3598. $ctx1.sendIdx["assert:equals:"]=2;
  3599. $6=_st(testObject)._at_ifAbsent_("a",(function(){
  3600. return smalltalk.withContext(function($ctx2) {
  3601. return "Property does not exist";
  3602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3603. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3604. $5=self._assert_equals_($6,(1));
  3605. $ctx1.sendIdx["assert:equals:"]=3;
  3606. $8=_st(testObject)._at_ifAbsent_("f",(function(){
  3607. return smalltalk.withContext(function($ctx2) {
  3608. return "Property does not exist";
  3609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3610. $7=self._assert_equals_($8,nil);
  3611. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3612. args: [],
  3613. 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.",
  3614. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3615. referencedClasses: []
  3616. }),
  3617. smalltalk.JSObjectProxyTest);
  3618. smalltalk.addMethod(
  3619. smalltalk.method({
  3620. selector: "testAtIfPresent",
  3621. category: 'tests',
  3622. fn: function (){
  3623. var self=this;
  3624. var testObject;
  3625. return smalltalk.withContext(function($ctx1) {
  3626. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10;
  3627. testObject=self._jsObject();
  3628. $2=_st(testObject)._at_ifPresent_("abc",(function(x){
  3629. return smalltalk.withContext(function($ctx2) {
  3630. $3=_st(x)._asString();
  3631. $ctx2.sendIdx["asString"]=1;
  3632. return "hello ".__comma($3);
  3633. $ctx2.sendIdx[","]=1;
  3634. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3635. $ctx1.sendIdx["at:ifPresent:"]=1;
  3636. $1=self._assert_equals_($2,nil);
  3637. $ctx1.sendIdx["assert:equals:"]=1;
  3638. $5=_st(testObject)._at_ifPresent_("e",(function(x){
  3639. return smalltalk.withContext(function($ctx2) {
  3640. $6=_st(x)._asString();
  3641. $ctx2.sendIdx["asString"]=2;
  3642. return "hello ".__comma($6);
  3643. $ctx2.sendIdx[","]=2;
  3644. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3645. $ctx1.sendIdx["at:ifPresent:"]=2;
  3646. $4=self._assert_equals_($5,"hello nil");
  3647. $ctx1.sendIdx["assert:equals:"]=2;
  3648. $8=_st(testObject)._at_ifPresent_("a",(function(x){
  3649. return smalltalk.withContext(function($ctx2) {
  3650. $9=_st(x)._asString();
  3651. $ctx2.sendIdx["asString"]=3;
  3652. return "hello ".__comma($9);
  3653. $ctx2.sendIdx[","]=3;
  3654. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3655. $ctx1.sendIdx["at:ifPresent:"]=3;
  3656. $7=self._assert_equals_($8,"hello 1");
  3657. $ctx1.sendIdx["assert:equals:"]=3;
  3658. $11=_st(testObject)._at_ifPresent_("f",(function(x){
  3659. return smalltalk.withContext(function($ctx2) {
  3660. $12=_st(x)._asString();
  3661. return "hello ".__comma($12);
  3662. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})}));
  3663. $10=self._assert_equals_($11,"hello nil");
  3664. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3665. args: [],
  3666. 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'.",
  3667. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3668. referencedClasses: []
  3669. }),
  3670. smalltalk.JSObjectProxyTest);
  3671. smalltalk.addMethod(
  3672. smalltalk.method({
  3673. selector: "testAtIfPresentIfAbsent",
  3674. category: 'tests',
  3675. fn: function (){
  3676. var self=this;
  3677. var testObject;
  3678. return smalltalk.withContext(function($ctx1) {
  3679. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10;
  3680. testObject=self._jsObject();
  3681. $2=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3682. return smalltalk.withContext(function($ctx2) {
  3683. $3=_st(x)._asString();
  3684. $ctx2.sendIdx["asString"]=1;
  3685. return "hello ".__comma($3);
  3686. $ctx2.sendIdx[","]=1;
  3687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3688. return smalltalk.withContext(function($ctx2) {
  3689. return "not present";
  3690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3691. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3692. $1=self._assert_equals_($2,"not present");
  3693. $ctx1.sendIdx["assert:equals:"]=1;
  3694. $5=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3695. return smalltalk.withContext(function($ctx2) {
  3696. $6=_st(x)._asString();
  3697. $ctx2.sendIdx["asString"]=2;
  3698. return "hello ".__comma($6);
  3699. $ctx2.sendIdx[","]=2;
  3700. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3701. return smalltalk.withContext(function($ctx2) {
  3702. return "not present";
  3703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3704. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3705. $4=self._assert_equals_($5,"hello nil");
  3706. $ctx1.sendIdx["assert:equals:"]=2;
  3707. $8=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3708. return smalltalk.withContext(function($ctx2) {
  3709. $9=_st(x)._asString();
  3710. $ctx2.sendIdx["asString"]=3;
  3711. return "hello ".__comma($9);
  3712. $ctx2.sendIdx[","]=3;
  3713. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3714. return smalltalk.withContext(function($ctx2) {
  3715. return "not present";
  3716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3717. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3718. $7=self._assert_equals_($8,"hello 1");
  3719. $ctx1.sendIdx["assert:equals:"]=3;
  3720. $11=_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3721. return smalltalk.withContext(function($ctx2) {
  3722. $12=_st(x)._asString();
  3723. return "hello ".__comma($12);
  3724. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3725. return smalltalk.withContext(function($ctx2) {
  3726. return "not present";
  3727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  3728. $10=self._assert_equals_($11,"hello nil");
  3729. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3730. args: [],
  3731. 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'.",
  3732. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3733. referencedClasses: []
  3734. }),
  3735. smalltalk.JSObjectProxyTest);
  3736. smalltalk.addMethod(
  3737. smalltalk.method({
  3738. selector: "testDNU",
  3739. category: 'tests',
  3740. fn: function (){
  3741. var self=this;
  3742. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3743. return smalltalk.withContext(function($ctx1) {
  3744. self._should_raise_((function(){
  3745. return smalltalk.withContext(function($ctx2) {
  3746. return _st(self._jsObject())._foo();
  3747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3748. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3749. args: [],
  3750. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  3751. messageSends: ["should:raise:", "foo", "jsObject"],
  3752. referencedClasses: ["MessageNotUnderstood"]
  3753. }),
  3754. smalltalk.JSObjectProxyTest);
  3755. smalltalk.addMethod(
  3756. smalltalk.method({
  3757. selector: "testMessageSend",
  3758. category: 'tests',
  3759. fn: function (){
  3760. var self=this;
  3761. return smalltalk.withContext(function($ctx1) {
  3762. var $3,$2,$1,$6,$5,$4,$9,$8,$7;
  3763. $3=self._jsObject();
  3764. $ctx1.sendIdx["jsObject"]=1;
  3765. $2=_st($3)._a();
  3766. $1=self._assert_equals_($2,(1));
  3767. $ctx1.sendIdx["assert:equals:"]=1;
  3768. $6=self._jsObject();
  3769. $ctx1.sendIdx["jsObject"]=2;
  3770. $5=_st($6)._b();
  3771. $4=self._assert_equals_($5,(2));
  3772. $ctx1.sendIdx["assert:equals:"]=2;
  3773. $9=self._jsObject();
  3774. $8=_st($9)._c_((3));
  3775. $7=self._assert_equals_($8,(3));
  3776. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3777. args: [],
  3778. 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",
  3779. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3780. referencedClasses: []
  3781. }),
  3782. smalltalk.JSObjectProxyTest);
  3783. smalltalk.addMethod(
  3784. smalltalk.method({
  3785. selector: "testMethodWithArguments",
  3786. category: 'tests',
  3787. fn: function (){
  3788. var self=this;
  3789. return smalltalk.withContext(function($ctx1) {
  3790. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3791. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3792. args: [],
  3793. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3794. messageSends: ["assert:equals:", "c:", "jsObject"],
  3795. referencedClasses: []
  3796. }),
  3797. smalltalk.JSObjectProxyTest);
  3798. smalltalk.addMethod(
  3799. smalltalk.method({
  3800. selector: "testPrinting",
  3801. category: 'tests',
  3802. fn: function (){
  3803. var self=this;
  3804. return smalltalk.withContext(function($ctx1) {
  3805. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  3806. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  3807. args: [],
  3808. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  3809. messageSends: ["assert:equals:", "printString", "jsObject"],
  3810. referencedClasses: []
  3811. }),
  3812. smalltalk.JSObjectProxyTest);
  3813. smalltalk.addMethod(
  3814. smalltalk.method({
  3815. selector: "testPropertyThatReturnsEmptyString",
  3816. category: 'tests',
  3817. fn: function (){
  3818. var self=this;
  3819. var object;
  3820. return smalltalk.withContext(function($ctx1) {
  3821. var $2,$1,$4,$3;
  3822. object=self._jsObject();
  3823. $2=_st(object)._d();
  3824. $ctx1.sendIdx["d"]=1;
  3825. $1=self._assert_equals_($2,"");
  3826. $ctx1.sendIdx["assert:equals:"]=1;
  3827. _st(object)._d_("hello");
  3828. $4=_st(object)._d();
  3829. $3=self._assert_equals_($4,"hello");
  3830. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  3831. args: [],
  3832. 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'",
  3833. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  3834. referencedClasses: []
  3835. }),
  3836. smalltalk.JSObjectProxyTest);
  3837. smalltalk.addMethod(
  3838. smalltalk.method({
  3839. selector: "testPropertyThatReturnsUndefined",
  3840. category: 'tests',
  3841. fn: function (){
  3842. var self=this;
  3843. var object;
  3844. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3845. return smalltalk.withContext(function($ctx1) {
  3846. var $2,$1;
  3847. object=self._jsObject();
  3848. self._shouldnt_raise_((function(){
  3849. return smalltalk.withContext(function($ctx2) {
  3850. return _st(object)._e();
  3851. $ctx2.sendIdx["e"]=1;
  3852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3853. $2=_st(object)._e();
  3854. $1=_st($2)._isNil();
  3855. self._assert_($1);
  3856. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  3857. args: [],
  3858. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  3859. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  3860. referencedClasses: ["MessageNotUnderstood"]
  3861. }),
  3862. smalltalk.JSObjectProxyTest);
  3863. smalltalk.addMethod(
  3864. smalltalk.method({
  3865. selector: "testValue",
  3866. category: 'tests',
  3867. fn: function (){
  3868. var self=this;
  3869. var testObject;
  3870. return smalltalk.withContext(function($ctx1) {
  3871. var $3,$2,$1,$5,$4;
  3872. testObject=self._jsObject();
  3873. $3=_st(testObject)._value();
  3874. $ctx1.sendIdx["value"]=1;
  3875. $2=_st($3)._printString();
  3876. $1=self._assert_equals_($2,"[object Object]");
  3877. $ctx1.sendIdx["assert:equals:"]=1;
  3878. _st(testObject)._at_put_("value","aValue");
  3879. $5=_st(testObject)._value();
  3880. $4=self._assert_equals_($5,"aValue");
  3881. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3882. args: [],
  3883. 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'",
  3884. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  3885. referencedClasses: []
  3886. }),
  3887. smalltalk.JSObjectProxyTest);
  3888. smalltalk.addMethod(
  3889. smalltalk.method({
  3890. selector: "testYourself",
  3891. category: 'tests',
  3892. fn: function (){
  3893. var self=this;
  3894. var object;
  3895. return smalltalk.withContext(function($ctx1) {
  3896. var $1,$2;
  3897. $1=self._jsObject();
  3898. _st($1)._d_("test");
  3899. $2=_st($1)._yourself();
  3900. object=$2;
  3901. self._assert_equals_(_st(object)._d(),"test");
  3902. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  3903. args: [],
  3904. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  3905. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  3906. referencedClasses: []
  3907. }),
  3908. smalltalk.JSObjectProxyTest);
  3909. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3910. smalltalk.addMethod(
  3911. smalltalk.method({
  3912. selector: "testCatchingException",
  3913. category: 'tests',
  3914. fn: function (){
  3915. var self=this;
  3916. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3917. return smalltalk.withContext(function($ctx1) {
  3918. _st((function(){
  3919. return smalltalk.withContext(function($ctx2) {
  3920. return self._throwException();
  3921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  3922. return smalltalk.withContext(function($ctx2) {
  3923. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  3924. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  3925. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  3926. args: [],
  3927. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  3928. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  3929. referencedClasses: ["Error"]
  3930. }),
  3931. smalltalk.JavaScriptExceptionTest);
  3932. smalltalk.addMethod(
  3933. smalltalk.method({
  3934. selector: "testRaisingException",
  3935. category: 'tests',
  3936. fn: function (){
  3937. var self=this;
  3938. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3939. return smalltalk.withContext(function($ctx1) {
  3940. self._should_raise_((function(){
  3941. return smalltalk.withContext(function($ctx2) {
  3942. return self._throwException();
  3943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  3944. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  3945. args: [],
  3946. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  3947. messageSends: ["should:raise:", "throwException"],
  3948. referencedClasses: ["JavaScriptException"]
  3949. }),
  3950. smalltalk.JavaScriptExceptionTest);
  3951. smalltalk.addMethod(
  3952. smalltalk.method({
  3953. selector: "throwException",
  3954. category: 'helpers',
  3955. fn: function (){
  3956. var self=this;
  3957. return smalltalk.withContext(function($ctx1) {
  3958. throw 'test';
  3959. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  3960. args: [],
  3961. source: "throwException\x0a\x09<throw 'test'>",
  3962. messageSends: [],
  3963. referencedClasses: []
  3964. }),
  3965. smalltalk.JavaScriptExceptionTest);
  3966. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3967. smalltalk.addMethod(
  3968. smalltalk.method({
  3969. selector: "testValue",
  3970. category: 'tests',
  3971. fn: function (){
  3972. var self=this;
  3973. var messageSend;
  3974. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  3975. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3976. return smalltalk.withContext(function($ctx1) {
  3977. var $1,$2,$3,$4;
  3978. $1=_st($MessageSend())._new();
  3979. $ctx1.sendIdx["new"]=1;
  3980. $2=$1;
  3981. $3=_st($Object())._new();
  3982. _st($2)._receiver_($3);
  3983. _st($1)._selector_("asString");
  3984. $4=_st($1)._yourself();
  3985. messageSend=$4;
  3986. self._assert_equals_(_st(messageSend)._value(),"an Object");
  3987. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  3988. args: [],
  3989. 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'",
  3990. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  3991. referencedClasses: ["MessageSend", "Object"]
  3992. }),
  3993. smalltalk.MessageSendTest);
  3994. smalltalk.addMethod(
  3995. smalltalk.method({
  3996. selector: "testValueWithArguments",
  3997. category: 'tests',
  3998. fn: function (){
  3999. var self=this;
  4000. var messageSend;
  4001. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4002. return smalltalk.withContext(function($ctx1) {
  4003. var $1,$2,$3,$4;
  4004. $1=_st($MessageSend())._new();
  4005. _st($1)._receiver_((2));
  4006. _st($1)._selector_("+");
  4007. $2=_st($1)._yourself();
  4008. messageSend=$2;
  4009. $3=self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4010. $ctx1.sendIdx["assert:equals:"]=1;
  4011. $4=self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4012. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4013. args: [],
  4014. 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",
  4015. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4016. referencedClasses: ["MessageSend"]
  4017. }),
  4018. smalltalk.MessageSendTest);
  4019. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4020. smalltalk.addMethod(
  4021. smalltalk.method({
  4022. selector: "codeGeneratorClass",
  4023. category: 'accessing',
  4024. fn: function (){
  4025. var self=this;
  4026. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4027. return smalltalk.withContext(function($ctx1) {
  4028. var $1;
  4029. $1=$CodeGenerator();
  4030. return $1;
  4031. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4032. args: [],
  4033. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4034. messageSends: [],
  4035. referencedClasses: ["CodeGenerator"]
  4036. }),
  4037. smalltalk.MethodInheritanceTest);
  4038. smalltalk.addMethod(
  4039. smalltalk.method({
  4040. selector: "compiler",
  4041. category: 'factory',
  4042. fn: function (){
  4043. var self=this;
  4044. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4045. return smalltalk.withContext(function($ctx1) {
  4046. var $2,$3,$1;
  4047. $2=_st($Compiler())._new();
  4048. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4049. $3=_st($2)._yourself();
  4050. $1=$3;
  4051. return $1;
  4052. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4053. args: [],
  4054. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4055. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4056. referencedClasses: ["Compiler"]
  4057. }),
  4058. smalltalk.MethodInheritanceTest);
  4059. smalltalk.addMethod(
  4060. smalltalk.method({
  4061. selector: "deinstallBottom",
  4062. category: 'testing',
  4063. fn: function (){
  4064. var self=this;
  4065. return smalltalk.withContext(function($ctx1) {
  4066. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4067. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4068. args: [],
  4069. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4070. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4071. referencedClasses: []
  4072. }),
  4073. smalltalk.MethodInheritanceTest);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "deinstallMiddle",
  4077. category: 'testing',
  4078. fn: function (){
  4079. var self=this;
  4080. return smalltalk.withContext(function($ctx1) {
  4081. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4082. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4083. args: [],
  4084. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4085. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4086. referencedClasses: []
  4087. }),
  4088. smalltalk.MethodInheritanceTest);
  4089. smalltalk.addMethod(
  4090. smalltalk.method({
  4091. selector: "deinstallTop",
  4092. category: 'testing',
  4093. fn: function (){
  4094. var self=this;
  4095. return smalltalk.withContext(function($ctx1) {
  4096. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4097. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4098. args: [],
  4099. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4100. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4101. referencedClasses: []
  4102. }),
  4103. smalltalk.MethodInheritanceTest);
  4104. smalltalk.addMethod(
  4105. smalltalk.method({
  4106. selector: "installBottom:",
  4107. category: 'testing',
  4108. fn: function (aString){
  4109. var self=this;
  4110. return smalltalk.withContext(function($ctx1) {
  4111. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  4112. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4113. args: ["aString"],
  4114. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  4115. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  4116. referencedClasses: []
  4117. }),
  4118. smalltalk.MethodInheritanceTest);
  4119. smalltalk.addMethod(
  4120. smalltalk.method({
  4121. selector: "installMiddle:",
  4122. category: 'testing',
  4123. fn: function (aString){
  4124. var self=this;
  4125. return smalltalk.withContext(function($ctx1) {
  4126. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  4127. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4128. args: ["aString"],
  4129. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  4130. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  4131. referencedClasses: []
  4132. }),
  4133. smalltalk.MethodInheritanceTest);
  4134. smalltalk.addMethod(
  4135. smalltalk.method({
  4136. selector: "installTop:",
  4137. category: 'testing',
  4138. fn: function (aString){
  4139. var self=this;
  4140. return smalltalk.withContext(function($ctx1) {
  4141. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  4142. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4143. args: ["aString"],
  4144. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  4145. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  4146. referencedClasses: []
  4147. }),
  4148. smalltalk.MethodInheritanceTest);
  4149. smalltalk.addMethod(
  4150. smalltalk.method({
  4151. selector: "setUp",
  4152. category: 'initialization',
  4153. fn: function (){
  4154. var self=this;
  4155. return smalltalk.withContext(function($ctx1) {
  4156. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4157. $ctx1.sendIdx["new"]=1;
  4158. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4159. $ctx1.sendIdx["new"]=2;
  4160. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4161. self["@method"]=nil;
  4162. self["@performBlock"]=(function(){
  4163. return smalltalk.withContext(function($ctx2) {
  4164. return self._error_("performBlock not initialized");
  4165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4166. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4167. args: [],
  4168. 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' ]",
  4169. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4170. referencedClasses: []
  4171. }),
  4172. smalltalk.MethodInheritanceTest);
  4173. smalltalk.addMethod(
  4174. smalltalk.method({
  4175. selector: "shouldMNU",
  4176. category: 'testing',
  4177. fn: function (){
  4178. var self=this;
  4179. return smalltalk.withContext(function($ctx1) {
  4180. self._shouldMNUTop();
  4181. self._shouldMNUMiddle();
  4182. self._shouldMNUBottom();
  4183. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4184. args: [],
  4185. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4186. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4187. referencedClasses: []
  4188. }),
  4189. smalltalk.MethodInheritanceTest);
  4190. smalltalk.addMethod(
  4191. smalltalk.method({
  4192. selector: "shouldMNUBottom",
  4193. category: 'testing',
  4194. fn: function (){
  4195. var self=this;
  4196. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4197. return smalltalk.withContext(function($ctx1) {
  4198. self._should_raise_((function(){
  4199. return smalltalk.withContext(function($ctx2) {
  4200. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4202. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4203. args: [],
  4204. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4205. messageSends: ["should:raise:", "value:"],
  4206. referencedClasses: ["MessageNotUnderstood"]
  4207. }),
  4208. smalltalk.MethodInheritanceTest);
  4209. smalltalk.addMethod(
  4210. smalltalk.method({
  4211. selector: "shouldMNUMiddle",
  4212. category: 'testing',
  4213. fn: function (){
  4214. var self=this;
  4215. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4216. return smalltalk.withContext(function($ctx1) {
  4217. self._should_raise_((function(){
  4218. return smalltalk.withContext(function($ctx2) {
  4219. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4221. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4222. args: [],
  4223. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4224. messageSends: ["should:raise:", "value:"],
  4225. referencedClasses: ["MessageNotUnderstood"]
  4226. }),
  4227. smalltalk.MethodInheritanceTest);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "shouldMNUTop",
  4231. category: 'testing',
  4232. fn: function (){
  4233. var self=this;
  4234. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4235. return smalltalk.withContext(function($ctx1) {
  4236. self._should_raise_((function(){
  4237. return smalltalk.withContext(function($ctx2) {
  4238. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4240. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4241. args: [],
  4242. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4243. messageSends: ["should:raise:", "value:"],
  4244. referencedClasses: ["MessageNotUnderstood"]
  4245. }),
  4246. smalltalk.MethodInheritanceTest);
  4247. smalltalk.addMethod(
  4248. smalltalk.method({
  4249. selector: "shouldReturn:",
  4250. category: 'testing',
  4251. fn: function (anObject){
  4252. var self=this;
  4253. var result;
  4254. return smalltalk.withContext(function($ctx1) {
  4255. var $1,$2,$3;
  4256. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4257. $ctx1.sendIdx["value:"]=1;
  4258. $1=self._assert_equals_(["top",anObject],["top",result]);
  4259. $ctx1.sendIdx["assert:equals:"]=1;
  4260. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4261. $ctx1.sendIdx["value:"]=2;
  4262. $2=self._assert_equals_(["middle",anObject],["middle",result]);
  4263. $ctx1.sendIdx["assert:equals:"]=2;
  4264. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4265. $3=self._assert_equals_(["bottom",anObject],["bottom",result]);
  4266. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4267. args: ["anObject"],
  4268. 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 }",
  4269. messageSends: ["value:", "assert:equals:"],
  4270. referencedClasses: []
  4271. }),
  4272. smalltalk.MethodInheritanceTest);
  4273. smalltalk.addMethod(
  4274. smalltalk.method({
  4275. selector: "shouldReturn:and:and:",
  4276. category: 'testing',
  4277. fn: function (anObject,anObject2,anObject3){
  4278. var self=this;
  4279. var result;
  4280. return smalltalk.withContext(function($ctx1) {
  4281. var $1,$2,$3;
  4282. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4283. $ctx1.sendIdx["value:"]=1;
  4284. $1=self._assert_equals_(["top",anObject],["top",result]);
  4285. $ctx1.sendIdx["assert:equals:"]=1;
  4286. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4287. $ctx1.sendIdx["value:"]=2;
  4288. $2=self._assert_equals_(["middle",anObject2],["middle",result]);
  4289. $ctx1.sendIdx["assert:equals:"]=2;
  4290. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4291. $3=self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4292. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4293. args: ["anObject", "anObject2", "anObject3"],
  4294. 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 }",
  4295. messageSends: ["value:", "assert:equals:"],
  4296. referencedClasses: []
  4297. }),
  4298. smalltalk.MethodInheritanceTest);
  4299. smalltalk.addMethod(
  4300. smalltalk.method({
  4301. selector: "targetClassBottom",
  4302. category: 'accessing',
  4303. fn: function (){
  4304. var self=this;
  4305. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4306. return smalltalk.withContext(function($ctx1) {
  4307. var $1;
  4308. $1=$JavaScriptException();
  4309. return $1;
  4310. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4311. args: [],
  4312. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4313. messageSends: [],
  4314. referencedClasses: ["JavaScriptException"]
  4315. }),
  4316. smalltalk.MethodInheritanceTest);
  4317. smalltalk.addMethod(
  4318. smalltalk.method({
  4319. selector: "targetClassMiddle",
  4320. category: 'accessing',
  4321. fn: function (){
  4322. var self=this;
  4323. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4324. return smalltalk.withContext(function($ctx1) {
  4325. var $1;
  4326. $1=$Error();
  4327. return $1;
  4328. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4329. args: [],
  4330. source: "targetClassMiddle\x0a\x09^ Error",
  4331. messageSends: [],
  4332. referencedClasses: ["Error"]
  4333. }),
  4334. smalltalk.MethodInheritanceTest);
  4335. smalltalk.addMethod(
  4336. smalltalk.method({
  4337. selector: "targetClassTop",
  4338. category: 'accessing',
  4339. fn: function (){
  4340. var self=this;
  4341. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4342. return smalltalk.withContext(function($ctx1) {
  4343. var $1;
  4344. $1=$Object();
  4345. return $1;
  4346. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4347. args: [],
  4348. source: "targetClassTop\x0a\x09^ Object",
  4349. messageSends: [],
  4350. referencedClasses: ["Object"]
  4351. }),
  4352. smalltalk.MethodInheritanceTest);
  4353. smalltalk.addMethod(
  4354. smalltalk.method({
  4355. selector: "tearDown",
  4356. category: 'initialization',
  4357. fn: function (){
  4358. var self=this;
  4359. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4360. return smalltalk.withContext(function($ctx1) {
  4361. var $1,$2,$3;
  4362. $1=_st((function(){
  4363. return smalltalk.withContext(function($ctx2) {
  4364. return self._deinstallTop();
  4365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4366. return smalltalk.withContext(function($ctx2) {
  4367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4368. $ctx1.sendIdx["on:do:"]=1;
  4369. $2=_st((function(){
  4370. return smalltalk.withContext(function($ctx2) {
  4371. return self._deinstallMiddle();
  4372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4373. return smalltalk.withContext(function($ctx2) {
  4374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4375. $ctx1.sendIdx["on:do:"]=2;
  4376. $3=_st((function(){
  4377. return smalltalk.withContext(function($ctx2) {
  4378. return self._deinstallBottom();
  4379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4380. return smalltalk.withContext(function($ctx2) {
  4381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4382. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4383. args: [],
  4384. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  4385. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4386. referencedClasses: ["Error"]
  4387. }),
  4388. smalltalk.MethodInheritanceTest);
  4389. smalltalk.addMethod(
  4390. smalltalk.method({
  4391. selector: "testMNU11",
  4392. category: 'tests',
  4393. fn: function (){
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) {
  4396. var $1,$2,$3,$4;
  4397. self["@performBlock"]=(function(x){
  4398. return smalltalk.withContext(function($ctx2) {
  4399. return _st(x)._foo();
  4400. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4401. $1=self._shouldMNU();
  4402. $ctx1.sendIdx["shouldMNU"]=1;
  4403. $2=self._installTop_("foo ^ false");
  4404. $ctx1.sendIdx["installTop:"]=1;
  4405. $3=self._installTop_("foo ^ true");
  4406. self._deinstallTop();
  4407. $4=self._shouldMNU();
  4408. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4409. args: [],
  4410. 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",
  4411. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4412. referencedClasses: []
  4413. }),
  4414. smalltalk.MethodInheritanceTest);
  4415. smalltalk.addMethod(
  4416. smalltalk.method({
  4417. selector: "testMNU22",
  4418. category: 'tests',
  4419. fn: function (){
  4420. var self=this;
  4421. return smalltalk.withContext(function($ctx1) {
  4422. var $1,$2,$3,$4;
  4423. self["@performBlock"]=(function(x){
  4424. return smalltalk.withContext(function($ctx2) {
  4425. return _st(x)._foo();
  4426. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4427. $1=self._shouldMNU();
  4428. $ctx1.sendIdx["shouldMNU"]=1;
  4429. $2=self._installMiddle_("foo ^ false");
  4430. $ctx1.sendIdx["installMiddle:"]=1;
  4431. $3=self._installMiddle_("foo ^ true");
  4432. self._deinstallMiddle();
  4433. $4=self._shouldMNU();
  4434. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4435. args: [],
  4436. 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",
  4437. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4438. referencedClasses: []
  4439. }),
  4440. smalltalk.MethodInheritanceTest);
  4441. smalltalk.addMethod(
  4442. smalltalk.method({
  4443. selector: "testReturns1",
  4444. category: 'tests',
  4445. fn: function (){
  4446. var self=this;
  4447. return smalltalk.withContext(function($ctx1) {
  4448. var $1,$2,$3,$4;
  4449. self["@performBlock"]=(function(x){
  4450. return smalltalk.withContext(function($ctx2) {
  4451. return _st(x)._foo();
  4452. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4453. $1=self._installTop_("foo ^ false");
  4454. $ctx1.sendIdx["installTop:"]=1;
  4455. $2=self._shouldReturn_(false);
  4456. $ctx1.sendIdx["shouldReturn:"]=1;
  4457. $3=self._installTop_("foo ^ true");
  4458. $4=self._shouldReturn_(true);
  4459. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4460. args: [],
  4461. 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",
  4462. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4463. referencedClasses: []
  4464. }),
  4465. smalltalk.MethodInheritanceTest);
  4466. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4467. smalltalk.addMethod(
  4468. smalltalk.method({
  4469. selector: "testAbs",
  4470. category: 'tests',
  4471. fn: function (){
  4472. var self=this;
  4473. return smalltalk.withContext(function($ctx1) {
  4474. var $2,$1,$4,$3;
  4475. $2=(4)._abs();
  4476. $ctx1.sendIdx["abs"]=1;
  4477. $1=self._assert_equals_($2,(4));
  4478. $ctx1.sendIdx["assert:equals:"]=1;
  4479. $4=(-4)._abs();
  4480. $3=self._assert_equals_($4,(4));
  4481. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4482. args: [],
  4483. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4484. messageSends: ["assert:equals:", "abs"],
  4485. referencedClasses: []
  4486. }),
  4487. smalltalk.NumberTest);
  4488. smalltalk.addMethod(
  4489. smalltalk.method({
  4490. selector: "testArithmetic",
  4491. category: 'tests',
  4492. fn: function (){
  4493. var self=this;
  4494. return smalltalk.withContext(function($ctx1) {
  4495. var $2,$1,$4,$3,$6,$5,$7,$9,$8,$10,$11,$14,$13,$12,$17,$16,$15;
  4496. $2=(1.5).__plus((1));
  4497. $ctx1.sendIdx["+"]=1;
  4498. $1=self._assert_equals_($2,(2.5));
  4499. $ctx1.sendIdx["assert:equals:"]=1;
  4500. $4=(2).__minus((1));
  4501. $ctx1.sendIdx["-"]=1;
  4502. $3=self._assert_equals_($4,(1));
  4503. $ctx1.sendIdx["assert:equals:"]=2;
  4504. $6=(-2).__minus((1));
  4505. $5=self._assert_equals_($6,(-3));
  4506. $ctx1.sendIdx["assert:equals:"]=3;
  4507. $7=self._assert_equals_((12).__slash((2)),(6));
  4508. $ctx1.sendIdx["assert:equals:"]=4;
  4509. $9=(3).__star((4));
  4510. $ctx1.sendIdx["*"]=1;
  4511. $8=self._assert_equals_($9,(12));
  4512. $ctx1.sendIdx["assert:equals:"]=5;
  4513. $10=self._assert_equals_((7).__slash_slash((2)),(3));
  4514. $ctx1.sendIdx["assert:equals:"]=6;
  4515. $11=self._assert_equals_((7).__backslash_backslash((2)),(1));
  4516. $ctx1.sendIdx["assert:equals:"]=7;
  4517. $14=(1).__plus((2));
  4518. $ctx1.sendIdx["+"]=2;
  4519. $13=_st($14).__star((3));
  4520. $ctx1.sendIdx["*"]=2;
  4521. $12=self._assert_equals_($13,(9));
  4522. $ctx1.sendIdx["assert:equals:"]=8;
  4523. $17=(2).__star((3));
  4524. $16=(1).__plus($17);
  4525. $15=self._assert_equals_($16,(7));
  4526. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4527. args: [],
  4528. 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",
  4529. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4530. referencedClasses: []
  4531. }),
  4532. smalltalk.NumberTest);
  4533. smalltalk.addMethod(
  4534. smalltalk.method({
  4535. selector: "testAsNumber",
  4536. category: 'tests',
  4537. fn: function (){
  4538. var self=this;
  4539. return smalltalk.withContext(function($ctx1) {
  4540. self._assert_equals_((3)._asNumber(),(3));
  4541. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4542. args: [],
  4543. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4544. messageSends: ["assert:equals:", "asNumber"],
  4545. referencedClasses: []
  4546. }),
  4547. smalltalk.NumberTest);
  4548. smalltalk.addMethod(
  4549. smalltalk.method({
  4550. selector: "testCeiling",
  4551. category: 'tests',
  4552. fn: function (){
  4553. var self=this;
  4554. return smalltalk.withContext(function($ctx1) {
  4555. var $2,$1,$4,$3,$6,$5;
  4556. $2=(1.2)._ceiling();
  4557. $ctx1.sendIdx["ceiling"]=1;
  4558. $1=self._assert_equals_($2,(2));
  4559. $ctx1.sendIdx["assert:equals:"]=1;
  4560. $4=(-1.2)._ceiling();
  4561. $ctx1.sendIdx["ceiling"]=2;
  4562. $3=self._assert_equals_($4,(-1));
  4563. $ctx1.sendIdx["assert:equals:"]=2;
  4564. $6=(1)._ceiling();
  4565. $5=self._assert_equals_($6,(1));
  4566. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4567. args: [],
  4568. 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.",
  4569. messageSends: ["assert:equals:", "ceiling"],
  4570. referencedClasses: []
  4571. }),
  4572. smalltalk.NumberTest);
  4573. smalltalk.addMethod(
  4574. smalltalk.method({
  4575. selector: "testComparison",
  4576. category: 'tests',
  4577. fn: function (){
  4578. var self=this;
  4579. return smalltalk.withContext(function($ctx1) {
  4580. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  4581. $2=(3).__gt((2));
  4582. $ctx1.sendIdx[">"]=1;
  4583. $1=self._assert_($2);
  4584. $ctx1.sendIdx["assert:"]=1;
  4585. $4=(2).__lt((3));
  4586. $ctx1.sendIdx["<"]=1;
  4587. $3=self._assert_($4);
  4588. $ctx1.sendIdx["assert:"]=2;
  4589. $6=(3).__lt((2));
  4590. $5=self._deny_($6);
  4591. $ctx1.sendIdx["deny:"]=1;
  4592. $8=(2).__gt((3));
  4593. $7=self._deny_($8);
  4594. $10=(3).__gt_eq((3));
  4595. $ctx1.sendIdx[">="]=1;
  4596. $9=self._assert_($10);
  4597. $ctx1.sendIdx["assert:"]=3;
  4598. $12=(3.1).__gt_eq((3));
  4599. $11=self._assert_($12);
  4600. $ctx1.sendIdx["assert:"]=4;
  4601. $14=(3).__lt_eq((3));
  4602. $ctx1.sendIdx["<="]=1;
  4603. $13=self._assert_($14);
  4604. $ctx1.sendIdx["assert:"]=5;
  4605. $16=(3).__lt_eq((3.1));
  4606. $15=self._assert_($16);
  4607. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4608. args: [],
  4609. 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",
  4610. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4611. referencedClasses: []
  4612. }),
  4613. smalltalk.NumberTest);
  4614. smalltalk.addMethod(
  4615. smalltalk.method({
  4616. selector: "testCopying",
  4617. category: 'tests',
  4618. fn: function (){
  4619. var self=this;
  4620. return smalltalk.withContext(function($ctx1) {
  4621. var $2,$1,$4,$3;
  4622. $2=_st((1)._copy()).__eq_eq((1));
  4623. $ctx1.sendIdx["=="]=1;
  4624. $1=self._assert_($2);
  4625. $ctx1.sendIdx["assert:"]=1;
  4626. $4=_st((1)._deepCopy()).__eq_eq((1));
  4627. $3=self._assert_($4);
  4628. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4629. args: [],
  4630. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4631. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4632. referencedClasses: []
  4633. }),
  4634. smalltalk.NumberTest);
  4635. smalltalk.addMethod(
  4636. smalltalk.method({
  4637. selector: "testEquality",
  4638. category: 'tests',
  4639. fn: function (){
  4640. var self=this;
  4641. return smalltalk.withContext(function($ctx1) {
  4642. 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;
  4643. $2=(1).__eq((1));
  4644. $ctx1.sendIdx["="]=1;
  4645. $1=self._assert_($2);
  4646. $ctx1.sendIdx["assert:"]=1;
  4647. $4=(0).__eq((0));
  4648. $ctx1.sendIdx["="]=2;
  4649. $3=self._assert_($4);
  4650. $ctx1.sendIdx["assert:"]=2;
  4651. $6=(1).__eq((0));
  4652. $ctx1.sendIdx["="]=3;
  4653. $5=self._deny_($6);
  4654. $ctx1.sendIdx["deny:"]=1;
  4655. $9=(1)._yourself();
  4656. $ctx1.sendIdx["yourself"]=1;
  4657. $8=_st($9).__eq((1));
  4658. $ctx1.sendIdx["="]=4;
  4659. $7=self._assert_($8);
  4660. $ctx1.sendIdx["assert:"]=3;
  4661. $12=(1)._yourself();
  4662. $ctx1.sendIdx["yourself"]=2;
  4663. $11=(1).__eq($12);
  4664. $ctx1.sendIdx["="]=5;
  4665. $10=self._assert_($11);
  4666. $ctx1.sendIdx["assert:"]=4;
  4667. $15=(1)._yourself();
  4668. $ctx1.sendIdx["yourself"]=3;
  4669. $16=(1)._yourself();
  4670. $14=_st($15).__eq($16);
  4671. $ctx1.sendIdx["="]=6;
  4672. $13=self._assert_($14);
  4673. $18=(0).__eq(false);
  4674. $ctx1.sendIdx["="]=7;
  4675. $17=self._deny_($18);
  4676. $ctx1.sendIdx["deny:"]=2;
  4677. $20=false.__eq((0));
  4678. $ctx1.sendIdx["="]=8;
  4679. $19=self._deny_($20);
  4680. $ctx1.sendIdx["deny:"]=3;
  4681. $22="".__eq((0));
  4682. $ctx1.sendIdx["="]=9;
  4683. $21=self._deny_($22);
  4684. $ctx1.sendIdx["deny:"]=4;
  4685. $24=(0).__eq("");
  4686. $23=self._deny_($24);
  4687. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4688. args: [],
  4689. 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 = ''",
  4690. messageSends: ["assert:", "=", "deny:", "yourself"],
  4691. referencedClasses: []
  4692. }),
  4693. smalltalk.NumberTest);
  4694. smalltalk.addMethod(
  4695. smalltalk.method({
  4696. selector: "testFloor",
  4697. category: 'tests',
  4698. fn: function (){
  4699. var self=this;
  4700. return smalltalk.withContext(function($ctx1) {
  4701. var $2,$1,$4,$3,$6,$5;
  4702. $2=(1.2)._floor();
  4703. $ctx1.sendIdx["floor"]=1;
  4704. $1=self._assert_equals_($2,(1));
  4705. $ctx1.sendIdx["assert:equals:"]=1;
  4706. $4=(-1.2)._floor();
  4707. $ctx1.sendIdx["floor"]=2;
  4708. $3=self._assert_equals_($4,(-2));
  4709. $ctx1.sendIdx["assert:equals:"]=2;
  4710. $6=(1)._floor();
  4711. $5=self._assert_equals_($6,(1));
  4712. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4713. args: [],
  4714. 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.",
  4715. messageSends: ["assert:equals:", "floor"],
  4716. referencedClasses: []
  4717. }),
  4718. smalltalk.NumberTest);
  4719. smalltalk.addMethod(
  4720. smalltalk.method({
  4721. selector: "testHexNumbers",
  4722. category: 'tests',
  4723. fn: function (){
  4724. var self=this;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$11,$10,$13,$12;
  4727. $1=self._assert_equals_((9),(9));
  4728. $ctx1.sendIdx["assert:equals:"]=1;
  4729. $3=(10)._truncated();
  4730. $ctx1.sendIdx["truncated"]=1;
  4731. $2=self._assert_equals_($3,(10));
  4732. $ctx1.sendIdx["assert:equals:"]=2;
  4733. $5=(11)._truncated();
  4734. $ctx1.sendIdx["truncated"]=2;
  4735. $4=self._assert_equals_($5,(11));
  4736. $ctx1.sendIdx["assert:equals:"]=3;
  4737. $7=(12)._truncated();
  4738. $ctx1.sendIdx["truncated"]=3;
  4739. $6=self._assert_equals_($7,(12));
  4740. $ctx1.sendIdx["assert:equals:"]=4;
  4741. $9=(13)._truncated();
  4742. $ctx1.sendIdx["truncated"]=4;
  4743. $8=self._assert_equals_($9,(13));
  4744. $ctx1.sendIdx["assert:equals:"]=5;
  4745. $11=(14)._truncated();
  4746. $ctx1.sendIdx["truncated"]=5;
  4747. $10=self._assert_equals_($11,(14));
  4748. $ctx1.sendIdx["assert:equals:"]=6;
  4749. $13=(15)._truncated();
  4750. $12=self._assert_equals_($13,(15));
  4751. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4752. args: [],
  4753. 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",
  4754. messageSends: ["assert:equals:", "truncated"],
  4755. referencedClasses: []
  4756. }),
  4757. smalltalk.NumberTest);
  4758. smalltalk.addMethod(
  4759. smalltalk.method({
  4760. selector: "testIdentity",
  4761. category: 'tests',
  4762. fn: function (){
  4763. var self=this;
  4764. return smalltalk.withContext(function($ctx1) {
  4765. var $2,$1,$4,$3,$6,$5,$9,$8,$7,$12,$11,$10,$15,$16,$14,$13,$18,$17;
  4766. $2=(1).__eq_eq((1));
  4767. $ctx1.sendIdx["=="]=1;
  4768. $1=self._assert_($2);
  4769. $ctx1.sendIdx["assert:"]=1;
  4770. $4=(0).__eq_eq((0));
  4771. $ctx1.sendIdx["=="]=2;
  4772. $3=self._assert_($4);
  4773. $ctx1.sendIdx["assert:"]=2;
  4774. $6=(1).__eq_eq((0));
  4775. $ctx1.sendIdx["=="]=3;
  4776. $5=self._deny_($6);
  4777. $ctx1.sendIdx["deny:"]=1;
  4778. $9=(1)._yourself();
  4779. $ctx1.sendIdx["yourself"]=1;
  4780. $8=_st($9).__eq_eq((1));
  4781. $ctx1.sendIdx["=="]=4;
  4782. $7=self._assert_($8);
  4783. $ctx1.sendIdx["assert:"]=3;
  4784. $12=(1)._yourself();
  4785. $ctx1.sendIdx["yourself"]=2;
  4786. $11=(1).__eq_eq($12);
  4787. $ctx1.sendIdx["=="]=5;
  4788. $10=self._assert_($11);
  4789. $ctx1.sendIdx["assert:"]=4;
  4790. $15=(1)._yourself();
  4791. $ctx1.sendIdx["yourself"]=3;
  4792. $16=(1)._yourself();
  4793. $14=_st($15).__eq_eq($16);
  4794. $ctx1.sendIdx["=="]=6;
  4795. $13=self._assert_($14);
  4796. $18=(1).__eq_eq((2));
  4797. $17=self._deny_($18);
  4798. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4799. args: [],
  4800. 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",
  4801. messageSends: ["assert:", "==", "deny:", "yourself"],
  4802. referencedClasses: []
  4803. }),
  4804. smalltalk.NumberTest);
  4805. smalltalk.addMethod(
  4806. smalltalk.method({
  4807. selector: "testInvalidHexNumbers",
  4808. category: 'tests',
  4809. fn: function (){
  4810. var self=this;
  4811. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4812. return smalltalk.withContext(function($ctx1) {
  4813. 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;
  4814. $1=self._should_raise_((function(){
  4815. return smalltalk.withContext(function($ctx2) {
  4816. return (16)._rG();
  4817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4818. $ctx1.sendIdx["should:raise:"]=1;
  4819. $2=self._should_raise_((function(){
  4820. return smalltalk.withContext(function($ctx2) {
  4821. return (16)._rg();
  4822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4823. $ctx1.sendIdx["should:raise:"]=2;
  4824. $3=self._should_raise_((function(){
  4825. return smalltalk.withContext(function($ctx2) {
  4826. return (16)._rH();
  4827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4828. $ctx1.sendIdx["should:raise:"]=3;
  4829. $4=self._should_raise_((function(){
  4830. return smalltalk.withContext(function($ctx2) {
  4831. return (16)._rh();
  4832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4833. $ctx1.sendIdx["should:raise:"]=4;
  4834. $5=self._should_raise_((function(){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. return (16)._rI();
  4837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4838. $ctx1.sendIdx["should:raise:"]=5;
  4839. $6=self._should_raise_((function(){
  4840. return smalltalk.withContext(function($ctx2) {
  4841. return (16)._ri();
  4842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4843. $ctx1.sendIdx["should:raise:"]=6;
  4844. $7=self._should_raise_((function(){
  4845. return smalltalk.withContext(function($ctx2) {
  4846. return (16)._rJ();
  4847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4848. $ctx1.sendIdx["should:raise:"]=7;
  4849. $8=self._should_raise_((function(){
  4850. return smalltalk.withContext(function($ctx2) {
  4851. return (16)._rj();
  4852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4853. $ctx1.sendIdx["should:raise:"]=8;
  4854. $9=self._should_raise_((function(){
  4855. return smalltalk.withContext(function($ctx2) {
  4856. return (16)._rK();
  4857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4858. $ctx1.sendIdx["should:raise:"]=9;
  4859. $10=self._should_raise_((function(){
  4860. return smalltalk.withContext(function($ctx2) {
  4861. return (16)._rk();
  4862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  4863. $ctx1.sendIdx["should:raise:"]=10;
  4864. $11=self._should_raise_((function(){
  4865. return smalltalk.withContext(function($ctx2) {
  4866. return (16)._rL();
  4867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  4868. $ctx1.sendIdx["should:raise:"]=11;
  4869. $12=self._should_raise_((function(){
  4870. return smalltalk.withContext(function($ctx2) {
  4871. return (16)._rl();
  4872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  4873. $ctx1.sendIdx["should:raise:"]=12;
  4874. $13=self._should_raise_((function(){
  4875. return smalltalk.withContext(function($ctx2) {
  4876. return (16)._rM();
  4877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  4878. $ctx1.sendIdx["should:raise:"]=13;
  4879. $14=self._should_raise_((function(){
  4880. return smalltalk.withContext(function($ctx2) {
  4881. return (16)._rm();
  4882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  4883. $ctx1.sendIdx["should:raise:"]=14;
  4884. $15=self._should_raise_((function(){
  4885. return smalltalk.withContext(function($ctx2) {
  4886. return (16)._rN();
  4887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  4888. $ctx1.sendIdx["should:raise:"]=15;
  4889. $16=self._should_raise_((function(){
  4890. return smalltalk.withContext(function($ctx2) {
  4891. return (16)._rn();
  4892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  4893. $ctx1.sendIdx["should:raise:"]=16;
  4894. $17=self._should_raise_((function(){
  4895. return smalltalk.withContext(function($ctx2) {
  4896. return (16)._rO();
  4897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  4898. $ctx1.sendIdx["should:raise:"]=17;
  4899. $18=self._should_raise_((function(){
  4900. return smalltalk.withContext(function($ctx2) {
  4901. return (16)._ro();
  4902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  4903. $ctx1.sendIdx["should:raise:"]=18;
  4904. $19=self._should_raise_((function(){
  4905. return smalltalk.withContext(function($ctx2) {
  4906. return (16)._rP();
  4907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  4908. $ctx1.sendIdx["should:raise:"]=19;
  4909. $20=self._should_raise_((function(){
  4910. return smalltalk.withContext(function($ctx2) {
  4911. return (16)._rp();
  4912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  4913. $ctx1.sendIdx["should:raise:"]=20;
  4914. $21=self._should_raise_((function(){
  4915. return smalltalk.withContext(function($ctx2) {
  4916. return (16)._rQ();
  4917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  4918. $ctx1.sendIdx["should:raise:"]=21;
  4919. $22=self._should_raise_((function(){
  4920. return smalltalk.withContext(function($ctx2) {
  4921. return (16)._rq();
  4922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  4923. $ctx1.sendIdx["should:raise:"]=22;
  4924. $23=self._should_raise_((function(){
  4925. return smalltalk.withContext(function($ctx2) {
  4926. return (16)._rR();
  4927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  4928. $ctx1.sendIdx["should:raise:"]=23;
  4929. $24=self._should_raise_((function(){
  4930. return smalltalk.withContext(function($ctx2) {
  4931. return (16)._rr();
  4932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  4933. $ctx1.sendIdx["should:raise:"]=24;
  4934. $25=self._should_raise_((function(){
  4935. return smalltalk.withContext(function($ctx2) {
  4936. return (16)._rS();
  4937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  4938. $ctx1.sendIdx["should:raise:"]=25;
  4939. $26=self._should_raise_((function(){
  4940. return smalltalk.withContext(function($ctx2) {
  4941. return (16)._rs();
  4942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  4943. $ctx1.sendIdx["should:raise:"]=26;
  4944. $27=self._should_raise_((function(){
  4945. return smalltalk.withContext(function($ctx2) {
  4946. return (16)._rT();
  4947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  4948. $ctx1.sendIdx["should:raise:"]=27;
  4949. $28=self._should_raise_((function(){
  4950. return smalltalk.withContext(function($ctx2) {
  4951. return (16)._rt();
  4952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  4953. $ctx1.sendIdx["should:raise:"]=28;
  4954. $29=self._should_raise_((function(){
  4955. return smalltalk.withContext(function($ctx2) {
  4956. return (16)._rU();
  4957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  4958. $ctx1.sendIdx["should:raise:"]=29;
  4959. $30=self._should_raise_((function(){
  4960. return smalltalk.withContext(function($ctx2) {
  4961. return (16)._ru();
  4962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  4963. $ctx1.sendIdx["should:raise:"]=30;
  4964. $31=self._should_raise_((function(){
  4965. return smalltalk.withContext(function($ctx2) {
  4966. return (16)._rV();
  4967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  4968. $ctx1.sendIdx["should:raise:"]=31;
  4969. $32=self._should_raise_((function(){
  4970. return smalltalk.withContext(function($ctx2) {
  4971. return (16)._rv();
  4972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  4973. $ctx1.sendIdx["should:raise:"]=32;
  4974. $33=self._should_raise_((function(){
  4975. return smalltalk.withContext(function($ctx2) {
  4976. return (16)._rW();
  4977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  4978. $ctx1.sendIdx["should:raise:"]=33;
  4979. $34=self._should_raise_((function(){
  4980. return smalltalk.withContext(function($ctx2) {
  4981. return (16)._rw();
  4982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  4983. $ctx1.sendIdx["should:raise:"]=34;
  4984. $35=self._should_raise_((function(){
  4985. return smalltalk.withContext(function($ctx2) {
  4986. return (16)._rX();
  4987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  4988. $ctx1.sendIdx["should:raise:"]=35;
  4989. $36=self._should_raise_((function(){
  4990. return smalltalk.withContext(function($ctx2) {
  4991. return (16)._rx();
  4992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  4993. $ctx1.sendIdx["should:raise:"]=36;
  4994. $37=self._should_raise_((function(){
  4995. return smalltalk.withContext(function($ctx2) {
  4996. return (16)._rY();
  4997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  4998. $ctx1.sendIdx["should:raise:"]=37;
  4999. $38=self._should_raise_((function(){
  5000. return smalltalk.withContext(function($ctx2) {
  5001. return (16)._ry();
  5002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5003. $ctx1.sendIdx["should:raise:"]=38;
  5004. $39=self._should_raise_((function(){
  5005. return smalltalk.withContext(function($ctx2) {
  5006. return (16)._rZ();
  5007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5008. $ctx1.sendIdx["should:raise:"]=39;
  5009. $40=self._should_raise_((function(){
  5010. return smalltalk.withContext(function($ctx2) {
  5011. return (16)._rz();
  5012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5013. $ctx1.sendIdx["should:raise:"]=40;
  5014. $41=self._should_raise_((function(){
  5015. return smalltalk.withContext(function($ctx2) {
  5016. return (11259375)._Z();
  5017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5018. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5019. args: [],
  5020. 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.",
  5021. 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"],
  5022. referencedClasses: ["MessageNotUnderstood"]
  5023. }),
  5024. smalltalk.NumberTest);
  5025. smalltalk.addMethod(
  5026. smalltalk.method({
  5027. selector: "testLog",
  5028. category: 'tests',
  5029. fn: function (){
  5030. var self=this;
  5031. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5032. return smalltalk.withContext(function($ctx1) {
  5033. var $1,$2,$3;
  5034. $1=self._assert_equals_((10000)._log(),(4));
  5035. $ctx1.sendIdx["assert:equals:"]=1;
  5036. $2=self._assert_equals_((512)._log_((2)),(9));
  5037. $ctx1.sendIdx["assert:equals:"]=2;
  5038. $3=self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5039. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5040. args: [],
  5041. 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.",
  5042. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5043. referencedClasses: ["Number"]
  5044. }),
  5045. smalltalk.NumberTest);
  5046. smalltalk.addMethod(
  5047. smalltalk.method({
  5048. selector: "testMinMax",
  5049. category: 'tests',
  5050. fn: function (){
  5051. var self=this;
  5052. return smalltalk.withContext(function($ctx1) {
  5053. var $1,$2;
  5054. $1=self._assert_equals_((2)._max_((5)),(5));
  5055. $ctx1.sendIdx["assert:equals:"]=1;
  5056. $2=self._assert_equals_((2)._min_((5)),(2));
  5057. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5058. args: [],
  5059. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5060. messageSends: ["assert:equals:", "max:", "min:"],
  5061. referencedClasses: []
  5062. }),
  5063. smalltalk.NumberTest);
  5064. smalltalk.addMethod(
  5065. smalltalk.method({
  5066. selector: "testNegated",
  5067. category: 'tests',
  5068. fn: function (){
  5069. var self=this;
  5070. return smalltalk.withContext(function($ctx1) {
  5071. var $2,$1,$4,$3;
  5072. $2=(3)._negated();
  5073. $ctx1.sendIdx["negated"]=1;
  5074. $1=self._assert_equals_($2,(-3));
  5075. $ctx1.sendIdx["assert:equals:"]=1;
  5076. $4=(-3)._negated();
  5077. $3=self._assert_equals_($4,(3));
  5078. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5079. args: [],
  5080. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5081. messageSends: ["assert:equals:", "negated"],
  5082. referencedClasses: []
  5083. }),
  5084. smalltalk.NumberTest);
  5085. smalltalk.addMethod(
  5086. smalltalk.method({
  5087. selector: "testPrintShowingDecimalPlaces",
  5088. category: 'tests',
  5089. fn: function (){
  5090. var self=this;
  5091. return smalltalk.withContext(function($ctx1) {
  5092. 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;
  5093. $2=(23)._printShowingDecimalPlaces_((2));
  5094. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5095. $1=self._assert_equals_($2,"23.00");
  5096. $ctx1.sendIdx["assert:equals:"]=1;
  5097. $4=(23.5698)._printShowingDecimalPlaces_((2));
  5098. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5099. $3=self._assert_equals_($4,"23.57");
  5100. $ctx1.sendIdx["assert:equals:"]=2;
  5101. $7=(234.567)._negated();
  5102. $ctx1.sendIdx["negated"]=1;
  5103. $6=_st($7)._printShowingDecimalPlaces_((5));
  5104. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5105. $5=self._assert_equals_($6,"-234.56700");
  5106. $ctx1.sendIdx["assert:equals:"]=3;
  5107. $9=(23.4567)._printShowingDecimalPlaces_((0));
  5108. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5109. $8=self._assert_equals_($9,"23");
  5110. $ctx1.sendIdx["assert:equals:"]=4;
  5111. $11=(23.5567)._printShowingDecimalPlaces_((0));
  5112. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5113. $10=self._assert_equals_($11,"24");
  5114. $ctx1.sendIdx["assert:equals:"]=5;
  5115. $14=(23.4567)._negated();
  5116. $ctx1.sendIdx["negated"]=2;
  5117. $13=_st($14)._printShowingDecimalPlaces_((0));
  5118. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5119. $12=self._assert_equals_($13,"-23");
  5120. $ctx1.sendIdx["assert:equals:"]=6;
  5121. $17=(23.5567)._negated();
  5122. $ctx1.sendIdx["negated"]=3;
  5123. $16=_st($17)._printShowingDecimalPlaces_((0));
  5124. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5125. $15=self._assert_equals_($16,"-24");
  5126. $ctx1.sendIdx["assert:equals:"]=7;
  5127. $19=(100000000)._printShowingDecimalPlaces_((1));
  5128. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5129. $18=self._assert_equals_($19,"100000000.0");
  5130. $ctx1.sendIdx["assert:equals:"]=8;
  5131. $21=(0.98)._printShowingDecimalPlaces_((5));
  5132. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5133. $20=self._assert_equals_($21,"0.98000");
  5134. $ctx1.sendIdx["assert:equals:"]=9;
  5135. $24=(0.98)._negated();
  5136. $23=_st($24)._printShowingDecimalPlaces_((2));
  5137. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5138. $22=self._assert_equals_($23,"-0.98");
  5139. $ctx1.sendIdx["assert:equals:"]=10;
  5140. $26=(2.567)._printShowingDecimalPlaces_((2));
  5141. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5142. $25=self._assert_equals_($26,"2.57");
  5143. $ctx1.sendIdx["assert:equals:"]=11;
  5144. $28=(-2.567)._printShowingDecimalPlaces_((2));
  5145. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5146. $27=self._assert_equals_($28,"-2.57");
  5147. $ctx1.sendIdx["assert:equals:"]=12;
  5148. $30=(0)._printShowingDecimalPlaces_((2));
  5149. $29=self._assert_equals_($30,"0.00");
  5150. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5151. args: [],
  5152. 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'.",
  5153. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5154. referencedClasses: []
  5155. }),
  5156. smalltalk.NumberTest);
  5157. smalltalk.addMethod(
  5158. smalltalk.method({
  5159. selector: "testRaisedTo",
  5160. category: 'tests',
  5161. fn: function (){
  5162. var self=this;
  5163. return smalltalk.withContext(function($ctx1) {
  5164. var $2,$1,$4,$3,$6,$5,$8,$7,$9;
  5165. $2=(2)._raisedTo_((4));
  5166. $ctx1.sendIdx["raisedTo:"]=1;
  5167. $1=self._assert_equals_($2,(16));
  5168. $ctx1.sendIdx["assert:equals:"]=1;
  5169. $4=(2)._raisedTo_((0));
  5170. $ctx1.sendIdx["raisedTo:"]=2;
  5171. $3=self._assert_equals_($4,(1));
  5172. $ctx1.sendIdx["assert:equals:"]=2;
  5173. $6=(2)._raisedTo_((-3));
  5174. $ctx1.sendIdx["raisedTo:"]=3;
  5175. $5=self._assert_equals_($6,(0.125));
  5176. $ctx1.sendIdx["assert:equals:"]=3;
  5177. $8=(4)._raisedTo_((0.5));
  5178. $7=self._assert_equals_($8,(2));
  5179. $ctx1.sendIdx["assert:equals:"]=4;
  5180. $9=self._assert_equals_((2).__star_star((4)),(16));
  5181. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5182. args: [],
  5183. 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.",
  5184. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5185. referencedClasses: []
  5186. }),
  5187. smalltalk.NumberTest);
  5188. smalltalk.addMethod(
  5189. smalltalk.method({
  5190. selector: "testRounded",
  5191. category: 'tests',
  5192. fn: function (){
  5193. var self=this;
  5194. return smalltalk.withContext(function($ctx1) {
  5195. var $2,$1,$4,$3,$6,$5;
  5196. $2=(3)._rounded();
  5197. $ctx1.sendIdx["rounded"]=1;
  5198. $1=self._assert_equals_($2,(3));
  5199. $ctx1.sendIdx["assert:equals:"]=1;
  5200. $4=(3.212)._rounded();
  5201. $ctx1.sendIdx["rounded"]=2;
  5202. $3=self._assert_equals_($4,(3));
  5203. $ctx1.sendIdx["assert:equals:"]=2;
  5204. $6=(3.51)._rounded();
  5205. $5=self._assert_equals_($6,(4));
  5206. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5207. args: [],
  5208. 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",
  5209. messageSends: ["assert:equals:", "rounded"],
  5210. referencedClasses: []
  5211. }),
  5212. smalltalk.NumberTest);
  5213. smalltalk.addMethod(
  5214. smalltalk.method({
  5215. selector: "testSign",
  5216. category: 'tests',
  5217. fn: function (){
  5218. var self=this;
  5219. return smalltalk.withContext(function($ctx1) {
  5220. var $2,$1,$4,$3,$6,$5;
  5221. $2=(5)._sign();
  5222. $ctx1.sendIdx["sign"]=1;
  5223. $1=self._assert_equals_($2,(1));
  5224. $ctx1.sendIdx["assert:equals:"]=1;
  5225. $4=(0)._sign();
  5226. $ctx1.sendIdx["sign"]=2;
  5227. $3=self._assert_equals_($4,(0));
  5228. $ctx1.sendIdx["assert:equals:"]=2;
  5229. $6=(-1.4)._sign();
  5230. $5=self._assert_equals_($6,(-1));
  5231. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5232. args: [],
  5233. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5234. messageSends: ["assert:equals:", "sign"],
  5235. referencedClasses: []
  5236. }),
  5237. smalltalk.NumberTest);
  5238. smalltalk.addMethod(
  5239. smalltalk.method({
  5240. selector: "testSqrt",
  5241. category: 'tests',
  5242. fn: function (){
  5243. var self=this;
  5244. return smalltalk.withContext(function($ctx1) {
  5245. var $2,$1,$4,$3;
  5246. $2=(4)._sqrt();
  5247. $ctx1.sendIdx["sqrt"]=1;
  5248. $1=self._assert_equals_($2,(2));
  5249. $ctx1.sendIdx["assert:equals:"]=1;
  5250. $4=(16)._sqrt();
  5251. $3=self._assert_equals_($4,(4));
  5252. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5253. args: [],
  5254. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5255. messageSends: ["assert:equals:", "sqrt"],
  5256. referencedClasses: []
  5257. }),
  5258. smalltalk.NumberTest);
  5259. smalltalk.addMethod(
  5260. smalltalk.method({
  5261. selector: "testSquared",
  5262. category: 'tests',
  5263. fn: function (){
  5264. var self=this;
  5265. return smalltalk.withContext(function($ctx1) {
  5266. self._assert_equals_((4)._squared(),(16));
  5267. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5268. args: [],
  5269. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5270. messageSends: ["assert:equals:", "squared"],
  5271. referencedClasses: []
  5272. }),
  5273. smalltalk.NumberTest);
  5274. smalltalk.addMethod(
  5275. smalltalk.method({
  5276. selector: "testTimesRepeat",
  5277. category: 'tests',
  5278. fn: function (){
  5279. var self=this;
  5280. var i;
  5281. return smalltalk.withContext(function($ctx1) {
  5282. var $1,$2,$3,$4;
  5283. i=(0);
  5284. $1=(0)._timesRepeat_((function(){
  5285. return smalltalk.withContext(function($ctx2) {
  5286. i=_st(i).__plus((1));
  5287. $ctx2.sendIdx["+"]=1;
  5288. return i;
  5289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5290. $ctx1.sendIdx["timesRepeat:"]=1;
  5291. $2=self._assert_equals_(i,(0));
  5292. $ctx1.sendIdx["assert:equals:"]=1;
  5293. $3=(5)._timesRepeat_((function(){
  5294. return smalltalk.withContext(function($ctx2) {
  5295. i=_st(i).__plus((1));
  5296. return i;
  5297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5298. $4=self._assert_equals_(i,(5));
  5299. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5300. args: [],
  5301. 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",
  5302. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5303. referencedClasses: []
  5304. }),
  5305. smalltalk.NumberTest);
  5306. smalltalk.addMethod(
  5307. smalltalk.method({
  5308. selector: "testTo",
  5309. category: 'tests',
  5310. fn: function (){
  5311. var self=this;
  5312. return smalltalk.withContext(function($ctx1) {
  5313. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5314. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5315. args: [],
  5316. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5317. messageSends: ["assert:equals:", "to:"],
  5318. referencedClasses: []
  5319. }),
  5320. smalltalk.NumberTest);
  5321. smalltalk.addMethod(
  5322. smalltalk.method({
  5323. selector: "testToBy",
  5324. category: 'tests',
  5325. fn: function (){
  5326. var self=this;
  5327. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5328. return smalltalk.withContext(function($ctx1) {
  5329. var $1;
  5330. $1=(0)._to_by_((6),(2));
  5331. $ctx1.sendIdx["to:by:"]=1;
  5332. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5333. self._should_raise_((function(){
  5334. return smalltalk.withContext(function($ctx2) {
  5335. return (1)._to_by_((4),(0));
  5336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5337. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5338. args: [],
  5339. 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",
  5340. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5341. referencedClasses: ["Error"]
  5342. }),
  5343. smalltalk.NumberTest);
  5344. smalltalk.addMethod(
  5345. smalltalk.method({
  5346. selector: "testTrigonometry",
  5347. category: 'tests',
  5348. fn: function (){
  5349. var self=this;
  5350. return smalltalk.withContext(function($ctx1) {
  5351. var $1,$2,$3,$4,$5,$6;
  5352. $1=self._assert_equals_((0)._cos(),(1));
  5353. $ctx1.sendIdx["assert:equals:"]=1;
  5354. $2=self._assert_equals_((0)._sin(),(0));
  5355. $ctx1.sendIdx["assert:equals:"]=2;
  5356. $3=self._assert_equals_((0)._tan(),(0));
  5357. $ctx1.sendIdx["assert:equals:"]=3;
  5358. $4=self._assert_equals_((1)._arcCos(),(0));
  5359. $ctx1.sendIdx["assert:equals:"]=4;
  5360. $5=self._assert_equals_((0)._arcSin(),(0));
  5361. $ctx1.sendIdx["assert:equals:"]=5;
  5362. $6=self._assert_equals_((0)._arcTan(),(0));
  5363. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5364. args: [],
  5365. 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.",
  5366. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5367. referencedClasses: []
  5368. }),
  5369. smalltalk.NumberTest);
  5370. smalltalk.addMethod(
  5371. smalltalk.method({
  5372. selector: "testTruncated",
  5373. category: 'tests',
  5374. fn: function (){
  5375. var self=this;
  5376. return smalltalk.withContext(function($ctx1) {
  5377. var $2,$1,$4,$3,$6,$5;
  5378. $2=(3)._truncated();
  5379. $ctx1.sendIdx["truncated"]=1;
  5380. $1=self._assert_equals_($2,(3));
  5381. $ctx1.sendIdx["assert:equals:"]=1;
  5382. $4=(3.212)._truncated();
  5383. $ctx1.sendIdx["truncated"]=2;
  5384. $3=self._assert_equals_($4,(3));
  5385. $ctx1.sendIdx["assert:equals:"]=2;
  5386. $6=(3.51)._truncated();
  5387. $5=self._assert_equals_($6,(3));
  5388. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5389. args: [],
  5390. 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",
  5391. messageSends: ["assert:equals:", "truncated"],
  5392. referencedClasses: []
  5393. }),
  5394. smalltalk.NumberTest);
  5395. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5396. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5397. smalltalk.addMethod(
  5398. smalltalk.method({
  5399. selector: "foo",
  5400. category: 'not yet classified',
  5401. fn: function (){
  5402. var self=this;
  5403. return smalltalk.withContext(function($ctx1) {
  5404. var $1;
  5405. $1=self["@foo"];
  5406. return $1;
  5407. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5408. args: [],
  5409. source: "foo\x0a\x09^foo",
  5410. messageSends: [],
  5411. referencedClasses: []
  5412. }),
  5413. smalltalk.ObjectMock);
  5414. smalltalk.addMethod(
  5415. smalltalk.method({
  5416. selector: "foo:",
  5417. category: 'not yet classified',
  5418. fn: function (anObject){
  5419. var self=this;
  5420. return smalltalk.withContext(function($ctx1) {
  5421. self["@foo"]=anObject;
  5422. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5423. args: ["anObject"],
  5424. source: "foo: anObject\x0a\x09foo := anObject",
  5425. messageSends: [],
  5426. referencedClasses: []
  5427. }),
  5428. smalltalk.ObjectMock);
  5429. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5430. smalltalk.addMethod(
  5431. smalltalk.method({
  5432. selector: "notDefined",
  5433. category: 'tests',
  5434. fn: function (){
  5435. var self=this;
  5436. return smalltalk.withContext(function($ctx1) {
  5437. return void 0;;
  5438. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5439. args: [],
  5440. source: "notDefined\x0a\x09<return void 0;>",
  5441. messageSends: [],
  5442. referencedClasses: []
  5443. }),
  5444. smalltalk.ObjectTest);
  5445. smalltalk.addMethod(
  5446. smalltalk.method({
  5447. selector: "testBasicAccess",
  5448. category: 'tests',
  5449. fn: function (){
  5450. var self=this;
  5451. var o;
  5452. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5453. return smalltalk.withContext(function($ctx1) {
  5454. var $2,$1,$4,$3;
  5455. o=_st($Object())._new();
  5456. _st(o)._basicAt_put_("a",(1));
  5457. $2=_st(o)._basicAt_("a");
  5458. $ctx1.sendIdx["basicAt:"]=1;
  5459. $1=self._assert_equals_($2,(1));
  5460. $ctx1.sendIdx["assert:equals:"]=1;
  5461. $4=_st(o)._basicAt_("b");
  5462. $3=self._assert_equals_($4,nil);
  5463. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5464. args: [],
  5465. 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",
  5466. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5467. referencedClasses: ["Object"]
  5468. }),
  5469. smalltalk.ObjectTest);
  5470. smalltalk.addMethod(
  5471. smalltalk.method({
  5472. selector: "testBasicPerform",
  5473. category: 'tests',
  5474. fn: function (){
  5475. var self=this;
  5476. var o;
  5477. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5478. return smalltalk.withContext(function($ctx1) {
  5479. var $1,$2,$3,$4;
  5480. o=_st($Object())._new();
  5481. $1=_st(o)._basicAt_put_("func",(function(){
  5482. return smalltalk.withContext(function($ctx2) {
  5483. return "hello";
  5484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5485. $ctx1.sendIdx["basicAt:put:"]=1;
  5486. $2=_st(o)._basicAt_put_("func2",(function(a){
  5487. return smalltalk.withContext(function($ctx2) {
  5488. return _st(a).__plus((1));
  5489. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5490. $3=self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5491. $ctx1.sendIdx["assert:equals:"]=1;
  5492. $4=self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5493. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5494. args: [],
  5495. 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",
  5496. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5497. referencedClasses: ["Object"]
  5498. }),
  5499. smalltalk.ObjectTest);
  5500. smalltalk.addMethod(
  5501. smalltalk.method({
  5502. selector: "testDNU",
  5503. category: 'tests',
  5504. fn: function (){
  5505. var self=this;
  5506. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5507. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5508. return smalltalk.withContext(function($ctx1) {
  5509. self._should_raise_((function(){
  5510. return smalltalk.withContext(function($ctx2) {
  5511. return _st(_st($Object())._new())._foo();
  5512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5513. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5514. args: [],
  5515. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  5516. messageSends: ["should:raise:", "foo", "new"],
  5517. referencedClasses: ["Object", "MessageNotUnderstood"]
  5518. }),
  5519. smalltalk.ObjectTest);
  5520. smalltalk.addMethod(
  5521. smalltalk.method({
  5522. selector: "testEquality",
  5523. category: 'tests',
  5524. fn: function (){
  5525. var self=this;
  5526. var o;
  5527. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5528. return smalltalk.withContext(function($ctx1) {
  5529. var $2,$3,$1,$5,$4,$8,$7,$6,$11,$12,$10,$9;
  5530. o=_st($Object())._new();
  5531. $ctx1.sendIdx["new"]=1;
  5532. $2=o;
  5533. $3=_st($Object())._new();
  5534. $1=_st($2).__eq($3);
  5535. $ctx1.sendIdx["="]=1;
  5536. self._deny_($1);
  5537. $5=_st(o).__eq(o);
  5538. $ctx1.sendIdx["="]=2;
  5539. $4=self._assert_($5);
  5540. $ctx1.sendIdx["assert:"]=1;
  5541. $8=_st(o)._yourself();
  5542. $ctx1.sendIdx["yourself"]=1;
  5543. $7=_st($8).__eq(o);
  5544. $ctx1.sendIdx["="]=3;
  5545. $6=self._assert_($7);
  5546. $ctx1.sendIdx["assert:"]=2;
  5547. $11=o;
  5548. $12=_st(o)._yourself();
  5549. $10=_st($11).__eq($12);
  5550. $9=self._assert_($10);
  5551. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5552. args: [],
  5553. 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)",
  5554. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5555. referencedClasses: ["Object"]
  5556. }),
  5557. smalltalk.ObjectTest);
  5558. smalltalk.addMethod(
  5559. smalltalk.method({
  5560. selector: "testHalt",
  5561. category: 'tests',
  5562. fn: function (){
  5563. var self=this;
  5564. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5565. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5566. return smalltalk.withContext(function($ctx1) {
  5567. self._should_raise_((function(){
  5568. return smalltalk.withContext(function($ctx2) {
  5569. return _st(_st($Object())._new())._halt();
  5570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5571. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5572. args: [],
  5573. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  5574. messageSends: ["should:raise:", "halt", "new"],
  5575. referencedClasses: ["Object", "Error"]
  5576. }),
  5577. smalltalk.ObjectTest);
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "testIdentity",
  5581. category: 'tests',
  5582. fn: function (){
  5583. var self=this;
  5584. var o;
  5585. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5586. return smalltalk.withContext(function($ctx1) {
  5587. var $2,$3,$1,$5,$4,$8,$7,$6,$11,$12,$10,$9;
  5588. o=_st($Object())._new();
  5589. $ctx1.sendIdx["new"]=1;
  5590. $2=o;
  5591. $3=_st($Object())._new();
  5592. $1=_st($2).__eq_eq($3);
  5593. $ctx1.sendIdx["=="]=1;
  5594. self._deny_($1);
  5595. $5=_st(o).__eq_eq(o);
  5596. $ctx1.sendIdx["=="]=2;
  5597. $4=self._assert_($5);
  5598. $ctx1.sendIdx["assert:"]=1;
  5599. $8=_st(o)._yourself();
  5600. $ctx1.sendIdx["yourself"]=1;
  5601. $7=_st($8).__eq_eq(o);
  5602. $ctx1.sendIdx["=="]=3;
  5603. $6=self._assert_($7);
  5604. $ctx1.sendIdx["assert:"]=2;
  5605. $11=o;
  5606. $12=_st(o)._yourself();
  5607. $10=_st($11).__eq_eq($12);
  5608. $9=self._assert_($10);
  5609. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5610. args: [],
  5611. 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",
  5612. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5613. referencedClasses: ["Object"]
  5614. }),
  5615. smalltalk.ObjectTest);
  5616. smalltalk.addMethod(
  5617. smalltalk.method({
  5618. selector: "testIfNil",
  5619. category: 'tests',
  5620. fn: function (){
  5621. var self=this;
  5622. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5623. return smalltalk.withContext(function($ctx1) {
  5624. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  5625. $3=_st($Object())._new();
  5626. $ctx1.sendIdx["new"]=1;
  5627. $2=_st($3)._isNil();
  5628. $1=self._deny_($2);
  5629. $ctx1.sendIdx["deny:"]=1;
  5630. $7=_st($Object())._new();
  5631. $ctx1.sendIdx["new"]=2;
  5632. if(($receiver = $7) == nil || $receiver == null){
  5633. $6=true;
  5634. } else {
  5635. $6=$7;
  5636. };
  5637. $5=_st($6).__eq(true);
  5638. $4=self._deny_($5);
  5639. $10=_st($Object())._new();
  5640. $ctx1.sendIdx["new"]=3;
  5641. if(($receiver = $10) == nil || $receiver == null){
  5642. $9=$10;
  5643. } else {
  5644. $9=true;
  5645. };
  5646. $8=self._assert_equals_($9,true);
  5647. $ctx1.sendIdx["assert:equals:"]=1;
  5648. $13=_st($Object())._new();
  5649. $ctx1.sendIdx["new"]=4;
  5650. if(($receiver = $13) == nil || $receiver == null){
  5651. $12=false;
  5652. } else {
  5653. $12=true;
  5654. };
  5655. $11=self._assert_equals_($12,true);
  5656. $ctx1.sendIdx["assert:equals:"]=2;
  5657. $16=_st($Object())._new();
  5658. if(($receiver = $16) == nil || $receiver == null){
  5659. $15=false;
  5660. } else {
  5661. $15=true;
  5662. };
  5663. $14=self._assert_equals_($15,true);
  5664. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5665. args: [],
  5666. 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",
  5667. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5668. referencedClasses: ["Object"]
  5669. }),
  5670. smalltalk.ObjectTest);
  5671. smalltalk.addMethod(
  5672. smalltalk.method({
  5673. selector: "testInstVars",
  5674. category: 'tests',
  5675. fn: function (){
  5676. var self=this;
  5677. var o;
  5678. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5679. return smalltalk.withContext(function($ctx1) {
  5680. var $2,$1,$4,$3,$6,$5;
  5681. o=_st($ObjectMock())._new();
  5682. $2=_st(o)._instVarAt_("foo");
  5683. $ctx1.sendIdx["instVarAt:"]=1;
  5684. $1=self._assert_equals_($2,nil);
  5685. $ctx1.sendIdx["assert:equals:"]=1;
  5686. _st(o)._instVarAt_put_("foo",(1));
  5687. $4=_st(o)._instVarAt_("foo");
  5688. $ctx1.sendIdx["instVarAt:"]=2;
  5689. $3=self._assert_equals_($4,(1));
  5690. $ctx1.sendIdx["assert:equals:"]=2;
  5691. $6=_st(o)._instVarAt_("foo");
  5692. $5=self._assert_equals_($6,(1));
  5693. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5694. args: [],
  5695. 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",
  5696. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5697. referencedClasses: ["ObjectMock"]
  5698. }),
  5699. smalltalk.ObjectTest);
  5700. smalltalk.addMethod(
  5701. smalltalk.method({
  5702. selector: "testNilUndefined",
  5703. category: 'tests',
  5704. fn: function (){
  5705. var self=this;
  5706. return smalltalk.withContext(function($ctx1) {
  5707. self._assert_equals_(self._notDefined(),nil);
  5708. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5709. args: [],
  5710. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5711. messageSends: ["assert:equals:", "notDefined"],
  5712. referencedClasses: []
  5713. }),
  5714. smalltalk.ObjectTest);
  5715. smalltalk.addMethod(
  5716. smalltalk.method({
  5717. selector: "testYourself",
  5718. category: 'tests',
  5719. fn: function (){
  5720. var self=this;
  5721. var o;
  5722. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5723. return smalltalk.withContext(function($ctx1) {
  5724. o=_st($ObjectMock())._new();
  5725. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5726. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5727. args: [],
  5728. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5729. messageSends: ["new", "assert:", "==", "yourself"],
  5730. referencedClasses: ["ObjectMock"]
  5731. }),
  5732. smalltalk.ObjectTest);
  5733. smalltalk.addMethod(
  5734. smalltalk.method({
  5735. selector: "testidentityHash",
  5736. category: 'tests',
  5737. fn: function (){
  5738. var self=this;
  5739. var o1,o2;
  5740. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5741. return smalltalk.withContext(function($ctx1) {
  5742. var $2,$3,$1,$5,$6,$4;
  5743. o1=_st($Object())._new();
  5744. $ctx1.sendIdx["new"]=1;
  5745. o2=_st($Object())._new();
  5746. $2=_st(o1)._identityHash();
  5747. $ctx1.sendIdx["identityHash"]=1;
  5748. $3=_st(o1)._identityHash();
  5749. $ctx1.sendIdx["identityHash"]=2;
  5750. $1=_st($2).__eq_eq($3);
  5751. $ctx1.sendIdx["=="]=1;
  5752. self._assert_($1);
  5753. $5=_st(o1)._identityHash();
  5754. $ctx1.sendIdx["identityHash"]=3;
  5755. $6=_st(o2)._identityHash();
  5756. $4=_st($5).__eq_eq($6);
  5757. self._deny_($4);
  5758. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5759. args: [],
  5760. 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",
  5761. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5762. referencedClasses: ["Object"]
  5763. }),
  5764. smalltalk.ObjectTest);
  5765. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5766. smalltalk.addMethod(
  5767. smalltalk.method({
  5768. selector: "testAccessing",
  5769. category: 'tests',
  5770. fn: function (){
  5771. var self=this;
  5772. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5773. return smalltalk.withContext(function($ctx1) {
  5774. var $3,$2,$1,$6,$5,$4,$10,$9,$8,$7,$14,$13,$12,$11;
  5775. $3=_st($Point())._x_y_((3),(4));
  5776. $ctx1.sendIdx["x:y:"]=1;
  5777. $2=_st($3)._x();
  5778. $ctx1.sendIdx["x"]=1;
  5779. $1=self._assert_equals_($2,(3));
  5780. $ctx1.sendIdx["assert:equals:"]=1;
  5781. $6=_st($Point())._x_y_((3),(4));
  5782. $5=_st($6)._y();
  5783. $ctx1.sendIdx["y"]=1;
  5784. $4=self._assert_equals_($5,(4));
  5785. $ctx1.sendIdx["assert:equals:"]=2;
  5786. $10=_st($Point())._new();
  5787. $ctx1.sendIdx["new"]=1;
  5788. $9=_st($10)._x_((3));
  5789. $8=_st($9)._x();
  5790. $7=self._assert_equals_($8,(3));
  5791. $ctx1.sendIdx["assert:equals:"]=3;
  5792. $14=_st($Point())._new();
  5793. $13=_st($14)._y_((4));
  5794. $12=_st($13)._y();
  5795. $11=self._assert_equals_($12,(4));
  5796. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5797. args: [],
  5798. 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",
  5799. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5800. referencedClasses: ["Point"]
  5801. }),
  5802. smalltalk.PointTest);
  5803. smalltalk.addMethod(
  5804. smalltalk.method({
  5805. selector: "testArithmetic",
  5806. category: 'tests',
  5807. fn: function (){
  5808. var self=this;
  5809. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5810. return smalltalk.withContext(function($ctx1) {
  5811. var $3,$4,$2,$5,$1,$8,$9,$7,$10,$6,$13,$14,$12,$15,$11,$18,$19,$17,$20,$16;
  5812. $3=(3).__at((4));
  5813. $ctx1.sendIdx["@"]=1;
  5814. $4=(3).__at((4));
  5815. $ctx1.sendIdx["@"]=2;
  5816. $2=_st($3).__star($4);
  5817. $5=_st($Point())._x_y_((9),(16));
  5818. $ctx1.sendIdx["x:y:"]=1;
  5819. $1=self._assert_equals_($2,$5);
  5820. $ctx1.sendIdx["assert:equals:"]=1;
  5821. $8=(3).__at((4));
  5822. $ctx1.sendIdx["@"]=3;
  5823. $9=(3).__at((4));
  5824. $ctx1.sendIdx["@"]=4;
  5825. $7=_st($8).__plus($9);
  5826. $10=_st($Point())._x_y_((6),(8));
  5827. $ctx1.sendIdx["x:y:"]=2;
  5828. $6=self._assert_equals_($7,$10);
  5829. $ctx1.sendIdx["assert:equals:"]=2;
  5830. $13=(3).__at((4));
  5831. $ctx1.sendIdx["@"]=5;
  5832. $14=(3).__at((4));
  5833. $ctx1.sendIdx["@"]=6;
  5834. $12=_st($13).__minus($14);
  5835. $15=_st($Point())._x_y_((0),(0));
  5836. $ctx1.sendIdx["x:y:"]=3;
  5837. $11=self._assert_equals_($12,$15);
  5838. $ctx1.sendIdx["assert:equals:"]=3;
  5839. $18=(6).__at((8));
  5840. $ctx1.sendIdx["@"]=7;
  5841. $19=(3).__at((4));
  5842. $17=_st($18).__slash($19);
  5843. $20=_st($Point())._x_y_((2),(2));
  5844. $16=self._assert_equals_($17,$20);
  5845. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5846. args: [],
  5847. 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)",
  5848. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5849. referencedClasses: ["Point"]
  5850. }),
  5851. smalltalk.PointTest);
  5852. smalltalk.addMethod(
  5853. smalltalk.method({
  5854. selector: "testAt",
  5855. category: 'tests',
  5856. fn: function (){
  5857. var self=this;
  5858. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5859. return smalltalk.withContext(function($ctx1) {
  5860. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5861. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5862. args: [],
  5863. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5864. messageSends: ["assert:equals:", "@", "x:y:"],
  5865. referencedClasses: ["Point"]
  5866. }),
  5867. smalltalk.PointTest);
  5868. smalltalk.addMethod(
  5869. smalltalk.method({
  5870. selector: "testEgality",
  5871. category: 'tests',
  5872. fn: function (){
  5873. var self=this;
  5874. return smalltalk.withContext(function($ctx1) {
  5875. var $2,$3,$1,$5,$6,$4;
  5876. $2=(3).__at((4));
  5877. $ctx1.sendIdx["@"]=1;
  5878. $3=(3).__at((4));
  5879. $ctx1.sendIdx["@"]=2;
  5880. $1=_st($2).__eq($3);
  5881. $ctx1.sendIdx["="]=1;
  5882. self._assert_($1);
  5883. $5=(3).__at((5));
  5884. $ctx1.sendIdx["@"]=3;
  5885. $6=(3).__at((6));
  5886. $4=_st($5).__eq($6);
  5887. self._deny_($4);
  5888. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5889. args: [],
  5890. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5891. messageSends: ["assert:", "=", "@", "deny:"],
  5892. referencedClasses: []
  5893. }),
  5894. smalltalk.PointTest);
  5895. smalltalk.addMethod(
  5896. smalltalk.method({
  5897. selector: "testNew",
  5898. category: 'tests',
  5899. fn: function (){
  5900. var self=this;
  5901. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5902. return smalltalk.withContext(function($ctx1) {
  5903. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._y(),nil);
  5904. self._deny_(_st(_st(_st(_st($Point())._new())._x_((3)))._x()).__eq((0)));
  5905. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._x(),nil);
  5906. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  5907. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  5908. args: [],
  5909. 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.",
  5910. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  5911. referencedClasses: ["Point"]
  5912. }),
  5913. smalltalk.PointTest);
  5914. smalltalk.addMethod(
  5915. smalltalk.method({
  5916. selector: "testTranslateBy",
  5917. category: 'tests',
  5918. fn: function (){
  5919. var self=this;
  5920. return smalltalk.withContext(function($ctx1) {
  5921. var $3,$4,$2,$5,$1,$8,$10,$9,$7,$11,$6,$14,$15,$13,$16,$12,$19,$21,$20,$18,$22,$17;
  5922. $3=(3).__at((3));
  5923. $ctx1.sendIdx["@"]=1;
  5924. $4=(0).__at((1));
  5925. $ctx1.sendIdx["@"]=2;
  5926. $2=_st($3)._translateBy_($4);
  5927. $ctx1.sendIdx["translateBy:"]=1;
  5928. $5=(3).__at((4));
  5929. $ctx1.sendIdx["@"]=3;
  5930. $1=self._assert_equals_($2,$5);
  5931. $ctx1.sendIdx["assert:equals:"]=1;
  5932. $8=(3).__at((3));
  5933. $ctx1.sendIdx["@"]=4;
  5934. $10=(1)._negated();
  5935. $ctx1.sendIdx["negated"]=1;
  5936. $9=(0).__at($10);
  5937. $ctx1.sendIdx["@"]=5;
  5938. $7=_st($8)._translateBy_($9);
  5939. $ctx1.sendIdx["translateBy:"]=2;
  5940. $11=(3).__at((2));
  5941. $ctx1.sendIdx["@"]=6;
  5942. $6=self._assert_equals_($7,$11);
  5943. $ctx1.sendIdx["assert:equals:"]=2;
  5944. $14=(3).__at((3));
  5945. $ctx1.sendIdx["@"]=7;
  5946. $15=(2).__at((3));
  5947. $ctx1.sendIdx["@"]=8;
  5948. $13=_st($14)._translateBy_($15);
  5949. $ctx1.sendIdx["translateBy:"]=3;
  5950. $16=(5).__at((6));
  5951. $ctx1.sendIdx["@"]=9;
  5952. $12=self._assert_equals_($13,$16);
  5953. $ctx1.sendIdx["assert:equals:"]=3;
  5954. $19=(3).__at((3));
  5955. $ctx1.sendIdx["@"]=10;
  5956. $21=(3)._negated();
  5957. $20=_st($21).__at((0));
  5958. $ctx1.sendIdx["@"]=11;
  5959. $18=_st($19)._translateBy_($20);
  5960. $22=(0).__at((3));
  5961. $17=self._assert_equals_($18,$22);
  5962. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  5963. args: [],
  5964. 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.",
  5965. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  5966. referencedClasses: []
  5967. }),
  5968. smalltalk.PointTest);
  5969. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5970. smalltalk.addMethod(
  5971. smalltalk.method({
  5972. selector: "testNextIfAbsent",
  5973. category: 'not yet classified',
  5974. fn: function (){
  5975. var self=this;
  5976. var queue;
  5977. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  5978. return smalltalk.withContext(function($ctx1) {
  5979. queue=_st($Queue())._new();
  5980. _st(queue)._nextPut_("index1");
  5981. self._assert_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  5982. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  5983. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  5984. args: [],
  5985. 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'.",
  5986. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  5987. referencedClasses: ["Queue"]
  5988. }),
  5989. smalltalk.QueueTest);
  5990. smalltalk.addMethod(
  5991. smalltalk.method({
  5992. selector: "testQueueNext",
  5993. category: 'not yet classified',
  5994. fn: function (){
  5995. var self=this;
  5996. var queue;
  5997. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  5998. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5999. return smalltalk.withContext(function($ctx1) {
  6000. var $1,$2;
  6001. queue=_st($Queue())._new();
  6002. $1=queue;
  6003. _st($1)._nextPut_("index1");
  6004. $2=_st($1)._nextPut_("index2");
  6005. self._assert_(_st(_st(queue)._next()).__eq("index1"));
  6006. self._deny_(_st(_st(queue)._next()).__eq("index"));
  6007. self._should_raise_((function(){
  6008. return smalltalk.withContext(function($ctx2) {
  6009. return _st(queue)._next();
  6010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6011. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6012. args: [],
  6013. source: "testQueueNext\x0a\x09|queue| \x0a\x09queue:= Queue new.\x0a\x09queue nextPut: 'index1' ;\x0a\x09nextPut: 'index2' . \x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should:[ queue next ] raise: Error.",
  6014. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6015. referencedClasses: ["Queue", "Error"]
  6016. }),
  6017. smalltalk.QueueTest);
  6018. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6019. smalltalk.addMethod(
  6020. smalltalk.method({
  6021. selector: "testAtRandomNumber",
  6022. category: 'tests',
  6023. fn: function (){
  6024. var self=this;
  6025. var val;
  6026. return smalltalk.withContext(function($ctx1) {
  6027. (100)._timesRepeat_((function(){
  6028. return smalltalk.withContext(function($ctx2) {
  6029. val=(10)._atRandom();
  6030. val;
  6031. self._assert_(_st(val).__gt((0)));
  6032. return self._assert_(_st(val).__lt((11)));
  6033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6034. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6035. args: [],
  6036. 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]",
  6037. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6038. referencedClasses: []
  6039. }),
  6040. smalltalk.RandomTest);
  6041. smalltalk.addMethod(
  6042. smalltalk.method({
  6043. selector: "testAtRandomSequenceableCollection",
  6044. category: 'tests',
  6045. fn: function (){
  6046. var self=this;
  6047. var val;
  6048. return smalltalk.withContext(function($ctx1) {
  6049. (100)._timesRepeat_((function(){
  6050. return smalltalk.withContext(function($ctx2) {
  6051. val="abc"._atRandom();
  6052. val;
  6053. return self._assert_(_st(_st(_st(val).__eq("a")).__or(_st(val).__eq("b"))).__or(_st(val).__eq("c")));
  6054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6055. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6056. args: [],
  6057. 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].",
  6058. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6059. referencedClasses: []
  6060. }),
  6061. smalltalk.RandomTest);
  6062. smalltalk.addMethod(
  6063. smalltalk.method({
  6064. selector: "textNext",
  6065. category: 'tests',
  6066. fn: function (){
  6067. var self=this;
  6068. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6069. return smalltalk.withContext(function($ctx1) {
  6070. var $1;
  6071. (10000)._timesRepeat_((function(){
  6072. var current,next;
  6073. return smalltalk.withContext(function($ctx2) {
  6074. next=_st(_st($Random())._new())._next();
  6075. next;
  6076. self._assert_(_st(next).__gt_eq((0)));
  6077. $ctx2.sendIdx["assert:"]=1;
  6078. self._assert_(_st(next).__lt((1)));
  6079. $1=_st(current).__eq(next);
  6080. $ctx2.sendIdx["="]=1;
  6081. self._deny_($1);
  6082. return _st(next).__eq(current);
  6083. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6084. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6085. args: [],
  6086. 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]",
  6087. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6088. referencedClasses: ["Random"]
  6089. }),
  6090. smalltalk.RandomTest);
  6091. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6092. smalltalk.addMethod(
  6093. smalltalk.method({
  6094. selector: "testAddRemove",
  6095. category: 'tests',
  6096. fn: function (){
  6097. var self=this;
  6098. var set;
  6099. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6100. return smalltalk.withContext(function($ctx1) {
  6101. var $1,$2,$4,$3,$5,$7,$6,$8;
  6102. set=_st($Set())._new();
  6103. $1=self._assert_(_st(set)._isEmpty());
  6104. $ctx1.sendIdx["assert:"]=1;
  6105. $2=_st(set)._add_((3));
  6106. $ctx1.sendIdx["add:"]=1;
  6107. $4=_st(set)._includes_((3));
  6108. $ctx1.sendIdx["includes:"]=1;
  6109. $3=self._assert_($4);
  6110. $ctx1.sendIdx["assert:"]=2;
  6111. $5=_st(set)._add_((5));
  6112. $7=_st(set)._includes_((5));
  6113. $ctx1.sendIdx["includes:"]=2;
  6114. $6=self._assert_($7);
  6115. _st(set)._remove_((3));
  6116. $8=_st(set)._includes_((3));
  6117. self._deny_($8);
  6118. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6119. args: [],
  6120. 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)",
  6121. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6122. referencedClasses: ["Set"]
  6123. }),
  6124. smalltalk.SetTest);
  6125. smalltalk.addMethod(
  6126. smalltalk.method({
  6127. selector: "testAt",
  6128. category: 'tests',
  6129. fn: function (){
  6130. var self=this;
  6131. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6132. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6133. return smalltalk.withContext(function($ctx1) {
  6134. self._should_raise_((function(){
  6135. return smalltalk.withContext(function($ctx2) {
  6136. return _st(_st($Set())._new())._at_put_((1),(2));
  6137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6138. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6139. args: [],
  6140. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  6141. messageSends: ["should:raise:", "at:put:", "new"],
  6142. referencedClasses: ["Set", "Error"]
  6143. }),
  6144. smalltalk.SetTest);
  6145. smalltalk.addMethod(
  6146. smalltalk.method({
  6147. selector: "testCollect",
  6148. category: 'tests',
  6149. fn: function (){
  6150. var self=this;
  6151. return smalltalk.withContext(function($ctx1) {
  6152. var $2,$1,$3;
  6153. $2=[(5), (6), (8)]._asSet();
  6154. $ctx1.sendIdx["asSet"]=1;
  6155. $1=_st($2)._collect_((function(x){
  6156. return smalltalk.withContext(function($ctx2) {
  6157. return _st(x).__backslash_backslash((3));
  6158. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6159. $3=[(0), (2)]._asSet();
  6160. self._assert_equals_($1,$3);
  6161. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6162. args: [],
  6163. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6164. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6165. referencedClasses: []
  6166. }),
  6167. smalltalk.SetTest);
  6168. smalltalk.addMethod(
  6169. smalltalk.method({
  6170. selector: "testComparing",
  6171. category: 'tests',
  6172. fn: function (){
  6173. var self=this;
  6174. return smalltalk.withContext(function($ctx1) {
  6175. var $2,$3,$1,$5,$6,$4,$9,$10,$8,$7,$13,$14,$12,$11;
  6176. $2=[(0), (2)]._asSet();
  6177. $ctx1.sendIdx["asSet"]=1;
  6178. $3=[(0), (2)]._asSet();
  6179. $ctx1.sendIdx["asSet"]=2;
  6180. $1=self._assert_equals_($2,$3);
  6181. $ctx1.sendIdx["assert:equals:"]=1;
  6182. $5=[(2), (0)]._asSet();
  6183. $ctx1.sendIdx["asSet"]=3;
  6184. $6=[(0), (2)]._asSet();
  6185. $ctx1.sendIdx["asSet"]=4;
  6186. $4=self._assert_equals_($5,$6);
  6187. $9=[(0), (2), (3)]._asSet();
  6188. $ctx1.sendIdx["asSet"]=5;
  6189. $10=[(0), (2)]._asSet();
  6190. $ctx1.sendIdx["asSet"]=6;
  6191. $8=_st($9).__eq($10);
  6192. $ctx1.sendIdx["="]=1;
  6193. $7=self._deny_($8);
  6194. $ctx1.sendIdx["deny:"]=1;
  6195. $13=[(1), (2)]._asSet();
  6196. $ctx1.sendIdx["asSet"]=7;
  6197. $14=[(0), (2)]._asSet();
  6198. $12=_st($13).__eq($14);
  6199. $11=self._deny_($12);
  6200. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6201. args: [],
  6202. 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",
  6203. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6204. referencedClasses: []
  6205. }),
  6206. smalltalk.SetTest);
  6207. smalltalk.addMethod(
  6208. smalltalk.method({
  6209. selector: "testPrintString",
  6210. category: 'tests',
  6211. fn: function (){
  6212. var self=this;
  6213. var set;
  6214. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6215. return smalltalk.withContext(function($ctx1) {
  6216. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10,$11,$13,$12,$14,$16,$15,$17,$19,$18;
  6217. set=_st($Set())._new();
  6218. $2=_st(set)._printString();
  6219. $ctx1.sendIdx["printString"]=1;
  6220. $1=self._assert_equals_($2,"a Set ()");
  6221. $ctx1.sendIdx["assert:equals:"]=1;
  6222. $3=set;
  6223. _st($3)._add_((1));
  6224. $ctx1.sendIdx["add:"]=1;
  6225. $4=_st($3)._add_((3));
  6226. $ctx1.sendIdx["add:"]=2;
  6227. $6=_st(set)._printString();
  6228. $ctx1.sendIdx["printString"]=2;
  6229. $5=self._assert_equals_($6,"a Set (1 3)");
  6230. $ctx1.sendIdx["assert:equals:"]=2;
  6231. $7=_st(set)._add_("foo");
  6232. $ctx1.sendIdx["add:"]=3;
  6233. $9=_st(set)._printString();
  6234. $ctx1.sendIdx["printString"]=3;
  6235. $8=self._assert_equals_($9,"a Set (1 3 'foo')");
  6236. $ctx1.sendIdx["assert:equals:"]=3;
  6237. $10=set;
  6238. _st($10)._remove_((1));
  6239. $ctx1.sendIdx["remove:"]=1;
  6240. $11=_st($10)._remove_((3));
  6241. $13=_st(set)._printString();
  6242. $ctx1.sendIdx["printString"]=4;
  6243. $12=self._assert_equals_($13,"a Set ('foo')");
  6244. $ctx1.sendIdx["assert:equals:"]=4;
  6245. $14=_st(set)._add_((3));
  6246. $ctx1.sendIdx["add:"]=4;
  6247. $16=_st(set)._printString();
  6248. $ctx1.sendIdx["printString"]=5;
  6249. $15=self._assert_equals_($16,"a Set ('foo' 3)");
  6250. $ctx1.sendIdx["assert:equals:"]=5;
  6251. $17=_st(set)._add_((3));
  6252. $19=_st(set)._printString();
  6253. $18=self._assert_equals_($19,"a Set ('foo' 3)");
  6254. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6255. args: [],
  6256. 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)'",
  6257. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6258. referencedClasses: ["Set"]
  6259. }),
  6260. smalltalk.SetTest);
  6261. smalltalk.addMethod(
  6262. smalltalk.method({
  6263. selector: "testSize",
  6264. category: 'tests',
  6265. fn: function (){
  6266. var self=this;
  6267. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6268. return smalltalk.withContext(function($ctx1) {
  6269. var $2,$1,$5,$4,$3,$8,$7,$6;
  6270. $2=_st(_st($Set())._new())._size();
  6271. $ctx1.sendIdx["size"]=1;
  6272. $1=self._assert_equals_($2,(0));
  6273. $ctx1.sendIdx["assert:equals:"]=1;
  6274. $5=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6275. $ctx1.sendIdx["withAll:"]=1;
  6276. $4=_st($5)._size();
  6277. $ctx1.sendIdx["size"]=2;
  6278. $3=self._assert_equals_($4,(4));
  6279. $ctx1.sendIdx["assert:equals:"]=2;
  6280. $8=_st($Set())._withAll_([(1), (1), (1), (1)]);
  6281. $7=_st($8)._size();
  6282. $6=self._assert_equals_($7,(1));
  6283. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6284. args: [],
  6285. 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",
  6286. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6287. referencedClasses: ["Set"]
  6288. }),
  6289. smalltalk.SetTest);
  6290. smalltalk.addMethod(
  6291. smalltalk.method({
  6292. selector: "testUnboxedObjects",
  6293. category: 'tests',
  6294. fn: function (){
  6295. var self=this;
  6296. return smalltalk.withContext(function($ctx1) {
  6297. var $4,$5,$3,$2,$1;
  6298. $4="foo"._yourself();
  6299. $ctx1.sendIdx["yourself"]=1;
  6300. $5="foo"._yourself();
  6301. $3=[$4,$5];
  6302. $2=_st($3)._asSet();
  6303. $1=_st($2)._asArray();
  6304. self._assert_equals_($1,["foo"]);
  6305. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6306. args: [],
  6307. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6308. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6309. referencedClasses: []
  6310. }),
  6311. smalltalk.SetTest);
  6312. smalltalk.addMethod(
  6313. smalltalk.method({
  6314. selector: "testUnicity",
  6315. category: 'tests',
  6316. fn: function (){
  6317. var self=this;
  6318. var set;
  6319. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6320. return smalltalk.withContext(function($ctx1) {
  6321. var $1,$2,$3,$5,$4,$6,$8,$7,$9;
  6322. set=_st($Set())._new();
  6323. $1=_st(set)._add_((21));
  6324. $ctx1.sendIdx["add:"]=1;
  6325. $2=_st(set)._add_("hello");
  6326. $ctx1.sendIdx["add:"]=2;
  6327. $3=_st(set)._add_((21));
  6328. $ctx1.sendIdx["add:"]=3;
  6329. $5=_st(set)._size();
  6330. $ctx1.sendIdx["size"]=1;
  6331. $4=self._assert_equals_($5,(2));
  6332. $ctx1.sendIdx["assert:equals:"]=1;
  6333. $6=_st(set)._add_("hello");
  6334. $8=_st(set)._size();
  6335. $7=self._assert_equals_($8,(2));
  6336. $ctx1.sendIdx["assert:equals:"]=2;
  6337. $9=self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6338. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6339. args: [],
  6340. 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')",
  6341. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6342. referencedClasses: ["Set"]
  6343. }),
  6344. smalltalk.SetTest);
  6345. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6346. smalltalk.addMethod(
  6347. smalltalk.method({
  6348. selector: "collectionClass",
  6349. category: 'accessing',
  6350. fn: function (){
  6351. var self=this;
  6352. return smalltalk.withContext(function($ctx1) {
  6353. var $1;
  6354. $1=_st(self._class())._collectionClass();
  6355. return $1;
  6356. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6357. args: [],
  6358. source: "collectionClass\x0a\x09^ self class collectionClass",
  6359. messageSends: ["collectionClass", "class"],
  6360. referencedClasses: []
  6361. }),
  6362. smalltalk.StreamTest);
  6363. smalltalk.addMethod(
  6364. smalltalk.method({
  6365. selector: "newCollection",
  6366. category: 'accessing',
  6367. fn: function (){
  6368. var self=this;
  6369. return smalltalk.withContext(function($ctx1) {
  6370. var $1;
  6371. $1=_st(self._collectionClass())._new();
  6372. return $1;
  6373. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6374. args: [],
  6375. source: "newCollection\x0a\x09^ self collectionClass new",
  6376. messageSends: ["new", "collectionClass"],
  6377. referencedClasses: []
  6378. }),
  6379. smalltalk.StreamTest);
  6380. smalltalk.addMethod(
  6381. smalltalk.method({
  6382. selector: "newStream",
  6383. category: 'accessing',
  6384. fn: function (){
  6385. var self=this;
  6386. return smalltalk.withContext(function($ctx1) {
  6387. var $1;
  6388. $1=_st(_st(self._collectionClass())._new())._stream();
  6389. return $1;
  6390. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6391. args: [],
  6392. source: "newStream\x0a\x09^ self collectionClass new stream",
  6393. messageSends: ["stream", "new", "collectionClass"],
  6394. referencedClasses: []
  6395. }),
  6396. smalltalk.StreamTest);
  6397. smalltalk.addMethod(
  6398. smalltalk.method({
  6399. selector: "testAtStartAtEnd",
  6400. category: 'tests',
  6401. fn: function (){
  6402. var self=this;
  6403. var stream;
  6404. return smalltalk.withContext(function($ctx1) {
  6405. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  6406. stream=self._newStream();
  6407. $2=_st(stream)._atStart();
  6408. $ctx1.sendIdx["atStart"]=1;
  6409. $1=self._assert_($2);
  6410. $ctx1.sendIdx["assert:"]=1;
  6411. $4=_st(stream)._atEnd();
  6412. $ctx1.sendIdx["atEnd"]=1;
  6413. $3=self._assert_($4);
  6414. $ctx1.sendIdx["assert:"]=2;
  6415. _st(stream)._nextPutAll_(self._newCollection());
  6416. $6=_st(stream)._atEnd();
  6417. $ctx1.sendIdx["atEnd"]=2;
  6418. $5=self._assert_($6);
  6419. $8=_st(stream)._atStart();
  6420. $ctx1.sendIdx["atStart"]=2;
  6421. $7=self._deny_($8);
  6422. $ctx1.sendIdx["deny:"]=1;
  6423. _st(stream)._position_((1));
  6424. $10=_st(stream)._atEnd();
  6425. $9=self._deny_($10);
  6426. $ctx1.sendIdx["deny:"]=2;
  6427. $12=_st(stream)._atStart();
  6428. $11=self._deny_($12);
  6429. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6430. args: [],
  6431. 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",
  6432. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6433. referencedClasses: []
  6434. }),
  6435. smalltalk.StreamTest);
  6436. smalltalk.addMethod(
  6437. smalltalk.method({
  6438. selector: "testContents",
  6439. category: 'tests',
  6440. fn: function (){
  6441. var self=this;
  6442. var stream;
  6443. return smalltalk.withContext(function($ctx1) {
  6444. var $1,$2,$3,$4;
  6445. stream=self._newStream();
  6446. $1=stream;
  6447. $2=self._newCollection();
  6448. $ctx1.sendIdx["newCollection"]=1;
  6449. _st($1)._nextPutAll_($2);
  6450. $3=_st(stream)._contents();
  6451. $4=self._newCollection();
  6452. self._assert_equals_($3,$4);
  6453. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6454. args: [],
  6455. 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",
  6456. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6457. referencedClasses: []
  6458. }),
  6459. smalltalk.StreamTest);
  6460. smalltalk.addMethod(
  6461. smalltalk.method({
  6462. selector: "testIsEmpty",
  6463. category: 'tests',
  6464. fn: function (){
  6465. var self=this;
  6466. var stream;
  6467. return smalltalk.withContext(function($ctx1) {
  6468. var $1,$2;
  6469. stream=self._newStream();
  6470. $1=_st(stream)._isEmpty();
  6471. $ctx1.sendIdx["isEmpty"]=1;
  6472. self._assert_($1);
  6473. _st(stream)._nextPutAll_(self._newCollection());
  6474. $2=_st(stream)._isEmpty();
  6475. self._deny_($2);
  6476. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6477. args: [],
  6478. 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",
  6479. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6480. referencedClasses: []
  6481. }),
  6482. smalltalk.StreamTest);
  6483. smalltalk.addMethod(
  6484. smalltalk.method({
  6485. selector: "testPosition",
  6486. category: 'tests',
  6487. fn: function (){
  6488. var self=this;
  6489. var collection,stream;
  6490. return smalltalk.withContext(function($ctx1) {
  6491. var $2,$1,$4,$3,$5,$7,$6,$8,$10,$9;
  6492. collection=self._newCollection();
  6493. stream=self._newStream();
  6494. _st(stream)._nextPutAll_(collection);
  6495. $2=_st(stream)._position();
  6496. $ctx1.sendIdx["position"]=1;
  6497. $1=self._assert_equals_($2,_st(collection)._size());
  6498. $ctx1.sendIdx["assert:equals:"]=1;
  6499. _st(stream)._position_((0));
  6500. $4=_st(stream)._position();
  6501. $ctx1.sendIdx["position"]=2;
  6502. $3=self._assert_equals_($4,(0));
  6503. $ctx1.sendIdx["assert:equals:"]=2;
  6504. $5=_st(stream)._next();
  6505. $ctx1.sendIdx["next"]=1;
  6506. $7=_st(stream)._position();
  6507. $ctx1.sendIdx["position"]=3;
  6508. $6=self._assert_equals_($7,(1));
  6509. $ctx1.sendIdx["assert:equals:"]=3;
  6510. $8=_st(stream)._next();
  6511. $10=_st(stream)._position();
  6512. $9=self._assert_equals_($10,(2));
  6513. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6514. args: [],
  6515. 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",
  6516. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6517. referencedClasses: []
  6518. }),
  6519. smalltalk.StreamTest);
  6520. smalltalk.addMethod(
  6521. smalltalk.method({
  6522. selector: "testReading",
  6523. category: 'tests',
  6524. fn: function (){
  6525. var self=this;
  6526. var stream,collection;
  6527. return smalltalk.withContext(function($ctx1) {
  6528. var $1,$2,$3,$5,$4;
  6529. collection=self._newCollection();
  6530. stream=self._newStream();
  6531. $1=stream;
  6532. _st($1)._nextPutAll_(collection);
  6533. $2=_st($1)._position_((0));
  6534. _st(collection)._do_((function(each){
  6535. return smalltalk.withContext(function($ctx2) {
  6536. $3=_st(stream)._next();
  6537. $ctx2.sendIdx["next"]=1;
  6538. return self._assert_equals_($3,each);
  6539. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6540. $5=_st(stream)._next();
  6541. $4=_st($5)._isNil();
  6542. self._assert_($4);
  6543. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6544. args: [],
  6545. 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",
  6546. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6547. referencedClasses: []
  6548. }),
  6549. smalltalk.StreamTest);
  6550. smalltalk.addMethod(
  6551. smalltalk.method({
  6552. selector: "testStreamContents",
  6553. category: 'tests',
  6554. fn: function (){
  6555. var self=this;
  6556. return smalltalk.withContext(function($ctx1) {
  6557. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6558. args: [],
  6559. source: "testStreamContents",
  6560. messageSends: [],
  6561. referencedClasses: []
  6562. }),
  6563. smalltalk.StreamTest);
  6564. smalltalk.addMethod(
  6565. smalltalk.method({
  6566. selector: "testWrite",
  6567. category: 'tests',
  6568. fn: function (){
  6569. var self=this;
  6570. var stream,collection;
  6571. return smalltalk.withContext(function($ctx1) {
  6572. collection=self._newCollection();
  6573. stream=self._newStream();
  6574. _st(collection)._do_((function(each){
  6575. return smalltalk.withContext(function($ctx2) {
  6576. return _st(stream).__lt_lt(each);
  6577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6578. self._assert_equals_(_st(stream)._contents(),collection);
  6579. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6580. args: [],
  6581. 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",
  6582. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6583. referencedClasses: []
  6584. }),
  6585. smalltalk.StreamTest);
  6586. smalltalk.addMethod(
  6587. smalltalk.method({
  6588. selector: "testWriting",
  6589. category: 'tests',
  6590. fn: function (){
  6591. var self=this;
  6592. var stream,collection;
  6593. return smalltalk.withContext(function($ctx1) {
  6594. var $2,$1,$4,$3;
  6595. collection=self._newCollection();
  6596. stream=self._newStream();
  6597. $ctx1.sendIdx["newStream"]=1;
  6598. _st(collection)._do_((function(each){
  6599. return smalltalk.withContext(function($ctx2) {
  6600. return _st(stream)._nextPut_(each);
  6601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6602. $2=_st(stream)._contents();
  6603. $ctx1.sendIdx["contents"]=1;
  6604. $1=self._assert_equals_($2,collection);
  6605. $ctx1.sendIdx["assert:equals:"]=1;
  6606. stream=self._newStream();
  6607. _st(stream)._nextPutAll_(collection);
  6608. $4=_st(stream)._contents();
  6609. $3=self._assert_equals_($4,collection);
  6610. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6611. args: [],
  6612. 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",
  6613. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6614. referencedClasses: []
  6615. }),
  6616. smalltalk.StreamTest);
  6617. smalltalk.addMethod(
  6618. smalltalk.method({
  6619. selector: "collectionClass",
  6620. category: 'accessing',
  6621. fn: function (){
  6622. var self=this;
  6623. return smalltalk.withContext(function($ctx1) {
  6624. return nil;
  6625. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6626. args: [],
  6627. source: "collectionClass\x0a\x09^ nil",
  6628. messageSends: [],
  6629. referencedClasses: []
  6630. }),
  6631. smalltalk.StreamTest.klass);
  6632. smalltalk.addMethod(
  6633. smalltalk.method({
  6634. selector: "isAbstract",
  6635. category: 'testing',
  6636. fn: function (){
  6637. var self=this;
  6638. return smalltalk.withContext(function($ctx1) {
  6639. var $1;
  6640. $1=_st(self._collectionClass())._isNil();
  6641. return $1;
  6642. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6643. args: [],
  6644. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6645. messageSends: ["isNil", "collectionClass"],
  6646. referencedClasses: []
  6647. }),
  6648. smalltalk.StreamTest.klass);
  6649. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6650. smalltalk.addMethod(
  6651. smalltalk.method({
  6652. selector: "newCollection",
  6653. category: 'accessing',
  6654. fn: function (){
  6655. var self=this;
  6656. return smalltalk.withContext(function($ctx1) {
  6657. var $1;
  6658. $1=[true,(1),(3).__at((4)),"foo"];
  6659. return $1;
  6660. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6661. args: [],
  6662. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6663. messageSends: ["@"],
  6664. referencedClasses: []
  6665. }),
  6666. smalltalk.ArrayStreamTest);
  6667. smalltalk.addMethod(
  6668. smalltalk.method({
  6669. selector: "collectionClass",
  6670. category: 'accessing',
  6671. fn: function (){
  6672. var self=this;
  6673. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6674. return smalltalk.withContext(function($ctx1) {
  6675. var $1;
  6676. $1=$Array();
  6677. return $1;
  6678. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6679. args: [],
  6680. source: "collectionClass\x0a\x09^ Array",
  6681. messageSends: [],
  6682. referencedClasses: ["Array"]
  6683. }),
  6684. smalltalk.ArrayStreamTest.klass);
  6685. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6686. smalltalk.addMethod(
  6687. smalltalk.method({
  6688. selector: "newCollection",
  6689. category: 'accessing',
  6690. fn: function (){
  6691. var self=this;
  6692. return smalltalk.withContext(function($ctx1) {
  6693. return "hello world";
  6694. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6695. args: [],
  6696. source: "newCollection\x0a\x09^ 'hello world'",
  6697. messageSends: [],
  6698. referencedClasses: []
  6699. }),
  6700. smalltalk.StringStreamTest);
  6701. smalltalk.addMethod(
  6702. smalltalk.method({
  6703. selector: "collectionClass",
  6704. category: 'accessing',
  6705. fn: function (){
  6706. var self=this;
  6707. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6708. return smalltalk.withContext(function($ctx1) {
  6709. var $1;
  6710. $1=$String();
  6711. return $1;
  6712. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6713. args: [],
  6714. source: "collectionClass\x0a\x09^ String",
  6715. messageSends: [],
  6716. referencedClasses: ["String"]
  6717. }),
  6718. smalltalk.StringStreamTest.klass);
  6719. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6720. smalltalk.addMethod(
  6721. smalltalk.method({
  6722. selector: "testCopying",
  6723. category: 'tests',
  6724. fn: function (){
  6725. var self=this;
  6726. return smalltalk.withContext(function($ctx1) {
  6727. self._assert_equals_(nil._copy(),nil);
  6728. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6729. args: [],
  6730. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6731. messageSends: ["assert:equals:", "copy"],
  6732. referencedClasses: []
  6733. }),
  6734. smalltalk.UndefinedTest);
  6735. smalltalk.addMethod(
  6736. smalltalk.method({
  6737. selector: "testDeepCopy",
  6738. category: 'tests',
  6739. fn: function (){
  6740. var self=this;
  6741. return smalltalk.withContext(function($ctx1) {
  6742. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6743. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6744. args: [],
  6745. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6746. messageSends: ["assert:", "=", "deepCopy"],
  6747. referencedClasses: []
  6748. }),
  6749. smalltalk.UndefinedTest);
  6750. smalltalk.addMethod(
  6751. smalltalk.method({
  6752. selector: "testIfNil",
  6753. category: 'tests',
  6754. fn: function (){
  6755. var self=this;
  6756. return smalltalk.withContext(function($ctx1) {
  6757. var $2,$1,$5,$4,$3,$7,$6,$10,$9,$8;
  6758. if(($receiver = nil) == nil || $receiver == null){
  6759. $2=true;
  6760. } else {
  6761. $2=nil;
  6762. };
  6763. $1=self._assert_equals_($2,true);
  6764. $ctx1.sendIdx["assert:equals:"]=1;
  6765. if(($receiver = nil) == nil || $receiver == null){
  6766. $5=nil;
  6767. } else {
  6768. $5=true;
  6769. };
  6770. $4=_st($5).__eq(true);
  6771. $ctx1.sendIdx["="]=1;
  6772. $3=self._deny_($4);
  6773. $ctx1.sendIdx["deny:"]=1;
  6774. if(($receiver = nil) == nil || $receiver == null){
  6775. $7=true;
  6776. } else {
  6777. $7=false;
  6778. };
  6779. $6=self._assert_equals_($7,true);
  6780. if(($receiver = nil) == nil || $receiver == null){
  6781. $10=false;
  6782. } else {
  6783. $10=true;
  6784. };
  6785. $9=_st($10).__eq(true);
  6786. $8=self._deny_($9);
  6787. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6788. args: [],
  6789. 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",
  6790. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6791. referencedClasses: []
  6792. }),
  6793. smalltalk.UndefinedTest);
  6794. smalltalk.addMethod(
  6795. smalltalk.method({
  6796. selector: "testIsNil",
  6797. category: 'tests',
  6798. fn: function (){
  6799. var self=this;
  6800. return smalltalk.withContext(function($ctx1) {
  6801. self._assert_(nil._isNil());
  6802. self._deny_(nil._notNil());
  6803. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6804. args: [],
  6805. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6806. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6807. referencedClasses: []
  6808. }),
  6809. smalltalk.UndefinedTest);
  6810. });