Kernel-Tests.js 320 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548
  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. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. 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) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. 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.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfPresent",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var visited,sentinel;
  2334. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2335. return smalltalk.withContext(function($ctx1) {
  2336. var $2,$1,$4,$3;
  2337. sentinel=_st($Object())._new();
  2338. self._nonIndexesDo_((function(each){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. visited=nil;
  2341. visited;
  2342. $2=self._collection();
  2343. $ctx2.sendIdx["collection"]=1;
  2344. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2345. return smalltalk.withContext(function($ctx3) {
  2346. visited=value1;
  2347. visited;
  2348. return sentinel;
  2349. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2350. $ctx2.sendIdx["at:ifPresent:"]=1;
  2351. self._assert_equals_($1,nil);
  2352. $ctx2.sendIdx["assert:equals:"]=1;
  2353. return self._assert_(_st(visited)._isNil());
  2354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2355. self._samplesDo_((function(index,value){
  2356. return smalltalk.withContext(function($ctx2) {
  2357. visited=nil;
  2358. visited;
  2359. $4=self._collection();
  2360. $ctx2.sendIdx["collection"]=2;
  2361. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2362. return smalltalk.withContext(function($ctx3) {
  2363. visited=value2;
  2364. visited;
  2365. return sentinel;
  2366. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2367. self._assert_equals_($3,sentinel);
  2368. $ctx2.sendIdx["assert:equals:"]=2;
  2369. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2370. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2371. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2372. args: [],
  2373. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2374. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2375. referencedClasses: ["Object"]
  2376. }),
  2377. smalltalk.IndexableCollectionTest);
  2378. smalltalk.addMethod(
  2379. smalltalk.method({
  2380. selector: "testAtIfPresentIfAbsent",
  2381. protocol: 'tests',
  2382. fn: function (){
  2383. var self=this;
  2384. var visited,sentinel;
  2385. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2386. return smalltalk.withContext(function($ctx1) {
  2387. var $2,$1,$3,$5,$4;
  2388. sentinel=_st($Object())._new();
  2389. self._nonIndexesDo_((function(each){
  2390. return smalltalk.withContext(function($ctx2) {
  2391. visited=nil;
  2392. visited;
  2393. $2=self._collection();
  2394. $ctx2.sendIdx["collection"]=1;
  2395. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2396. return smalltalk.withContext(function($ctx3) {
  2397. visited=value1;
  2398. visited;
  2399. return sentinel;
  2400. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2401. return smalltalk.withContext(function($ctx3) {
  2402. return self._sampleNewValue();
  2403. $ctx3.sendIdx["sampleNewValue"]=1;
  2404. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2405. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2406. $3=self._sampleNewValue();
  2407. $ctx2.sendIdx["sampleNewValue"]=2;
  2408. self._assert_equals_($1,$3);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. return self._assert_(_st(visited)._isNil());
  2411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2412. self._samplesDo_((function(index,value){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. visited=nil;
  2415. visited;
  2416. $5=self._collection();
  2417. $ctx2.sendIdx["collection"]=2;
  2418. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2419. return smalltalk.withContext(function($ctx3) {
  2420. visited=value2;
  2421. visited;
  2422. return sentinel;
  2423. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2424. return smalltalk.withContext(function($ctx3) {
  2425. return self._sampleNewValue();
  2426. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2427. self._assert_equals_($4,sentinel);
  2428. $ctx2.sendIdx["assert:equals:"]=2;
  2429. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2430. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2431. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2432. args: [],
  2433. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2434. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2435. referencedClasses: ["Object"]
  2436. }),
  2437. smalltalk.IndexableCollectionTest);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "testAtPut",
  2441. protocol: 'tests',
  2442. fn: function (){
  2443. var self=this;
  2444. var newCollection;
  2445. return smalltalk.withContext(function($ctx1) {
  2446. newCollection=self._collection();
  2447. $ctx1.sendIdx["collection"]=1;
  2448. self._samplesDo_((function(index,value){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return _st(newCollection)._at_put_(index,value);
  2451. $ctx2.sendIdx["at:put:"]=1;
  2452. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2453. self._assert_equals_(newCollection,self._collection());
  2454. $ctx1.sendIdx["assert:equals:"]=1;
  2455. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2456. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2457. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2458. args: [],
  2459. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2460. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2461. referencedClasses: []
  2462. }),
  2463. smalltalk.IndexableCollectionTest);
  2464. smalltalk.addMethod(
  2465. smalltalk.method({
  2466. selector: "testIndexOf",
  2467. protocol: 'tests',
  2468. fn: function (){
  2469. var self=this;
  2470. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2471. return smalltalk.withContext(function($ctx1) {
  2472. var $1;
  2473. self._should_raise_((function(){
  2474. return smalltalk.withContext(function($ctx2) {
  2475. $1=self._collection();
  2476. $ctx2.sendIdx["collection"]=1;
  2477. return _st($1)._indexOf_(self._sampleNewValue());
  2478. $ctx2.sendIdx["indexOf:"]=1;
  2479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2480. self._samplesDo_((function(index,value){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2483. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2484. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2485. args: [],
  2486. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2487. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2488. referencedClasses: ["Error"]
  2489. }),
  2490. smalltalk.IndexableCollectionTest);
  2491. smalltalk.addMethod(
  2492. smalltalk.method({
  2493. selector: "testWithIndexDo",
  2494. protocol: 'tests',
  2495. fn: function (){
  2496. var self=this;
  2497. var collection;
  2498. return smalltalk.withContext(function($ctx1) {
  2499. collection=self._collection();
  2500. $ctx1.sendIdx["collection"]=1;
  2501. _st(self._collection())._withIndexDo_((function(each,index){
  2502. return smalltalk.withContext(function($ctx2) {
  2503. return self._assert_equals_(_st(collection)._at_(index),each);
  2504. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2505. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2506. args: [],
  2507. 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 ]",
  2508. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.IndexableCollectionTest);
  2512. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2513. smalltalk.addMethod(
  2514. smalltalk.method({
  2515. selector: "collection",
  2516. protocol: 'fixture',
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.withContext(function($ctx1) {
  2520. var $2,$3,$4,$1;
  2521. $2="b".__minus_gt((1));
  2522. $ctx1.sendIdx["->"]=1;
  2523. $3="a".__minus_gt((2));
  2524. $ctx1.sendIdx["->"]=2;
  2525. $4="c".__minus_gt((3));
  2526. $ctx1.sendIdx["->"]=3;
  2527. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2528. return $1;
  2529. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2530. args: [],
  2531. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2532. messageSends: ["->"],
  2533. referencedClasses: []
  2534. }),
  2535. smalltalk.HashedCollectionTest);
  2536. smalltalk.addMethod(
  2537. smalltalk.method({
  2538. selector: "collectionOfPrintStrings",
  2539. protocol: 'fixture',
  2540. fn: function (){
  2541. var self=this;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. var $2,$3,$4,$1;
  2544. $2="b".__minus_gt("1");
  2545. $ctx1.sendIdx["->"]=1;
  2546. $3="a".__minus_gt("2");
  2547. $ctx1.sendIdx["->"]=2;
  2548. $4="c".__minus_gt("3");
  2549. $ctx1.sendIdx["->"]=3;
  2550. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2551. return $1;
  2552. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2553. args: [],
  2554. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2555. messageSends: ["->"],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.HashedCollectionTest);
  2559. smalltalk.addMethod(
  2560. smalltalk.method({
  2561. selector: "collectionSize",
  2562. protocol: 'fixture',
  2563. fn: function (){
  2564. var self=this;
  2565. return smalltalk.withContext(function($ctx1) {
  2566. return (4);
  2567. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2568. args: [],
  2569. source: "collectionSize\x0a\x09^ 4",
  2570. messageSends: [],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.HashedCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "collectionWithDuplicates",
  2577. protocol: 'fixture',
  2578. fn: function (){
  2579. var self=this;
  2580. return smalltalk.withContext(function($ctx1) {
  2581. var $2,$3,$4,$5,$6,$7,$1;
  2582. $2="b".__minus_gt((1));
  2583. $ctx1.sendIdx["->"]=1;
  2584. $3="a".__minus_gt((2));
  2585. $ctx1.sendIdx["->"]=2;
  2586. $4="c".__minus_gt((3));
  2587. $ctx1.sendIdx["->"]=3;
  2588. $5="d".__minus_gt((-4));
  2589. $ctx1.sendIdx["->"]=4;
  2590. $6="e".__minus_gt((1));
  2591. $ctx1.sendIdx["->"]=5;
  2592. $7="f".__minus_gt((2));
  2593. $ctx1.sendIdx["->"]=6;
  2594. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2595. return $1;
  2596. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2597. args: [],
  2598. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2599. messageSends: ["->"],
  2600. referencedClasses: []
  2601. }),
  2602. smalltalk.HashedCollectionTest);
  2603. smalltalk.addMethod(
  2604. smalltalk.method({
  2605. selector: "collectionWithNewValue",
  2606. protocol: 'fixture',
  2607. fn: function (){
  2608. var self=this;
  2609. return smalltalk.withContext(function($ctx1) {
  2610. var $2,$3,$4,$5,$1;
  2611. $2="b".__minus_gt((1));
  2612. $ctx1.sendIdx["->"]=1;
  2613. $3="a".__minus_gt((2));
  2614. $ctx1.sendIdx["->"]=2;
  2615. $4="c".__minus_gt((3));
  2616. $ctx1.sendIdx["->"]=3;
  2617. $5="d".__minus_gt((-4));
  2618. $ctx1.sendIdx["->"]=4;
  2619. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2620. return $1;
  2621. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2622. args: [],
  2623. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2624. messageSends: ["->"],
  2625. referencedClasses: []
  2626. }),
  2627. smalltalk.HashedCollectionTest);
  2628. smalltalk.addMethod(
  2629. smalltalk.method({
  2630. selector: "nonIndexesDo:",
  2631. protocol: 'fixture',
  2632. fn: function (aBlock){
  2633. var self=this;
  2634. return smalltalk.withContext(function($ctx1) {
  2635. _st(aBlock)._value_((5));
  2636. $ctx1.sendIdx["value:"]=1;
  2637. _st(aBlock)._value_("z");
  2638. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2639. args: ["aBlock"],
  2640. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2641. messageSends: ["value:"],
  2642. referencedClasses: []
  2643. }),
  2644. smalltalk.HashedCollectionTest);
  2645. smalltalk.addMethod(
  2646. smalltalk.method({
  2647. selector: "sampleNewIndex",
  2648. protocol: 'fixture',
  2649. fn: function (){
  2650. var self=this;
  2651. return smalltalk.withContext(function($ctx1) {
  2652. return "new";
  2653. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2654. args: [],
  2655. source: "sampleNewIndex\x0a\x09^ 'new'",
  2656. messageSends: [],
  2657. referencedClasses: []
  2658. }),
  2659. smalltalk.HashedCollectionTest);
  2660. smalltalk.addMethod(
  2661. smalltalk.method({
  2662. selector: "sampleNewValueAsCollection",
  2663. protocol: 'fixture',
  2664. fn: function (){
  2665. var self=this;
  2666. return smalltalk.withContext(function($ctx1) {
  2667. var $1;
  2668. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2669. return $1;
  2670. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2671. args: [],
  2672. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2673. messageSends: ["->"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.HashedCollectionTest);
  2677. smalltalk.addMethod(
  2678. smalltalk.method({
  2679. selector: "samplesDo:",
  2680. protocol: 'fixture',
  2681. fn: function (aBlock){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) {
  2684. _st(aBlock)._value_value_("a",(2));
  2685. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2686. args: ["aBlock"],
  2687. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2688. messageSends: ["value:value:"],
  2689. referencedClasses: []
  2690. }),
  2691. smalltalk.HashedCollectionTest);
  2692. smalltalk.addMethod(
  2693. smalltalk.method({
  2694. selector: "testAddAll",
  2695. protocol: 'tests',
  2696. fn: function (){
  2697. var self=this;
  2698. return smalltalk.withContext(function($ctx1) {
  2699. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2700. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2701. $2=self._collection();
  2702. $ctx1.sendIdx["collection"]=1;
  2703. $3=$2;
  2704. $4=self._collection();
  2705. $ctx1.sendIdx["collection"]=2;
  2706. _st($3)._addAll_($4);
  2707. $ctx1.sendIdx["addAll:"]=1;
  2708. $5=_st($2)._yourself();
  2709. $ctx1.sendIdx["yourself"]=1;
  2710. $1=$5;
  2711. $6=self._collection();
  2712. $ctx1.sendIdx["collection"]=3;
  2713. self._assert_equals_($1,$6);
  2714. $ctx1.sendIdx["assert:equals:"]=1;
  2715. $8=self._collection();
  2716. $ctx1.sendIdx["collection"]=4;
  2717. $9=$8;
  2718. $10=self._collectionWithNewValue();
  2719. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2720. _st($9)._addAll_($10);
  2721. $ctx1.sendIdx["addAll:"]=2;
  2722. $11=_st($8)._yourself();
  2723. $ctx1.sendIdx["yourself"]=2;
  2724. $7=$11;
  2725. $12=self._collectionWithNewValue();
  2726. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2727. self._assert_equals_($7,$12);
  2728. $ctx1.sendIdx["assert:equals:"]=2;
  2729. $14=self._collectionWithNewValue();
  2730. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2731. _st($14)._addAll_(self._collection());
  2732. $15=_st($14)._yourself();
  2733. $13=$15;
  2734. self._assert_equals_($13,self._collectionWithNewValue());
  2735. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2736. args: [],
  2737. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2738. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2739. referencedClasses: []
  2740. }),
  2741. smalltalk.HashedCollectionTest);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "testAsDictionary",
  2745. protocol: 'tests',
  2746. fn: function (){
  2747. var self=this;
  2748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2749. return smalltalk.withContext(function($ctx1) {
  2750. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2751. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2752. args: [],
  2753. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2754. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2755. referencedClasses: ["Dictionary"]
  2756. }),
  2757. smalltalk.HashedCollectionTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testComma",
  2761. protocol: 'tests',
  2762. fn: function (){
  2763. var self=this;
  2764. return smalltalk.withContext(function($ctx1) {
  2765. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2766. smalltalk.HashedCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2767. $2=self._collection();
  2768. $ctx1.sendIdx["collection"]=1;
  2769. $3=self._collection();
  2770. $ctx1.sendIdx["collection"]=2;
  2771. $1=_st($2).__comma($3);
  2772. $ctx1.sendIdx[","]=1;
  2773. $4=self._collection();
  2774. $ctx1.sendIdx["collection"]=3;
  2775. self._assert_equals_($1,$4);
  2776. $ctx1.sendIdx["assert:equals:"]=1;
  2777. $6=self._collection();
  2778. $ctx1.sendIdx["collection"]=4;
  2779. $7=self._collectionWithNewValue();
  2780. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2781. $5=_st($6).__comma($7);
  2782. $ctx1.sendIdx[","]=2;
  2783. $8=self._collectionWithNewValue();
  2784. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2785. self._assert_equals_($5,$8);
  2786. $ctx1.sendIdx["assert:equals:"]=2;
  2787. $10=self._collectionWithNewValue();
  2788. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2789. $9=_st($10).__comma(self._collection());
  2790. self._assert_equals_($9,self._collectionWithNewValue());
  2791. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2792. args: [],
  2793. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  2794. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2795. referencedClasses: []
  2796. }),
  2797. smalltalk.HashedCollectionTest);
  2798. smalltalk.addMethod(
  2799. smalltalk.method({
  2800. selector: "testFrom",
  2801. protocol: 'tests',
  2802. fn: function (){
  2803. var self=this;
  2804. var associations;
  2805. return smalltalk.withContext(function($ctx1) {
  2806. var $1,$2,$3,$5,$4;
  2807. $1="a".__minus_gt((1));
  2808. $ctx1.sendIdx["->"]=1;
  2809. $2="b".__minus_gt((2));
  2810. $ctx1.sendIdx["->"]=2;
  2811. associations=[$1,$2];
  2812. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2813. $5="a".__minus_gt((1));
  2814. $ctx1.sendIdx["->"]=3;
  2815. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2816. self._assertSameContents_as_($3,$4);
  2817. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2818. args: [],
  2819. 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 }.",
  2820. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2821. referencedClasses: []
  2822. }),
  2823. smalltalk.HashedCollectionTest);
  2824. smalltalk.addMethod(
  2825. smalltalk.method({
  2826. selector: "testNewFromPairs",
  2827. protocol: 'tests',
  2828. fn: function (){
  2829. var self=this;
  2830. var flattenedAssociations;
  2831. return smalltalk.withContext(function($ctx1) {
  2832. var $1,$3,$2;
  2833. flattenedAssociations=["a",(1),"b",(2)];
  2834. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2835. $3="a".__minus_gt((1));
  2836. $ctx1.sendIdx["->"]=1;
  2837. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2838. self._assertSameContents_as_($1,$2);
  2839. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2840. args: [],
  2841. 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 }.",
  2842. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2843. referencedClasses: []
  2844. }),
  2845. smalltalk.HashedCollectionTest);
  2846. smalltalk.addMethod(
  2847. smalltalk.method({
  2848. selector: "collectionClass",
  2849. protocol: 'fixture',
  2850. fn: function (){
  2851. var self=this;
  2852. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2853. return smalltalk.withContext(function($ctx1) {
  2854. return $HashedCollection();
  2855. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2856. args: [],
  2857. source: "collectionClass\x0a\x09^ HashedCollection",
  2858. messageSends: [],
  2859. referencedClasses: ["HashedCollection"]
  2860. }),
  2861. smalltalk.HashedCollectionTest.klass);
  2862. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2863. smalltalk.addMethod(
  2864. smalltalk.method({
  2865. selector: "collection",
  2866. protocol: 'fixture',
  2867. fn: function (){
  2868. var self=this;
  2869. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2870. return smalltalk.withContext(function($ctx1) {
  2871. var $2,$3,$1;
  2872. $2=_st($Dictionary())._new();
  2873. _st($2)._at_put_((1),(1));
  2874. $ctx1.sendIdx["at:put:"]=1;
  2875. _st($2)._at_put_("a",(2));
  2876. $ctx1.sendIdx["at:put:"]=2;
  2877. _st($2)._at_put_(true,(3));
  2878. $ctx1.sendIdx["at:put:"]=3;
  2879. _st($2)._at_put_((1).__at((3)),(-4));
  2880. $3=_st($2)._yourself();
  2881. $1=$3;
  2882. return $1;
  2883. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2884. args: [],
  2885. 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: 1@3 put: -4;\x0a\x09\x09yourself",
  2886. messageSends: ["at:put:", "new", "@", "yourself"],
  2887. referencedClasses: ["Dictionary"]
  2888. }),
  2889. smalltalk.DictionaryTest);
  2890. smalltalk.addMethod(
  2891. smalltalk.method({
  2892. selector: "collectionOfPrintStrings",
  2893. protocol: 'fixture',
  2894. fn: function (){
  2895. var self=this;
  2896. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2897. return smalltalk.withContext(function($ctx1) {
  2898. var $2,$3,$1;
  2899. $2=_st($Dictionary())._new();
  2900. _st($2)._at_put_((1),"1");
  2901. $ctx1.sendIdx["at:put:"]=1;
  2902. _st($2)._at_put_("a","2");
  2903. $ctx1.sendIdx["at:put:"]=2;
  2904. _st($2)._at_put_(true,"3");
  2905. $ctx1.sendIdx["at:put:"]=3;
  2906. _st($2)._at_put_((1).__at((3)),"-4");
  2907. $3=_st($2)._yourself();
  2908. $1=$3;
  2909. return $1;
  2910. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2911. args: [],
  2912. source: "collectionOfPrintStrings\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: 1@3 put: '-4';\x0a\x09\x09yourself",
  2913. messageSends: ["at:put:", "new", "@", "yourself"],
  2914. referencedClasses: ["Dictionary"]
  2915. }),
  2916. smalltalk.DictionaryTest);
  2917. smalltalk.addMethod(
  2918. smalltalk.method({
  2919. selector: "collectionSize",
  2920. protocol: 'fixture',
  2921. fn: function (){
  2922. var self=this;
  2923. return smalltalk.withContext(function($ctx1) {
  2924. return (4);
  2925. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2926. args: [],
  2927. source: "collectionSize\x0a\x09^ 4",
  2928. messageSends: [],
  2929. referencedClasses: []
  2930. }),
  2931. smalltalk.DictionaryTest);
  2932. smalltalk.addMethod(
  2933. smalltalk.method({
  2934. selector: "collectionWithDuplicates",
  2935. protocol: 'fixture',
  2936. fn: function (){
  2937. var self=this;
  2938. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2939. return smalltalk.withContext(function($ctx1) {
  2940. var $2,$3,$1;
  2941. $2=_st($Dictionary())._new();
  2942. _st($2)._at_put_((1),(1));
  2943. $ctx1.sendIdx["at:put:"]=1;
  2944. _st($2)._at_put_("a",(2));
  2945. $ctx1.sendIdx["at:put:"]=2;
  2946. _st($2)._at_put_(true,(3));
  2947. $ctx1.sendIdx["at:put:"]=3;
  2948. _st($2)._at_put_((4),(-4));
  2949. $ctx1.sendIdx["at:put:"]=4;
  2950. _st($2)._at_put_("b",(1));
  2951. $ctx1.sendIdx["at:put:"]=5;
  2952. _st($2)._at_put_((3),(3));
  2953. $ctx1.sendIdx["at:put:"]=6;
  2954. _st($2)._at_put_(false,(12));
  2955. $3=_st($2)._yourself();
  2956. $1=$3;
  2957. return $1;
  2958. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2959. args: [],
  2960. 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",
  2961. messageSends: ["at:put:", "new", "yourself"],
  2962. referencedClasses: ["Dictionary"]
  2963. }),
  2964. smalltalk.DictionaryTest);
  2965. smalltalk.addMethod(
  2966. smalltalk.method({
  2967. selector: "collectionWithNewValue",
  2968. protocol: 'fixture',
  2969. fn: function (){
  2970. var self=this;
  2971. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2972. return smalltalk.withContext(function($ctx1) {
  2973. var $2,$3,$1;
  2974. $2=_st($Dictionary())._new();
  2975. _st($2)._at_put_((1),(1));
  2976. $ctx1.sendIdx["at:put:"]=1;
  2977. _st($2)._at_put_("a",(2));
  2978. $ctx1.sendIdx["at:put:"]=2;
  2979. _st($2)._at_put_(true,(3));
  2980. $ctx1.sendIdx["at:put:"]=3;
  2981. _st($2)._at_put_((1).__at((3)),(-4));
  2982. $ctx1.sendIdx["at:put:"]=4;
  2983. _st($2)._at_put_("new","N");
  2984. $3=_st($2)._yourself();
  2985. $1=$3;
  2986. return $1;
  2987. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2988. args: [],
  2989. source: "collectionWithNewValue\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: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2990. messageSends: ["at:put:", "new", "@", "yourself"],
  2991. referencedClasses: ["Dictionary"]
  2992. }),
  2993. smalltalk.DictionaryTest);
  2994. smalltalk.addMethod(
  2995. smalltalk.method({
  2996. selector: "sampleNewValueAsCollection",
  2997. protocol: 'fixture',
  2998. fn: function (){
  2999. var self=this;
  3000. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3001. return smalltalk.withContext(function($ctx1) {
  3002. var $2,$3,$1;
  3003. $2=_st($Dictionary())._new();
  3004. _st($2)._at_put_("new","N");
  3005. $3=_st($2)._yourself();
  3006. $1=$3;
  3007. return $1;
  3008. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3009. args: [],
  3010. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3011. messageSends: ["at:put:", "new", "yourself"],
  3012. referencedClasses: ["Dictionary"]
  3013. }),
  3014. smalltalk.DictionaryTest);
  3015. smalltalk.addMethod(
  3016. smalltalk.method({
  3017. selector: "samplesDo:",
  3018. protocol: 'fixture',
  3019. fn: function (aBlock){
  3020. var self=this;
  3021. return smalltalk.withContext(function($ctx1) {
  3022. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3023. _st(aBlock)._value_value_(true,(3));
  3024. $ctx1.sendIdx["value:value:"]=1;
  3025. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3026. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3027. args: ["aBlock"],
  3028. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3029. messageSends: ["samplesDo:", "value:value:", "@"],
  3030. referencedClasses: []
  3031. }),
  3032. smalltalk.DictionaryTest);
  3033. smalltalk.addMethod(
  3034. smalltalk.method({
  3035. selector: "testAccessing",
  3036. protocol: 'tests',
  3037. fn: function (){
  3038. var self=this;
  3039. var d;
  3040. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3041. return smalltalk.withContext(function($ctx1) {
  3042. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3043. d=_st($Dictionary())._new();
  3044. _st(d)._at_put_("hello","world");
  3045. $ctx1.sendIdx["at:put:"]=1;
  3046. $1=_st(d)._at_("hello");
  3047. $ctx1.sendIdx["at:"]=1;
  3048. self._assert_equals_($1,"world");
  3049. $ctx1.sendIdx["assert:equals:"]=1;
  3050. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3051. return smalltalk.withContext(function($ctx2) {
  3052. return nil;
  3053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3054. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3055. self._assert_equals_($2,"world");
  3056. $ctx1.sendIdx["assert:equals:"]=2;
  3057. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3058. return smalltalk.withContext(function($ctx2) {
  3059. return nil;
  3060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3061. $ctx1.sendIdx["deny:"]=1;
  3062. $3=_st(d)._includesKey_("hello");
  3063. $ctx1.sendIdx["includesKey:"]=1;
  3064. self._assert_($3);
  3065. $ctx1.sendIdx["assert:"]=1;
  3066. $4=_st(d)._includesKey_("foo");
  3067. $ctx1.sendIdx["includesKey:"]=2;
  3068. self._deny_($4);
  3069. $ctx1.sendIdx["deny:"]=2;
  3070. _st(d)._at_put_((1),(2));
  3071. $ctx1.sendIdx["at:put:"]=2;
  3072. $5=_st(d)._at_((1));
  3073. $ctx1.sendIdx["at:"]=2;
  3074. self._assert_equals_($5,(2));
  3075. $ctx1.sendIdx["assert:equals:"]=3;
  3076. $6=d;
  3077. $7=(1).__at((3));
  3078. $ctx1.sendIdx["@"]=1;
  3079. _st($6)._at_put_($7,(3));
  3080. $9=d;
  3081. $10=(1).__at((3));
  3082. $ctx1.sendIdx["@"]=2;
  3083. $8=_st($9)._at_($10);
  3084. self._assert_equals_($8,(3));
  3085. $12=d;
  3086. $13=(1).__at((3));
  3087. $ctx1.sendIdx["@"]=3;
  3088. $11=_st($12)._includesKey_($13);
  3089. $ctx1.sendIdx["includesKey:"]=3;
  3090. self._assert_($11);
  3091. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3092. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3093. args: [],
  3094. 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)",
  3095. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3096. referencedClasses: ["Dictionary"]
  3097. }),
  3098. smalltalk.DictionaryTest);
  3099. smalltalk.addMethod(
  3100. smalltalk.method({
  3101. selector: "testAsHashedCollection",
  3102. protocol: 'tests',
  3103. fn: function (){
  3104. var self=this;
  3105. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3106. return smalltalk.withContext(function($ctx1) {
  3107. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3108. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3109. args: [],
  3110. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3111. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3112. referencedClasses: ["HashedCollection"]
  3113. }),
  3114. smalltalk.DictionaryTest);
  3115. smalltalk.addMethod(
  3116. smalltalk.method({
  3117. selector: "testDynamicDictionaries",
  3118. protocol: 'tests',
  3119. fn: function (){
  3120. var self=this;
  3121. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3122. return smalltalk.withContext(function($ctx1) {
  3123. var $3,$2,$1;
  3124. $3="hello".__minus_gt((1));
  3125. $ctx1.sendIdx["->"]=1;
  3126. $2=smalltalk.HashedCollection._from_([$3]);
  3127. $1=_st($2)._asDictionary();
  3128. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3129. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3130. args: [],
  3131. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3132. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3133. referencedClasses: ["Dictionary"]
  3134. }),
  3135. smalltalk.DictionaryTest);
  3136. smalltalk.addMethod(
  3137. smalltalk.method({
  3138. selector: "testEquality",
  3139. protocol: 'tests',
  3140. fn: function (){
  3141. var self=this;
  3142. var d1,d2;
  3143. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3144. return smalltalk.withContext(function($ctx1) {
  3145. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3146. $2=_st($Dictionary())._new();
  3147. $ctx1.sendIdx["new"]=1;
  3148. $3=_st($Dictionary())._new();
  3149. $ctx1.sendIdx["new"]=2;
  3150. $1=_st($2).__eq($3);
  3151. $ctx1.sendIdx["="]=1;
  3152. self._assert_($1);
  3153. $ctx1.sendIdx["assert:"]=1;
  3154. $4=_st($Dictionary())._new();
  3155. $ctx1.sendIdx["new"]=3;
  3156. _st($4)._at_put_((1),(2));
  3157. $ctx1.sendIdx["at:put:"]=1;
  3158. $5=_st($4)._yourself();
  3159. $ctx1.sendIdx["yourself"]=1;
  3160. d1=$5;
  3161. $6=_st($Dictionary())._new();
  3162. $ctx1.sendIdx["new"]=4;
  3163. _st($6)._at_put_((1),(2));
  3164. $ctx1.sendIdx["at:put:"]=2;
  3165. $7=_st($6)._yourself();
  3166. $ctx1.sendIdx["yourself"]=2;
  3167. d2=$7;
  3168. $8=_st(d1).__eq(d2);
  3169. $ctx1.sendIdx["="]=2;
  3170. self._assert_($8);
  3171. $9=_st($Dictionary())._new();
  3172. $ctx1.sendIdx["new"]=5;
  3173. _st($9)._at_put_((1),(3));
  3174. $ctx1.sendIdx["at:put:"]=3;
  3175. $10=_st($9)._yourself();
  3176. $ctx1.sendIdx["yourself"]=3;
  3177. d2=$10;
  3178. $11=_st(d1).__eq(d2);
  3179. $ctx1.sendIdx["="]=3;
  3180. self._deny_($11);
  3181. $ctx1.sendIdx["deny:"]=1;
  3182. $12=_st($Dictionary())._new();
  3183. $ctx1.sendIdx["new"]=6;
  3184. _st($12)._at_put_((2),(2));
  3185. $ctx1.sendIdx["at:put:"]=4;
  3186. $13=_st($12)._yourself();
  3187. $ctx1.sendIdx["yourself"]=4;
  3188. d2=$13;
  3189. $14=_st(d1).__eq(d2);
  3190. $ctx1.sendIdx["="]=4;
  3191. self._deny_($14);
  3192. $ctx1.sendIdx["deny:"]=2;
  3193. $15=_st($Dictionary())._new();
  3194. _st($15)._at_put_((1),(2));
  3195. $ctx1.sendIdx["at:put:"]=5;
  3196. _st($15)._at_put_((3),(4));
  3197. $16=_st($15)._yourself();
  3198. d2=$16;
  3199. self._deny_(_st(d1).__eq(d2));
  3200. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3201. args: [],
  3202. 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.",
  3203. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3204. referencedClasses: ["Dictionary"]
  3205. }),
  3206. smalltalk.DictionaryTest);
  3207. smalltalk.addMethod(
  3208. smalltalk.method({
  3209. selector: "testKeys",
  3210. protocol: 'tests',
  3211. fn: function (){
  3212. var self=this;
  3213. var d;
  3214. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3215. return smalltalk.withContext(function($ctx1) {
  3216. d=_st($Dictionary())._new();
  3217. _st(d)._at_put_((1),(2));
  3218. $ctx1.sendIdx["at:put:"]=1;
  3219. _st(d)._at_put_((2),(3));
  3220. $ctx1.sendIdx["at:put:"]=2;
  3221. _st(d)._at_put_((3),(4));
  3222. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3223. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3224. args: [],
  3225. 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)",
  3226. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3227. referencedClasses: ["Dictionary"]
  3228. }),
  3229. smalltalk.DictionaryTest);
  3230. smalltalk.addMethod(
  3231. smalltalk.method({
  3232. selector: "testPointKey",
  3233. protocol: 'tests',
  3234. fn: function (){
  3235. var self=this;
  3236. var d;
  3237. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3238. return smalltalk.withContext(function($ctx1) {
  3239. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3240. d=_st($Dictionary())._new();
  3241. $1=d;
  3242. $2=(1).__at((1));
  3243. $ctx1.sendIdx["@"]=1;
  3244. _st($1)._at_put_($2,"foo");
  3245. $ctx1.sendIdx["at:put:"]=1;
  3246. $4=d;
  3247. $5=(1).__at((1));
  3248. $ctx1.sendIdx["@"]=2;
  3249. $3=_st($4)._at_($5);
  3250. $ctx1.sendIdx["at:"]=1;
  3251. self._assert_equals_($3,"foo");
  3252. $ctx1.sendIdx["assert:equals:"]=1;
  3253. $6=d;
  3254. $7=(1).__at((1));
  3255. $ctx1.sendIdx["@"]=3;
  3256. _st($6)._at_put_($7,"bar");
  3257. $9=d;
  3258. $10=(1).__at((1));
  3259. $ctx1.sendIdx["@"]=4;
  3260. $8=_st($9)._at_($10);
  3261. self._assert_equals_($8,"bar");
  3262. $ctx1.sendIdx["assert:equals:"]=2;
  3263. $11=d;
  3264. $12=(1).__at((1));
  3265. $ctx1.sendIdx["@"]=5;
  3266. _st($11)._removeKey_($12);
  3267. $14=d;
  3268. $15=(1).__at((1));
  3269. $ctx1.sendIdx["@"]=6;
  3270. $13=_st($14)._at_ifAbsent_($15,(function(){
  3271. return smalltalk.withContext(function($ctx2) {
  3272. return "baz";
  3273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3274. self._assert_equals_($13,"baz");
  3275. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3276. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3277. args: [],
  3278. 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)",
  3279. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3280. referencedClasses: ["Dictionary"]
  3281. }),
  3282. smalltalk.DictionaryTest);
  3283. smalltalk.addMethod(
  3284. smalltalk.method({
  3285. selector: "testPrintString",
  3286. protocol: 'tests',
  3287. fn: function (){
  3288. var self=this;
  3289. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3290. return smalltalk.withContext(function($ctx1) {
  3291. var $2,$3,$1;
  3292. $2=_st($Dictionary())._new();
  3293. _st($2)._at_put_("firstname","James");
  3294. $ctx1.sendIdx["at:put:"]=1;
  3295. _st($2)._at_put_("lastname","Bond");
  3296. $3=_st($2)._printString();
  3297. $1=$3;
  3298. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3299. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3300. args: [],
  3301. 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'')'",
  3302. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3303. referencedClasses: ["Dictionary"]
  3304. }),
  3305. smalltalk.DictionaryTest);
  3306. smalltalk.addMethod(
  3307. smalltalk.method({
  3308. selector: "testRemoveKey",
  3309. protocol: 'tests',
  3310. fn: function (){
  3311. var self=this;
  3312. var d,key;
  3313. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3314. return smalltalk.withContext(function($ctx1) {
  3315. var $1;
  3316. d=_st($Dictionary())._new();
  3317. _st(d)._at_put_((1),(2));
  3318. $ctx1.sendIdx["at:put:"]=1;
  3319. _st(d)._at_put_((2),(3));
  3320. $ctx1.sendIdx["at:put:"]=2;
  3321. _st(d)._at_put_((3),(4));
  3322. key=(2);
  3323. $1=_st(d)._keys();
  3324. $ctx1.sendIdx["keys"]=1;
  3325. self._assert_equals_($1,[(1), (2), (3)]);
  3326. $ctx1.sendIdx["assert:equals:"]=1;
  3327. _st(d)._removeKey_(key);
  3328. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3329. $ctx1.sendIdx["assert:equals:"]=2;
  3330. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3331. self._deny_(_st(d)._includesKey_((2)));
  3332. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3333. args: [],
  3334. 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)",
  3335. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3336. referencedClasses: ["Dictionary"]
  3337. }),
  3338. smalltalk.DictionaryTest);
  3339. smalltalk.addMethod(
  3340. smalltalk.method({
  3341. selector: "testRemoveKeyIfAbsent",
  3342. protocol: 'tests',
  3343. fn: function (){
  3344. var self=this;
  3345. var d,key;
  3346. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3347. return smalltalk.withContext(function($ctx1) {
  3348. var $1;
  3349. d=_st($Dictionary())._new();
  3350. _st(d)._at_put_((1),(2));
  3351. $ctx1.sendIdx["at:put:"]=1;
  3352. _st(d)._at_put_((2),(3));
  3353. $ctx1.sendIdx["at:put:"]=2;
  3354. _st(d)._at_put_((3),(4));
  3355. key=(2);
  3356. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3357. $ctx1.sendIdx["assert:equals:"]=1;
  3358. key=(3);
  3359. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3360. return smalltalk.withContext(function($ctx2) {
  3361. return (42);
  3362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3363. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3364. self._assert_equals_($1,(4));
  3365. $ctx1.sendIdx["assert:equals:"]=2;
  3366. key="why";
  3367. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3368. return smalltalk.withContext(function($ctx2) {
  3369. return (42);
  3370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3371. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3372. args: [],
  3373. 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.",
  3374. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3375. referencedClasses: ["Dictionary"]
  3376. }),
  3377. smalltalk.DictionaryTest);
  3378. smalltalk.addMethod(
  3379. smalltalk.method({
  3380. selector: "testValues",
  3381. protocol: 'tests',
  3382. fn: function (){
  3383. var self=this;
  3384. var d;
  3385. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3386. return smalltalk.withContext(function($ctx1) {
  3387. d=_st($Dictionary())._new();
  3388. _st(d)._at_put_((1),(2));
  3389. $ctx1.sendIdx["at:put:"]=1;
  3390. _st(d)._at_put_((2),(3));
  3391. $ctx1.sendIdx["at:put:"]=2;
  3392. _st(d)._at_put_((3),(4));
  3393. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3394. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3395. args: [],
  3396. 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)",
  3397. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3398. referencedClasses: ["Dictionary"]
  3399. }),
  3400. smalltalk.DictionaryTest);
  3401. smalltalk.addMethod(
  3402. smalltalk.method({
  3403. selector: "collectionClass",
  3404. protocol: 'fixture',
  3405. fn: function (){
  3406. var self=this;
  3407. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3408. return smalltalk.withContext(function($ctx1) {
  3409. return $Dictionary();
  3410. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3411. args: [],
  3412. source: "collectionClass\x0a\x09^ Dictionary",
  3413. messageSends: [],
  3414. referencedClasses: ["Dictionary"]
  3415. }),
  3416. smalltalk.DictionaryTest.klass);
  3417. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3418. smalltalk.addMethod(
  3419. smalltalk.method({
  3420. selector: "collectionFirst",
  3421. protocol: 'fixture',
  3422. fn: function (){
  3423. var self=this;
  3424. return smalltalk.withContext(function($ctx1) {
  3425. self._subclassResponsibility();
  3426. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3427. args: [],
  3428. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3429. messageSends: ["subclassResponsibility"],
  3430. referencedClasses: []
  3431. }),
  3432. smalltalk.SequenceableCollectionTest);
  3433. smalltalk.addMethod(
  3434. smalltalk.method({
  3435. selector: "collectionFirstTwo",
  3436. protocol: 'fixture',
  3437. fn: function (){
  3438. var self=this;
  3439. return smalltalk.withContext(function($ctx1) {
  3440. self._subclassResponsibility();
  3441. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3442. args: [],
  3443. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3444. messageSends: ["subclassResponsibility"],
  3445. referencedClasses: []
  3446. }),
  3447. smalltalk.SequenceableCollectionTest);
  3448. smalltalk.addMethod(
  3449. smalltalk.method({
  3450. selector: "collectionLast",
  3451. protocol: 'fixture',
  3452. fn: function (){
  3453. var self=this;
  3454. return smalltalk.withContext(function($ctx1) {
  3455. self._subclassResponsibility();
  3456. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3457. args: [],
  3458. source: "collectionLast\x0a\x09self subclassResponsibility",
  3459. messageSends: ["subclassResponsibility"],
  3460. referencedClasses: []
  3461. }),
  3462. smalltalk.SequenceableCollectionTest);
  3463. smalltalk.addMethod(
  3464. smalltalk.method({
  3465. selector: "collectionLastTwo",
  3466. protocol: 'fixture',
  3467. fn: function (){
  3468. var self=this;
  3469. return smalltalk.withContext(function($ctx1) {
  3470. self._subclassResponsibility();
  3471. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3472. args: [],
  3473. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3474. messageSends: ["subclassResponsibility"],
  3475. referencedClasses: []
  3476. }),
  3477. smalltalk.SequenceableCollectionTest);
  3478. smalltalk.addMethod(
  3479. smalltalk.method({
  3480. selector: "nonIndexesDo:",
  3481. protocol: 'fixture',
  3482. fn: function (aBlock){
  3483. var self=this;
  3484. return smalltalk.withContext(function($ctx1) {
  3485. _st(aBlock)._value_((0));
  3486. $ctx1.sendIdx["value:"]=1;
  3487. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3488. $ctx1.sendIdx["value:"]=2;
  3489. _st(aBlock)._value_("z");
  3490. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3491. args: ["aBlock"],
  3492. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3493. messageSends: ["value:", "+", "collectionSize"],
  3494. referencedClasses: []
  3495. }),
  3496. smalltalk.SequenceableCollectionTest);
  3497. smalltalk.addMethod(
  3498. smalltalk.method({
  3499. selector: "samplesDo:",
  3500. protocol: 'fixture',
  3501. fn: function (aBlock){
  3502. var self=this;
  3503. return smalltalk.withContext(function($ctx1) {
  3504. _st(aBlock)._value_value_((1),self._collectionFirst());
  3505. $ctx1.sendIdx["value:value:"]=1;
  3506. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3507. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3508. args: ["aBlock"],
  3509. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3510. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3511. referencedClasses: []
  3512. }),
  3513. smalltalk.SequenceableCollectionTest);
  3514. smalltalk.addMethod(
  3515. smalltalk.method({
  3516. selector: "testBeginsWith",
  3517. protocol: 'tests',
  3518. fn: function (){
  3519. var self=this;
  3520. return smalltalk.withContext(function($ctx1) {
  3521. var $2,$1,$4,$5,$3,$7,$6;
  3522. $2=self._collection();
  3523. $ctx1.sendIdx["collection"]=1;
  3524. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3525. $ctx1.sendIdx["beginsWith:"]=1;
  3526. self._assert_($1);
  3527. $ctx1.sendIdx["assert:"]=1;
  3528. $4=self._collection();
  3529. $ctx1.sendIdx["collection"]=2;
  3530. $5=self._collection();
  3531. $ctx1.sendIdx["collection"]=3;
  3532. $3=_st($4)._beginsWith_($5);
  3533. $ctx1.sendIdx["beginsWith:"]=2;
  3534. self._assert_($3);
  3535. $ctx1.sendIdx["assert:"]=2;
  3536. $7=self._collection();
  3537. $ctx1.sendIdx["collection"]=4;
  3538. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3539. $ctx1.sendIdx["beginsWith:"]=3;
  3540. self._assert_($6);
  3541. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3542. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3543. args: [],
  3544. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  3545. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3546. referencedClasses: []
  3547. }),
  3548. smalltalk.SequenceableCollectionTest);
  3549. smalltalk.addMethod(
  3550. smalltalk.method({
  3551. selector: "testEndsWith",
  3552. protocol: 'tests',
  3553. fn: function (){
  3554. var self=this;
  3555. return smalltalk.withContext(function($ctx1) {
  3556. var $2,$1,$4,$5,$3,$7,$6;
  3557. $2=self._collection();
  3558. $ctx1.sendIdx["collection"]=1;
  3559. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3560. $ctx1.sendIdx["endsWith:"]=1;
  3561. self._assert_($1);
  3562. $ctx1.sendIdx["assert:"]=1;
  3563. $4=self._collection();
  3564. $ctx1.sendIdx["collection"]=2;
  3565. $5=self._collection();
  3566. $ctx1.sendIdx["collection"]=3;
  3567. $3=_st($4)._endsWith_($5);
  3568. $ctx1.sendIdx["endsWith:"]=2;
  3569. self._assert_($3);
  3570. $ctx1.sendIdx["assert:"]=2;
  3571. $7=self._collection();
  3572. $ctx1.sendIdx["collection"]=4;
  3573. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3574. $ctx1.sendIdx["endsWith:"]=3;
  3575. self._assert_($6);
  3576. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3577. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3578. args: [],
  3579. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  3580. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3581. referencedClasses: []
  3582. }),
  3583. smalltalk.SequenceableCollectionTest);
  3584. smalltalk.addMethod(
  3585. smalltalk.method({
  3586. selector: "testFirst",
  3587. protocol: 'tests',
  3588. fn: function (){
  3589. var self=this;
  3590. return smalltalk.withContext(function($ctx1) {
  3591. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3592. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3593. args: [],
  3594. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3595. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3596. referencedClasses: []
  3597. }),
  3598. smalltalk.SequenceableCollectionTest);
  3599. smalltalk.addMethod(
  3600. smalltalk.method({
  3601. selector: "testFirstN",
  3602. protocol: 'tests',
  3603. fn: function (){
  3604. var self=this;
  3605. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3606. return smalltalk.withContext(function($ctx1) {
  3607. var $2,$1,$4,$3,$6,$5,$7;
  3608. $2=self._collection();
  3609. $ctx1.sendIdx["collection"]=1;
  3610. $1=_st($2)._first_((2));
  3611. $ctx1.sendIdx["first:"]=1;
  3612. self._assert_equals_($1,self._collectionFirstTwo());
  3613. $ctx1.sendIdx["assert:equals:"]=1;
  3614. $4=self._collection();
  3615. $ctx1.sendIdx["collection"]=2;
  3616. $3=_st($4)._first_((0));
  3617. $ctx1.sendIdx["first:"]=2;
  3618. self._assert_equals_($3,_st(self._collectionClass())._new());
  3619. $ctx1.sendIdx["assert:equals:"]=2;
  3620. $6=self._collection();
  3621. $ctx1.sendIdx["collection"]=3;
  3622. $5=_st($6)._first_(self._collectionSize());
  3623. $ctx1.sendIdx["first:"]=3;
  3624. $7=self._collection();
  3625. $ctx1.sendIdx["collection"]=4;
  3626. self._assert_equals_($5,$7);
  3627. self._should_raise_((function(){
  3628. return smalltalk.withContext(function($ctx2) {
  3629. return _st(self._collection())._first_((33));
  3630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3631. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3632. args: [],
  3633. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3634. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3635. referencedClasses: ["Error"]
  3636. }),
  3637. smalltalk.SequenceableCollectionTest);
  3638. smalltalk.addMethod(
  3639. smalltalk.method({
  3640. selector: "testFourth",
  3641. protocol: 'tests',
  3642. fn: function (){
  3643. var self=this;
  3644. return smalltalk.withContext(function($ctx1) {
  3645. var $2,$1;
  3646. $2=self._collection();
  3647. $ctx1.sendIdx["collection"]=1;
  3648. $1=_st($2)._fourth();
  3649. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3650. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3651. args: [],
  3652. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3653. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3654. referencedClasses: []
  3655. }),
  3656. smalltalk.SequenceableCollectionTest);
  3657. smalltalk.addMethod(
  3658. smalltalk.method({
  3659. selector: "testLast",
  3660. protocol: 'tests',
  3661. fn: function (){
  3662. var self=this;
  3663. return smalltalk.withContext(function($ctx1) {
  3664. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3665. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3666. args: [],
  3667. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3668. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3669. referencedClasses: []
  3670. }),
  3671. smalltalk.SequenceableCollectionTest);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "testLastN",
  3675. protocol: 'tests',
  3676. fn: function (){
  3677. var self=this;
  3678. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3679. return smalltalk.withContext(function($ctx1) {
  3680. var $2,$1,$4,$3,$6,$5,$7;
  3681. $2=self._collection();
  3682. $ctx1.sendIdx["collection"]=1;
  3683. $1=_st($2)._last_((2));
  3684. $ctx1.sendIdx["last:"]=1;
  3685. self._assert_equals_($1,self._collectionLastTwo());
  3686. $ctx1.sendIdx["assert:equals:"]=1;
  3687. $4=self._collection();
  3688. $ctx1.sendIdx["collection"]=2;
  3689. $3=_st($4)._last_((0));
  3690. $ctx1.sendIdx["last:"]=2;
  3691. self._assert_equals_($3,_st(self._collectionClass())._new());
  3692. $ctx1.sendIdx["assert:equals:"]=2;
  3693. $6=self._collection();
  3694. $ctx1.sendIdx["collection"]=3;
  3695. $5=_st($6)._last_(self._collectionSize());
  3696. $ctx1.sendIdx["last:"]=3;
  3697. $7=self._collection();
  3698. $ctx1.sendIdx["collection"]=4;
  3699. self._assert_equals_($5,$7);
  3700. self._should_raise_((function(){
  3701. return smalltalk.withContext(function($ctx2) {
  3702. return _st(self._collection())._last_((33));
  3703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3704. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3705. args: [],
  3706. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3707. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3708. referencedClasses: ["Error"]
  3709. }),
  3710. smalltalk.SequenceableCollectionTest);
  3711. smalltalk.addMethod(
  3712. smalltalk.method({
  3713. selector: "testSecond",
  3714. protocol: 'tests',
  3715. fn: function (){
  3716. var self=this;
  3717. return smalltalk.withContext(function($ctx1) {
  3718. var $2,$1;
  3719. $2=self._collection();
  3720. $ctx1.sendIdx["collection"]=1;
  3721. $1=_st($2)._second();
  3722. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3723. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3724. args: [],
  3725. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3726. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3727. referencedClasses: []
  3728. }),
  3729. smalltalk.SequenceableCollectionTest);
  3730. smalltalk.addMethod(
  3731. smalltalk.method({
  3732. selector: "testThird",
  3733. protocol: 'tests',
  3734. fn: function (){
  3735. var self=this;
  3736. return smalltalk.withContext(function($ctx1) {
  3737. var $2,$1;
  3738. $2=self._collection();
  3739. $ctx1.sendIdx["collection"]=1;
  3740. $1=_st($2)._third();
  3741. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3742. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3743. args: [],
  3744. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3745. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3746. referencedClasses: []
  3747. }),
  3748. smalltalk.SequenceableCollectionTest);
  3749. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3750. smalltalk.addMethod(
  3751. smalltalk.method({
  3752. selector: "collection",
  3753. protocol: 'fixture',
  3754. fn: function (){
  3755. var self=this;
  3756. return smalltalk.withContext(function($ctx1) {
  3757. var $1;
  3758. $1=[(1), (2), (3), (-4)];
  3759. return $1;
  3760. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3761. args: [],
  3762. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3763. messageSends: [],
  3764. referencedClasses: []
  3765. }),
  3766. smalltalk.ArrayTest);
  3767. smalltalk.addMethod(
  3768. smalltalk.method({
  3769. selector: "collectionFirst",
  3770. protocol: 'fixture',
  3771. fn: function (){
  3772. var self=this;
  3773. return smalltalk.withContext(function($ctx1) {
  3774. return (1);
  3775. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3776. args: [],
  3777. source: "collectionFirst\x0a\x09^ 1",
  3778. messageSends: [],
  3779. referencedClasses: []
  3780. }),
  3781. smalltalk.ArrayTest);
  3782. smalltalk.addMethod(
  3783. smalltalk.method({
  3784. selector: "collectionFirstTwo",
  3785. protocol: 'fixture',
  3786. fn: function (){
  3787. var self=this;
  3788. return smalltalk.withContext(function($ctx1) {
  3789. var $1;
  3790. $1=[(1), (2)];
  3791. return $1;
  3792. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3793. args: [],
  3794. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3795. messageSends: [],
  3796. referencedClasses: []
  3797. }),
  3798. smalltalk.ArrayTest);
  3799. smalltalk.addMethod(
  3800. smalltalk.method({
  3801. selector: "collectionLast",
  3802. protocol: 'fixture',
  3803. fn: function (){
  3804. var self=this;
  3805. return smalltalk.withContext(function($ctx1) {
  3806. return (-4);
  3807. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3808. args: [],
  3809. source: "collectionLast\x0a\x09^ -4",
  3810. messageSends: [],
  3811. referencedClasses: []
  3812. }),
  3813. smalltalk.ArrayTest);
  3814. smalltalk.addMethod(
  3815. smalltalk.method({
  3816. selector: "collectionLastTwo",
  3817. protocol: 'fixture',
  3818. fn: function (){
  3819. var self=this;
  3820. return smalltalk.withContext(function($ctx1) {
  3821. var $1;
  3822. $1=[(3), (-4)];
  3823. return $1;
  3824. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3825. args: [],
  3826. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3827. messageSends: [],
  3828. referencedClasses: []
  3829. }),
  3830. smalltalk.ArrayTest);
  3831. smalltalk.addMethod(
  3832. smalltalk.method({
  3833. selector: "collectionOfPrintStrings",
  3834. protocol: 'fixture',
  3835. fn: function (){
  3836. var self=this;
  3837. return smalltalk.withContext(function($ctx1) {
  3838. var $1;
  3839. $1=["1", "2", "3", "-4"];
  3840. return $1;
  3841. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3842. args: [],
  3843. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3844. messageSends: [],
  3845. referencedClasses: []
  3846. }),
  3847. smalltalk.ArrayTest);
  3848. smalltalk.addMethod(
  3849. smalltalk.method({
  3850. selector: "collectionSize",
  3851. protocol: 'fixture',
  3852. fn: function (){
  3853. var self=this;
  3854. return smalltalk.withContext(function($ctx1) {
  3855. return (4);
  3856. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3857. args: [],
  3858. source: "collectionSize\x0a\x09^ 4",
  3859. messageSends: [],
  3860. referencedClasses: []
  3861. }),
  3862. smalltalk.ArrayTest);
  3863. smalltalk.addMethod(
  3864. smalltalk.method({
  3865. selector: "collectionWithDuplicates",
  3866. protocol: 'fixture',
  3867. fn: function (){
  3868. var self=this;
  3869. return smalltalk.withContext(function($ctx1) {
  3870. var $1;
  3871. $1=["a", "b", "c", (1), (2), (1), "a"];
  3872. return $1;
  3873. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3874. args: [],
  3875. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3876. messageSends: [],
  3877. referencedClasses: []
  3878. }),
  3879. smalltalk.ArrayTest);
  3880. smalltalk.addMethod(
  3881. smalltalk.method({
  3882. selector: "collectionWithNewValue",
  3883. protocol: 'fixture',
  3884. fn: function (){
  3885. var self=this;
  3886. return smalltalk.withContext(function($ctx1) {
  3887. var $1;
  3888. $1=[(1), (2), (3), (-4), "N"];
  3889. return $1;
  3890. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3891. args: [],
  3892. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3893. messageSends: [],
  3894. referencedClasses: []
  3895. }),
  3896. smalltalk.ArrayTest);
  3897. smalltalk.addMethod(
  3898. smalltalk.method({
  3899. selector: "sampleNewIndex",
  3900. protocol: 'fixture',
  3901. fn: function (){
  3902. var self=this;
  3903. return smalltalk.withContext(function($ctx1) {
  3904. return (5);
  3905. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3906. args: [],
  3907. source: "sampleNewIndex\x0a\x09^ 5",
  3908. messageSends: [],
  3909. referencedClasses: []
  3910. }),
  3911. smalltalk.ArrayTest);
  3912. smalltalk.addMethod(
  3913. smalltalk.method({
  3914. selector: "samplesDo:",
  3915. protocol: 'fixture',
  3916. fn: function (aBlock){
  3917. var self=this;
  3918. return smalltalk.withContext(function($ctx1) {
  3919. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3920. _st(aBlock)._value_value_((3),(3));
  3921. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3922. args: ["aBlock"],
  3923. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3924. messageSends: ["samplesDo:", "value:value:"],
  3925. referencedClasses: []
  3926. }),
  3927. smalltalk.ArrayTest);
  3928. smalltalk.addMethod(
  3929. smalltalk.method({
  3930. selector: "testAdd",
  3931. protocol: 'tests',
  3932. fn: function (){
  3933. var self=this;
  3934. var array;
  3935. return smalltalk.withContext(function($ctx1) {
  3936. array=self._collection();
  3937. _st(array)._add_((6));
  3938. self._assert_equals_(_st(array)._last(),(6));
  3939. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3940. args: [],
  3941. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3942. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3943. referencedClasses: []
  3944. }),
  3945. smalltalk.ArrayTest);
  3946. smalltalk.addMethod(
  3947. smalltalk.method({
  3948. selector: "testAddFirst",
  3949. protocol: 'tests',
  3950. fn: function (){
  3951. var self=this;
  3952. return smalltalk.withContext(function($ctx1) {
  3953. var $1,$2;
  3954. $1=self._collection();
  3955. _st($1)._addFirst_((0));
  3956. $2=_st($1)._yourself();
  3957. self._assert_equals_(_st($2)._first(),(0));
  3958. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3959. args: [],
  3960. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3961. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3962. referencedClasses: []
  3963. }),
  3964. smalltalk.ArrayTest);
  3965. smalltalk.addMethod(
  3966. smalltalk.method({
  3967. selector: "testPrintString",
  3968. protocol: 'tests',
  3969. fn: function (){
  3970. var self=this;
  3971. var array;
  3972. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3973. return smalltalk.withContext(function($ctx1) {
  3974. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3975. array=_st($Array())._new();
  3976. $1=_st(array)._printString();
  3977. $ctx1.sendIdx["printString"]=1;
  3978. self._assert_equals_($1,"an Array ()");
  3979. $ctx1.sendIdx["assert:equals:"]=1;
  3980. $2=array;
  3981. _st($2)._add_((1));
  3982. $ctx1.sendIdx["add:"]=1;
  3983. $3=_st($2)._add_((3));
  3984. $ctx1.sendIdx["add:"]=2;
  3985. $4=_st(array)._printString();
  3986. $ctx1.sendIdx["printString"]=2;
  3987. self._assert_equals_($4,"an Array (1 3)");
  3988. $ctx1.sendIdx["assert:equals:"]=2;
  3989. _st(array)._add_("foo");
  3990. $5=_st(array)._printString();
  3991. $ctx1.sendIdx["printString"]=3;
  3992. self._assert_equals_($5,"an Array (1 3 'foo')");
  3993. $ctx1.sendIdx["assert:equals:"]=3;
  3994. $6=array;
  3995. _st($6)._remove_((1));
  3996. $ctx1.sendIdx["remove:"]=1;
  3997. $7=_st($6)._remove_((3));
  3998. $8=_st(array)._printString();
  3999. $ctx1.sendIdx["printString"]=4;
  4000. self._assert_equals_($8,"an Array ('foo')");
  4001. $ctx1.sendIdx["assert:equals:"]=4;
  4002. _st(array)._addLast_((3));
  4003. $ctx1.sendIdx["addLast:"]=1;
  4004. $9=_st(array)._printString();
  4005. $ctx1.sendIdx["printString"]=5;
  4006. self._assert_equals_($9,"an Array ('foo' 3)");
  4007. $ctx1.sendIdx["assert:equals:"]=5;
  4008. _st(array)._addLast_((3));
  4009. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4010. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4011. args: [],
  4012. 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)'.",
  4013. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4014. referencedClasses: ["Array"]
  4015. }),
  4016. smalltalk.ArrayTest);
  4017. smalltalk.addMethod(
  4018. smalltalk.method({
  4019. selector: "testRemove",
  4020. protocol: 'tests',
  4021. fn: function (){
  4022. var self=this;
  4023. var array;
  4024. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4025. return smalltalk.withContext(function($ctx1) {
  4026. array=[(1), (2), (3), (4), (5)];
  4027. _st(array)._remove_((3));
  4028. $ctx1.sendIdx["remove:"]=1;
  4029. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4030. self._should_raise_((function(){
  4031. return smalltalk.withContext(function($ctx2) {
  4032. return _st(array)._remove_((3));
  4033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4034. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4035. args: [],
  4036. 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",
  4037. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4038. referencedClasses: ["Error"]
  4039. }),
  4040. smalltalk.ArrayTest);
  4041. smalltalk.addMethod(
  4042. smalltalk.method({
  4043. selector: "testRemoveFromTo",
  4044. protocol: 'tests',
  4045. fn: function (){
  4046. var self=this;
  4047. return smalltalk.withContext(function($ctx1) {
  4048. var $1,$2;
  4049. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4050. $ctx1.sendIdx["removeFrom:to:"]=1;
  4051. self._assert_equals_($1,[(4)]);
  4052. $ctx1.sendIdx["assert:equals:"]=1;
  4053. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4054. $ctx1.sendIdx["removeFrom:to:"]=2;
  4055. self._assert_equals_($2,[(1), (4)]);
  4056. $ctx1.sendIdx["assert:equals:"]=2;
  4057. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4058. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4059. args: [],
  4060. 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)",
  4061. messageSends: ["assert:equals:", "removeFrom:to:"],
  4062. referencedClasses: []
  4063. }),
  4064. smalltalk.ArrayTest);
  4065. smalltalk.addMethod(
  4066. smalltalk.method({
  4067. selector: "testRemoveIndex",
  4068. protocol: 'tests',
  4069. fn: function (){
  4070. var self=this;
  4071. return smalltalk.withContext(function($ctx1) {
  4072. var $1,$2;
  4073. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4074. $ctx1.sendIdx["removeIndex:"]=1;
  4075. self._assert_equals_($1,[(1), (3), (4)]);
  4076. $ctx1.sendIdx["assert:equals:"]=1;
  4077. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4078. $ctx1.sendIdx["removeIndex:"]=2;
  4079. self._assert_equals_($2,[(2), (3), (4)]);
  4080. $ctx1.sendIdx["assert:equals:"]=2;
  4081. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4082. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4083. args: [],
  4084. 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: #()",
  4085. messageSends: ["assert:equals:", "removeIndex:"],
  4086. referencedClasses: []
  4087. }),
  4088. smalltalk.ArrayTest);
  4089. smalltalk.addMethod(
  4090. smalltalk.method({
  4091. selector: "testRemoveLast",
  4092. protocol: 'tests',
  4093. fn: function (){
  4094. var self=this;
  4095. var array;
  4096. return smalltalk.withContext(function($ctx1) {
  4097. array=[(1), (2)];
  4098. _st(array)._removeLast();
  4099. self._assert_equals_(_st(array)._last(),(1));
  4100. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4101. args: [],
  4102. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4103. messageSends: ["removeLast", "assert:equals:", "last"],
  4104. referencedClasses: []
  4105. }),
  4106. smalltalk.ArrayTest);
  4107. smalltalk.addMethod(
  4108. smalltalk.method({
  4109. selector: "testReversed",
  4110. protocol: 'tests',
  4111. fn: function (){
  4112. var self=this;
  4113. var array;
  4114. return smalltalk.withContext(function($ctx1) {
  4115. array=[(5), (4), (3), (2), (1)];
  4116. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4117. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4118. args: [],
  4119. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4120. messageSends: ["assert:equals:", "reversed"],
  4121. referencedClasses: []
  4122. }),
  4123. smalltalk.ArrayTest);
  4124. smalltalk.addMethod(
  4125. smalltalk.method({
  4126. selector: "testSort",
  4127. protocol: 'tests',
  4128. fn: function (){
  4129. var self=this;
  4130. var array;
  4131. return smalltalk.withContext(function($ctx1) {
  4132. array=[(3), (1), (4), (5), (2)];
  4133. _st(array)._sort();
  4134. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4135. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4136. args: [],
  4137. 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)",
  4138. messageSends: ["sort", "assert:equals:"],
  4139. referencedClasses: []
  4140. }),
  4141. smalltalk.ArrayTest);
  4142. smalltalk.addMethod(
  4143. smalltalk.method({
  4144. selector: "collectionClass",
  4145. protocol: 'fixture',
  4146. fn: function (){
  4147. var self=this;
  4148. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4149. return smalltalk.withContext(function($ctx1) {
  4150. return $Array();
  4151. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4152. args: [],
  4153. source: "collectionClass\x0a\x09^ Array",
  4154. messageSends: [],
  4155. referencedClasses: ["Array"]
  4156. }),
  4157. smalltalk.ArrayTest.klass);
  4158. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4159. smalltalk.addMethod(
  4160. smalltalk.method({
  4161. selector: "collection",
  4162. protocol: 'fixture',
  4163. fn: function (){
  4164. var self=this;
  4165. return smalltalk.withContext(function($ctx1) {
  4166. return "hello";
  4167. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4168. args: [],
  4169. source: "collection\x0a\x09^ 'hello'",
  4170. messageSends: [],
  4171. referencedClasses: []
  4172. }),
  4173. smalltalk.StringTest);
  4174. smalltalk.addMethod(
  4175. smalltalk.method({
  4176. selector: "collectionFirst",
  4177. protocol: 'fixture',
  4178. fn: function (){
  4179. var self=this;
  4180. return smalltalk.withContext(function($ctx1) {
  4181. return "h";
  4182. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4183. args: [],
  4184. source: "collectionFirst\x0a\x09^ 'h'",
  4185. messageSends: [],
  4186. referencedClasses: []
  4187. }),
  4188. smalltalk.StringTest);
  4189. smalltalk.addMethod(
  4190. smalltalk.method({
  4191. selector: "collectionFirstTwo",
  4192. protocol: 'fixture',
  4193. fn: function (){
  4194. var self=this;
  4195. return smalltalk.withContext(function($ctx1) {
  4196. return "he";
  4197. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4198. args: [],
  4199. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4200. messageSends: [],
  4201. referencedClasses: []
  4202. }),
  4203. smalltalk.StringTest);
  4204. smalltalk.addMethod(
  4205. smalltalk.method({
  4206. selector: "collectionLast",
  4207. protocol: 'fixture',
  4208. fn: function (){
  4209. var self=this;
  4210. return smalltalk.withContext(function($ctx1) {
  4211. return "o";
  4212. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4213. args: [],
  4214. source: "collectionLast\x0a\x09^ 'o'",
  4215. messageSends: [],
  4216. referencedClasses: []
  4217. }),
  4218. smalltalk.StringTest);
  4219. smalltalk.addMethod(
  4220. smalltalk.method({
  4221. selector: "collectionLastTwo",
  4222. protocol: 'fixture',
  4223. fn: function (){
  4224. var self=this;
  4225. return smalltalk.withContext(function($ctx1) {
  4226. return "lo";
  4227. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4228. args: [],
  4229. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4230. messageSends: [],
  4231. referencedClasses: []
  4232. }),
  4233. smalltalk.StringTest);
  4234. smalltalk.addMethod(
  4235. smalltalk.method({
  4236. selector: "collectionOfPrintStrings",
  4237. protocol: 'fixture',
  4238. fn: function (){
  4239. var self=this;
  4240. return smalltalk.withContext(function($ctx1) {
  4241. return "'h''e''l''l''o'";
  4242. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4243. args: [],
  4244. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4245. messageSends: [],
  4246. referencedClasses: []
  4247. }),
  4248. smalltalk.StringTest);
  4249. smalltalk.addMethod(
  4250. smalltalk.method({
  4251. selector: "collectionSize",
  4252. protocol: 'fixture',
  4253. fn: function (){
  4254. var self=this;
  4255. return smalltalk.withContext(function($ctx1) {
  4256. return (5);
  4257. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4258. args: [],
  4259. source: "collectionSize\x0a\x09^ 5",
  4260. messageSends: [],
  4261. referencedClasses: []
  4262. }),
  4263. smalltalk.StringTest);
  4264. smalltalk.addMethod(
  4265. smalltalk.method({
  4266. selector: "collectionWithDuplicates",
  4267. protocol: 'fixture',
  4268. fn: function (){
  4269. var self=this;
  4270. return smalltalk.withContext(function($ctx1) {
  4271. return "abbaerte";
  4272. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4273. args: [],
  4274. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4275. messageSends: [],
  4276. referencedClasses: []
  4277. }),
  4278. smalltalk.StringTest);
  4279. smalltalk.addMethod(
  4280. smalltalk.method({
  4281. selector: "collectionWithNewValue",
  4282. protocol: 'fixture',
  4283. fn: function (){
  4284. var self=this;
  4285. return smalltalk.withContext(function($ctx1) {
  4286. return "helloN";
  4287. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4288. args: [],
  4289. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4290. messageSends: [],
  4291. referencedClasses: []
  4292. }),
  4293. smalltalk.StringTest);
  4294. smalltalk.addMethod(
  4295. smalltalk.method({
  4296. selector: "sampleNewValueAsCollection",
  4297. protocol: 'fixture',
  4298. fn: function (){
  4299. var self=this;
  4300. return smalltalk.withContext(function($ctx1) {
  4301. return "N";
  4302. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4303. args: [],
  4304. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4305. messageSends: [],
  4306. referencedClasses: []
  4307. }),
  4308. smalltalk.StringTest);
  4309. smalltalk.addMethod(
  4310. smalltalk.method({
  4311. selector: "samplesDo:",
  4312. protocol: 'fixture',
  4313. fn: function (aBlock){
  4314. var self=this;
  4315. return smalltalk.withContext(function($ctx1) {
  4316. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4317. _st(aBlock)._value_value_((3),"l");
  4318. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4319. args: ["aBlock"],
  4320. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4321. messageSends: ["samplesDo:", "value:value:"],
  4322. referencedClasses: []
  4323. }),
  4324. smalltalk.StringTest);
  4325. smalltalk.addMethod(
  4326. smalltalk.method({
  4327. selector: "testAddAll",
  4328. protocol: 'tests',
  4329. fn: function (){
  4330. var self=this;
  4331. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4332. return smalltalk.withContext(function($ctx1) {
  4333. var $1;
  4334. self._should_raise_((function(){
  4335. return smalltalk.withContext(function($ctx2) {
  4336. $1=self._collection();
  4337. $ctx2.sendIdx["collection"]=1;
  4338. return _st($1)._addAll_(self._collection());
  4339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4340. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4341. args: [],
  4342. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4343. messageSends: ["should:raise:", "addAll:", "collection"],
  4344. referencedClasses: ["Error"]
  4345. }),
  4346. smalltalk.StringTest);
  4347. smalltalk.addMethod(
  4348. smalltalk.method({
  4349. selector: "testAddRemove",
  4350. protocol: 'tests',
  4351. fn: function (){
  4352. var self=this;
  4353. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4354. return smalltalk.withContext(function($ctx1) {
  4355. self._should_raise_((function(){
  4356. return smalltalk.withContext(function($ctx2) {
  4357. return "hello"._add_("a");
  4358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4359. $ctx1.sendIdx["should:raise:"]=1;
  4360. self._should_raise_((function(){
  4361. return smalltalk.withContext(function($ctx2) {
  4362. return "hello"._remove_("h");
  4363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4364. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4365. args: [],
  4366. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4367. messageSends: ["should:raise:", "add:", "remove:"],
  4368. referencedClasses: ["Error"]
  4369. }),
  4370. smalltalk.StringTest);
  4371. smalltalk.addMethod(
  4372. smalltalk.method({
  4373. selector: "testAsArray",
  4374. protocol: 'tests',
  4375. fn: function (){
  4376. var self=this;
  4377. return smalltalk.withContext(function($ctx1) {
  4378. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4379. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4380. args: [],
  4381. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4382. messageSends: ["assert:equals:", "asArray"],
  4383. referencedClasses: []
  4384. }),
  4385. smalltalk.StringTest);
  4386. smalltalk.addMethod(
  4387. smalltalk.method({
  4388. selector: "testAsLowerCase",
  4389. protocol: 'tests',
  4390. fn: function (){
  4391. var self=this;
  4392. return smalltalk.withContext(function($ctx1) {
  4393. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4394. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4395. args: [],
  4396. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4397. messageSends: ["assert:equals:", "asLowercase"],
  4398. referencedClasses: []
  4399. }),
  4400. smalltalk.StringTest);
  4401. smalltalk.addMethod(
  4402. smalltalk.method({
  4403. selector: "testAsNumber",
  4404. protocol: 'tests',
  4405. fn: function (){
  4406. var self=this;
  4407. return smalltalk.withContext(function($ctx1) {
  4408. var $1,$2;
  4409. $1="3"._asNumber();
  4410. $ctx1.sendIdx["asNumber"]=1;
  4411. self._assert_equals_($1,(3));
  4412. $ctx1.sendIdx["assert:equals:"]=1;
  4413. $2="-3"._asNumber();
  4414. $ctx1.sendIdx["asNumber"]=2;
  4415. self._assert_equals_($2,(-3));
  4416. $ctx1.sendIdx["assert:equals:"]=2;
  4417. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4418. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4419. args: [],
  4420. 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.",
  4421. messageSends: ["assert:equals:", "asNumber"],
  4422. referencedClasses: []
  4423. }),
  4424. smalltalk.StringTest);
  4425. smalltalk.addMethod(
  4426. smalltalk.method({
  4427. selector: "testAsUpperCase",
  4428. protocol: 'tests',
  4429. fn: function (){
  4430. var self=this;
  4431. return smalltalk.withContext(function($ctx1) {
  4432. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4433. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4434. args: [],
  4435. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4436. messageSends: ["assert:equals:", "asUppercase"],
  4437. referencedClasses: []
  4438. }),
  4439. smalltalk.StringTest);
  4440. smalltalk.addMethod(
  4441. smalltalk.method({
  4442. selector: "testAsciiValue",
  4443. protocol: 'tests',
  4444. fn: function (){
  4445. var self=this;
  4446. var characterA,characterU;
  4447. return smalltalk.withContext(function($ctx1) {
  4448. var $1;
  4449. characterA="A";
  4450. characterU="U";
  4451. $1=_st(characterA)._asciiValue();
  4452. $ctx1.sendIdx["asciiValue"]=1;
  4453. self._assert_equals_($1,(65));
  4454. $ctx1.sendIdx["assert:equals:"]=1;
  4455. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4456. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4457. args: [],
  4458. 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",
  4459. messageSends: ["assert:equals:", "asciiValue"],
  4460. referencedClasses: []
  4461. }),
  4462. smalltalk.StringTest);
  4463. smalltalk.addMethod(
  4464. smalltalk.method({
  4465. selector: "testAtPut",
  4466. protocol: 'tests',
  4467. fn: function (){
  4468. var self=this;
  4469. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4470. return smalltalk.withContext(function($ctx1) {
  4471. self._should_raise_((function(){
  4472. return smalltalk.withContext(function($ctx2) {
  4473. return "hello"._at_put_((1),"a");
  4474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4475. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4476. args: [],
  4477. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4478. messageSends: ["should:raise:", "at:put:"],
  4479. referencedClasses: ["Error"]
  4480. }),
  4481. smalltalk.StringTest);
  4482. smalltalk.addMethod(
  4483. smalltalk.method({
  4484. selector: "testCapitalized",
  4485. protocol: 'tests',
  4486. fn: function (){
  4487. var self=this;
  4488. return smalltalk.withContext(function($ctx1) {
  4489. var $1,$2,$3;
  4490. $1="test"._capitalized();
  4491. $ctx1.sendIdx["capitalized"]=1;
  4492. self._assert_equals_($1,"Test");
  4493. $ctx1.sendIdx["assert:equals:"]=1;
  4494. $2="Test"._capitalized();
  4495. $ctx1.sendIdx["capitalized"]=2;
  4496. self._assert_equals_($2,"Test");
  4497. $ctx1.sendIdx["assert:equals:"]=2;
  4498. self._assert_equals_(""._capitalized(),"");
  4499. $ctx1.sendIdx["assert:equals:"]=3;
  4500. $3="Test"._isCapitalized();
  4501. $ctx1.sendIdx["isCapitalized"]=1;
  4502. self._assert_equals_($3,true);
  4503. $ctx1.sendIdx["assert:equals:"]=4;
  4504. self._assert_equals_("test"._isCapitalized(),false);
  4505. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4506. args: [],
  4507. 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.",
  4508. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4509. referencedClasses: []
  4510. }),
  4511. smalltalk.StringTest);
  4512. smalltalk.addMethod(
  4513. smalltalk.method({
  4514. selector: "testCharCodeAt",
  4515. protocol: 'tests',
  4516. fn: function (){
  4517. var self=this;
  4518. return smalltalk.withContext(function($ctx1) {
  4519. var $1,$2,$3,$4,$5;
  4520. $1="jackie"._charCodeAt_((1));
  4521. $ctx1.sendIdx["charCodeAt:"]=1;
  4522. self._assert_equals_($1,(106));
  4523. $ctx1.sendIdx["assert:equals:"]=1;
  4524. $2="jackie"._charCodeAt_((2));
  4525. $ctx1.sendIdx["charCodeAt:"]=2;
  4526. self._assert_equals_($2,(97));
  4527. $ctx1.sendIdx["assert:equals:"]=2;
  4528. $3="jackie"._charCodeAt_((3));
  4529. $ctx1.sendIdx["charCodeAt:"]=3;
  4530. self._assert_equals_($3,(99));
  4531. $ctx1.sendIdx["assert:equals:"]=3;
  4532. $4="jackie"._charCodeAt_((4));
  4533. $ctx1.sendIdx["charCodeAt:"]=4;
  4534. self._assert_equals_($4,(107));
  4535. $ctx1.sendIdx["assert:equals:"]=4;
  4536. $5="jackie"._charCodeAt_((5));
  4537. $ctx1.sendIdx["charCodeAt:"]=5;
  4538. self._assert_equals_($5,(105));
  4539. $ctx1.sendIdx["assert:equals:"]=5;
  4540. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4541. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4542. args: [],
  4543. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  4544. messageSends: ["assert:equals:", "charCodeAt:"],
  4545. referencedClasses: []
  4546. }),
  4547. smalltalk.StringTest);
  4548. smalltalk.addMethod(
  4549. smalltalk.method({
  4550. selector: "testCopyFromTo",
  4551. protocol: 'tests',
  4552. fn: function (){
  4553. var self=this;
  4554. return smalltalk.withContext(function($ctx1) {
  4555. var $1;
  4556. $1="jackie"._copyFrom_to_((1),(3));
  4557. $ctx1.sendIdx["copyFrom:to:"]=1;
  4558. self._assert_equals_($1,"jac");
  4559. $ctx1.sendIdx["assert:equals:"]=1;
  4560. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4561. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4562. args: [],
  4563. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4564. messageSends: ["assert:equals:", "copyFrom:to:"],
  4565. referencedClasses: []
  4566. }),
  4567. smalltalk.StringTest);
  4568. smalltalk.addMethod(
  4569. smalltalk.method({
  4570. selector: "testCopyWithoutAll",
  4571. protocol: 'tests',
  4572. fn: function (){
  4573. var self=this;
  4574. return smalltalk.withContext(function($ctx1) {
  4575. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4576. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4577. args: [],
  4578. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4579. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4580. referencedClasses: []
  4581. }),
  4582. smalltalk.StringTest);
  4583. smalltalk.addMethod(
  4584. smalltalk.method({
  4585. selector: "testEquality",
  4586. protocol: 'tests',
  4587. fn: function (){
  4588. var self=this;
  4589. return smalltalk.withContext(function($ctx1) {
  4590. var $1,$2,$3;
  4591. self._assert_equals_("hello","hello");
  4592. $ctx1.sendIdx["assert:equals:"]=1;
  4593. $1="hello".__eq("world");
  4594. $ctx1.sendIdx["="]=1;
  4595. self._deny_($1);
  4596. $ctx1.sendIdx["deny:"]=1;
  4597. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4598. return smalltalk.withContext(function($ctx2) {
  4599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4600. $ctx1.sendIdx["="]=2;
  4601. self._deny_($2);
  4602. $ctx1.sendIdx["deny:"]=2;
  4603. $3="hello"._yourself();
  4604. $ctx1.sendIdx["yourself"]=1;
  4605. self._assert_equals_("hello",$3);
  4606. $ctx1.sendIdx["assert:equals:"]=2;
  4607. self._assert_equals_("hello"._yourself(),"hello");
  4608. self._deny_("".__eq((0)));
  4609. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4610. args: [],
  4611. 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",
  4612. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4613. referencedClasses: []
  4614. }),
  4615. smalltalk.StringTest);
  4616. smalltalk.addMethod(
  4617. smalltalk.method({
  4618. selector: "testIdentity",
  4619. protocol: 'tests',
  4620. fn: function (){
  4621. var self=this;
  4622. return smalltalk.withContext(function($ctx1) {
  4623. var $1,$2,$4,$3,$5;
  4624. $1="hello".__eq_eq("hello");
  4625. $ctx1.sendIdx["=="]=1;
  4626. self._assert_($1);
  4627. $ctx1.sendIdx["assert:"]=1;
  4628. $2="hello".__eq_eq("world");
  4629. $ctx1.sendIdx["=="]=2;
  4630. self._deny_($2);
  4631. $ctx1.sendIdx["deny:"]=1;
  4632. $4="hello"._yourself();
  4633. $ctx1.sendIdx["yourself"]=1;
  4634. $3="hello".__eq_eq($4);
  4635. $ctx1.sendIdx["=="]=3;
  4636. self._assert_($3);
  4637. $ctx1.sendIdx["assert:"]=2;
  4638. $5=_st("hello"._yourself()).__eq_eq("hello");
  4639. $ctx1.sendIdx["=="]=4;
  4640. self._assert_($5);
  4641. self._deny_("".__eq_eq((0)));
  4642. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4643. args: [],
  4644. 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",
  4645. messageSends: ["assert:", "==", "deny:", "yourself"],
  4646. referencedClasses: []
  4647. }),
  4648. smalltalk.StringTest);
  4649. smalltalk.addMethod(
  4650. smalltalk.method({
  4651. selector: "testIdentityHash",
  4652. protocol: 'tests',
  4653. fn: function (){
  4654. var self=this;
  4655. return smalltalk.withContext(function($ctx1) {
  4656. var $1,$2,$4,$3;
  4657. $1="foo"._identityHash();
  4658. $ctx1.sendIdx["identityHash"]=1;
  4659. $2="foo"._identityHash();
  4660. $ctx1.sendIdx["identityHash"]=2;
  4661. self._assert_equals_($1,$2);
  4662. $4="foo"._identityHash();
  4663. $ctx1.sendIdx["identityHash"]=3;
  4664. $3=_st($4).__eq("bar"._identityHash());
  4665. self._deny_($3);
  4666. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4667. args: [],
  4668. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4669. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4670. referencedClasses: []
  4671. }),
  4672. smalltalk.StringTest);
  4673. smalltalk.addMethod(
  4674. smalltalk.method({
  4675. selector: "testIncludesSubString",
  4676. protocol: 'tests',
  4677. fn: function (){
  4678. var self=this;
  4679. return smalltalk.withContext(function($ctx1) {
  4680. var $1;
  4681. $1="amber"._includesSubString_("ber");
  4682. $ctx1.sendIdx["includesSubString:"]=1;
  4683. self._assert_($1);
  4684. self._deny_("amber"._includesSubString_("zork"));
  4685. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4686. args: [],
  4687. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4688. messageSends: ["assert:", "includesSubString:", "deny:"],
  4689. referencedClasses: []
  4690. }),
  4691. smalltalk.StringTest);
  4692. smalltalk.addMethod(
  4693. smalltalk.method({
  4694. selector: "testIsVowel",
  4695. protocol: 'tests',
  4696. fn: function (){
  4697. var self=this;
  4698. var vowel,consonant;
  4699. return smalltalk.withContext(function($ctx1) {
  4700. var $1;
  4701. vowel="u";
  4702. consonant="z";
  4703. $1=_st(vowel)._isVowel();
  4704. $ctx1.sendIdx["isVowel"]=1;
  4705. self._assert_equals_($1,true);
  4706. $ctx1.sendIdx["assert:equals:"]=1;
  4707. self._assert_equals_(_st(consonant)._isVowel(),false);
  4708. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4709. args: [],
  4710. 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",
  4711. messageSends: ["assert:equals:", "isVowel"],
  4712. referencedClasses: []
  4713. }),
  4714. smalltalk.StringTest);
  4715. smalltalk.addMethod(
  4716. smalltalk.method({
  4717. selector: "testJoin",
  4718. protocol: 'tests',
  4719. fn: function (){
  4720. var self=this;
  4721. return smalltalk.withContext(function($ctx1) {
  4722. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4723. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4724. args: [],
  4725. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4726. messageSends: ["assert:equals:", "join:"],
  4727. referencedClasses: []
  4728. }),
  4729. smalltalk.StringTest);
  4730. smalltalk.addMethod(
  4731. smalltalk.method({
  4732. selector: "testRemoveAll",
  4733. protocol: 'tests',
  4734. fn: function (){
  4735. var self=this;
  4736. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4737. return smalltalk.withContext(function($ctx1) {
  4738. self._should_raise_((function(){
  4739. return smalltalk.withContext(function($ctx2) {
  4740. return _st(self._collection())._removeAll();
  4741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4742. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4743. args: [],
  4744. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4745. messageSends: ["should:raise:", "removeAll", "collection"],
  4746. referencedClasses: ["Error"]
  4747. }),
  4748. smalltalk.StringTest);
  4749. smalltalk.addMethod(
  4750. smalltalk.method({
  4751. selector: "testReversed",
  4752. protocol: 'tests',
  4753. fn: function (){
  4754. var self=this;
  4755. return smalltalk.withContext(function($ctx1) {
  4756. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4757. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4758. args: [],
  4759. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4760. messageSends: ["assert:equals:", "reversed"],
  4761. referencedClasses: []
  4762. }),
  4763. smalltalk.StringTest);
  4764. smalltalk.addMethod(
  4765. smalltalk.method({
  4766. selector: "testStreamContents",
  4767. protocol: 'tests',
  4768. fn: function (){
  4769. var self=this;
  4770. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4771. return smalltalk.withContext(function($ctx1) {
  4772. var $1;
  4773. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4774. return smalltalk.withContext(function($ctx2) {
  4775. _st(aStream)._nextPutAll_("hello");
  4776. $ctx2.sendIdx["nextPutAll:"]=1;
  4777. _st(aStream)._space();
  4778. $1=_st(aStream)._nextPutAll_("world");
  4779. return $1;
  4780. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4781. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4782. args: [],
  4783. 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'",
  4784. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4785. referencedClasses: ["String"]
  4786. }),
  4787. smalltalk.StringTest);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "testSubStrings",
  4791. protocol: 'tests',
  4792. fn: function (){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4797. args: [],
  4798. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4799. messageSends: ["assert:equals:", "subStrings:"],
  4800. referencedClasses: []
  4801. }),
  4802. smalltalk.StringTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testTrim",
  4806. protocol: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4811. $ctx1.sendIdx["assert:equals:"]=1;
  4812. self._assert_equals_("jackie "._trimRight(),"jackie");
  4813. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4814. args: [],
  4815. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4816. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4817. referencedClasses: []
  4818. }),
  4819. smalltalk.StringTest);
  4820. smalltalk.addMethod(
  4821. smalltalk.method({
  4822. selector: "collectionClass",
  4823. protocol: 'fixture',
  4824. fn: function (){
  4825. var self=this;
  4826. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4827. return smalltalk.withContext(function($ctx1) {
  4828. return $String();
  4829. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4830. args: [],
  4831. source: "collectionClass\x0a\x09^ String",
  4832. messageSends: [],
  4833. referencedClasses: ["String"]
  4834. }),
  4835. smalltalk.StringTest.klass);
  4836. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4837. smalltalk.addMethod(
  4838. smalltalk.method({
  4839. selector: "collection",
  4840. protocol: 'fixture',
  4841. fn: function (){
  4842. var self=this;
  4843. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4844. return smalltalk.withContext(function($ctx1) {
  4845. var $2,$3,$1;
  4846. $2=_st($Set())._new();
  4847. _st($2)._add_((1));
  4848. $ctx1.sendIdx["add:"]=1;
  4849. _st($2)._add_((2));
  4850. $ctx1.sendIdx["add:"]=2;
  4851. _st($2)._add_((3));
  4852. $ctx1.sendIdx["add:"]=3;
  4853. _st($2)._add_((-4));
  4854. $3=_st($2)._yourself();
  4855. $1=$3;
  4856. return $1;
  4857. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  4858. args: [],
  4859. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4860. messageSends: ["add:", "new", "yourself"],
  4861. referencedClasses: ["Set"]
  4862. }),
  4863. smalltalk.SetTest);
  4864. smalltalk.addMethod(
  4865. smalltalk.method({
  4866. selector: "collectionOfPrintStrings",
  4867. protocol: 'fixture',
  4868. fn: function (){
  4869. var self=this;
  4870. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4871. return smalltalk.withContext(function($ctx1) {
  4872. var $2,$3,$1;
  4873. $2=_st($Set())._new();
  4874. _st($2)._add_("1");
  4875. $ctx1.sendIdx["add:"]=1;
  4876. _st($2)._add_("2");
  4877. $ctx1.sendIdx["add:"]=2;
  4878. _st($2)._add_("3");
  4879. $ctx1.sendIdx["add:"]=3;
  4880. _st($2)._add_("-4");
  4881. $3=_st($2)._yourself();
  4882. $1=$3;
  4883. return $1;
  4884. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  4885. args: [],
  4886. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  4887. messageSends: ["add:", "new", "yourself"],
  4888. referencedClasses: ["Set"]
  4889. }),
  4890. smalltalk.SetTest);
  4891. smalltalk.addMethod(
  4892. smalltalk.method({
  4893. selector: "collectionSize",
  4894. protocol: 'fixture',
  4895. fn: function (){
  4896. var self=this;
  4897. return smalltalk.withContext(function($ctx1) {
  4898. return (4);
  4899. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  4900. args: [],
  4901. source: "collectionSize\x0a\x09^ 4",
  4902. messageSends: [],
  4903. referencedClasses: []
  4904. }),
  4905. smalltalk.SetTest);
  4906. smalltalk.addMethod(
  4907. smalltalk.method({
  4908. selector: "collectionWithDuplicates",
  4909. protocol: 'fixture',
  4910. fn: function (){
  4911. var self=this;
  4912. return smalltalk.withContext(function($ctx1) {
  4913. var $2,$3,$1;
  4914. $2=self._collection();
  4915. _st($2)._add_("yet another");
  4916. $3=_st($2)._yourself();
  4917. $1=$3;
  4918. return $1;
  4919. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  4920. args: [],
  4921. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  4922. messageSends: ["add:", "collection", "yourself"],
  4923. referencedClasses: []
  4924. }),
  4925. smalltalk.SetTest);
  4926. smalltalk.addMethod(
  4927. smalltalk.method({
  4928. selector: "collectionWithNewValue",
  4929. protocol: 'fixture',
  4930. fn: function (){
  4931. var self=this;
  4932. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4933. return smalltalk.withContext(function($ctx1) {
  4934. var $2,$3,$1;
  4935. $2=_st($Set())._new();
  4936. _st($2)._add_((1));
  4937. $ctx1.sendIdx["add:"]=1;
  4938. _st($2)._add_((2));
  4939. $ctx1.sendIdx["add:"]=2;
  4940. _st($2)._add_((3));
  4941. $ctx1.sendIdx["add:"]=3;
  4942. _st($2)._add_("N");
  4943. $ctx1.sendIdx["add:"]=4;
  4944. _st($2)._add_((-4));
  4945. $3=_st($2)._yourself();
  4946. $1=$3;
  4947. return $1;
  4948. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  4949. args: [],
  4950. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4951. messageSends: ["add:", "new", "yourself"],
  4952. referencedClasses: ["Set"]
  4953. }),
  4954. smalltalk.SetTest);
  4955. smalltalk.addMethod(
  4956. smalltalk.method({
  4957. selector: "testAddRemove",
  4958. protocol: 'tests',
  4959. fn: function (){
  4960. var self=this;
  4961. var set;
  4962. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4963. return smalltalk.withContext(function($ctx1) {
  4964. var $1,$2;
  4965. set=_st($Set())._new();
  4966. self._assert_(_st(set)._isEmpty());
  4967. $ctx1.sendIdx["assert:"]=1;
  4968. _st(set)._add_((3));
  4969. $ctx1.sendIdx["add:"]=1;
  4970. $1=_st(set)._includes_((3));
  4971. $ctx1.sendIdx["includes:"]=1;
  4972. self._assert_($1);
  4973. $ctx1.sendIdx["assert:"]=2;
  4974. _st(set)._add_((5));
  4975. $2=_st(set)._includes_((5));
  4976. $ctx1.sendIdx["includes:"]=2;
  4977. self._assert_($2);
  4978. _st(set)._remove_((3));
  4979. self._deny_(_st(set)._includes_((3)));
  4980. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4981. args: [],
  4982. 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)",
  4983. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4984. referencedClasses: ["Set"]
  4985. }),
  4986. smalltalk.SetTest);
  4987. smalltalk.addMethod(
  4988. smalltalk.method({
  4989. selector: "testAt",
  4990. protocol: 'tests',
  4991. fn: function (){
  4992. var self=this;
  4993. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4994. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4995. return smalltalk.withContext(function($ctx1) {
  4996. self._should_raise_((function(){
  4997. return smalltalk.withContext(function($ctx2) {
  4998. return _st(_st($Set())._new())._at_put_((1),(2));
  4999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5000. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5001. args: [],
  5002. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5003. messageSends: ["should:raise:", "at:put:", "new"],
  5004. referencedClasses: ["Set", "Error"]
  5005. }),
  5006. smalltalk.SetTest);
  5007. smalltalk.addMethod(
  5008. smalltalk.method({
  5009. selector: "testCollect",
  5010. protocol: 'tests',
  5011. fn: function (){
  5012. var self=this;
  5013. return smalltalk.withContext(function($ctx1) {
  5014. var $2,$1;
  5015. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5016. $2=[(5), (6), (8)]._asSet();
  5017. $ctx1.sendIdx["asSet"]=1;
  5018. $1=_st($2)._collect_((function(x){
  5019. return smalltalk.withContext(function($ctx2) {
  5020. return _st(x).__backslash_backslash((3));
  5021. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5022. self._assert_equals_($1,[(0), (2)]._asSet());
  5023. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5024. args: [],
  5025. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5026. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5027. referencedClasses: []
  5028. }),
  5029. smalltalk.SetTest);
  5030. smalltalk.addMethod(
  5031. smalltalk.method({
  5032. selector: "testComparing",
  5033. protocol: 'tests',
  5034. fn: function (){
  5035. var self=this;
  5036. return smalltalk.withContext(function($ctx1) {
  5037. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5038. $1=[(0), (2)]._asSet();
  5039. $ctx1.sendIdx["asSet"]=1;
  5040. $2=[(0), (2)]._asSet();
  5041. $ctx1.sendIdx["asSet"]=2;
  5042. self._assert_equals_($1,$2);
  5043. $ctx1.sendIdx["assert:equals:"]=1;
  5044. $3=[(2), (0)]._asSet();
  5045. $ctx1.sendIdx["asSet"]=3;
  5046. $4=[(0), (2)]._asSet();
  5047. $ctx1.sendIdx["asSet"]=4;
  5048. self._assert_equals_($3,$4);
  5049. $6=[(0), (2), (3)]._asSet();
  5050. $ctx1.sendIdx["asSet"]=5;
  5051. $7=[(0), (2)]._asSet();
  5052. $ctx1.sendIdx["asSet"]=6;
  5053. $5=_st($6).__eq($7);
  5054. $ctx1.sendIdx["="]=1;
  5055. self._deny_($5);
  5056. $ctx1.sendIdx["deny:"]=1;
  5057. $9=[(1), (2)]._asSet();
  5058. $ctx1.sendIdx["asSet"]=7;
  5059. $8=_st($9).__eq([(0), (2)]._asSet());
  5060. self._deny_($8);
  5061. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5062. args: [],
  5063. 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",
  5064. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5065. referencedClasses: []
  5066. }),
  5067. smalltalk.SetTest);
  5068. smalltalk.addMethod(
  5069. smalltalk.method({
  5070. selector: "testPrintString",
  5071. protocol: 'tests',
  5072. fn: function (){
  5073. var self=this;
  5074. var set;
  5075. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5076. return smalltalk.withContext(function($ctx1) {
  5077. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5078. set=_st($Set())._new();
  5079. $1=_st(set)._printString();
  5080. $ctx1.sendIdx["printString"]=1;
  5081. self._assert_equals_($1,"a Set ()");
  5082. $ctx1.sendIdx["assert:equals:"]=1;
  5083. $2=set;
  5084. _st($2)._add_((1));
  5085. $ctx1.sendIdx["add:"]=1;
  5086. $3=_st($2)._add_((3));
  5087. $ctx1.sendIdx["add:"]=2;
  5088. $4=_st(set)._printString();
  5089. $ctx1.sendIdx["printString"]=2;
  5090. self._assert_equals_($4,"a Set (1 3)");
  5091. $ctx1.sendIdx["assert:equals:"]=2;
  5092. _st(set)._add_("foo");
  5093. $ctx1.sendIdx["add:"]=3;
  5094. $5=_st(set)._printString();
  5095. $ctx1.sendIdx["printString"]=3;
  5096. self._assert_equals_($5,"a Set (1 3 'foo')");
  5097. $ctx1.sendIdx["assert:equals:"]=3;
  5098. $6=set;
  5099. _st($6)._remove_((1));
  5100. $ctx1.sendIdx["remove:"]=1;
  5101. $7=_st($6)._remove_((3));
  5102. $8=_st(set)._printString();
  5103. $ctx1.sendIdx["printString"]=4;
  5104. self._assert_equals_($8,"a Set ('foo')");
  5105. $ctx1.sendIdx["assert:equals:"]=4;
  5106. _st(set)._add_((3));
  5107. $ctx1.sendIdx["add:"]=4;
  5108. $9=_st(set)._printString();
  5109. $ctx1.sendIdx["printString"]=5;
  5110. self._assert_equals_($9,"a Set ('foo' 3)");
  5111. $ctx1.sendIdx["assert:equals:"]=5;
  5112. _st(set)._add_((3));
  5113. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5114. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5115. args: [],
  5116. 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)'",
  5117. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5118. referencedClasses: ["Set"]
  5119. }),
  5120. smalltalk.SetTest);
  5121. smalltalk.addMethod(
  5122. smalltalk.method({
  5123. selector: "testUnboxedObjects",
  5124. protocol: 'tests',
  5125. fn: function (){
  5126. var self=this;
  5127. return smalltalk.withContext(function($ctx1) {
  5128. var $4,$3,$2,$1;
  5129. $4="foo"._yourself();
  5130. $ctx1.sendIdx["yourself"]=1;
  5131. $3=[$4,"foo"._yourself()];
  5132. $2=_st($3)._asSet();
  5133. $1=_st($2)._asArray();
  5134. self._assert_equals_($1,["foo"]);
  5135. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5136. args: [],
  5137. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5138. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5139. referencedClasses: []
  5140. }),
  5141. smalltalk.SetTest);
  5142. smalltalk.addMethod(
  5143. smalltalk.method({
  5144. selector: "testUnicity",
  5145. protocol: 'tests',
  5146. fn: function (){
  5147. var self=this;
  5148. var set;
  5149. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5150. return smalltalk.withContext(function($ctx1) {
  5151. var $1;
  5152. set=_st($Set())._new();
  5153. _st(set)._add_((21));
  5154. $ctx1.sendIdx["add:"]=1;
  5155. _st(set)._add_("hello");
  5156. $ctx1.sendIdx["add:"]=2;
  5157. _st(set)._add_((21));
  5158. $ctx1.sendIdx["add:"]=3;
  5159. $1=_st(set)._size();
  5160. $ctx1.sendIdx["size"]=1;
  5161. self._assert_equals_($1,(2));
  5162. $ctx1.sendIdx["assert:equals:"]=1;
  5163. _st(set)._add_("hello");
  5164. self._assert_equals_(_st(set)._size(),(2));
  5165. $ctx1.sendIdx["assert:equals:"]=2;
  5166. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5167. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5168. args: [],
  5169. 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')",
  5170. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5171. referencedClasses: ["Set"]
  5172. }),
  5173. smalltalk.SetTest);
  5174. smalltalk.addMethod(
  5175. smalltalk.method({
  5176. selector: "collectionClass",
  5177. protocol: 'fixture',
  5178. fn: function (){
  5179. var self=this;
  5180. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5181. return smalltalk.withContext(function($ctx1) {
  5182. return $Set();
  5183. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5184. args: [],
  5185. source: "collectionClass\x0a\x09^ Set",
  5186. messageSends: [],
  5187. referencedClasses: ["Set"]
  5188. }),
  5189. smalltalk.SetTest.klass);
  5190. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5191. smalltalk.addMethod(
  5192. smalltalk.method({
  5193. selector: "testShow",
  5194. protocol: 'tests',
  5195. fn: function (){
  5196. var self=this;
  5197. var originalTranscript;
  5198. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5199. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5200. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5201. return smalltalk.withContext(function($ctx1) {
  5202. originalTranscript=_st($Transcript())._current();
  5203. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5204. $ctx1.sendIdx["register:"]=1;
  5205. self._shouldnt_raise_((function(){
  5206. return smalltalk.withContext(function($ctx2) {
  5207. return _st($Transcript())._show_("Hello console!");
  5208. $ctx2.sendIdx["show:"]=1;
  5209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5210. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5211. self._shouldnt_raise_((function(){
  5212. return smalltalk.withContext(function($ctx2) {
  5213. return _st($Transcript())._show_(console);
  5214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5215. _st($Transcript())._register_(originalTranscript);
  5216. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5217. args: [],
  5218. 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.",
  5219. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5220. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5221. }),
  5222. smalltalk.ConsoleTranscriptTest);
  5223. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5224. smalltalk.addMethod(
  5225. smalltalk.method({
  5226. selector: "jsObject",
  5227. protocol: 'accessing',
  5228. fn: function (){
  5229. var self=this;
  5230. return smalltalk.withContext(function($ctx1) {
  5231. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5232. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5233. args: [],
  5234. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5235. messageSends: [],
  5236. referencedClasses: []
  5237. }),
  5238. smalltalk.JSObjectProxyTest);
  5239. smalltalk.addMethod(
  5240. smalltalk.method({
  5241. selector: "testAtIfAbsent",
  5242. protocol: 'tests',
  5243. fn: function (){
  5244. var self=this;
  5245. var testObject;
  5246. return smalltalk.withContext(function($ctx1) {
  5247. var $1,$2,$3;
  5248. testObject=self._jsObject();
  5249. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5250. return smalltalk.withContext(function($ctx2) {
  5251. return "Property does not exist";
  5252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5253. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5254. self._assert_equals_($1,"Property does not exist");
  5255. $ctx1.sendIdx["assert:equals:"]=1;
  5256. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5257. return smalltalk.withContext(function($ctx2) {
  5258. return "Property does not exist";
  5259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5260. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5261. self._assert_equals_($2,nil);
  5262. $ctx1.sendIdx["assert:equals:"]=2;
  5263. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5264. return smalltalk.withContext(function($ctx2) {
  5265. return "Property does not exist";
  5266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5267. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5268. self._assert_equals_($3,(1));
  5269. $ctx1.sendIdx["assert:equals:"]=3;
  5270. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5271. return smalltalk.withContext(function($ctx2) {
  5272. return "Property does not exist";
  5273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5274. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5275. args: [],
  5276. 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.",
  5277. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5278. referencedClasses: []
  5279. }),
  5280. smalltalk.JSObjectProxyTest);
  5281. smalltalk.addMethod(
  5282. smalltalk.method({
  5283. selector: "testAtIfPresent",
  5284. protocol: 'tests',
  5285. fn: function (){
  5286. var self=this;
  5287. var testObject;
  5288. return smalltalk.withContext(function($ctx1) {
  5289. var $2,$1,$4,$3,$6,$5;
  5290. testObject=self._jsObject();
  5291. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5292. return smalltalk.withContext(function($ctx2) {
  5293. $2=_st(x)._asString();
  5294. $ctx2.sendIdx["asString"]=1;
  5295. return "hello ".__comma($2);
  5296. $ctx2.sendIdx[","]=1;
  5297. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5298. $ctx1.sendIdx["at:ifPresent:"]=1;
  5299. self._assert_equals_($1,nil);
  5300. $ctx1.sendIdx["assert:equals:"]=1;
  5301. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5302. return smalltalk.withContext(function($ctx2) {
  5303. $4=_st(x)._asString();
  5304. $ctx2.sendIdx["asString"]=2;
  5305. return "hello ".__comma($4);
  5306. $ctx2.sendIdx[","]=2;
  5307. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5308. $ctx1.sendIdx["at:ifPresent:"]=2;
  5309. self._assert_equals_($3,"hello nil");
  5310. $ctx1.sendIdx["assert:equals:"]=2;
  5311. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5312. return smalltalk.withContext(function($ctx2) {
  5313. $6=_st(x)._asString();
  5314. $ctx2.sendIdx["asString"]=3;
  5315. return "hello ".__comma($6);
  5316. $ctx2.sendIdx[","]=3;
  5317. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5318. $ctx1.sendIdx["at:ifPresent:"]=3;
  5319. self._assert_equals_($5,"hello 1");
  5320. $ctx1.sendIdx["assert:equals:"]=3;
  5321. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5322. return smalltalk.withContext(function($ctx2) {
  5323. return "hello ".__comma(_st(x)._asString());
  5324. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5325. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5326. args: [],
  5327. 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'.",
  5328. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5329. referencedClasses: []
  5330. }),
  5331. smalltalk.JSObjectProxyTest);
  5332. smalltalk.addMethod(
  5333. smalltalk.method({
  5334. selector: "testAtIfPresentIfAbsent",
  5335. protocol: 'tests',
  5336. fn: function (){
  5337. var self=this;
  5338. var testObject;
  5339. return smalltalk.withContext(function($ctx1) {
  5340. var $2,$1,$4,$3,$6,$5;
  5341. testObject=self._jsObject();
  5342. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5343. return smalltalk.withContext(function($ctx2) {
  5344. $2=_st(x)._asString();
  5345. $ctx2.sendIdx["asString"]=1;
  5346. return "hello ".__comma($2);
  5347. $ctx2.sendIdx[","]=1;
  5348. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5349. return smalltalk.withContext(function($ctx2) {
  5350. return "not present";
  5351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5352. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5353. self._assert_equals_($1,"not present");
  5354. $ctx1.sendIdx["assert:equals:"]=1;
  5355. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5356. return smalltalk.withContext(function($ctx2) {
  5357. $4=_st(x)._asString();
  5358. $ctx2.sendIdx["asString"]=2;
  5359. return "hello ".__comma($4);
  5360. $ctx2.sendIdx[","]=2;
  5361. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5362. return smalltalk.withContext(function($ctx2) {
  5363. return "not present";
  5364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5365. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5366. self._assert_equals_($3,"hello nil");
  5367. $ctx1.sendIdx["assert:equals:"]=2;
  5368. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5369. return smalltalk.withContext(function($ctx2) {
  5370. $6=_st(x)._asString();
  5371. $ctx2.sendIdx["asString"]=3;
  5372. return "hello ".__comma($6);
  5373. $ctx2.sendIdx[","]=3;
  5374. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5375. return smalltalk.withContext(function($ctx2) {
  5376. return "not present";
  5377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5378. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5379. self._assert_equals_($5,"hello 1");
  5380. $ctx1.sendIdx["assert:equals:"]=3;
  5381. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5382. return smalltalk.withContext(function($ctx2) {
  5383. return "hello ".__comma(_st(x)._asString());
  5384. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5385. return smalltalk.withContext(function($ctx2) {
  5386. return "not present";
  5387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5388. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5389. args: [],
  5390. 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'.",
  5391. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5392. referencedClasses: []
  5393. }),
  5394. smalltalk.JSObjectProxyTest);
  5395. smalltalk.addMethod(
  5396. smalltalk.method({
  5397. selector: "testAtPut",
  5398. protocol: 'tests',
  5399. fn: function (){
  5400. var self=this;
  5401. var testObject;
  5402. return smalltalk.withContext(function($ctx1) {
  5403. var $2,$1;
  5404. testObject=self._jsObject();
  5405. $2=_st(testObject)._at_("abc");
  5406. $ctx1.sendIdx["at:"]=1;
  5407. $1=_st($2).__tild_eq("xyz");
  5408. self._assert_($1);
  5409. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5410. $ctx1.sendIdx["assert:equals:"]=1;
  5411. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5412. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5413. args: [],
  5414. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  5415. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5416. referencedClasses: []
  5417. }),
  5418. smalltalk.JSObjectProxyTest);
  5419. smalltalk.addMethod(
  5420. smalltalk.method({
  5421. selector: "testDNU",
  5422. protocol: 'tests',
  5423. fn: function (){
  5424. var self=this;
  5425. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5426. return smalltalk.withContext(function($ctx1) {
  5427. self._should_raise_((function(){
  5428. return smalltalk.withContext(function($ctx2) {
  5429. return _st(self._jsObject())._foo();
  5430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5431. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5432. args: [],
  5433. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5434. messageSends: ["should:raise:", "foo", "jsObject"],
  5435. referencedClasses: ["MessageNotUnderstood"]
  5436. }),
  5437. smalltalk.JSObjectProxyTest);
  5438. smalltalk.addMethod(
  5439. smalltalk.method({
  5440. selector: "testMessageSend",
  5441. protocol: 'tests',
  5442. fn: function (){
  5443. var self=this;
  5444. return smalltalk.withContext(function($ctx1) {
  5445. var $2,$1,$4,$3;
  5446. $2=self._jsObject();
  5447. $ctx1.sendIdx["jsObject"]=1;
  5448. $1=_st($2)._a();
  5449. self._assert_equals_($1,(1));
  5450. $ctx1.sendIdx["assert:equals:"]=1;
  5451. $4=self._jsObject();
  5452. $ctx1.sendIdx["jsObject"]=2;
  5453. $3=_st($4)._b();
  5454. self._assert_equals_($3,(2));
  5455. $ctx1.sendIdx["assert:equals:"]=2;
  5456. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5457. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5458. args: [],
  5459. 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",
  5460. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5461. referencedClasses: []
  5462. }),
  5463. smalltalk.JSObjectProxyTest);
  5464. smalltalk.addMethod(
  5465. smalltalk.method({
  5466. selector: "testMethodWithArguments",
  5467. protocol: 'tests',
  5468. fn: function (){
  5469. var self=this;
  5470. return smalltalk.withContext(function($ctx1) {
  5471. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5472. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5473. args: [],
  5474. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5475. messageSends: ["assert:equals:", "c:", "jsObject"],
  5476. referencedClasses: []
  5477. }),
  5478. smalltalk.JSObjectProxyTest);
  5479. smalltalk.addMethod(
  5480. smalltalk.method({
  5481. selector: "testPrinting",
  5482. protocol: 'tests',
  5483. fn: function (){
  5484. var self=this;
  5485. return smalltalk.withContext(function($ctx1) {
  5486. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5487. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5488. args: [],
  5489. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5490. messageSends: ["assert:equals:", "printString", "jsObject"],
  5491. referencedClasses: []
  5492. }),
  5493. smalltalk.JSObjectProxyTest);
  5494. smalltalk.addMethod(
  5495. smalltalk.method({
  5496. selector: "testPropertyThatReturnsEmptyString",
  5497. protocol: 'tests',
  5498. fn: function (){
  5499. var self=this;
  5500. var object;
  5501. return smalltalk.withContext(function($ctx1) {
  5502. var $1;
  5503. object=self._jsObject();
  5504. $1=_st(object)._d();
  5505. $ctx1.sendIdx["d"]=1;
  5506. self._assert_equals_($1,"");
  5507. $ctx1.sendIdx["assert:equals:"]=1;
  5508. _st(object)._d_("hello");
  5509. self._assert_equals_(_st(object)._d(),"hello");
  5510. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5511. args: [],
  5512. 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'",
  5513. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5514. referencedClasses: []
  5515. }),
  5516. smalltalk.JSObjectProxyTest);
  5517. smalltalk.addMethod(
  5518. smalltalk.method({
  5519. selector: "testPropertyThatReturnsUndefined",
  5520. protocol: 'tests',
  5521. fn: function (){
  5522. var self=this;
  5523. var object;
  5524. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5525. return smalltalk.withContext(function($ctx1) {
  5526. object=self._jsObject();
  5527. self._shouldnt_raise_((function(){
  5528. return smalltalk.withContext(function($ctx2) {
  5529. return _st(object)._e();
  5530. $ctx2.sendIdx["e"]=1;
  5531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5532. self._assert_(_st(_st(object)._e())._isNil());
  5533. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5534. args: [],
  5535. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5536. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5537. referencedClasses: ["MessageNotUnderstood"]
  5538. }),
  5539. smalltalk.JSObjectProxyTest);
  5540. smalltalk.addMethod(
  5541. smalltalk.method({
  5542. selector: "testValue",
  5543. protocol: 'tests',
  5544. fn: function (){
  5545. var self=this;
  5546. var testObject;
  5547. return smalltalk.withContext(function($ctx1) {
  5548. testObject=self._jsObject();
  5549. _st(testObject)._at_put_("value","aValue");
  5550. self._assert_equals_(_st(testObject)._value(),"aValue");
  5551. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5552. args: [],
  5553. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5554. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5555. referencedClasses: []
  5556. }),
  5557. smalltalk.JSObjectProxyTest);
  5558. smalltalk.addMethod(
  5559. smalltalk.method({
  5560. selector: "testYourself",
  5561. protocol: 'tests',
  5562. fn: function (){
  5563. var self=this;
  5564. var object;
  5565. return smalltalk.withContext(function($ctx1) {
  5566. var $1,$2;
  5567. $1=self._jsObject();
  5568. _st($1)._d_("test");
  5569. $2=_st($1)._yourself();
  5570. object=$2;
  5571. self._assert_equals_(_st(object)._d(),"test");
  5572. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5573. args: [],
  5574. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5575. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5576. referencedClasses: []
  5577. }),
  5578. smalltalk.JSObjectProxyTest);
  5579. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5580. smalltalk.addMethod(
  5581. smalltalk.method({
  5582. selector: "testCatchingException",
  5583. protocol: 'tests',
  5584. fn: function (){
  5585. var self=this;
  5586. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5587. return smalltalk.withContext(function($ctx1) {
  5588. _st((function(){
  5589. return smalltalk.withContext(function($ctx2) {
  5590. return self._throwException();
  5591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5592. return smalltalk.withContext(function($ctx2) {
  5593. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5594. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5595. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5596. args: [],
  5597. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5598. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5599. referencedClasses: ["Error"]
  5600. }),
  5601. smalltalk.JavaScriptExceptionTest);
  5602. smalltalk.addMethod(
  5603. smalltalk.method({
  5604. selector: "testRaisingException",
  5605. protocol: 'tests',
  5606. fn: function (){
  5607. var self=this;
  5608. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5609. return smalltalk.withContext(function($ctx1) {
  5610. self._should_raise_((function(){
  5611. return smalltalk.withContext(function($ctx2) {
  5612. return self._throwException();
  5613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5614. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5615. args: [],
  5616. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5617. messageSends: ["should:raise:", "throwException"],
  5618. referencedClasses: ["JavaScriptException"]
  5619. }),
  5620. smalltalk.JavaScriptExceptionTest);
  5621. smalltalk.addMethod(
  5622. smalltalk.method({
  5623. selector: "throwException",
  5624. protocol: 'helpers',
  5625. fn: function (){
  5626. var self=this;
  5627. return smalltalk.withContext(function($ctx1) {
  5628. throw 'test';
  5629. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5630. args: [],
  5631. source: "throwException\x0a\x09<throw 'test'>",
  5632. messageSends: [],
  5633. referencedClasses: []
  5634. }),
  5635. smalltalk.JavaScriptExceptionTest);
  5636. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5637. smalltalk.addMethod(
  5638. smalltalk.method({
  5639. selector: "testValue",
  5640. protocol: 'tests',
  5641. fn: function (){
  5642. var self=this;
  5643. var messageSend;
  5644. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5645. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5646. return smalltalk.withContext(function($ctx1) {
  5647. var $1,$2;
  5648. $1=_st($MessageSend())._new();
  5649. $ctx1.sendIdx["new"]=1;
  5650. _st($1)._receiver_(_st($Object())._new());
  5651. _st($1)._selector_("asString");
  5652. $2=_st($1)._yourself();
  5653. messageSend=$2;
  5654. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5655. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5656. args: [],
  5657. 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'",
  5658. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5659. referencedClasses: ["MessageSend", "Object"]
  5660. }),
  5661. smalltalk.MessageSendTest);
  5662. smalltalk.addMethod(
  5663. smalltalk.method({
  5664. selector: "testValueWithArguments",
  5665. protocol: 'tests',
  5666. fn: function (){
  5667. var self=this;
  5668. var messageSend;
  5669. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5670. return smalltalk.withContext(function($ctx1) {
  5671. var $1,$2;
  5672. $1=_st($MessageSend())._new();
  5673. _st($1)._receiver_((2));
  5674. _st($1)._selector_("+");
  5675. $2=_st($1)._yourself();
  5676. messageSend=$2;
  5677. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5678. $ctx1.sendIdx["assert:equals:"]=1;
  5679. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5680. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5681. args: [],
  5682. 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",
  5683. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5684. referencedClasses: ["MessageSend"]
  5685. }),
  5686. smalltalk.MessageSendTest);
  5687. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5688. smalltalk.addMethod(
  5689. smalltalk.method({
  5690. selector: "codeGeneratorClass",
  5691. protocol: 'accessing',
  5692. fn: function (){
  5693. var self=this;
  5694. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5695. return smalltalk.withContext(function($ctx1) {
  5696. return $CodeGenerator();
  5697. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5698. args: [],
  5699. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5700. messageSends: [],
  5701. referencedClasses: ["CodeGenerator"]
  5702. }),
  5703. smalltalk.MethodInheritanceTest);
  5704. smalltalk.addMethod(
  5705. smalltalk.method({
  5706. selector: "compiler",
  5707. protocol: 'factory',
  5708. fn: function (){
  5709. var self=this;
  5710. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5711. return smalltalk.withContext(function($ctx1) {
  5712. var $2,$3,$1;
  5713. $2=_st($Compiler())._new();
  5714. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5715. $3=_st($2)._yourself();
  5716. $1=$3;
  5717. return $1;
  5718. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5719. args: [],
  5720. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5721. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5722. referencedClasses: ["Compiler"]
  5723. }),
  5724. smalltalk.MethodInheritanceTest);
  5725. smalltalk.addMethod(
  5726. smalltalk.method({
  5727. selector: "deinstallBottom",
  5728. protocol: 'testing',
  5729. fn: function (){
  5730. var self=this;
  5731. return smalltalk.withContext(function($ctx1) {
  5732. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5733. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5734. args: [],
  5735. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5736. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5737. referencedClasses: []
  5738. }),
  5739. smalltalk.MethodInheritanceTest);
  5740. smalltalk.addMethod(
  5741. smalltalk.method({
  5742. selector: "deinstallMiddle",
  5743. protocol: 'testing',
  5744. fn: function (){
  5745. var self=this;
  5746. return smalltalk.withContext(function($ctx1) {
  5747. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5748. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5749. args: [],
  5750. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5751. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5752. referencedClasses: []
  5753. }),
  5754. smalltalk.MethodInheritanceTest);
  5755. smalltalk.addMethod(
  5756. smalltalk.method({
  5757. selector: "deinstallTop",
  5758. protocol: 'testing',
  5759. fn: function (){
  5760. var self=this;
  5761. return smalltalk.withContext(function($ctx1) {
  5762. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5763. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5764. args: [],
  5765. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5766. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5767. referencedClasses: []
  5768. }),
  5769. smalltalk.MethodInheritanceTest);
  5770. smalltalk.addMethod(
  5771. smalltalk.method({
  5772. selector: "installBottom:",
  5773. protocol: 'testing',
  5774. fn: function (aString){
  5775. var self=this;
  5776. return smalltalk.withContext(function($ctx1) {
  5777. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5778. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5779. args: ["aString"],
  5780. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5781. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5782. referencedClasses: []
  5783. }),
  5784. smalltalk.MethodInheritanceTest);
  5785. smalltalk.addMethod(
  5786. smalltalk.method({
  5787. selector: "installMiddle:",
  5788. protocol: 'testing',
  5789. fn: function (aString){
  5790. var self=this;
  5791. return smalltalk.withContext(function($ctx1) {
  5792. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5793. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5794. args: ["aString"],
  5795. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5796. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5797. referencedClasses: []
  5798. }),
  5799. smalltalk.MethodInheritanceTest);
  5800. smalltalk.addMethod(
  5801. smalltalk.method({
  5802. selector: "installTop:",
  5803. protocol: 'testing',
  5804. fn: function (aString){
  5805. var self=this;
  5806. return smalltalk.withContext(function($ctx1) {
  5807. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5808. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5809. args: ["aString"],
  5810. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5811. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5812. referencedClasses: []
  5813. }),
  5814. smalltalk.MethodInheritanceTest);
  5815. smalltalk.addMethod(
  5816. smalltalk.method({
  5817. selector: "setUp",
  5818. protocol: 'initialization',
  5819. fn: function (){
  5820. var self=this;
  5821. return smalltalk.withContext(function($ctx1) {
  5822. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5823. $ctx1.sendIdx["new"]=1;
  5824. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5825. $ctx1.sendIdx["new"]=2;
  5826. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5827. self["@method"]=nil;
  5828. self["@performBlock"]=(function(){
  5829. return smalltalk.withContext(function($ctx2) {
  5830. return self._error_("performBlock not initialized");
  5831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5832. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5833. args: [],
  5834. 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' ]",
  5835. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5836. referencedClasses: []
  5837. }),
  5838. smalltalk.MethodInheritanceTest);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "shouldMNU",
  5842. protocol: 'testing',
  5843. fn: function (){
  5844. var self=this;
  5845. return smalltalk.withContext(function($ctx1) {
  5846. self._shouldMNUTop();
  5847. self._shouldMNUMiddle();
  5848. self._shouldMNUBottom();
  5849. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5850. args: [],
  5851. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5852. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5853. referencedClasses: []
  5854. }),
  5855. smalltalk.MethodInheritanceTest);
  5856. smalltalk.addMethod(
  5857. smalltalk.method({
  5858. selector: "shouldMNUBottom",
  5859. protocol: 'testing',
  5860. fn: function (){
  5861. var self=this;
  5862. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5863. return smalltalk.withContext(function($ctx1) {
  5864. self._should_raise_((function(){
  5865. return smalltalk.withContext(function($ctx2) {
  5866. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5868. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5869. args: [],
  5870. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5871. messageSends: ["should:raise:", "value:"],
  5872. referencedClasses: ["MessageNotUnderstood"]
  5873. }),
  5874. smalltalk.MethodInheritanceTest);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "shouldMNUMiddle",
  5878. protocol: 'testing',
  5879. fn: function (){
  5880. var self=this;
  5881. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5882. return smalltalk.withContext(function($ctx1) {
  5883. self._should_raise_((function(){
  5884. return smalltalk.withContext(function($ctx2) {
  5885. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5887. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5888. args: [],
  5889. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5890. messageSends: ["should:raise:", "value:"],
  5891. referencedClasses: ["MessageNotUnderstood"]
  5892. }),
  5893. smalltalk.MethodInheritanceTest);
  5894. smalltalk.addMethod(
  5895. smalltalk.method({
  5896. selector: "shouldMNUTop",
  5897. protocol: 'testing',
  5898. fn: function (){
  5899. var self=this;
  5900. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5901. return smalltalk.withContext(function($ctx1) {
  5902. self._should_raise_((function(){
  5903. return smalltalk.withContext(function($ctx2) {
  5904. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5906. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5907. args: [],
  5908. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5909. messageSends: ["should:raise:", "value:"],
  5910. referencedClasses: ["MessageNotUnderstood"]
  5911. }),
  5912. smalltalk.MethodInheritanceTest);
  5913. smalltalk.addMethod(
  5914. smalltalk.method({
  5915. selector: "shouldReturn:",
  5916. protocol: 'testing',
  5917. fn: function (anObject){
  5918. var self=this;
  5919. var result;
  5920. return smalltalk.withContext(function($ctx1) {
  5921. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5922. $ctx1.sendIdx["value:"]=1;
  5923. self._assert_equals_(["top",anObject],["top",result]);
  5924. $ctx1.sendIdx["assert:equals:"]=1;
  5925. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5926. $ctx1.sendIdx["value:"]=2;
  5927. self._assert_equals_(["middle",anObject],["middle",result]);
  5928. $ctx1.sendIdx["assert:equals:"]=2;
  5929. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5930. self._assert_equals_(["bottom",anObject],["bottom",result]);
  5931. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  5932. args: ["anObject"],
  5933. 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 }",
  5934. messageSends: ["value:", "assert:equals:"],
  5935. referencedClasses: []
  5936. }),
  5937. smalltalk.MethodInheritanceTest);
  5938. smalltalk.addMethod(
  5939. smalltalk.method({
  5940. selector: "shouldReturn:and:and:",
  5941. protocol: 'testing',
  5942. fn: function (anObject,anObject2,anObject3){
  5943. var self=this;
  5944. var result;
  5945. return smalltalk.withContext(function($ctx1) {
  5946. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5947. $ctx1.sendIdx["value:"]=1;
  5948. self._assert_equals_(["top",anObject],["top",result]);
  5949. $ctx1.sendIdx["assert:equals:"]=1;
  5950. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5951. $ctx1.sendIdx["value:"]=2;
  5952. self._assert_equals_(["middle",anObject2],["middle",result]);
  5953. $ctx1.sendIdx["assert:equals:"]=2;
  5954. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5955. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5956. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5957. args: ["anObject", "anObject2", "anObject3"],
  5958. 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 }",
  5959. messageSends: ["value:", "assert:equals:"],
  5960. referencedClasses: []
  5961. }),
  5962. smalltalk.MethodInheritanceTest);
  5963. smalltalk.addMethod(
  5964. smalltalk.method({
  5965. selector: "targetClassBottom",
  5966. protocol: 'accessing',
  5967. fn: function (){
  5968. var self=this;
  5969. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5970. return smalltalk.withContext(function($ctx1) {
  5971. return $JavaScriptException();
  5972. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5973. args: [],
  5974. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5975. messageSends: [],
  5976. referencedClasses: ["JavaScriptException"]
  5977. }),
  5978. smalltalk.MethodInheritanceTest);
  5979. smalltalk.addMethod(
  5980. smalltalk.method({
  5981. selector: "targetClassMiddle",
  5982. protocol: 'accessing',
  5983. fn: function (){
  5984. var self=this;
  5985. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5986. return smalltalk.withContext(function($ctx1) {
  5987. return $Error();
  5988. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5989. args: [],
  5990. source: "targetClassMiddle\x0a\x09^ Error",
  5991. messageSends: [],
  5992. referencedClasses: ["Error"]
  5993. }),
  5994. smalltalk.MethodInheritanceTest);
  5995. smalltalk.addMethod(
  5996. smalltalk.method({
  5997. selector: "targetClassTop",
  5998. protocol: 'accessing',
  5999. fn: function (){
  6000. var self=this;
  6001. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6002. return smalltalk.withContext(function($ctx1) {
  6003. return $Object();
  6004. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6005. args: [],
  6006. source: "targetClassTop\x0a\x09^ Object",
  6007. messageSends: [],
  6008. referencedClasses: ["Object"]
  6009. }),
  6010. smalltalk.MethodInheritanceTest);
  6011. smalltalk.addMethod(
  6012. smalltalk.method({
  6013. selector: "tearDown",
  6014. protocol: 'initialization',
  6015. fn: function (){
  6016. var self=this;
  6017. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6018. return smalltalk.withContext(function($ctx1) {
  6019. _st((function(){
  6020. return smalltalk.withContext(function($ctx2) {
  6021. return self._deinstallTop();
  6022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6023. return smalltalk.withContext(function($ctx2) {
  6024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6025. $ctx1.sendIdx["on:do:"]=1;
  6026. _st((function(){
  6027. return smalltalk.withContext(function($ctx2) {
  6028. return self._deinstallMiddle();
  6029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6030. return smalltalk.withContext(function($ctx2) {
  6031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6032. $ctx1.sendIdx["on:do:"]=2;
  6033. _st((function(){
  6034. return smalltalk.withContext(function($ctx2) {
  6035. return self._deinstallBottom();
  6036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6037. return smalltalk.withContext(function($ctx2) {
  6038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6039. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6040. args: [],
  6041. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6042. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6043. referencedClasses: ["Error"]
  6044. }),
  6045. smalltalk.MethodInheritanceTest);
  6046. smalltalk.addMethod(
  6047. smalltalk.method({
  6048. selector: "testMNU11",
  6049. protocol: 'tests',
  6050. fn: function (){
  6051. var self=this;
  6052. return smalltalk.withContext(function($ctx1) {
  6053. self["@performBlock"]=(function(x){
  6054. return smalltalk.withContext(function($ctx2) {
  6055. return _st(x)._foo();
  6056. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6057. self._shouldMNU();
  6058. $ctx1.sendIdx["shouldMNU"]=1;
  6059. self._installTop_("foo ^ false");
  6060. $ctx1.sendIdx["installTop:"]=1;
  6061. self._installTop_("foo ^ true");
  6062. self._deinstallTop();
  6063. self._shouldMNU();
  6064. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6065. args: [],
  6066. 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",
  6067. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6068. referencedClasses: []
  6069. }),
  6070. smalltalk.MethodInheritanceTest);
  6071. smalltalk.addMethod(
  6072. smalltalk.method({
  6073. selector: "testMNU22",
  6074. protocol: 'tests',
  6075. fn: function (){
  6076. var self=this;
  6077. return smalltalk.withContext(function($ctx1) {
  6078. self["@performBlock"]=(function(x){
  6079. return smalltalk.withContext(function($ctx2) {
  6080. return _st(x)._foo();
  6081. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6082. self._shouldMNU();
  6083. $ctx1.sendIdx["shouldMNU"]=1;
  6084. self._installMiddle_("foo ^ false");
  6085. $ctx1.sendIdx["installMiddle:"]=1;
  6086. self._installMiddle_("foo ^ true");
  6087. self._deinstallMiddle();
  6088. self._shouldMNU();
  6089. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6090. args: [],
  6091. 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",
  6092. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6093. referencedClasses: []
  6094. }),
  6095. smalltalk.MethodInheritanceTest);
  6096. smalltalk.addMethod(
  6097. smalltalk.method({
  6098. selector: "testReturns1",
  6099. protocol: 'tests',
  6100. fn: function (){
  6101. var self=this;
  6102. return smalltalk.withContext(function($ctx1) {
  6103. self["@performBlock"]=(function(x){
  6104. return smalltalk.withContext(function($ctx2) {
  6105. return _st(x)._foo();
  6106. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6107. self._installTop_("foo ^ false");
  6108. $ctx1.sendIdx["installTop:"]=1;
  6109. self._shouldReturn_(false);
  6110. $ctx1.sendIdx["shouldReturn:"]=1;
  6111. self._installTop_("foo ^ true");
  6112. self._shouldReturn_(true);
  6113. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6114. args: [],
  6115. 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",
  6116. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6117. referencedClasses: []
  6118. }),
  6119. smalltalk.MethodInheritanceTest);
  6120. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6121. smalltalk.addMethod(
  6122. smalltalk.method({
  6123. selector: "testAbs",
  6124. protocol: 'tests',
  6125. fn: function (){
  6126. var self=this;
  6127. return smalltalk.withContext(function($ctx1) {
  6128. var $1;
  6129. $1=(4)._abs();
  6130. $ctx1.sendIdx["abs"]=1;
  6131. self._assert_equals_($1,(4));
  6132. $ctx1.sendIdx["assert:equals:"]=1;
  6133. self._assert_equals_((-4)._abs(),(4));
  6134. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6135. args: [],
  6136. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6137. messageSends: ["assert:equals:", "abs"],
  6138. referencedClasses: []
  6139. }),
  6140. smalltalk.NumberTest);
  6141. smalltalk.addMethod(
  6142. smalltalk.method({
  6143. selector: "testArithmetic",
  6144. protocol: 'tests',
  6145. fn: function (){
  6146. var self=this;
  6147. return smalltalk.withContext(function($ctx1) {
  6148. var $1,$2,$3,$5,$4;
  6149. $1=(1.5).__plus((1));
  6150. $ctx1.sendIdx["+"]=1;
  6151. self._assert_equals_($1,(2.5));
  6152. $ctx1.sendIdx["assert:equals:"]=1;
  6153. $2=(2).__minus((1));
  6154. $ctx1.sendIdx["-"]=1;
  6155. self._assert_equals_($2,(1));
  6156. $ctx1.sendIdx["assert:equals:"]=2;
  6157. self._assert_equals_((-2).__minus((1)),(-3));
  6158. $ctx1.sendIdx["assert:equals:"]=3;
  6159. self._assert_equals_((12).__slash((2)),(6));
  6160. $ctx1.sendIdx["assert:equals:"]=4;
  6161. $3=(3).__star((4));
  6162. $ctx1.sendIdx["*"]=1;
  6163. self._assert_equals_($3,(12));
  6164. $ctx1.sendIdx["assert:equals:"]=5;
  6165. self._assert_equals_((7).__slash_slash((2)),(3));
  6166. $ctx1.sendIdx["assert:equals:"]=6;
  6167. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6168. $ctx1.sendIdx["assert:equals:"]=7;
  6169. $5=(1).__plus((2));
  6170. $ctx1.sendIdx["+"]=2;
  6171. $4=_st($5).__star((3));
  6172. $ctx1.sendIdx["*"]=2;
  6173. self._assert_equals_($4,(9));
  6174. $ctx1.sendIdx["assert:equals:"]=8;
  6175. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6176. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6177. args: [],
  6178. 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",
  6179. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6180. referencedClasses: []
  6181. }),
  6182. smalltalk.NumberTest);
  6183. smalltalk.addMethod(
  6184. smalltalk.method({
  6185. selector: "testAsNumber",
  6186. protocol: 'tests',
  6187. fn: function (){
  6188. var self=this;
  6189. return smalltalk.withContext(function($ctx1) {
  6190. self._assert_equals_((3)._asNumber(),(3));
  6191. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6192. args: [],
  6193. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6194. messageSends: ["assert:equals:", "asNumber"],
  6195. referencedClasses: []
  6196. }),
  6197. smalltalk.NumberTest);
  6198. smalltalk.addMethod(
  6199. smalltalk.method({
  6200. selector: "testCeiling",
  6201. protocol: 'tests',
  6202. fn: function (){
  6203. var self=this;
  6204. return smalltalk.withContext(function($ctx1) {
  6205. var $1,$2;
  6206. $1=(1.2)._ceiling();
  6207. $ctx1.sendIdx["ceiling"]=1;
  6208. self._assert_equals_($1,(2));
  6209. $ctx1.sendIdx["assert:equals:"]=1;
  6210. $2=(-1.2)._ceiling();
  6211. $ctx1.sendIdx["ceiling"]=2;
  6212. self._assert_equals_($2,(-1));
  6213. $ctx1.sendIdx["assert:equals:"]=2;
  6214. self._assert_equals_((1)._ceiling(),(1));
  6215. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6216. args: [],
  6217. 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.",
  6218. messageSends: ["assert:equals:", "ceiling"],
  6219. referencedClasses: []
  6220. }),
  6221. smalltalk.NumberTest);
  6222. smalltalk.addMethod(
  6223. smalltalk.method({
  6224. selector: "testComparison",
  6225. protocol: 'tests',
  6226. fn: function (){
  6227. var self=this;
  6228. return smalltalk.withContext(function($ctx1) {
  6229. var $1,$2,$3,$4;
  6230. $1=(3).__gt((2));
  6231. $ctx1.sendIdx[">"]=1;
  6232. self._assert_($1);
  6233. $ctx1.sendIdx["assert:"]=1;
  6234. $2=(2).__lt((3));
  6235. $ctx1.sendIdx["<"]=1;
  6236. self._assert_($2);
  6237. $ctx1.sendIdx["assert:"]=2;
  6238. self._deny_((3).__lt((2)));
  6239. $ctx1.sendIdx["deny:"]=1;
  6240. self._deny_((2).__gt((3)));
  6241. $3=(3).__gt_eq((3));
  6242. $ctx1.sendIdx[">="]=1;
  6243. self._assert_($3);
  6244. $ctx1.sendIdx["assert:"]=3;
  6245. self._assert_((3.1).__gt_eq((3)));
  6246. $ctx1.sendIdx["assert:"]=4;
  6247. $4=(3).__lt_eq((3));
  6248. $ctx1.sendIdx["<="]=1;
  6249. self._assert_($4);
  6250. $ctx1.sendIdx["assert:"]=5;
  6251. self._assert_((3).__lt_eq((3.1)));
  6252. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6253. args: [],
  6254. 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",
  6255. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6256. referencedClasses: []
  6257. }),
  6258. smalltalk.NumberTest);
  6259. smalltalk.addMethod(
  6260. smalltalk.method({
  6261. selector: "testCopying",
  6262. protocol: 'tests',
  6263. fn: function (){
  6264. var self=this;
  6265. return smalltalk.withContext(function($ctx1) {
  6266. var $1;
  6267. $1=_st((1)._copy()).__eq_eq((1));
  6268. $ctx1.sendIdx["=="]=1;
  6269. self._assert_($1);
  6270. $ctx1.sendIdx["assert:"]=1;
  6271. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6272. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6273. args: [],
  6274. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6275. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6276. referencedClasses: []
  6277. }),
  6278. smalltalk.NumberTest);
  6279. smalltalk.addMethod(
  6280. smalltalk.method({
  6281. selector: "testEquality",
  6282. protocol: 'tests',
  6283. fn: function (){
  6284. var self=this;
  6285. return smalltalk.withContext(function($ctx1) {
  6286. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6287. $1=(1).__eq((1));
  6288. $ctx1.sendIdx["="]=1;
  6289. self._assert_($1);
  6290. $ctx1.sendIdx["assert:"]=1;
  6291. $2=(0).__eq((0));
  6292. $ctx1.sendIdx["="]=2;
  6293. self._assert_($2);
  6294. $ctx1.sendIdx["assert:"]=2;
  6295. $3=(1).__eq((0));
  6296. $ctx1.sendIdx["="]=3;
  6297. self._deny_($3);
  6298. $ctx1.sendIdx["deny:"]=1;
  6299. $5=(1)._yourself();
  6300. $ctx1.sendIdx["yourself"]=1;
  6301. $4=_st($5).__eq((1));
  6302. $ctx1.sendIdx["="]=4;
  6303. self._assert_($4);
  6304. $ctx1.sendIdx["assert:"]=3;
  6305. $7=(1)._yourself();
  6306. $ctx1.sendIdx["yourself"]=2;
  6307. $6=(1).__eq($7);
  6308. $ctx1.sendIdx["="]=5;
  6309. self._assert_($6);
  6310. $ctx1.sendIdx["assert:"]=4;
  6311. $9=(1)._yourself();
  6312. $ctx1.sendIdx["yourself"]=3;
  6313. $8=_st($9).__eq((1)._yourself());
  6314. $ctx1.sendIdx["="]=6;
  6315. self._assert_($8);
  6316. $10=(0).__eq(false);
  6317. $ctx1.sendIdx["="]=7;
  6318. self._deny_($10);
  6319. $ctx1.sendIdx["deny:"]=2;
  6320. $11=false.__eq((0));
  6321. $ctx1.sendIdx["="]=8;
  6322. self._deny_($11);
  6323. $ctx1.sendIdx["deny:"]=3;
  6324. $12="".__eq((0));
  6325. $ctx1.sendIdx["="]=9;
  6326. self._deny_($12);
  6327. $ctx1.sendIdx["deny:"]=4;
  6328. self._deny_((0).__eq(""));
  6329. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6330. args: [],
  6331. 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 = ''",
  6332. messageSends: ["assert:", "=", "deny:", "yourself"],
  6333. referencedClasses: []
  6334. }),
  6335. smalltalk.NumberTest);
  6336. smalltalk.addMethod(
  6337. smalltalk.method({
  6338. selector: "testFloor",
  6339. protocol: 'tests',
  6340. fn: function (){
  6341. var self=this;
  6342. return smalltalk.withContext(function($ctx1) {
  6343. var $1,$2;
  6344. $1=(1.2)._floor();
  6345. $ctx1.sendIdx["floor"]=1;
  6346. self._assert_equals_($1,(1));
  6347. $ctx1.sendIdx["assert:equals:"]=1;
  6348. $2=(-1.2)._floor();
  6349. $ctx1.sendIdx["floor"]=2;
  6350. self._assert_equals_($2,(-2));
  6351. $ctx1.sendIdx["assert:equals:"]=2;
  6352. self._assert_equals_((1)._floor(),(1));
  6353. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6354. args: [],
  6355. 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.",
  6356. messageSends: ["assert:equals:", "floor"],
  6357. referencedClasses: []
  6358. }),
  6359. smalltalk.NumberTest);
  6360. smalltalk.addMethod(
  6361. smalltalk.method({
  6362. selector: "testHexNumbers",
  6363. protocol: 'tests',
  6364. fn: function (){
  6365. var self=this;
  6366. return smalltalk.withContext(function($ctx1) {
  6367. var $1,$2,$3,$4,$5;
  6368. self._assert_equals_((9),(9));
  6369. $ctx1.sendIdx["assert:equals:"]=1;
  6370. $1=(10)._truncated();
  6371. $ctx1.sendIdx["truncated"]=1;
  6372. self._assert_equals_($1,(10));
  6373. $ctx1.sendIdx["assert:equals:"]=2;
  6374. $2=(11)._truncated();
  6375. $ctx1.sendIdx["truncated"]=2;
  6376. self._assert_equals_($2,(11));
  6377. $ctx1.sendIdx["assert:equals:"]=3;
  6378. $3=(12)._truncated();
  6379. $ctx1.sendIdx["truncated"]=3;
  6380. self._assert_equals_($3,(12));
  6381. $ctx1.sendIdx["assert:equals:"]=4;
  6382. $4=(13)._truncated();
  6383. $ctx1.sendIdx["truncated"]=4;
  6384. self._assert_equals_($4,(13));
  6385. $ctx1.sendIdx["assert:equals:"]=5;
  6386. $5=(14)._truncated();
  6387. $ctx1.sendIdx["truncated"]=5;
  6388. self._assert_equals_($5,(14));
  6389. $ctx1.sendIdx["assert:equals:"]=6;
  6390. self._assert_equals_((15)._truncated(),(15));
  6391. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6392. args: [],
  6393. 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",
  6394. messageSends: ["assert:equals:", "truncated"],
  6395. referencedClasses: []
  6396. }),
  6397. smalltalk.NumberTest);
  6398. smalltalk.addMethod(
  6399. smalltalk.method({
  6400. selector: "testIdentity",
  6401. protocol: 'tests',
  6402. fn: function (){
  6403. var self=this;
  6404. return smalltalk.withContext(function($ctx1) {
  6405. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6406. $1=(1).__eq_eq((1));
  6407. $ctx1.sendIdx["=="]=1;
  6408. self._assert_($1);
  6409. $ctx1.sendIdx["assert:"]=1;
  6410. $2=(0).__eq_eq((0));
  6411. $ctx1.sendIdx["=="]=2;
  6412. self._assert_($2);
  6413. $ctx1.sendIdx["assert:"]=2;
  6414. $3=(1).__eq_eq((0));
  6415. $ctx1.sendIdx["=="]=3;
  6416. self._deny_($3);
  6417. $ctx1.sendIdx["deny:"]=1;
  6418. $5=(1)._yourself();
  6419. $ctx1.sendIdx["yourself"]=1;
  6420. $4=_st($5).__eq_eq((1));
  6421. $ctx1.sendIdx["=="]=4;
  6422. self._assert_($4);
  6423. $ctx1.sendIdx["assert:"]=3;
  6424. $7=(1)._yourself();
  6425. $ctx1.sendIdx["yourself"]=2;
  6426. $6=(1).__eq_eq($7);
  6427. $ctx1.sendIdx["=="]=5;
  6428. self._assert_($6);
  6429. $ctx1.sendIdx["assert:"]=4;
  6430. $9=(1)._yourself();
  6431. $ctx1.sendIdx["yourself"]=3;
  6432. $8=_st($9).__eq_eq((1)._yourself());
  6433. $ctx1.sendIdx["=="]=6;
  6434. self._assert_($8);
  6435. self._deny_((1).__eq_eq((2)));
  6436. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6437. args: [],
  6438. 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",
  6439. messageSends: ["assert:", "==", "deny:", "yourself"],
  6440. referencedClasses: []
  6441. }),
  6442. smalltalk.NumberTest);
  6443. smalltalk.addMethod(
  6444. smalltalk.method({
  6445. selector: "testInvalidHexNumbers",
  6446. protocol: 'tests',
  6447. fn: function (){
  6448. var self=this;
  6449. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6450. return smalltalk.withContext(function($ctx1) {
  6451. self._should_raise_((function(){
  6452. return smalltalk.withContext(function($ctx2) {
  6453. return (16)._rG();
  6454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6455. $ctx1.sendIdx["should:raise:"]=1;
  6456. self._should_raise_((function(){
  6457. return smalltalk.withContext(function($ctx2) {
  6458. return (16)._rg();
  6459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6460. $ctx1.sendIdx["should:raise:"]=2;
  6461. self._should_raise_((function(){
  6462. return smalltalk.withContext(function($ctx2) {
  6463. return (16)._rH();
  6464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6465. $ctx1.sendIdx["should:raise:"]=3;
  6466. self._should_raise_((function(){
  6467. return smalltalk.withContext(function($ctx2) {
  6468. return (16)._rh();
  6469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6470. $ctx1.sendIdx["should:raise:"]=4;
  6471. self._should_raise_((function(){
  6472. return smalltalk.withContext(function($ctx2) {
  6473. return (16)._rI();
  6474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6475. $ctx1.sendIdx["should:raise:"]=5;
  6476. self._should_raise_((function(){
  6477. return smalltalk.withContext(function($ctx2) {
  6478. return (16)._ri();
  6479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6480. $ctx1.sendIdx["should:raise:"]=6;
  6481. self._should_raise_((function(){
  6482. return smalltalk.withContext(function($ctx2) {
  6483. return (16)._rJ();
  6484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6485. $ctx1.sendIdx["should:raise:"]=7;
  6486. self._should_raise_((function(){
  6487. return smalltalk.withContext(function($ctx2) {
  6488. return (16)._rj();
  6489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6490. $ctx1.sendIdx["should:raise:"]=8;
  6491. self._should_raise_((function(){
  6492. return smalltalk.withContext(function($ctx2) {
  6493. return (16)._rK();
  6494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6495. $ctx1.sendIdx["should:raise:"]=9;
  6496. self._should_raise_((function(){
  6497. return smalltalk.withContext(function($ctx2) {
  6498. return (16)._rk();
  6499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6500. $ctx1.sendIdx["should:raise:"]=10;
  6501. self._should_raise_((function(){
  6502. return smalltalk.withContext(function($ctx2) {
  6503. return (16)._rL();
  6504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6505. $ctx1.sendIdx["should:raise:"]=11;
  6506. self._should_raise_((function(){
  6507. return smalltalk.withContext(function($ctx2) {
  6508. return (16)._rl();
  6509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6510. $ctx1.sendIdx["should:raise:"]=12;
  6511. self._should_raise_((function(){
  6512. return smalltalk.withContext(function($ctx2) {
  6513. return (16)._rM();
  6514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6515. $ctx1.sendIdx["should:raise:"]=13;
  6516. self._should_raise_((function(){
  6517. return smalltalk.withContext(function($ctx2) {
  6518. return (16)._rm();
  6519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6520. $ctx1.sendIdx["should:raise:"]=14;
  6521. self._should_raise_((function(){
  6522. return smalltalk.withContext(function($ctx2) {
  6523. return (16)._rN();
  6524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6525. $ctx1.sendIdx["should:raise:"]=15;
  6526. self._should_raise_((function(){
  6527. return smalltalk.withContext(function($ctx2) {
  6528. return (16)._rn();
  6529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6530. $ctx1.sendIdx["should:raise:"]=16;
  6531. self._should_raise_((function(){
  6532. return smalltalk.withContext(function($ctx2) {
  6533. return (16)._rO();
  6534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6535. $ctx1.sendIdx["should:raise:"]=17;
  6536. self._should_raise_((function(){
  6537. return smalltalk.withContext(function($ctx2) {
  6538. return (16)._ro();
  6539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6540. $ctx1.sendIdx["should:raise:"]=18;
  6541. self._should_raise_((function(){
  6542. return smalltalk.withContext(function($ctx2) {
  6543. return (16)._rP();
  6544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6545. $ctx1.sendIdx["should:raise:"]=19;
  6546. self._should_raise_((function(){
  6547. return smalltalk.withContext(function($ctx2) {
  6548. return (16)._rp();
  6549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6550. $ctx1.sendIdx["should:raise:"]=20;
  6551. self._should_raise_((function(){
  6552. return smalltalk.withContext(function($ctx2) {
  6553. return (16)._rQ();
  6554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6555. $ctx1.sendIdx["should:raise:"]=21;
  6556. self._should_raise_((function(){
  6557. return smalltalk.withContext(function($ctx2) {
  6558. return (16)._rq();
  6559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6560. $ctx1.sendIdx["should:raise:"]=22;
  6561. self._should_raise_((function(){
  6562. return smalltalk.withContext(function($ctx2) {
  6563. return (16)._rR();
  6564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6565. $ctx1.sendIdx["should:raise:"]=23;
  6566. self._should_raise_((function(){
  6567. return smalltalk.withContext(function($ctx2) {
  6568. return (16)._rr();
  6569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6570. $ctx1.sendIdx["should:raise:"]=24;
  6571. self._should_raise_((function(){
  6572. return smalltalk.withContext(function($ctx2) {
  6573. return (16)._rS();
  6574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6575. $ctx1.sendIdx["should:raise:"]=25;
  6576. self._should_raise_((function(){
  6577. return smalltalk.withContext(function($ctx2) {
  6578. return (16)._rs();
  6579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6580. $ctx1.sendIdx["should:raise:"]=26;
  6581. self._should_raise_((function(){
  6582. return smalltalk.withContext(function($ctx2) {
  6583. return (16)._rT();
  6584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6585. $ctx1.sendIdx["should:raise:"]=27;
  6586. self._should_raise_((function(){
  6587. return smalltalk.withContext(function($ctx2) {
  6588. return (16)._rt();
  6589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6590. $ctx1.sendIdx["should:raise:"]=28;
  6591. self._should_raise_((function(){
  6592. return smalltalk.withContext(function($ctx2) {
  6593. return (16)._rU();
  6594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6595. $ctx1.sendIdx["should:raise:"]=29;
  6596. self._should_raise_((function(){
  6597. return smalltalk.withContext(function($ctx2) {
  6598. return (16)._ru();
  6599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6600. $ctx1.sendIdx["should:raise:"]=30;
  6601. self._should_raise_((function(){
  6602. return smalltalk.withContext(function($ctx2) {
  6603. return (16)._rV();
  6604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6605. $ctx1.sendIdx["should:raise:"]=31;
  6606. self._should_raise_((function(){
  6607. return smalltalk.withContext(function($ctx2) {
  6608. return (16)._rv();
  6609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6610. $ctx1.sendIdx["should:raise:"]=32;
  6611. self._should_raise_((function(){
  6612. return smalltalk.withContext(function($ctx2) {
  6613. return (16)._rW();
  6614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6615. $ctx1.sendIdx["should:raise:"]=33;
  6616. self._should_raise_((function(){
  6617. return smalltalk.withContext(function($ctx2) {
  6618. return (16)._rw();
  6619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6620. $ctx1.sendIdx["should:raise:"]=34;
  6621. self._should_raise_((function(){
  6622. return smalltalk.withContext(function($ctx2) {
  6623. return (16)._rX();
  6624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6625. $ctx1.sendIdx["should:raise:"]=35;
  6626. self._should_raise_((function(){
  6627. return smalltalk.withContext(function($ctx2) {
  6628. return (16)._rx();
  6629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6630. $ctx1.sendIdx["should:raise:"]=36;
  6631. self._should_raise_((function(){
  6632. return smalltalk.withContext(function($ctx2) {
  6633. return (16)._rY();
  6634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6635. $ctx1.sendIdx["should:raise:"]=37;
  6636. self._should_raise_((function(){
  6637. return smalltalk.withContext(function($ctx2) {
  6638. return (16)._ry();
  6639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6640. $ctx1.sendIdx["should:raise:"]=38;
  6641. self._should_raise_((function(){
  6642. return smalltalk.withContext(function($ctx2) {
  6643. return (16)._rZ();
  6644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6645. $ctx1.sendIdx["should:raise:"]=39;
  6646. self._should_raise_((function(){
  6647. return smalltalk.withContext(function($ctx2) {
  6648. return (16)._rz();
  6649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6650. $ctx1.sendIdx["should:raise:"]=40;
  6651. self._should_raise_((function(){
  6652. return smalltalk.withContext(function($ctx2) {
  6653. return (11259375)._Z();
  6654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6655. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6656. args: [],
  6657. 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.",
  6658. 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"],
  6659. referencedClasses: ["MessageNotUnderstood"]
  6660. }),
  6661. smalltalk.NumberTest);
  6662. smalltalk.addMethod(
  6663. smalltalk.method({
  6664. selector: "testLog",
  6665. protocol: 'tests',
  6666. fn: function (){
  6667. var self=this;
  6668. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6669. return smalltalk.withContext(function($ctx1) {
  6670. self._assert_equals_((10000)._log(),(4));
  6671. $ctx1.sendIdx["assert:equals:"]=1;
  6672. self._assert_equals_((512)._log_((2)),(9));
  6673. $ctx1.sendIdx["assert:equals:"]=2;
  6674. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6675. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6676. args: [],
  6677. 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.",
  6678. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6679. referencedClasses: ["Number"]
  6680. }),
  6681. smalltalk.NumberTest);
  6682. smalltalk.addMethod(
  6683. smalltalk.method({
  6684. selector: "testMinMax",
  6685. protocol: 'tests',
  6686. fn: function (){
  6687. var self=this;
  6688. return smalltalk.withContext(function($ctx1) {
  6689. self._assert_equals_((2)._max_((5)),(5));
  6690. $ctx1.sendIdx["assert:equals:"]=1;
  6691. self._assert_equals_((2)._min_((5)),(2));
  6692. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6693. args: [],
  6694. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6695. messageSends: ["assert:equals:", "max:", "min:"],
  6696. referencedClasses: []
  6697. }),
  6698. smalltalk.NumberTest);
  6699. smalltalk.addMethod(
  6700. smalltalk.method({
  6701. selector: "testNegated",
  6702. protocol: 'tests',
  6703. fn: function (){
  6704. var self=this;
  6705. return smalltalk.withContext(function($ctx1) {
  6706. var $1;
  6707. $1=(3)._negated();
  6708. $ctx1.sendIdx["negated"]=1;
  6709. self._assert_equals_($1,(-3));
  6710. $ctx1.sendIdx["assert:equals:"]=1;
  6711. self._assert_equals_((-3)._negated(),(3));
  6712. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6713. args: [],
  6714. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6715. messageSends: ["assert:equals:", "negated"],
  6716. referencedClasses: []
  6717. }),
  6718. smalltalk.NumberTest);
  6719. smalltalk.addMethod(
  6720. smalltalk.method({
  6721. selector: "testPrintShowingDecimalPlaces",
  6722. protocol: 'tests',
  6723. fn: function (){
  6724. var self=this;
  6725. return smalltalk.withContext(function($ctx1) {
  6726. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6727. $1=(23)._printShowingDecimalPlaces_((2));
  6728. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6729. self._assert_equals_($1,"23.00");
  6730. $ctx1.sendIdx["assert:equals:"]=1;
  6731. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6732. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6733. self._assert_equals_($2,"23.57");
  6734. $ctx1.sendIdx["assert:equals:"]=2;
  6735. $4=(234.567)._negated();
  6736. $ctx1.sendIdx["negated"]=1;
  6737. $3=_st($4)._printShowingDecimalPlaces_((5));
  6738. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6739. self._assert_equals_($3,"-234.56700");
  6740. $ctx1.sendIdx["assert:equals:"]=3;
  6741. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6742. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6743. self._assert_equals_($5,"23");
  6744. $ctx1.sendIdx["assert:equals:"]=4;
  6745. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6746. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6747. self._assert_equals_($6,"24");
  6748. $ctx1.sendIdx["assert:equals:"]=5;
  6749. $8=(23.4567)._negated();
  6750. $ctx1.sendIdx["negated"]=2;
  6751. $7=_st($8)._printShowingDecimalPlaces_((0));
  6752. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6753. self._assert_equals_($7,"-23");
  6754. $ctx1.sendIdx["assert:equals:"]=6;
  6755. $10=(23.5567)._negated();
  6756. $ctx1.sendIdx["negated"]=3;
  6757. $9=_st($10)._printShowingDecimalPlaces_((0));
  6758. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6759. self._assert_equals_($9,"-24");
  6760. $ctx1.sendIdx["assert:equals:"]=7;
  6761. $11=(100000000)._printShowingDecimalPlaces_((1));
  6762. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6763. self._assert_equals_($11,"100000000.0");
  6764. $ctx1.sendIdx["assert:equals:"]=8;
  6765. $12=(0.98)._printShowingDecimalPlaces_((5));
  6766. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6767. self._assert_equals_($12,"0.98000");
  6768. $ctx1.sendIdx["assert:equals:"]=9;
  6769. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6770. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6771. self._assert_equals_($13,"-0.98");
  6772. $ctx1.sendIdx["assert:equals:"]=10;
  6773. $14=(2.567)._printShowingDecimalPlaces_((2));
  6774. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6775. self._assert_equals_($14,"2.57");
  6776. $ctx1.sendIdx["assert:equals:"]=11;
  6777. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6778. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6779. self._assert_equals_($15,"-2.57");
  6780. $ctx1.sendIdx["assert:equals:"]=12;
  6781. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6782. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6783. args: [],
  6784. 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'.",
  6785. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6786. referencedClasses: []
  6787. }),
  6788. smalltalk.NumberTest);
  6789. smalltalk.addMethod(
  6790. smalltalk.method({
  6791. selector: "testRaisedTo",
  6792. protocol: 'tests',
  6793. fn: function (){
  6794. var self=this;
  6795. return smalltalk.withContext(function($ctx1) {
  6796. var $1,$2,$3;
  6797. $1=(2)._raisedTo_((4));
  6798. $ctx1.sendIdx["raisedTo:"]=1;
  6799. self._assert_equals_($1,(16));
  6800. $ctx1.sendIdx["assert:equals:"]=1;
  6801. $2=(2)._raisedTo_((0));
  6802. $ctx1.sendIdx["raisedTo:"]=2;
  6803. self._assert_equals_($2,(1));
  6804. $ctx1.sendIdx["assert:equals:"]=2;
  6805. $3=(2)._raisedTo_((-3));
  6806. $ctx1.sendIdx["raisedTo:"]=3;
  6807. self._assert_equals_($3,(0.125));
  6808. $ctx1.sendIdx["assert:equals:"]=3;
  6809. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6810. $ctx1.sendIdx["assert:equals:"]=4;
  6811. self._assert_equals_((2).__star_star((4)),(16));
  6812. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6813. args: [],
  6814. 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.",
  6815. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6816. referencedClasses: []
  6817. }),
  6818. smalltalk.NumberTest);
  6819. smalltalk.addMethod(
  6820. smalltalk.method({
  6821. selector: "testRounded",
  6822. protocol: 'tests',
  6823. fn: function (){
  6824. var self=this;
  6825. return smalltalk.withContext(function($ctx1) {
  6826. var $1,$2;
  6827. $1=(3)._rounded();
  6828. $ctx1.sendIdx["rounded"]=1;
  6829. self._assert_equals_($1,(3));
  6830. $ctx1.sendIdx["assert:equals:"]=1;
  6831. $2=(3.212)._rounded();
  6832. $ctx1.sendIdx["rounded"]=2;
  6833. self._assert_equals_($2,(3));
  6834. $ctx1.sendIdx["assert:equals:"]=2;
  6835. self._assert_equals_((3.51)._rounded(),(4));
  6836. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6837. args: [],
  6838. 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",
  6839. messageSends: ["assert:equals:", "rounded"],
  6840. referencedClasses: []
  6841. }),
  6842. smalltalk.NumberTest);
  6843. smalltalk.addMethod(
  6844. smalltalk.method({
  6845. selector: "testSign",
  6846. protocol: 'tests',
  6847. fn: function (){
  6848. var self=this;
  6849. return smalltalk.withContext(function($ctx1) {
  6850. var $1,$2;
  6851. $1=(5)._sign();
  6852. $ctx1.sendIdx["sign"]=1;
  6853. self._assert_equals_($1,(1));
  6854. $ctx1.sendIdx["assert:equals:"]=1;
  6855. $2=(0)._sign();
  6856. $ctx1.sendIdx["sign"]=2;
  6857. self._assert_equals_($2,(0));
  6858. $ctx1.sendIdx["assert:equals:"]=2;
  6859. self._assert_equals_((-1.4)._sign(),(-1));
  6860. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6861. args: [],
  6862. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6863. messageSends: ["assert:equals:", "sign"],
  6864. referencedClasses: []
  6865. }),
  6866. smalltalk.NumberTest);
  6867. smalltalk.addMethod(
  6868. smalltalk.method({
  6869. selector: "testSqrt",
  6870. protocol: 'tests',
  6871. fn: function (){
  6872. var self=this;
  6873. return smalltalk.withContext(function($ctx1) {
  6874. var $1;
  6875. $1=(4)._sqrt();
  6876. $ctx1.sendIdx["sqrt"]=1;
  6877. self._assert_equals_($1,(2));
  6878. $ctx1.sendIdx["assert:equals:"]=1;
  6879. self._assert_equals_((16)._sqrt(),(4));
  6880. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6881. args: [],
  6882. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6883. messageSends: ["assert:equals:", "sqrt"],
  6884. referencedClasses: []
  6885. }),
  6886. smalltalk.NumberTest);
  6887. smalltalk.addMethod(
  6888. smalltalk.method({
  6889. selector: "testSquared",
  6890. protocol: 'tests',
  6891. fn: function (){
  6892. var self=this;
  6893. return smalltalk.withContext(function($ctx1) {
  6894. self._assert_equals_((4)._squared(),(16));
  6895. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6896. args: [],
  6897. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6898. messageSends: ["assert:equals:", "squared"],
  6899. referencedClasses: []
  6900. }),
  6901. smalltalk.NumberTest);
  6902. smalltalk.addMethod(
  6903. smalltalk.method({
  6904. selector: "testTimesRepeat",
  6905. protocol: 'tests',
  6906. fn: function (){
  6907. var self=this;
  6908. var i;
  6909. return smalltalk.withContext(function($ctx1) {
  6910. i=(0);
  6911. (0)._timesRepeat_((function(){
  6912. return smalltalk.withContext(function($ctx2) {
  6913. i=_st(i).__plus((1));
  6914. $ctx2.sendIdx["+"]=1;
  6915. return i;
  6916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6917. $ctx1.sendIdx["timesRepeat:"]=1;
  6918. self._assert_equals_(i,(0));
  6919. $ctx1.sendIdx["assert:equals:"]=1;
  6920. (5)._timesRepeat_((function(){
  6921. return smalltalk.withContext(function($ctx2) {
  6922. i=_st(i).__plus((1));
  6923. return i;
  6924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6925. self._assert_equals_(i,(5));
  6926. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6927. args: [],
  6928. 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",
  6929. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  6930. referencedClasses: []
  6931. }),
  6932. smalltalk.NumberTest);
  6933. smalltalk.addMethod(
  6934. smalltalk.method({
  6935. selector: "testTo",
  6936. protocol: 'tests',
  6937. fn: function (){
  6938. var self=this;
  6939. return smalltalk.withContext(function($ctx1) {
  6940. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  6941. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  6942. args: [],
  6943. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  6944. messageSends: ["assert:equals:", "to:"],
  6945. referencedClasses: []
  6946. }),
  6947. smalltalk.NumberTest);
  6948. smalltalk.addMethod(
  6949. smalltalk.method({
  6950. selector: "testToBy",
  6951. protocol: 'tests',
  6952. fn: function (){
  6953. var self=this;
  6954. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6955. return smalltalk.withContext(function($ctx1) {
  6956. var $1;
  6957. $1=(0)._to_by_((6),(2));
  6958. $ctx1.sendIdx["to:by:"]=1;
  6959. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6960. self._should_raise_((function(){
  6961. return smalltalk.withContext(function($ctx2) {
  6962. return (1)._to_by_((4),(0));
  6963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6964. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6965. args: [],
  6966. 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",
  6967. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6968. referencedClasses: ["Error"]
  6969. }),
  6970. smalltalk.NumberTest);
  6971. smalltalk.addMethod(
  6972. smalltalk.method({
  6973. selector: "testTrigonometry",
  6974. protocol: 'tests',
  6975. fn: function (){
  6976. var self=this;
  6977. return smalltalk.withContext(function($ctx1) {
  6978. self._assert_equals_((0)._cos(),(1));
  6979. $ctx1.sendIdx["assert:equals:"]=1;
  6980. self._assert_equals_((0)._sin(),(0));
  6981. $ctx1.sendIdx["assert:equals:"]=2;
  6982. self._assert_equals_((0)._tan(),(0));
  6983. $ctx1.sendIdx["assert:equals:"]=3;
  6984. self._assert_equals_((1)._arcCos(),(0));
  6985. $ctx1.sendIdx["assert:equals:"]=4;
  6986. self._assert_equals_((0)._arcSin(),(0));
  6987. $ctx1.sendIdx["assert:equals:"]=5;
  6988. self._assert_equals_((0)._arcTan(),(0));
  6989. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6990. args: [],
  6991. 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.",
  6992. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6993. referencedClasses: []
  6994. }),
  6995. smalltalk.NumberTest);
  6996. smalltalk.addMethod(
  6997. smalltalk.method({
  6998. selector: "testTruncated",
  6999. protocol: 'tests',
  7000. fn: function (){
  7001. var self=this;
  7002. return smalltalk.withContext(function($ctx1) {
  7003. var $1,$2;
  7004. $1=(3)._truncated();
  7005. $ctx1.sendIdx["truncated"]=1;
  7006. self._assert_equals_($1,(3));
  7007. $ctx1.sendIdx["assert:equals:"]=1;
  7008. $2=(3.212)._truncated();
  7009. $ctx1.sendIdx["truncated"]=2;
  7010. self._assert_equals_($2,(3));
  7011. $ctx1.sendIdx["assert:equals:"]=2;
  7012. self._assert_equals_((3.51)._truncated(),(3));
  7013. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7014. args: [],
  7015. 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",
  7016. messageSends: ["assert:equals:", "truncated"],
  7017. referencedClasses: []
  7018. }),
  7019. smalltalk.NumberTest);
  7020. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7021. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7022. smalltalk.addMethod(
  7023. smalltalk.method({
  7024. selector: "foo",
  7025. protocol: 'not yet classified',
  7026. fn: function (){
  7027. var self=this;
  7028. return smalltalk.withContext(function($ctx1) {
  7029. var $1;
  7030. $1=self["@foo"];
  7031. return $1;
  7032. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7033. args: [],
  7034. source: "foo\x0a\x09^ foo",
  7035. messageSends: [],
  7036. referencedClasses: []
  7037. }),
  7038. smalltalk.ObjectMock);
  7039. smalltalk.addMethod(
  7040. smalltalk.method({
  7041. selector: "foo:",
  7042. protocol: 'not yet classified',
  7043. fn: function (anObject){
  7044. var self=this;
  7045. return smalltalk.withContext(function($ctx1) {
  7046. self["@foo"]=anObject;
  7047. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7048. args: ["anObject"],
  7049. source: "foo: anObject\x0a\x09foo := anObject",
  7050. messageSends: [],
  7051. referencedClasses: []
  7052. }),
  7053. smalltalk.ObjectMock);
  7054. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7055. smalltalk.addMethod(
  7056. smalltalk.method({
  7057. selector: "notDefined",
  7058. protocol: 'tests',
  7059. fn: function (){
  7060. var self=this;
  7061. return smalltalk.withContext(function($ctx1) {
  7062. return void 0;;
  7063. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7064. args: [],
  7065. source: "notDefined\x0a\x09<return void 0;>",
  7066. messageSends: [],
  7067. referencedClasses: []
  7068. }),
  7069. smalltalk.ObjectTest);
  7070. smalltalk.addMethod(
  7071. smalltalk.method({
  7072. selector: "testBasicAccess",
  7073. protocol: 'tests',
  7074. fn: function (){
  7075. var self=this;
  7076. var o;
  7077. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7078. return smalltalk.withContext(function($ctx1) {
  7079. var $1;
  7080. o=_st($Object())._new();
  7081. _st(o)._basicAt_put_("a",(1));
  7082. $1=_st(o)._basicAt_("a");
  7083. $ctx1.sendIdx["basicAt:"]=1;
  7084. self._assert_equals_($1,(1));
  7085. $ctx1.sendIdx["assert:equals:"]=1;
  7086. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7087. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7088. args: [],
  7089. 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",
  7090. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7091. referencedClasses: ["Object"]
  7092. }),
  7093. smalltalk.ObjectTest);
  7094. smalltalk.addMethod(
  7095. smalltalk.method({
  7096. selector: "testBasicPerform",
  7097. protocol: 'tests',
  7098. fn: function (){
  7099. var self=this;
  7100. var o;
  7101. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7102. return smalltalk.withContext(function($ctx1) {
  7103. o=_st($Object())._new();
  7104. _st(o)._basicAt_put_("func",(function(){
  7105. return smalltalk.withContext(function($ctx2) {
  7106. return "hello";
  7107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7108. $ctx1.sendIdx["basicAt:put:"]=1;
  7109. _st(o)._basicAt_put_("func2",(function(a){
  7110. return smalltalk.withContext(function($ctx2) {
  7111. return _st(a).__plus((1));
  7112. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7113. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7114. $ctx1.sendIdx["assert:equals:"]=1;
  7115. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7116. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7117. args: [],
  7118. 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",
  7119. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7120. referencedClasses: ["Object"]
  7121. }),
  7122. smalltalk.ObjectTest);
  7123. smalltalk.addMethod(
  7124. smalltalk.method({
  7125. selector: "testDNU",
  7126. protocol: 'tests',
  7127. fn: function (){
  7128. var self=this;
  7129. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7130. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7131. return smalltalk.withContext(function($ctx1) {
  7132. self._should_raise_((function(){
  7133. return smalltalk.withContext(function($ctx2) {
  7134. return _st(_st($Object())._new())._foo();
  7135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7136. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7137. args: [],
  7138. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7139. messageSends: ["should:raise:", "foo", "new"],
  7140. referencedClasses: ["Object", "MessageNotUnderstood"]
  7141. }),
  7142. smalltalk.ObjectTest);
  7143. smalltalk.addMethod(
  7144. smalltalk.method({
  7145. selector: "testEquality",
  7146. protocol: 'tests',
  7147. fn: function (){
  7148. var self=this;
  7149. var o;
  7150. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7151. return smalltalk.withContext(function($ctx1) {
  7152. var $1,$2,$4,$3;
  7153. o=_st($Object())._new();
  7154. $ctx1.sendIdx["new"]=1;
  7155. $1=_st(o).__eq(_st($Object())._new());
  7156. $ctx1.sendIdx["="]=1;
  7157. self._deny_($1);
  7158. $2=_st(o).__eq(o);
  7159. $ctx1.sendIdx["="]=2;
  7160. self._assert_($2);
  7161. $ctx1.sendIdx["assert:"]=1;
  7162. $4=_st(o)._yourself();
  7163. $ctx1.sendIdx["yourself"]=1;
  7164. $3=_st($4).__eq(o);
  7165. $ctx1.sendIdx["="]=3;
  7166. self._assert_($3);
  7167. $ctx1.sendIdx["assert:"]=2;
  7168. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7169. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7170. args: [],
  7171. 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)",
  7172. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7173. referencedClasses: ["Object"]
  7174. }),
  7175. smalltalk.ObjectTest);
  7176. smalltalk.addMethod(
  7177. smalltalk.method({
  7178. selector: "testHalt",
  7179. protocol: 'tests',
  7180. fn: function (){
  7181. var self=this;
  7182. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7183. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7184. return smalltalk.withContext(function($ctx1) {
  7185. self._should_raise_((function(){
  7186. return smalltalk.withContext(function($ctx2) {
  7187. return _st(_st($Object())._new())._halt();
  7188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7189. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7190. args: [],
  7191. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7192. messageSends: ["should:raise:", "halt", "new"],
  7193. referencedClasses: ["Object", "Error"]
  7194. }),
  7195. smalltalk.ObjectTest);
  7196. smalltalk.addMethod(
  7197. smalltalk.method({
  7198. selector: "testIdentity",
  7199. protocol: 'tests',
  7200. fn: function (){
  7201. var self=this;
  7202. var o;
  7203. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7204. return smalltalk.withContext(function($ctx1) {
  7205. var $1,$2,$4,$3;
  7206. o=_st($Object())._new();
  7207. $ctx1.sendIdx["new"]=1;
  7208. $1=_st(o).__eq_eq(_st($Object())._new());
  7209. $ctx1.sendIdx["=="]=1;
  7210. self._deny_($1);
  7211. $2=_st(o).__eq_eq(o);
  7212. $ctx1.sendIdx["=="]=2;
  7213. self._assert_($2);
  7214. $ctx1.sendIdx["assert:"]=1;
  7215. $4=_st(o)._yourself();
  7216. $ctx1.sendIdx["yourself"]=1;
  7217. $3=_st($4).__eq_eq(o);
  7218. $ctx1.sendIdx["=="]=3;
  7219. self._assert_($3);
  7220. $ctx1.sendIdx["assert:"]=2;
  7221. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7222. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7223. args: [],
  7224. 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",
  7225. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7226. referencedClasses: ["Object"]
  7227. }),
  7228. smalltalk.ObjectTest);
  7229. smalltalk.addMethod(
  7230. smalltalk.method({
  7231. selector: "testIfNil",
  7232. protocol: 'tests',
  7233. fn: function (){
  7234. var self=this;
  7235. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7236. return smalltalk.withContext(function($ctx1) {
  7237. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7238. $2=_st($Object())._new();
  7239. $ctx1.sendIdx["new"]=1;
  7240. $1=_st($2)._isNil();
  7241. self._deny_($1);
  7242. $ctx1.sendIdx["deny:"]=1;
  7243. $5=_st($Object())._new();
  7244. $ctx1.sendIdx["new"]=2;
  7245. if(($receiver = $5) == nil || $receiver == null){
  7246. $4=true;
  7247. } else {
  7248. $4=$5;
  7249. };
  7250. $3=_st($4).__eq(true);
  7251. self._deny_($3);
  7252. $7=_st($Object())._new();
  7253. $ctx1.sendIdx["new"]=3;
  7254. if(($receiver = $7) == nil || $receiver == null){
  7255. $6=$7;
  7256. } else {
  7257. $6=true;
  7258. };
  7259. self._assert_equals_($6,true);
  7260. $ctx1.sendIdx["assert:equals:"]=1;
  7261. $9=_st($Object())._new();
  7262. $ctx1.sendIdx["new"]=4;
  7263. if(($receiver = $9) == nil || $receiver == null){
  7264. $8=false;
  7265. } else {
  7266. $8=true;
  7267. };
  7268. self._assert_equals_($8,true);
  7269. $ctx1.sendIdx["assert:equals:"]=2;
  7270. $11=_st($Object())._new();
  7271. if(($receiver = $11) == nil || $receiver == null){
  7272. $10=false;
  7273. } else {
  7274. $10=true;
  7275. };
  7276. self._assert_equals_($10,true);
  7277. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7278. args: [],
  7279. 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",
  7280. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7281. referencedClasses: ["Object"]
  7282. }),
  7283. smalltalk.ObjectTest);
  7284. smalltalk.addMethod(
  7285. smalltalk.method({
  7286. selector: "testInstVars",
  7287. protocol: 'tests',
  7288. fn: function (){
  7289. var self=this;
  7290. var o;
  7291. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7292. return smalltalk.withContext(function($ctx1) {
  7293. var $1,$2;
  7294. o=_st($ObjectMock())._new();
  7295. $1=_st(o)._instVarAt_("foo");
  7296. $ctx1.sendIdx["instVarAt:"]=1;
  7297. self._assert_equals_($1,nil);
  7298. $ctx1.sendIdx["assert:equals:"]=1;
  7299. _st(o)._instVarAt_put_("foo",(1));
  7300. $2=_st(o)._instVarAt_("foo");
  7301. $ctx1.sendIdx["instVarAt:"]=2;
  7302. self._assert_equals_($2,(1));
  7303. $ctx1.sendIdx["assert:equals:"]=2;
  7304. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7305. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7306. args: [],
  7307. 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",
  7308. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7309. referencedClasses: ["ObjectMock"]
  7310. }),
  7311. smalltalk.ObjectTest);
  7312. smalltalk.addMethod(
  7313. smalltalk.method({
  7314. selector: "testNilUndefined",
  7315. protocol: 'tests',
  7316. fn: function (){
  7317. var self=this;
  7318. return smalltalk.withContext(function($ctx1) {
  7319. self._assert_equals_(self._notDefined(),nil);
  7320. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7321. args: [],
  7322. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7323. messageSends: ["assert:equals:", "notDefined"],
  7324. referencedClasses: []
  7325. }),
  7326. smalltalk.ObjectTest);
  7327. smalltalk.addMethod(
  7328. smalltalk.method({
  7329. selector: "testYourself",
  7330. protocol: 'tests',
  7331. fn: function (){
  7332. var self=this;
  7333. var o;
  7334. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7335. return smalltalk.withContext(function($ctx1) {
  7336. o=_st($ObjectMock())._new();
  7337. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7338. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7339. args: [],
  7340. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7341. messageSends: ["new", "assert:", "==", "yourself"],
  7342. referencedClasses: ["ObjectMock"]
  7343. }),
  7344. smalltalk.ObjectTest);
  7345. smalltalk.addMethod(
  7346. smalltalk.method({
  7347. selector: "testidentityHash",
  7348. protocol: 'tests',
  7349. fn: function (){
  7350. var self=this;
  7351. var o1,o2;
  7352. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7353. return smalltalk.withContext(function($ctx1) {
  7354. var $2,$3,$1,$5,$4;
  7355. o1=_st($Object())._new();
  7356. $ctx1.sendIdx["new"]=1;
  7357. o2=_st($Object())._new();
  7358. $2=_st(o1)._identityHash();
  7359. $ctx1.sendIdx["identityHash"]=1;
  7360. $3=_st(o1)._identityHash();
  7361. $ctx1.sendIdx["identityHash"]=2;
  7362. $1=_st($2).__eq_eq($3);
  7363. $ctx1.sendIdx["=="]=1;
  7364. self._assert_($1);
  7365. $5=_st(o1)._identityHash();
  7366. $ctx1.sendIdx["identityHash"]=3;
  7367. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7368. self._deny_($4);
  7369. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7370. args: [],
  7371. 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",
  7372. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7373. referencedClasses: ["Object"]
  7374. }),
  7375. smalltalk.ObjectTest);
  7376. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7377. smalltalk.addMethod(
  7378. smalltalk.method({
  7379. selector: "testAccessing",
  7380. protocol: 'tests',
  7381. fn: function (){
  7382. var self=this;
  7383. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7384. return smalltalk.withContext(function($ctx1) {
  7385. var $2,$1,$3,$6,$5,$4;
  7386. $2=_st($Point())._x_y_((3),(4));
  7387. $ctx1.sendIdx["x:y:"]=1;
  7388. $1=_st($2)._x();
  7389. $ctx1.sendIdx["x"]=1;
  7390. self._assert_equals_($1,(3));
  7391. $ctx1.sendIdx["assert:equals:"]=1;
  7392. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7393. $ctx1.sendIdx["y"]=1;
  7394. self._assert_equals_($3,(4));
  7395. $ctx1.sendIdx["assert:equals:"]=2;
  7396. $6=_st($Point())._new();
  7397. $ctx1.sendIdx["new"]=1;
  7398. $5=_st($6)._x_((3));
  7399. $4=_st($5)._x();
  7400. self._assert_equals_($4,(3));
  7401. $ctx1.sendIdx["assert:equals:"]=3;
  7402. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7403. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7404. args: [],
  7405. 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",
  7406. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7407. referencedClasses: ["Point"]
  7408. }),
  7409. smalltalk.PointTest);
  7410. smalltalk.addMethod(
  7411. smalltalk.method({
  7412. selector: "testArithmetic",
  7413. protocol: 'tests',
  7414. fn: function (){
  7415. var self=this;
  7416. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7417. return smalltalk.withContext(function($ctx1) {
  7418. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7419. $2=(3).__at((4));
  7420. $ctx1.sendIdx["@"]=1;
  7421. $3=(3).__at((4));
  7422. $ctx1.sendIdx["@"]=2;
  7423. $1=_st($2).__star($3);
  7424. $4=_st($Point())._x_y_((9),(16));
  7425. $ctx1.sendIdx["x:y:"]=1;
  7426. self._assert_equals_($1,$4);
  7427. $ctx1.sendIdx["assert:equals:"]=1;
  7428. $6=(3).__at((4));
  7429. $ctx1.sendIdx["@"]=3;
  7430. $7=(3).__at((4));
  7431. $ctx1.sendIdx["@"]=4;
  7432. $5=_st($6).__plus($7);
  7433. $8=_st($Point())._x_y_((6),(8));
  7434. $ctx1.sendIdx["x:y:"]=2;
  7435. self._assert_equals_($5,$8);
  7436. $ctx1.sendIdx["assert:equals:"]=2;
  7437. $10=(3).__at((4));
  7438. $ctx1.sendIdx["@"]=5;
  7439. $11=(3).__at((4));
  7440. $ctx1.sendIdx["@"]=6;
  7441. $9=_st($10).__minus($11);
  7442. $12=_st($Point())._x_y_((0),(0));
  7443. $ctx1.sendIdx["x:y:"]=3;
  7444. self._assert_equals_($9,$12);
  7445. $ctx1.sendIdx["assert:equals:"]=3;
  7446. $14=(6).__at((8));
  7447. $ctx1.sendIdx["@"]=7;
  7448. $13=_st($14).__slash((3).__at((4)));
  7449. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7450. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7451. args: [],
  7452. 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)",
  7453. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7454. referencedClasses: ["Point"]
  7455. }),
  7456. smalltalk.PointTest);
  7457. smalltalk.addMethod(
  7458. smalltalk.method({
  7459. selector: "testAt",
  7460. protocol: 'tests',
  7461. fn: function (){
  7462. var self=this;
  7463. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7464. return smalltalk.withContext(function($ctx1) {
  7465. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7466. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7467. args: [],
  7468. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7469. messageSends: ["assert:equals:", "@", "x:y:"],
  7470. referencedClasses: ["Point"]
  7471. }),
  7472. smalltalk.PointTest);
  7473. smalltalk.addMethod(
  7474. smalltalk.method({
  7475. selector: "testEgality",
  7476. protocol: 'tests',
  7477. fn: function (){
  7478. var self=this;
  7479. return smalltalk.withContext(function($ctx1) {
  7480. var $2,$3,$1,$5,$4;
  7481. $2=(3).__at((4));
  7482. $ctx1.sendIdx["@"]=1;
  7483. $3=(3).__at((4));
  7484. $ctx1.sendIdx["@"]=2;
  7485. $1=_st($2).__eq($3);
  7486. $ctx1.sendIdx["="]=1;
  7487. self._assert_($1);
  7488. $5=(3).__at((5));
  7489. $ctx1.sendIdx["@"]=3;
  7490. $4=_st($5).__eq((3).__at((6)));
  7491. self._deny_($4);
  7492. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7493. args: [],
  7494. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7495. messageSends: ["assert:", "=", "@", "deny:"],
  7496. referencedClasses: []
  7497. }),
  7498. smalltalk.PointTest);
  7499. smalltalk.addMethod(
  7500. smalltalk.method({
  7501. selector: "testNew",
  7502. protocol: 'tests',
  7503. fn: function (){
  7504. var self=this;
  7505. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7506. return smalltalk.withContext(function($ctx1) {
  7507. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7508. $3=_st($Point())._new();
  7509. $ctx1.sendIdx["new"]=1;
  7510. $2=_st($3)._x_((3));
  7511. $ctx1.sendIdx["x:"]=1;
  7512. $1=_st($2)._y();
  7513. $ctx1.sendIdx["y"]=1;
  7514. self._assert_equals_($1,nil);
  7515. $ctx1.sendIdx["assert:equals:"]=1;
  7516. $7=_st($Point())._new();
  7517. $ctx1.sendIdx["new"]=2;
  7518. $6=_st($7)._x_((3));
  7519. $5=_st($6)._x();
  7520. $ctx1.sendIdx["x"]=1;
  7521. $4=_st($5).__eq((0));
  7522. $ctx1.sendIdx["="]=1;
  7523. self._deny_($4);
  7524. $ctx1.sendIdx["deny:"]=1;
  7525. $10=_st($Point())._new();
  7526. $ctx1.sendIdx["new"]=3;
  7527. $9=_st($10)._y_((4));
  7528. $ctx1.sendIdx["y:"]=1;
  7529. $8=_st($9)._x();
  7530. self._assert_equals_($8,nil);
  7531. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7532. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7533. args: [],
  7534. 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",
  7535. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7536. referencedClasses: ["Point"]
  7537. }),
  7538. smalltalk.PointTest);
  7539. smalltalk.addMethod(
  7540. smalltalk.method({
  7541. selector: "testTranslateBy",
  7542. protocol: 'tests',
  7543. fn: function (){
  7544. var self=this;
  7545. return smalltalk.withContext(function($ctx1) {
  7546. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7547. $2=(3).__at((3));
  7548. $ctx1.sendIdx["@"]=1;
  7549. $3=(0).__at((1));
  7550. $ctx1.sendIdx["@"]=2;
  7551. $1=_st($2)._translateBy_($3);
  7552. $ctx1.sendIdx["translateBy:"]=1;
  7553. $4=(3).__at((4));
  7554. $ctx1.sendIdx["@"]=3;
  7555. self._assert_equals_($1,$4);
  7556. $ctx1.sendIdx["assert:equals:"]=1;
  7557. $6=(3).__at((3));
  7558. $ctx1.sendIdx["@"]=4;
  7559. $8=(1)._negated();
  7560. $ctx1.sendIdx["negated"]=1;
  7561. $7=(0).__at($8);
  7562. $ctx1.sendIdx["@"]=5;
  7563. $5=_st($6)._translateBy_($7);
  7564. $ctx1.sendIdx["translateBy:"]=2;
  7565. $9=(3).__at((2));
  7566. $ctx1.sendIdx["@"]=6;
  7567. self._assert_equals_($5,$9);
  7568. $ctx1.sendIdx["assert:equals:"]=2;
  7569. $11=(3).__at((3));
  7570. $ctx1.sendIdx["@"]=7;
  7571. $12=(2).__at((3));
  7572. $ctx1.sendIdx["@"]=8;
  7573. $10=_st($11)._translateBy_($12);
  7574. $ctx1.sendIdx["translateBy:"]=3;
  7575. $13=(5).__at((6));
  7576. $ctx1.sendIdx["@"]=9;
  7577. self._assert_equals_($10,$13);
  7578. $ctx1.sendIdx["assert:equals:"]=3;
  7579. $15=(3).__at((3));
  7580. $ctx1.sendIdx["@"]=10;
  7581. $16=_st((3)._negated()).__at((0));
  7582. $ctx1.sendIdx["@"]=11;
  7583. $14=_st($15)._translateBy_($16);
  7584. self._assert_equals_($14,(0).__at((3)));
  7585. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7586. args: [],
  7587. 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.",
  7588. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7589. referencedClasses: []
  7590. }),
  7591. smalltalk.PointTest);
  7592. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7593. smalltalk.addMethod(
  7594. smalltalk.method({
  7595. selector: "testNextIfAbsent",
  7596. protocol: 'tests',
  7597. fn: function (){
  7598. var self=this;
  7599. var queue;
  7600. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7601. return smalltalk.withContext(function($ctx1) {
  7602. var $2,$1;
  7603. queue=_st($Queue())._new();
  7604. _st(queue)._nextPut_("index1");
  7605. $2=_st(queue)._nextIfAbsent_("empty");
  7606. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7607. $1=_st($2).__eq("index1");
  7608. $ctx1.sendIdx["="]=1;
  7609. self._assert_($1);
  7610. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7611. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7612. args: [],
  7613. 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'",
  7614. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7615. referencedClasses: ["Queue"]
  7616. }),
  7617. smalltalk.QueueTest);
  7618. smalltalk.addMethod(
  7619. smalltalk.method({
  7620. selector: "testQueueNext",
  7621. protocol: 'tests',
  7622. fn: function (){
  7623. var self=this;
  7624. var queue;
  7625. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7626. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7627. return smalltalk.withContext(function($ctx1) {
  7628. var $1,$2,$4,$3,$6,$5;
  7629. queue=_st($Queue())._new();
  7630. $1=queue;
  7631. _st($1)._nextPut_("index1");
  7632. $ctx1.sendIdx["nextPut:"]=1;
  7633. $2=_st($1)._nextPut_("index2");
  7634. $4=_st(queue)._next();
  7635. $ctx1.sendIdx["next"]=1;
  7636. $3=_st($4).__eq("index1");
  7637. $ctx1.sendIdx["="]=1;
  7638. self._assert_($3);
  7639. $6=_st(queue)._next();
  7640. $ctx1.sendIdx["next"]=2;
  7641. $5=_st($6).__eq("index");
  7642. self._deny_($5);
  7643. self._should_raise_((function(){
  7644. return smalltalk.withContext(function($ctx2) {
  7645. return _st(queue)._next();
  7646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7647. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7648. args: [],
  7649. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  7650. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7651. referencedClasses: ["Queue", "Error"]
  7652. }),
  7653. smalltalk.QueueTest);
  7654. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7655. smalltalk.addMethod(
  7656. smalltalk.method({
  7657. selector: "testAtRandomNumber",
  7658. protocol: 'tests',
  7659. fn: function (){
  7660. var self=this;
  7661. var val;
  7662. return smalltalk.withContext(function($ctx1) {
  7663. (100)._timesRepeat_((function(){
  7664. return smalltalk.withContext(function($ctx2) {
  7665. val=(10)._atRandom();
  7666. val;
  7667. self._assert_(_st(val).__gt((0)));
  7668. $ctx2.sendIdx["assert:"]=1;
  7669. return self._assert_(_st(val).__lt((11)));
  7670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7671. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7672. args: [],
  7673. 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]",
  7674. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7675. referencedClasses: []
  7676. }),
  7677. smalltalk.RandomTest);
  7678. smalltalk.addMethod(
  7679. smalltalk.method({
  7680. selector: "testAtRandomSequenceableCollection",
  7681. protocol: 'tests',
  7682. fn: function (){
  7683. var self=this;
  7684. var val;
  7685. return smalltalk.withContext(function($ctx1) {
  7686. var $3,$4,$2,$1;
  7687. (100)._timesRepeat_((function(){
  7688. return smalltalk.withContext(function($ctx2) {
  7689. val="abc"._atRandom();
  7690. val;
  7691. $3=_st(val).__eq("a");
  7692. $ctx2.sendIdx["="]=1;
  7693. $4=_st(val).__eq("b");
  7694. $ctx2.sendIdx["="]=2;
  7695. $2=_st($3).__or($4);
  7696. $1=_st($2).__or(_st(val).__eq("c"));
  7697. $ctx2.sendIdx["|"]=1;
  7698. return self._assert_($1);
  7699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7700. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7701. args: [],
  7702. 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].",
  7703. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7704. referencedClasses: []
  7705. }),
  7706. smalltalk.RandomTest);
  7707. smalltalk.addMethod(
  7708. smalltalk.method({
  7709. selector: "textNext",
  7710. protocol: 'tests',
  7711. fn: function (){
  7712. var self=this;
  7713. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7714. return smalltalk.withContext(function($ctx1) {
  7715. var $1;
  7716. (10000)._timesRepeat_((function(){
  7717. var current,next;
  7718. return smalltalk.withContext(function($ctx2) {
  7719. next=_st(_st($Random())._new())._next();
  7720. next;
  7721. self._assert_(_st(next).__gt_eq((0)));
  7722. $ctx2.sendIdx["assert:"]=1;
  7723. self._assert_(_st(next).__lt((1)));
  7724. $1=_st(current).__eq(next);
  7725. $ctx2.sendIdx["="]=1;
  7726. self._deny_($1);
  7727. return _st(next).__eq(current);
  7728. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7729. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7730. args: [],
  7731. 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 ]",
  7732. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7733. referencedClasses: ["Random"]
  7734. }),
  7735. smalltalk.RandomTest);
  7736. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7737. smalltalk.addMethod(
  7738. smalltalk.method({
  7739. selector: "collectionClass",
  7740. protocol: 'accessing',
  7741. fn: function (){
  7742. var self=this;
  7743. return smalltalk.withContext(function($ctx1) {
  7744. var $1;
  7745. $1=_st(self._class())._collectionClass();
  7746. return $1;
  7747. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7748. args: [],
  7749. source: "collectionClass\x0a\x09^ self class collectionClass",
  7750. messageSends: ["collectionClass", "class"],
  7751. referencedClasses: []
  7752. }),
  7753. smalltalk.StreamTest);
  7754. smalltalk.addMethod(
  7755. smalltalk.method({
  7756. selector: "newCollection",
  7757. protocol: 'accessing',
  7758. fn: function (){
  7759. var self=this;
  7760. return smalltalk.withContext(function($ctx1) {
  7761. var $1;
  7762. $1=_st(self._collectionClass())._new();
  7763. return $1;
  7764. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7765. args: [],
  7766. source: "newCollection\x0a\x09^ self collectionClass new",
  7767. messageSends: ["new", "collectionClass"],
  7768. referencedClasses: []
  7769. }),
  7770. smalltalk.StreamTest);
  7771. smalltalk.addMethod(
  7772. smalltalk.method({
  7773. selector: "newStream",
  7774. protocol: 'accessing',
  7775. fn: function (){
  7776. var self=this;
  7777. return smalltalk.withContext(function($ctx1) {
  7778. var $1;
  7779. $1=_st(_st(self._collectionClass())._new())._stream();
  7780. return $1;
  7781. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7782. args: [],
  7783. source: "newStream\x0a\x09^ self collectionClass new stream",
  7784. messageSends: ["stream", "new", "collectionClass"],
  7785. referencedClasses: []
  7786. }),
  7787. smalltalk.StreamTest);
  7788. smalltalk.addMethod(
  7789. smalltalk.method({
  7790. selector: "testAtStartAtEnd",
  7791. protocol: 'tests',
  7792. fn: function (){
  7793. var self=this;
  7794. var stream;
  7795. return smalltalk.withContext(function($ctx1) {
  7796. var $1,$2,$3,$4;
  7797. stream=self._newStream();
  7798. $1=_st(stream)._atStart();
  7799. $ctx1.sendIdx["atStart"]=1;
  7800. self._assert_($1);
  7801. $ctx1.sendIdx["assert:"]=1;
  7802. $2=_st(stream)._atEnd();
  7803. $ctx1.sendIdx["atEnd"]=1;
  7804. self._assert_($2);
  7805. $ctx1.sendIdx["assert:"]=2;
  7806. _st(stream)._nextPutAll_(self._newCollection());
  7807. $3=_st(stream)._atEnd();
  7808. $ctx1.sendIdx["atEnd"]=2;
  7809. self._assert_($3);
  7810. $4=_st(stream)._atStart();
  7811. $ctx1.sendIdx["atStart"]=2;
  7812. self._deny_($4);
  7813. $ctx1.sendIdx["deny:"]=1;
  7814. _st(stream)._position_((1));
  7815. self._deny_(_st(stream)._atEnd());
  7816. $ctx1.sendIdx["deny:"]=2;
  7817. self._deny_(_st(stream)._atStart());
  7818. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7819. args: [],
  7820. 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",
  7821. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7822. referencedClasses: []
  7823. }),
  7824. smalltalk.StreamTest);
  7825. smalltalk.addMethod(
  7826. smalltalk.method({
  7827. selector: "testContents",
  7828. protocol: 'tests',
  7829. fn: function (){
  7830. var self=this;
  7831. var stream;
  7832. return smalltalk.withContext(function($ctx1) {
  7833. var $1,$2;
  7834. stream=self._newStream();
  7835. $1=stream;
  7836. $2=self._newCollection();
  7837. $ctx1.sendIdx["newCollection"]=1;
  7838. _st($1)._nextPutAll_($2);
  7839. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7840. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7841. args: [],
  7842. 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",
  7843. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7844. referencedClasses: []
  7845. }),
  7846. smalltalk.StreamTest);
  7847. smalltalk.addMethod(
  7848. smalltalk.method({
  7849. selector: "testIsEmpty",
  7850. protocol: 'tests',
  7851. fn: function (){
  7852. var self=this;
  7853. var stream;
  7854. return smalltalk.withContext(function($ctx1) {
  7855. var $1;
  7856. stream=self._newStream();
  7857. $1=_st(stream)._isEmpty();
  7858. $ctx1.sendIdx["isEmpty"]=1;
  7859. self._assert_($1);
  7860. _st(stream)._nextPutAll_(self._newCollection());
  7861. self._deny_(_st(stream)._isEmpty());
  7862. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7863. args: [],
  7864. 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",
  7865. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7866. referencedClasses: []
  7867. }),
  7868. smalltalk.StreamTest);
  7869. smalltalk.addMethod(
  7870. smalltalk.method({
  7871. selector: "testPosition",
  7872. protocol: 'tests',
  7873. fn: function (){
  7874. var self=this;
  7875. var collection,stream;
  7876. return smalltalk.withContext(function($ctx1) {
  7877. var $1,$2,$3;
  7878. collection=self._newCollection();
  7879. stream=self._newStream();
  7880. _st(stream)._nextPutAll_(collection);
  7881. $1=_st(stream)._position();
  7882. $ctx1.sendIdx["position"]=1;
  7883. self._assert_equals_($1,_st(collection)._size());
  7884. $ctx1.sendIdx["assert:equals:"]=1;
  7885. _st(stream)._position_((0));
  7886. $2=_st(stream)._position();
  7887. $ctx1.sendIdx["position"]=2;
  7888. self._assert_equals_($2,(0));
  7889. $ctx1.sendIdx["assert:equals:"]=2;
  7890. _st(stream)._next();
  7891. $ctx1.sendIdx["next"]=1;
  7892. $3=_st(stream)._position();
  7893. $ctx1.sendIdx["position"]=3;
  7894. self._assert_equals_($3,(1));
  7895. $ctx1.sendIdx["assert:equals:"]=3;
  7896. _st(stream)._next();
  7897. self._assert_equals_(_st(stream)._position(),(2));
  7898. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7899. args: [],
  7900. 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",
  7901. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7902. referencedClasses: []
  7903. }),
  7904. smalltalk.StreamTest);
  7905. smalltalk.addMethod(
  7906. smalltalk.method({
  7907. selector: "testReading",
  7908. protocol: 'tests',
  7909. fn: function (){
  7910. var self=this;
  7911. var stream,collection;
  7912. return smalltalk.withContext(function($ctx1) {
  7913. var $1,$2,$3;
  7914. collection=self._newCollection();
  7915. stream=self._newStream();
  7916. $1=stream;
  7917. _st($1)._nextPutAll_(collection);
  7918. $2=_st($1)._position_((0));
  7919. _st(collection)._do_((function(each){
  7920. return smalltalk.withContext(function($ctx2) {
  7921. $3=_st(stream)._next();
  7922. $ctx2.sendIdx["next"]=1;
  7923. return self._assert_equals_($3,each);
  7924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7925. self._assert_(_st(_st(stream)._next())._isNil());
  7926. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7927. args: [],
  7928. 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",
  7929. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7930. referencedClasses: []
  7931. }),
  7932. smalltalk.StreamTest);
  7933. smalltalk.addMethod(
  7934. smalltalk.method({
  7935. selector: "testStreamContents",
  7936. protocol: 'tests',
  7937. fn: function (){
  7938. var self=this;
  7939. return smalltalk.withContext(function($ctx1) {
  7940. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7941. args: [],
  7942. source: "testStreamContents",
  7943. messageSends: [],
  7944. referencedClasses: []
  7945. }),
  7946. smalltalk.StreamTest);
  7947. smalltalk.addMethod(
  7948. smalltalk.method({
  7949. selector: "testWrite",
  7950. protocol: 'tests',
  7951. fn: function (){
  7952. var self=this;
  7953. var stream,collection;
  7954. return smalltalk.withContext(function($ctx1) {
  7955. collection=self._newCollection();
  7956. stream=self._newStream();
  7957. _st(collection)._do_((function(each){
  7958. return smalltalk.withContext(function($ctx2) {
  7959. return _st(stream).__lt_lt(each);
  7960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7961. self._assert_equals_(_st(stream)._contents(),collection);
  7962. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7963. args: [],
  7964. 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",
  7965. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7966. referencedClasses: []
  7967. }),
  7968. smalltalk.StreamTest);
  7969. smalltalk.addMethod(
  7970. smalltalk.method({
  7971. selector: "testWriting",
  7972. protocol: 'tests',
  7973. fn: function (){
  7974. var self=this;
  7975. var stream,collection;
  7976. return smalltalk.withContext(function($ctx1) {
  7977. var $1;
  7978. collection=self._newCollection();
  7979. stream=self._newStream();
  7980. $ctx1.sendIdx["newStream"]=1;
  7981. _st(collection)._do_((function(each){
  7982. return smalltalk.withContext(function($ctx2) {
  7983. return _st(stream)._nextPut_(each);
  7984. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7985. $1=_st(stream)._contents();
  7986. $ctx1.sendIdx["contents"]=1;
  7987. self._assert_equals_($1,collection);
  7988. $ctx1.sendIdx["assert:equals:"]=1;
  7989. stream=self._newStream();
  7990. _st(stream)._nextPutAll_(collection);
  7991. self._assert_equals_(_st(stream)._contents(),collection);
  7992. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7993. args: [],
  7994. 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",
  7995. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7996. referencedClasses: []
  7997. }),
  7998. smalltalk.StreamTest);
  7999. smalltalk.addMethod(
  8000. smalltalk.method({
  8001. selector: "collectionClass",
  8002. protocol: 'accessing',
  8003. fn: function (){
  8004. var self=this;
  8005. return smalltalk.withContext(function($ctx1) {
  8006. return nil;
  8007. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8008. args: [],
  8009. source: "collectionClass\x0a\x09^ nil",
  8010. messageSends: [],
  8011. referencedClasses: []
  8012. }),
  8013. smalltalk.StreamTest.klass);
  8014. smalltalk.addMethod(
  8015. smalltalk.method({
  8016. selector: "isAbstract",
  8017. protocol: 'testing',
  8018. fn: function (){
  8019. var self=this;
  8020. return smalltalk.withContext(function($ctx1) {
  8021. var $1;
  8022. $1=_st(self._collectionClass())._isNil();
  8023. return $1;
  8024. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8025. args: [],
  8026. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8027. messageSends: ["isNil", "collectionClass"],
  8028. referencedClasses: []
  8029. }),
  8030. smalltalk.StreamTest.klass);
  8031. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8032. smalltalk.addMethod(
  8033. smalltalk.method({
  8034. selector: "newCollection",
  8035. protocol: 'accessing',
  8036. fn: function (){
  8037. var self=this;
  8038. return smalltalk.withContext(function($ctx1) {
  8039. var $1;
  8040. $1=[true,(1),(3).__at((4)),"foo"];
  8041. return $1;
  8042. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8043. args: [],
  8044. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8045. messageSends: ["@"],
  8046. referencedClasses: []
  8047. }),
  8048. smalltalk.ArrayStreamTest);
  8049. smalltalk.addMethod(
  8050. smalltalk.method({
  8051. selector: "collectionClass",
  8052. protocol: 'accessing',
  8053. fn: function (){
  8054. var self=this;
  8055. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8056. return smalltalk.withContext(function($ctx1) {
  8057. return $Array();
  8058. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8059. args: [],
  8060. source: "collectionClass\x0a\x09^ Array",
  8061. messageSends: [],
  8062. referencedClasses: ["Array"]
  8063. }),
  8064. smalltalk.ArrayStreamTest.klass);
  8065. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8066. smalltalk.addMethod(
  8067. smalltalk.method({
  8068. selector: "newCollection",
  8069. protocol: 'accessing',
  8070. fn: function (){
  8071. var self=this;
  8072. return smalltalk.withContext(function($ctx1) {
  8073. return "hello world";
  8074. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8075. args: [],
  8076. source: "newCollection\x0a\x09^ 'hello world'",
  8077. messageSends: [],
  8078. referencedClasses: []
  8079. }),
  8080. smalltalk.StringStreamTest);
  8081. smalltalk.addMethod(
  8082. smalltalk.method({
  8083. selector: "collectionClass",
  8084. protocol: 'accessing',
  8085. fn: function (){
  8086. var self=this;
  8087. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8088. return smalltalk.withContext(function($ctx1) {
  8089. return $String();
  8090. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8091. args: [],
  8092. source: "collectionClass\x0a\x09^ String",
  8093. messageSends: [],
  8094. referencedClasses: ["String"]
  8095. }),
  8096. smalltalk.StringStreamTest.klass);
  8097. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8098. smalltalk.addMethod(
  8099. smalltalk.method({
  8100. selector: "testCopying",
  8101. protocol: 'tests',
  8102. fn: function (){
  8103. var self=this;
  8104. return smalltalk.withContext(function($ctx1) {
  8105. self._assert_equals_(nil._copy(),nil);
  8106. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8107. args: [],
  8108. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8109. messageSends: ["assert:equals:", "copy"],
  8110. referencedClasses: []
  8111. }),
  8112. smalltalk.UndefinedTest);
  8113. smalltalk.addMethod(
  8114. smalltalk.method({
  8115. selector: "testDeepCopy",
  8116. protocol: 'tests',
  8117. fn: function (){
  8118. var self=this;
  8119. return smalltalk.withContext(function($ctx1) {
  8120. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8121. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8122. args: [],
  8123. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8124. messageSends: ["assert:", "=", "deepCopy"],
  8125. referencedClasses: []
  8126. }),
  8127. smalltalk.UndefinedTest);
  8128. smalltalk.addMethod(
  8129. smalltalk.method({
  8130. selector: "testIfNil",
  8131. protocol: 'tests',
  8132. fn: function (){
  8133. var self=this;
  8134. return smalltalk.withContext(function($ctx1) {
  8135. var $1,$3,$2,$4,$6,$5;
  8136. if(($receiver = nil) == nil || $receiver == null){
  8137. $1=true;
  8138. } else {
  8139. $1=nil;
  8140. };
  8141. self._assert_equals_($1,true);
  8142. $ctx1.sendIdx["assert:equals:"]=1;
  8143. if(($receiver = nil) == nil || $receiver == null){
  8144. $3=nil;
  8145. } else {
  8146. $3=true;
  8147. };
  8148. $2=_st($3).__eq(true);
  8149. $ctx1.sendIdx["="]=1;
  8150. self._deny_($2);
  8151. $ctx1.sendIdx["deny:"]=1;
  8152. if(($receiver = nil) == nil || $receiver == null){
  8153. $4=true;
  8154. } else {
  8155. $4=false;
  8156. };
  8157. self._assert_equals_($4,true);
  8158. if(($receiver = nil) == nil || $receiver == null){
  8159. $6=false;
  8160. } else {
  8161. $6=true;
  8162. };
  8163. $5=_st($6).__eq(true);
  8164. self._deny_($5);
  8165. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8166. args: [],
  8167. 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",
  8168. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8169. referencedClasses: []
  8170. }),
  8171. smalltalk.UndefinedTest);
  8172. smalltalk.addMethod(
  8173. smalltalk.method({
  8174. selector: "testIsNil",
  8175. protocol: 'tests',
  8176. fn: function (){
  8177. var self=this;
  8178. return smalltalk.withContext(function($ctx1) {
  8179. self._assert_(nil._isNil());
  8180. self._deny_(nil._notNil());
  8181. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8182. args: [],
  8183. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8184. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8185. referencedClasses: []
  8186. }),
  8187. smalltalk.UndefinedTest);
  8188. });