Kernel-Tests.js 335 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145
  1. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Tests');
  4. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "testAddExtensionMethod",
  9. protocol: 'tests',
  10. fn: function (){
  11. var self=this;
  12. var method,dirty;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  15. $2=self._class();
  16. $ctx1.sendIdx["class"]=1;
  17. $1=_st($2)._package();
  18. $ctx1.sendIdx["package"]=1;
  19. dirty=_st($1)._isDirty();
  20. $ctx1.sendIdx["isDirty"]=1;
  21. $4=self._class();
  22. $ctx1.sendIdx["class"]=2;
  23. $3=_st($4)._package();
  24. $ctx1.sendIdx["package"]=2;
  25. _st($3)._beClean();
  26. $5=self._class();
  27. $ctx1.sendIdx["class"]=3;
  28. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  29. $8=self._class();
  30. $ctx1.sendIdx["class"]=4;
  31. $7=_st($8)._package();
  32. $ctx1.sendIdx["package"]=3;
  33. $6=_st($7)._isDirty();
  34. self._deny_($6);
  35. $9=self._class();
  36. $ctx1.sendIdx["class"]=5;
  37. _st($9)._removeCompiledMethod_(method);
  38. $10=dirty;
  39. if(smalltalk.assert($10)){
  40. _st(_st(self._class())._package())._beDirty();
  41. };
  42. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)})},
  43. args: [],
  44. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  45. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  46. referencedClasses: []
  47. }),
  48. globals.AnnouncementSubscriptionTest);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "testHandlesAnnouncement",
  52. protocol: 'tests',
  53. fn: function (){
  54. var self=this;
  55. var subscription,announcementClass1,announcementClass2,classBuilder;
  56. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  57. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  59. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  60. return smalltalk.withContext(function($ctx1) {
  61. var $1,$2;
  62. classBuilder=_st($ClassBuilder())._new();
  63. $ctx1.sendIdx["new"]=1;
  64. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  65. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  66. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  67. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  68. self._assert_equals_($1,true);
  69. $ctx1.sendIdx["assert:equals:"]=1;
  70. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  71. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  72. self._assert_equals_($2,true);
  73. $ctx1.sendIdx["assert:equals:"]=2;
  74. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  75. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  76. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  77. args: [],
  78. 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.",
  79. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  80. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  81. }),
  82. globals.AnnouncementSubscriptionTest);
  83. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "testOnDo",
  87. protocol: 'tests',
  88. fn: function (){
  89. var self=this;
  90. var counter,announcer;
  91. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  92. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  93. return smalltalk.withContext(function($ctx1) {
  94. var $1,$2;
  95. counter=(0);
  96. announcer=_st($Announcer())._new();
  97. $ctx1.sendIdx["new"]=1;
  98. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. counter=_st(counter).__plus((1));
  101. return counter;
  102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  103. $1=announcer;
  104. $2=_st($SystemAnnouncement())._new();
  105. $ctx1.sendIdx["new"]=2;
  106. _st($1)._announce_($2);
  107. $ctx1.sendIdx["announce:"]=1;
  108. self._assert_equals_(counter,(1));
  109. $ctx1.sendIdx["assert:equals:"]=1;
  110. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  111. self._assert_equals_(counter,(2));
  112. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  113. args: [],
  114. 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.",
  115. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  116. referencedClasses: ["Announcer", "SystemAnnouncement"]
  117. }),
  118. globals.AnnouncerTest);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "testOnDoFor",
  122. protocol: 'tests',
  123. fn: function (){
  124. var self=this;
  125. var counter,announcer;
  126. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  127. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1,$2,$3,$4;
  130. counter=(0);
  131. announcer=_st($Announcer())._new();
  132. $ctx1.sendIdx["new"]=1;
  133. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  134. return smalltalk.withContext(function($ctx2) {
  135. counter=_st(counter).__plus((1));
  136. return counter;
  137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  138. $1=announcer;
  139. $2=_st($SystemAnnouncement())._new();
  140. $ctx1.sendIdx["new"]=2;
  141. _st($1)._announce_($2);
  142. $ctx1.sendIdx["announce:"]=1;
  143. self._assert_equals_(counter,(1));
  144. $ctx1.sendIdx["assert:equals:"]=1;
  145. $3=announcer;
  146. $4=_st($SystemAnnouncement())._new();
  147. $ctx1.sendIdx["new"]=3;
  148. _st($3)._announce_($4);
  149. $ctx1.sendIdx["announce:"]=2;
  150. self._assert_equals_(counter,(2));
  151. $ctx1.sendIdx["assert:equals:"]=2;
  152. _st(announcer)._unsubscribe_(self);
  153. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  154. self._assert_equals_(counter,(2));
  155. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  156. args: [],
  157. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  158. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  159. referencedClasses: ["Announcer", "SystemAnnouncement"]
  160. }),
  161. globals.AnnouncerTest);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "testOnDoOnce",
  165. protocol: 'tests',
  166. fn: function (){
  167. var self=this;
  168. var counter,announcer;
  169. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  170. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  171. return smalltalk.withContext(function($ctx1) {
  172. var $1,$2;
  173. counter=(0);
  174. announcer=_st($Announcer())._new();
  175. $ctx1.sendIdx["new"]=1;
  176. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  177. return smalltalk.withContext(function($ctx2) {
  178. counter=_st(counter).__plus((1));
  179. return counter;
  180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  181. $1=announcer;
  182. $2=_st($SystemAnnouncement())._new();
  183. $ctx1.sendIdx["new"]=2;
  184. _st($1)._announce_($2);
  185. $ctx1.sendIdx["announce:"]=1;
  186. self._assert_equals_(counter,(1));
  187. $ctx1.sendIdx["assert:equals:"]=1;
  188. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  189. self._assert_equals_(counter,(1));
  190. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  191. args: [],
  192. 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.",
  193. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  194. referencedClasses: ["Announcer", "SystemAnnouncement"]
  195. }),
  196. globals.AnnouncerTest);
  197. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCanClearInterval",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  205. return smalltalk.withContext(function($ctx1) {
  206. self._shouldnt_raise_((function(){
  207. return smalltalk.withContext(function($ctx2) {
  208. return _st(_st((function(){
  209. return smalltalk.withContext(function($ctx3) {
  210. return _st(_st($Error())._new())._signal();
  211. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  213. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  214. args: [],
  215. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  216. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  217. referencedClasses: ["Error"]
  218. }),
  219. globals.BlockClosureTest);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "testCanClearTimeout",
  223. protocol: 'tests',
  224. fn: function (){
  225. var self=this;
  226. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  227. return smalltalk.withContext(function($ctx1) {
  228. self._shouldnt_raise_((function(){
  229. return smalltalk.withContext(function($ctx2) {
  230. return _st(_st((function(){
  231. return smalltalk.withContext(function($ctx3) {
  232. return _st(_st($Error())._new())._signal();
  233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  235. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  236. args: [],
  237. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  238. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  239. referencedClasses: ["Error"]
  240. }),
  241. globals.BlockClosureTest);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "testCompiledSource",
  245. protocol: 'tests',
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. self._assert_(_st(_st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. return (1).__plus((1));
  252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  253. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  254. args: [],
  255. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  256. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  257. referencedClasses: []
  258. }),
  259. globals.BlockClosureTest);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "testCurrySelf",
  263. protocol: 'tests',
  264. fn: function (){
  265. var self=this;
  266. var curriedMethod,array;
  267. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  268. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  269. return smalltalk.withContext(function($ctx1) {
  270. curriedMethod=_st(_st((function(selfarg,x){
  271. return smalltalk.withContext(function($ctx2) {
  272. return _st(selfarg)._at_(x);
  273. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  274. array=[(3), (1), (4)];
  275. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  276. _st((function(){
  277. return smalltalk.withContext(function($ctx2) {
  278. return self._assert_equals_(_st(array)._foo_((2)),(1));
  279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  280. return smalltalk.withContext(function($ctx2) {
  281. return _st($Array())._removeCompiledMethod_(curriedMethod);
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  284. args: [],
  285. 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 ]",
  286. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  287. referencedClasses: ["ClassBuilder", "Array"]
  288. }),
  289. globals.BlockClosureTest);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "testEnsure",
  293. protocol: 'tests',
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. self._assert_equals_(_st((function(){
  298. return (3);
  299. }))._ensure_((function(){
  300. return (4);
  301. })),(3));
  302. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  303. args: [],
  304. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  305. messageSends: ["assert:equals:", "ensure:"],
  306. referencedClasses: []
  307. }),
  308. globals.BlockClosureTest);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "testEnsureRaises",
  312. protocol: 'tests',
  313. fn: function (){
  314. var self=this;
  315. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  316. return smalltalk.withContext(function($ctx1) {
  317. self._should_raise_((function(){
  318. return smalltalk.withContext(function($ctx2) {
  319. return _st((function(){
  320. return smalltalk.withContext(function($ctx3) {
  321. return _st(_st($Error())._new())._signal();
  322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  323. return true;
  324. }));
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  326. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  327. args: [],
  328. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  329. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  330. referencedClasses: ["Error"]
  331. }),
  332. globals.BlockClosureTest);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "testExceptionSemantics",
  336. protocol: 'tests',
  337. fn: function (){
  338. var self=this;
  339. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  340. return smalltalk.withContext(function($ctx1) {
  341. self._timeout_((100));
  342. _st(self._async_((function(){
  343. return smalltalk.withContext(function($ctx2) {
  344. return _st((function(){
  345. return smalltalk.withContext(function($ctx3) {
  346. self._assert_(true);
  347. _st($Error())._signal();
  348. self._deny_(true);
  349. return self._finished();
  350. $ctx3.sendIdx["finished"]=1;
  351. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  352. return smalltalk.withContext(function($ctx3) {
  353. return self._finished();
  354. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  357. args: [],
  358. 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",
  359. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  360. referencedClasses: ["Error"]
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testNewWithValues",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. return smalltalk.withContext(function($ctx1) {
  370. function TestConstructor(arg1, arg2, arg3) {}
  371. TestConstructor.prototype.name = 'theTestPrototype';
  372. var wrappedConstructor = _st(TestConstructor);
  373. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  374. self._assert_(result instanceof TestConstructor);
  375. self._assert_equals_(result.name, 'theTestPrototype');
  376. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  377. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  378. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  379. args: [],
  380. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  381. messageSends: [],
  382. referencedClasses: []
  383. }),
  384. globals.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testNumArgs",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st((function(){
  394. }))._numArgs();
  395. $ctx1.sendIdx["numArgs"]=1;
  396. self._assert_equals_($1,(0));
  397. $ctx1.sendIdx["assert:equals:"]=1;
  398. self._assert_equals_(_st((function(a,b){
  399. }))._numArgs(),(2));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  401. args: [],
  402. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  403. messageSends: ["assert:equals:", "numArgs"],
  404. referencedClasses: []
  405. }),
  406. globals.BlockClosureTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testOnDo",
  410. protocol: 'tests',
  411. fn: function (){
  412. var self=this;
  413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  414. return smalltalk.withContext(function($ctx1) {
  415. self._assert_(_st((function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. return _st(_st($Error())._new())._signal();
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  419. return true;
  420. })));
  421. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  422. args: [],
  423. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  424. messageSends: ["assert:", "on:do:", "signal", "new"],
  425. referencedClasses: ["Error"]
  426. }),
  427. globals.BlockClosureTest);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testValue",
  431. protocol: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st((function(){
  437. return smalltalk.withContext(function($ctx2) {
  438. return (1).__plus((1));
  439. $ctx2.sendIdx["+"]=1;
  440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  441. $ctx1.sendIdx["value"]=1;
  442. self._assert_equals_($1,(2));
  443. $ctx1.sendIdx["assert:equals:"]=1;
  444. self._assert_equals_(_st((function(x){
  445. return smalltalk.withContext(function($ctx2) {
  446. return _st(x).__plus((1));
  447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  448. $ctx1.sendIdx["assert:equals:"]=2;
  449. self._assert_equals_(_st((function(x,y){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st(x).__star(y);
  452. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  453. $ctx1.sendIdx["assert:equals:"]=3;
  454. self._assert_equals_(_st((function(a,b,c){
  455. return (1);
  456. }))._value(),(1));
  457. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  458. args: [],
  459. 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",
  460. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  461. referencedClasses: []
  462. }),
  463. globals.BlockClosureTest);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "testValueWithPossibleArguments",
  467. protocol: 'tests',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) {
  471. var $1,$2;
  472. $1=_st((function(){
  473. return (1);
  474. }))._valueWithPossibleArguments_([(3), (4)]);
  475. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  476. self._assert_equals_($1,(1));
  477. $ctx1.sendIdx["assert:equals:"]=1;
  478. $2=_st((function(a){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st(a).__plus((4));
  481. $ctx2.sendIdx["+"]=1;
  482. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  483. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  484. self._assert_equals_($2,(7));
  485. $ctx1.sendIdx["assert:equals:"]=2;
  486. self._assert_equals_(_st((function(a,b){
  487. return smalltalk.withContext(function($ctx2) {
  488. return _st(a).__plus(b);
  489. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  490. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  491. args: [],
  492. 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.",
  493. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  494. referencedClasses: []
  495. }),
  496. globals.BlockClosureTest);
  497. smalltalk.addMethod(
  498. smalltalk.method({
  499. selector: "testWhileFalse",
  500. protocol: 'tests',
  501. fn: function (){
  502. var self=this;
  503. var i;
  504. return smalltalk.withContext(function($ctx1) {
  505. i=(0);
  506. _st((function(){
  507. return smalltalk.withContext(function($ctx2) {
  508. return _st(i).__gt((5));
  509. $ctx2.sendIdx[">"]=1;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  511. return smalltalk.withContext(function($ctx2) {
  512. i=_st(i).__plus((1));
  513. $ctx2.sendIdx["+"]=1;
  514. return i;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  516. self._assert_equals_(i,(6));
  517. $ctx1.sendIdx["assert:equals:"]=1;
  518. i=(0);
  519. _st((function(){
  520. return smalltalk.withContext(function($ctx2) {
  521. i=_st(i).__plus((1));
  522. i;
  523. return _st(i).__gt((5));
  524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  525. self._assert_equals_(i,(6));
  526. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  527. args: [],
  528. 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",
  529. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  530. referencedClasses: []
  531. }),
  532. globals.BlockClosureTest);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "testWhileTrue",
  536. protocol: 'tests',
  537. fn: function (){
  538. var self=this;
  539. var i;
  540. return smalltalk.withContext(function($ctx1) {
  541. i=(0);
  542. _st((function(){
  543. return smalltalk.withContext(function($ctx2) {
  544. return _st(i).__lt((5));
  545. $ctx2.sendIdx["<"]=1;
  546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  547. return smalltalk.withContext(function($ctx2) {
  548. i=_st(i).__plus((1));
  549. $ctx2.sendIdx["+"]=1;
  550. return i;
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  552. self._assert_equals_(i,(5));
  553. $ctx1.sendIdx["assert:equals:"]=1;
  554. i=(0);
  555. _st((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. i=_st(i).__plus((1));
  558. i;
  559. return _st(i).__lt((5));
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  561. self._assert_equals_(i,(5));
  562. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  563. args: [],
  564. 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",
  565. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  566. referencedClasses: []
  567. }),
  568. globals.BlockClosureTest);
  569. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  570. smalltalk.addMethod(
  571. smalltalk.method({
  572. selector: "testEquality",
  573. protocol: 'tests',
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  578. $1=(0).__eq(false);
  579. $ctx1.sendIdx["="]=1;
  580. self._deny_($1);
  581. $ctx1.sendIdx["deny:"]=1;
  582. $2=false.__eq((0));
  583. $ctx1.sendIdx["="]=2;
  584. self._deny_($2);
  585. $ctx1.sendIdx["deny:"]=2;
  586. $3="".__eq(false);
  587. $ctx1.sendIdx["="]=3;
  588. self._deny_($3);
  589. $ctx1.sendIdx["deny:"]=3;
  590. $4=false.__eq("");
  591. $ctx1.sendIdx["="]=4;
  592. self._deny_($4);
  593. $ctx1.sendIdx["deny:"]=4;
  594. $5=true.__eq(true);
  595. $ctx1.sendIdx["="]=5;
  596. self._assert_($5);
  597. $ctx1.sendIdx["assert:"]=1;
  598. $6=false.__eq(true);
  599. $ctx1.sendIdx["="]=6;
  600. self._deny_($6);
  601. $ctx1.sendIdx["deny:"]=5;
  602. $7=true.__eq(false);
  603. $ctx1.sendIdx["="]=7;
  604. self._deny_($7);
  605. $8=false.__eq(false);
  606. $ctx1.sendIdx["="]=8;
  607. self._assert_($8);
  608. $ctx1.sendIdx["assert:"]=2;
  609. $10=true._yourself();
  610. $ctx1.sendIdx["yourself"]=1;
  611. $9=_st($10).__eq(true);
  612. $ctx1.sendIdx["="]=9;
  613. self._assert_($9);
  614. $ctx1.sendIdx["assert:"]=3;
  615. $12=true._yourself();
  616. $ctx1.sendIdx["yourself"]=2;
  617. $11=_st($12).__eq(true._yourself());
  618. self._assert_($11);
  619. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  620. args: [],
  621. 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)",
  622. messageSends: ["deny:", "=", "assert:", "yourself"],
  623. referencedClasses: []
  624. }),
  625. globals.BooleanTest);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "testIdentity",
  629. protocol: 'tests',
  630. fn: function (){
  631. var self=this;
  632. return smalltalk.withContext(function($ctx1) {
  633. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  634. $1=(0).__eq_eq(false);
  635. $ctx1.sendIdx["=="]=1;
  636. self._deny_($1);
  637. $ctx1.sendIdx["deny:"]=1;
  638. $2=false.__eq_eq((0));
  639. $ctx1.sendIdx["=="]=2;
  640. self._deny_($2);
  641. $ctx1.sendIdx["deny:"]=2;
  642. $3="".__eq_eq(false);
  643. $ctx1.sendIdx["=="]=3;
  644. self._deny_($3);
  645. $ctx1.sendIdx["deny:"]=3;
  646. $4=false.__eq_eq("");
  647. $ctx1.sendIdx["=="]=4;
  648. self._deny_($4);
  649. $ctx1.sendIdx["deny:"]=4;
  650. $5=true.__eq_eq(true);
  651. $ctx1.sendIdx["=="]=5;
  652. self._assert_($5);
  653. $ctx1.sendIdx["assert:"]=1;
  654. $6=false.__eq_eq(true);
  655. $ctx1.sendIdx["=="]=6;
  656. self._deny_($6);
  657. $ctx1.sendIdx["deny:"]=5;
  658. $7=true.__eq_eq(false);
  659. $ctx1.sendIdx["=="]=7;
  660. self._deny_($7);
  661. $8=false.__eq_eq(false);
  662. $ctx1.sendIdx["=="]=8;
  663. self._assert_($8);
  664. $ctx1.sendIdx["assert:"]=2;
  665. $10=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. $9=_st($10).__eq_eq(true);
  668. $ctx1.sendIdx["=="]=9;
  669. self._assert_($9);
  670. $ctx1.sendIdx["assert:"]=3;
  671. $12=true._yourself();
  672. $ctx1.sendIdx["yourself"]=2;
  673. $11=_st($12).__eq_eq(true._yourself());
  674. self._assert_($11);
  675. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  676. args: [],
  677. 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",
  678. messageSends: ["deny:", "==", "assert:", "yourself"],
  679. referencedClasses: []
  680. }),
  681. globals.BooleanTest);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "testIfTrueIfFalse",
  685. protocol: 'tests',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1,$2,$3,$4,$5,$6,$7,$8;
  690. if(smalltalk.assert(true)){
  691. $1="alternative block";
  692. };
  693. self._assert_equals_($1,"alternative block");
  694. $ctx1.sendIdx["assert:equals:"]=1;
  695. if(! smalltalk.assert(true)){
  696. $2="alternative block";
  697. };
  698. self._assert_equals_($2,nil);
  699. $ctx1.sendIdx["assert:equals:"]=2;
  700. if(smalltalk.assert(false)){
  701. $3="alternative block";
  702. };
  703. self._assert_equals_($3,nil);
  704. $ctx1.sendIdx["assert:equals:"]=3;
  705. if(! smalltalk.assert(false)){
  706. $4="alternative block";
  707. };
  708. self._assert_equals_($4,"alternative block");
  709. $ctx1.sendIdx["assert:equals:"]=4;
  710. if(smalltalk.assert(false)){
  711. $5="alternative block";
  712. } else {
  713. $5="alternative block2";
  714. };
  715. self._assert_equals_($5,"alternative block2");
  716. $ctx1.sendIdx["assert:equals:"]=5;
  717. if(smalltalk.assert(false)){
  718. $6="alternative block2";
  719. } else {
  720. $6="alternative block";
  721. };
  722. self._assert_equals_($6,"alternative block");
  723. $ctx1.sendIdx["assert:equals:"]=6;
  724. if(smalltalk.assert(true)){
  725. $7="alternative block";
  726. } else {
  727. $7="alternative block2";
  728. };
  729. self._assert_equals_($7,"alternative block");
  730. $ctx1.sendIdx["assert:equals:"]=7;
  731. if(smalltalk.assert(true)){
  732. $8="alternative block2";
  733. } else {
  734. $8="alternative block";
  735. };
  736. self._assert_equals_($8,"alternative block2");
  737. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  738. args: [],
  739. 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'.",
  740. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  741. referencedClasses: []
  742. }),
  743. globals.BooleanTest);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "testIfTrueIfFalseWithBoxing",
  747. protocol: 'tests',
  748. fn: function (){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) {
  751. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  752. $2=true._yourself();
  753. $ctx1.sendIdx["yourself"]=1;
  754. if(smalltalk.assert($2)){
  755. $1="alternative block";
  756. };
  757. self._assert_equals_($1,"alternative block");
  758. $ctx1.sendIdx["assert:equals:"]=1;
  759. $4=true._yourself();
  760. $ctx1.sendIdx["yourself"]=2;
  761. if(! smalltalk.assert($4)){
  762. $3="alternative block";
  763. };
  764. self._assert_equals_($3,nil);
  765. $ctx1.sendIdx["assert:equals:"]=2;
  766. $6=false._yourself();
  767. $ctx1.sendIdx["yourself"]=3;
  768. if(smalltalk.assert($6)){
  769. $5="alternative block";
  770. };
  771. self._assert_equals_($5,nil);
  772. $ctx1.sendIdx["assert:equals:"]=3;
  773. $8=false._yourself();
  774. $ctx1.sendIdx["yourself"]=4;
  775. if(! smalltalk.assert($8)){
  776. $7="alternative block";
  777. };
  778. self._assert_equals_($7,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=4;
  780. $10=false._yourself();
  781. $ctx1.sendIdx["yourself"]=5;
  782. if(smalltalk.assert($10)){
  783. $9="alternative block";
  784. } else {
  785. $9="alternative block2";
  786. };
  787. self._assert_equals_($9,"alternative block2");
  788. $ctx1.sendIdx["assert:equals:"]=5;
  789. $12=false._yourself();
  790. $ctx1.sendIdx["yourself"]=6;
  791. if(smalltalk.assert($12)){
  792. $11="alternative block2";
  793. } else {
  794. $11="alternative block";
  795. };
  796. self._assert_equals_($11,"alternative block");
  797. $ctx1.sendIdx["assert:equals:"]=6;
  798. $14=true._yourself();
  799. $ctx1.sendIdx["yourself"]=7;
  800. if(smalltalk.assert($14)){
  801. $13="alternative block";
  802. } else {
  803. $13="alternative block2";
  804. };
  805. self._assert_equals_($13,"alternative block");
  806. $ctx1.sendIdx["assert:equals:"]=7;
  807. $16=true._yourself();
  808. if(smalltalk.assert($16)){
  809. $15="alternative block2";
  810. } else {
  811. $15="alternative block";
  812. };
  813. self._assert_equals_($15,"alternative block2");
  814. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  815. args: [],
  816. 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'.",
  817. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  818. referencedClasses: []
  819. }),
  820. globals.BooleanTest);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "testLogic",
  824. protocol: 'tests',
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. 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;
  829. $1=true.__and(true);
  830. $ctx1.sendIdx["&"]=1;
  831. self._assert_($1);
  832. $ctx1.sendIdx["assert:"]=1;
  833. $2=true.__and(false);
  834. $ctx1.sendIdx["&"]=2;
  835. self._deny_($2);
  836. $ctx1.sendIdx["deny:"]=1;
  837. $3=false.__and(true);
  838. $ctx1.sendIdx["&"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false.__and(false);
  842. $ctx1.sendIdx["&"]=4;
  843. $4=self._deny_($5);
  844. $ctx1.sendIdx["deny:"]=3;
  845. $6=true.__or(true);
  846. $ctx1.sendIdx["|"]=1;
  847. self._assert_($6);
  848. $ctx1.sendIdx["assert:"]=2;
  849. $7=true.__or(false);
  850. $ctx1.sendIdx["|"]=2;
  851. self._assert_($7);
  852. $ctx1.sendIdx["assert:"]=3;
  853. $8=false.__or(true);
  854. $ctx1.sendIdx["|"]=3;
  855. self._assert_($8);
  856. $ctx1.sendIdx["assert:"]=4;
  857. $10=false.__or(false);
  858. $ctx1.sendIdx["|"]=4;
  859. $9=self._deny_($10);
  860. $ctx1.sendIdx["deny:"]=4;
  861. $12=(1).__gt((0));
  862. $ctx1.sendIdx[">"]=1;
  863. $11=true.__and($12);
  864. $ctx1.sendIdx["&"]=5;
  865. self._assert_($11);
  866. $ctx1.sendIdx["assert:"]=5;
  867. $14=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=2;
  869. $13=_st($14).__and(false);
  870. $ctx1.sendIdx["&"]=6;
  871. self._deny_($13);
  872. $ctx1.sendIdx["deny:"]=5;
  873. $17=(1).__gt((0));
  874. $ctx1.sendIdx[">"]=3;
  875. $18=(1).__gt((2));
  876. $ctx1.sendIdx[">"]=4;
  877. $16=_st($17).__and($18);
  878. $15=self._deny_($16);
  879. $20=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=5;
  881. $19=false.__or($20);
  882. $ctx1.sendIdx["|"]=5;
  883. self._assert_($19);
  884. $ctx1.sendIdx["assert:"]=6;
  885. $22=(1).__gt((0));
  886. $ctx1.sendIdx[">"]=6;
  887. $21=_st($22).__or(false);
  888. $ctx1.sendIdx["|"]=6;
  889. self._assert_($21);
  890. $ctx1.sendIdx["assert:"]=7;
  891. $25=(1).__gt((0));
  892. $ctx1.sendIdx[">"]=7;
  893. $24=_st($25).__or((1).__gt((2)));
  894. $23=self._assert_($24);
  895. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  896. args: [],
  897. 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))",
  898. messageSends: ["assert:", "&", "deny:", "|", ">"],
  899. referencedClasses: []
  900. }),
  901. globals.BooleanTest);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "testLogicKeywords",
  905. protocol: 'tests',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  910. $1=true._and_((function(){
  911. return true;
  912. }));
  913. $ctx1.sendIdx["and:"]=1;
  914. self._assert_($1);
  915. $ctx1.sendIdx["assert:"]=1;
  916. $2=true._and_((function(){
  917. return false;
  918. }));
  919. $ctx1.sendIdx["and:"]=2;
  920. self._deny_($2);
  921. $ctx1.sendIdx["deny:"]=1;
  922. $3=false._and_((function(){
  923. return true;
  924. }));
  925. $ctx1.sendIdx["and:"]=3;
  926. self._deny_($3);
  927. $ctx1.sendIdx["deny:"]=2;
  928. $5=false._and_((function(){
  929. return false;
  930. }));
  931. $ctx1.sendIdx["and:"]=4;
  932. $4=self._deny_($5);
  933. $ctx1.sendIdx["deny:"]=3;
  934. $6=true._or_((function(){
  935. return true;
  936. }));
  937. $ctx1.sendIdx["or:"]=1;
  938. self._assert_($6);
  939. $ctx1.sendIdx["assert:"]=2;
  940. $7=true._or_((function(){
  941. return false;
  942. }));
  943. $ctx1.sendIdx["or:"]=2;
  944. self._assert_($7);
  945. $ctx1.sendIdx["assert:"]=3;
  946. $8=false._or_((function(){
  947. return true;
  948. }));
  949. $ctx1.sendIdx["or:"]=3;
  950. self._assert_($8);
  951. $ctx1.sendIdx["assert:"]=4;
  952. $10=false._or_((function(){
  953. return false;
  954. }));
  955. $ctx1.sendIdx["or:"]=4;
  956. $9=self._deny_($10);
  957. $ctx1.sendIdx["deny:"]=4;
  958. $11=true._and_((function(){
  959. return smalltalk.withContext(function($ctx2) {
  960. return (1).__gt((0));
  961. $ctx2.sendIdx[">"]=1;
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  963. $ctx1.sendIdx["and:"]=5;
  964. self._assert_($11);
  965. $ctx1.sendIdx["assert:"]=5;
  966. $13=(1).__gt((0));
  967. $ctx1.sendIdx[">"]=2;
  968. $12=_st($13)._and_((function(){
  969. return false;
  970. }));
  971. $ctx1.sendIdx["and:"]=6;
  972. self._deny_($12);
  973. $ctx1.sendIdx["deny:"]=5;
  974. $16=(1).__gt((0));
  975. $ctx1.sendIdx[">"]=3;
  976. $15=_st($16)._and_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. return (1).__gt((2));
  979. $ctx2.sendIdx[">"]=4;
  980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  981. $14=self._deny_($15);
  982. $17=false._or_((function(){
  983. return smalltalk.withContext(function($ctx2) {
  984. return (1).__gt((0));
  985. $ctx2.sendIdx[">"]=5;
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  987. $ctx1.sendIdx["or:"]=5;
  988. self._assert_($17);
  989. $ctx1.sendIdx["assert:"]=6;
  990. $19=(1).__gt((0));
  991. $ctx1.sendIdx[">"]=6;
  992. $18=_st($19)._or_((function(){
  993. return false;
  994. }));
  995. $ctx1.sendIdx["or:"]=6;
  996. self._assert_($18);
  997. $ctx1.sendIdx["assert:"]=7;
  998. $22=(1).__gt((0));
  999. $ctx1.sendIdx[">"]=7;
  1000. $21=_st($22)._or_((function(){
  1001. return smalltalk.withContext(function($ctx2) {
  1002. return (1).__gt((2));
  1003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  1004. $20=self._assert_($21);
  1005. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  1006. args: [],
  1007. 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 ])",
  1008. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  1009. referencedClasses: []
  1010. }),
  1011. globals.BooleanTest);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "testNonBooleanError",
  1015. protocol: 'tests',
  1016. fn: function (){
  1017. var self=this;
  1018. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1019. return smalltalk.withContext(function($ctx1) {
  1020. self._should_raise_((function(){
  1021. return smalltalk.withContext(function($ctx2) {
  1022. if(smalltalk.assert("")){
  1023. } else {
  1024. };
  1025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1026. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1027. args: [],
  1028. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1029. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1030. referencedClasses: ["NonBooleanReceiver"]
  1031. }),
  1032. globals.BooleanTest);
  1033. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1034. smalltalk.addMethod(
  1035. smalltalk.method({
  1036. selector: "setUp",
  1037. protocol: 'running',
  1038. fn: function (){
  1039. var self=this;
  1040. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1041. return smalltalk.withContext(function($ctx1) {
  1042. self["@builder"]=_st($ClassBuilder())._new();
  1043. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1044. args: [],
  1045. source: "setUp\x0a\x09builder := ClassBuilder new",
  1046. messageSends: ["new"],
  1047. referencedClasses: ["ClassBuilder"]
  1048. }),
  1049. globals.ClassBuilderTest);
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "tearDown",
  1053. protocol: 'running',
  1054. fn: function (){
  1055. var self=this;
  1056. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1,$receiver;
  1059. $1=self["@theClass"];
  1060. if(($receiver = $1) == null || $receiver.isNil){
  1061. $1;
  1062. } else {
  1063. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1064. self["@theClass"]=nil;
  1065. self["@theClass"];
  1066. };
  1067. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1068. args: [],
  1069. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1070. messageSends: ["ifNotNil:", "removeClass:"],
  1071. referencedClasses: ["Smalltalk"]
  1072. }),
  1073. globals.ClassBuilderTest);
  1074. smalltalk.addMethod(
  1075. smalltalk.method({
  1076. selector: "testClassCopy",
  1077. protocol: 'tests',
  1078. fn: function (){
  1079. var self=this;
  1080. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1081. return smalltalk.withContext(function($ctx1) {
  1082. var $2,$1,$4,$3,$6,$5,$8,$7;
  1083. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1084. $2=_st(self["@theClass"])._superclass();
  1085. $ctx1.sendIdx["superclass"]=1;
  1086. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1087. $ctx1.sendIdx["=="]=1;
  1088. self._assert_($1);
  1089. $ctx1.sendIdx["assert:"]=1;
  1090. $4=_st(self["@theClass"])._instanceVariableNames();
  1091. $ctx1.sendIdx["instanceVariableNames"]=1;
  1092. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1093. $ctx1.sendIdx["=="]=2;
  1094. self._assert_($3);
  1095. $ctx1.sendIdx["assert:"]=2;
  1096. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1097. $ctx1.sendIdx["assert:equals:"]=1;
  1098. $6=_st(self["@theClass"])._package();
  1099. $ctx1.sendIdx["package"]=1;
  1100. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1101. self._assert_($5);
  1102. $8=_st(self["@theClass"])._methodDictionary();
  1103. $ctx1.sendIdx["methodDictionary"]=1;
  1104. $7=_st($8)._keys();
  1105. $ctx1.sendIdx["keys"]=1;
  1106. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1107. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1108. args: [],
  1109. 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",
  1110. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1111. referencedClasses: ["ObjectMock"]
  1112. }),
  1113. globals.ClassBuilderTest);
  1114. smalltalk.addMethod(
  1115. smalltalk.method({
  1116. selector: "testClassMigration",
  1117. protocol: 'tests',
  1118. fn: function (){
  1119. var self=this;
  1120. var instance,oldClass;
  1121. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1122. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1123. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1126. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1127. $2=_st($Smalltalk())._globals();
  1128. $ctx1.sendIdx["globals"]=1;
  1129. $1=_st($2)._at_("ObjectMock2");
  1130. $ctx1.sendIdx["at:"]=1;
  1131. instance=_st($1)._new();
  1132. $4=_st($Smalltalk())._globals();
  1133. $ctx1.sendIdx["globals"]=2;
  1134. $3=_st($4)._at_("ObjectMock2");
  1135. $ctx1.sendIdx["at:"]=2;
  1136. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1137. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1138. $ctx1.sendIdx["=="]=1;
  1139. self._deny_($5);
  1140. $ctx1.sendIdx["deny:"]=1;
  1141. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1142. $ctx1.sendIdx["=="]=2;
  1143. self._assert_($6);
  1144. $ctx1.sendIdx["assert:"]=1;
  1145. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1146. $ctx1.sendIdx["assert:"]=2;
  1147. $7=_st($ObjectMock2())._selectors();
  1148. $ctx1.sendIdx["selectors"]=1;
  1149. self._assert_equals_($7,_st(oldClass)._selectors());
  1150. $ctx1.sendIdx["assert:equals:"]=1;
  1151. $8=_st($ObjectMock2())._comment();
  1152. $ctx1.sendIdx["comment"]=1;
  1153. self._assert_equals_($8,_st(oldClass)._comment());
  1154. $ctx1.sendIdx["assert:equals:"]=2;
  1155. $9=_st(_st($ObjectMock2())._package())._name();
  1156. $ctx1.sendIdx["name"]=1;
  1157. self._assert_equals_($9,"Kernel-Tests");
  1158. $11=_st(instance)._class();
  1159. $ctx1.sendIdx["class"]=1;
  1160. $10=_st($11).__eq_eq($ObjectMock2());
  1161. self._deny_($10);
  1162. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1163. _st($Smalltalk())._removeClass_($ObjectMock2());
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1165. args: [],
  1166. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals 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 globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1167. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1169. }),
  1170. globals.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testClassMigrationWithClassInstanceVariables",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1178. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1183. $1=_st($ObjectMock2())._class();
  1184. $ctx1.sendIdx["class"]=1;
  1185. _st($1)._instanceVariableNames_("foo bar");
  1186. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1187. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1188. _st($Smalltalk())._removeClass_($ObjectMock2());
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1190. args: [],
  1191. 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 globals 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 removeClass: ObjectMock2",
  1192. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1193. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1194. }),
  1195. globals.ClassBuilderTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "testClassMigrationWithSubclasses",
  1199. protocol: 'tests',
  1200. fn: function (){
  1201. var self=this;
  1202. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1203. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1204. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1205. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1206. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $2,$1,$4,$3;
  1209. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1210. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1211. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1212. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1213. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1214. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1215. $2=_st($ObjectMock())._subclasses();
  1216. $ctx1.sendIdx["subclasses"]=1;
  1217. $1=_st($2)._includes_($ObjectMock2());
  1218. $ctx1.sendIdx["includes:"]=1;
  1219. self._assert_($1);
  1220. $ctx1.sendIdx["assert:"]=1;
  1221. $4=_st($ObjectMock2())._subclasses();
  1222. $ctx1.sendIdx["subclasses"]=2;
  1223. $3=_st($4)._includes_($ObjectMock3());
  1224. $ctx1.sendIdx["includes:"]=2;
  1225. self._assert_($3);
  1226. $ctx1.sendIdx["assert:"]=2;
  1227. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1228. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st($Smalltalk())._removeClass_(each);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1233. args: [],
  1234. 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 globals 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 removeClass: each ]",
  1235. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1236. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1237. }),
  1238. globals.ClassBuilderTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "testInstanceVariableNames",
  1242. protocol: 'tests',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1248. args: [],
  1249. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1250. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.ClassBuilderTest);
  1254. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "assertSameContents:as:",
  1258. protocol: 'convenience',
  1259. fn: function (aCollection,anotherCollection){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $2,$1,$4,$3;
  1263. $2=_st(aCollection)._size();
  1264. $ctx1.sendIdx["size"]=1;
  1265. $1=_st($2).__eq(_st(anotherCollection)._size());
  1266. $ctx1.sendIdx["="]=1;
  1267. self._assert_($1);
  1268. $ctx1.sendIdx["assert:"]=1;
  1269. _st(aCollection)._do_((function(each){
  1270. return smalltalk.withContext(function($ctx2) {
  1271. $4=_st(aCollection)._occurrencesOf_(each);
  1272. $ctx2.sendIdx["occurrencesOf:"]=1;
  1273. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1274. return self._assert_($3);
  1275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1276. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1277. args: ["aCollection", "anotherCollection"],
  1278. 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)) ]",
  1279. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1280. referencedClasses: []
  1281. }),
  1282. globals.CollectionTest);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "collection",
  1286. protocol: 'fixture',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. self._subclassResponsibility();
  1291. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1292. args: [],
  1293. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1294. messageSends: ["subclassResponsibility"],
  1295. referencedClasses: []
  1296. }),
  1297. globals.CollectionTest);
  1298. smalltalk.addMethod(
  1299. smalltalk.method({
  1300. selector: "collectionClass",
  1301. protocol: 'fixture',
  1302. fn: function (){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. var $1;
  1306. $1=_st(self._class())._collectionClass();
  1307. return $1;
  1308. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1309. args: [],
  1310. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1311. messageSends: ["collectionClass", "class"],
  1312. referencedClasses: []
  1313. }),
  1314. globals.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "collectionOfPrintStrings",
  1318. protocol: 'fixture',
  1319. fn: function (){
  1320. var self=this;
  1321. return smalltalk.withContext(function($ctx1) {
  1322. self._subclassResponsibility();
  1323. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1324. args: [],
  1325. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1326. messageSends: ["subclassResponsibility"],
  1327. referencedClasses: []
  1328. }),
  1329. globals.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "collectionSize",
  1333. protocol: 'fixture',
  1334. fn: function (){
  1335. var self=this;
  1336. return smalltalk.withContext(function($ctx1) {
  1337. self._subclassResponsibility();
  1338. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1339. args: [],
  1340. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1341. messageSends: ["subclassResponsibility"],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "collectionWithDuplicates",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. self._subclassResponsibility();
  1353. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1354. args: [],
  1355. 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",
  1356. messageSends: ["subclassResponsibility"],
  1357. referencedClasses: []
  1358. }),
  1359. globals.CollectionTest);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "collectionWithNewValue",
  1363. protocol: 'fixture',
  1364. fn: function (){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. self._subclassResponsibility();
  1368. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1369. args: [],
  1370. 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",
  1371. messageSends: ["subclassResponsibility"],
  1372. referencedClasses: []
  1373. }),
  1374. globals.CollectionTest);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "isCollectionReadOnly",
  1378. protocol: 'testing',
  1379. fn: function (){
  1380. var self=this;
  1381. return false;
  1382. },
  1383. args: [],
  1384. source: "isCollectionReadOnly\x0a\x09^ false",
  1385. messageSends: [],
  1386. referencedClasses: []
  1387. }),
  1388. globals.CollectionTest);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "sampleNewValue",
  1392. protocol: 'fixture',
  1393. fn: function (){
  1394. var self=this;
  1395. return "N";
  1396. },
  1397. args: [],
  1398. 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'",
  1399. messageSends: [],
  1400. referencedClasses: []
  1401. }),
  1402. globals.CollectionTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "sampleNewValueAsCollection",
  1406. protocol: 'fixture',
  1407. fn: function (){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1414. args: [],
  1415. 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",
  1416. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1417. referencedClasses: []
  1418. }),
  1419. globals.CollectionTest);
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "testAddAll",
  1423. protocol: 'tests',
  1424. fn: function (){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. 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;
  1428. $2=self._collection();
  1429. $ctx1.sendIdx["collection"]=1;
  1430. $3=$2;
  1431. $5=self._collectionClass();
  1432. $ctx1.sendIdx["collectionClass"]=1;
  1433. $4=_st($5)._new();
  1434. $ctx1.sendIdx["new"]=1;
  1435. _st($3)._addAll_($4);
  1436. $ctx1.sendIdx["addAll:"]=1;
  1437. $6=_st($2)._yourself();
  1438. $ctx1.sendIdx["yourself"]=1;
  1439. $1=$6;
  1440. $7=self._collection();
  1441. $ctx1.sendIdx["collection"]=2;
  1442. self._assert_equals_($1,$7);
  1443. $ctx1.sendIdx["assert:equals:"]=1;
  1444. $10=self._collectionClass();
  1445. $ctx1.sendIdx["collectionClass"]=2;
  1446. $9=_st($10)._new();
  1447. $ctx1.sendIdx["new"]=2;
  1448. $11=$9;
  1449. $12=self._collection();
  1450. $ctx1.sendIdx["collection"]=3;
  1451. _st($11)._addAll_($12);
  1452. $ctx1.sendIdx["addAll:"]=2;
  1453. $13=_st($9)._yourself();
  1454. $ctx1.sendIdx["yourself"]=2;
  1455. $8=$13;
  1456. $14=self._collection();
  1457. $ctx1.sendIdx["collection"]=4;
  1458. self._assert_equals_($8,$14);
  1459. $ctx1.sendIdx["assert:equals:"]=2;
  1460. $17=self._collectionClass();
  1461. $ctx1.sendIdx["collectionClass"]=3;
  1462. $16=_st($17)._new();
  1463. $ctx1.sendIdx["new"]=3;
  1464. $18=$16;
  1465. $20=self._collectionClass();
  1466. $ctx1.sendIdx["collectionClass"]=4;
  1467. $19=_st($20)._new();
  1468. $ctx1.sendIdx["new"]=4;
  1469. _st($18)._addAll_($19);
  1470. $ctx1.sendIdx["addAll:"]=3;
  1471. $21=_st($16)._yourself();
  1472. $ctx1.sendIdx["yourself"]=3;
  1473. $15=$21;
  1474. self._assert_equals_($15,_st(self._collectionClass())._new());
  1475. $ctx1.sendIdx["assert:equals:"]=3;
  1476. $23=self._collection();
  1477. $ctx1.sendIdx["collection"]=5;
  1478. $24=$23;
  1479. $25=self._sampleNewValueAsCollection();
  1480. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1481. _st($24)._addAll_($25);
  1482. $ctx1.sendIdx["addAll:"]=4;
  1483. $26=_st($23)._yourself();
  1484. $ctx1.sendIdx["yourself"]=4;
  1485. $22=$26;
  1486. $27=self._collectionWithNewValue();
  1487. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1488. self._assert_equals_($22,$27);
  1489. $28=self._sampleNewValueAsCollection();
  1490. _st($28)._addAll_(self._collection());
  1491. $29=_st($28)._yourself();
  1492. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1493. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1494. args: [],
  1495. 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",
  1496. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1497. referencedClasses: []
  1498. }),
  1499. globals.CollectionTest);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "testAllSatisfy",
  1503. protocol: 'tests',
  1504. fn: function (){
  1505. var self=this;
  1506. var collection,anyOne;
  1507. return smalltalk.withContext(function($ctx1) {
  1508. var $1;
  1509. collection=self._collection();
  1510. anyOne=_st(collection)._anyOne();
  1511. $1=_st(collection)._allSatisfy_((function(each){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return _st(collection)._includes_(each);
  1514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1515. $ctx1.sendIdx["allSatisfy:"]=1;
  1516. self._assert_($1);
  1517. self._deny_(_st(collection)._allSatisfy_((function(each){
  1518. return smalltalk.withContext(function($ctx2) {
  1519. return _st(each).__tild_eq(anyOne);
  1520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1522. args: [],
  1523. 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 ])",
  1524. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1525. referencedClasses: []
  1526. }),
  1527. globals.CollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAnyOne",
  1531. protocol: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1535. return smalltalk.withContext(function($ctx1) {
  1536. var $2,$1;
  1537. self._should_raise_((function(){
  1538. return smalltalk.withContext(function($ctx2) {
  1539. return _st(_st(self._collectionClass())._new())._anyOne();
  1540. $ctx2.sendIdx["anyOne"]=1;
  1541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1542. $2=self._collection();
  1543. $ctx1.sendIdx["collection"]=1;
  1544. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1545. self._assert_($1);
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1547. args: [],
  1548. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1549. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1550. referencedClasses: ["Error"]
  1551. }),
  1552. globals.CollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testAnySatisfy",
  1556. protocol: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var anyOne;
  1560. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1,$3,$2;
  1563. $1=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. anyOne=_st($1)._anyOne();
  1566. $3=self._collection();
  1567. $ctx1.sendIdx["collection"]=2;
  1568. $2=_st($3)._anySatisfy_((function(each){
  1569. return smalltalk.withContext(function($ctx2) {
  1570. return _st(each).__eq(anyOne);
  1571. $ctx2.sendIdx["="]=1;
  1572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1573. $ctx1.sendIdx["anySatisfy:"]=1;
  1574. self._assert_($2);
  1575. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. return _st(each).__eq(_st($Object())._new());
  1578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1579. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1580. args: [],
  1581. 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 ])",
  1582. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1583. referencedClasses: ["Object"]
  1584. }),
  1585. globals.CollectionTest);
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "testAsArray",
  1589. protocol: 'tests',
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1598. args: [],
  1599. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1600. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.CollectionTest);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "testAsOrderedCollection",
  1607. protocol: 'tests',
  1608. fn: function (){
  1609. var self=this;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. $1=self._collection();
  1613. $ctx1.sendIdx["collection"]=1;
  1614. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1615. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1616. args: [],
  1617. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1618. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1619. referencedClasses: []
  1620. }),
  1621. globals.CollectionTest);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "testAsSet",
  1625. protocol: 'tests',
  1626. fn: function (){
  1627. var self=this;
  1628. var c,set;
  1629. return smalltalk.withContext(function($ctx1) {
  1630. c=self._collectionWithDuplicates();
  1631. set=_st(c)._asSet();
  1632. self._assert_equals_(_st(set)._size(),(5));
  1633. _st(c)._do_((function(each){
  1634. return smalltalk.withContext(function($ctx2) {
  1635. return self._assert_(_st(set)._includes_(each));
  1636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1637. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1638. args: [],
  1639. 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) ]",
  1640. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1641. referencedClasses: []
  1642. }),
  1643. globals.CollectionTest);
  1644. smalltalk.addMethod(
  1645. smalltalk.method({
  1646. selector: "testCollect",
  1647. protocol: 'tests',
  1648. fn: function (){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) {
  1651. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1652. $2=self._collection();
  1653. $ctx1.sendIdx["collection"]=1;
  1654. $1=_st($2)._collect_((function(each){
  1655. return each;
  1656. }));
  1657. $ctx1.sendIdx["collect:"]=1;
  1658. $3=self._collection();
  1659. $ctx1.sendIdx["collection"]=2;
  1660. self._assert_equals_($1,$3);
  1661. $ctx1.sendIdx["assert:equals:"]=1;
  1662. $5=self._collectionWithNewValue();
  1663. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1664. $4=_st($5)._collect_((function(each){
  1665. return each;
  1666. }));
  1667. $ctx1.sendIdx["collect:"]=2;
  1668. self._assert_equals_($4,self._collectionWithNewValue());
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $8=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=1;
  1672. $7=_st($8)._new();
  1673. $ctx1.sendIdx["new"]=1;
  1674. $6=_st($7)._collect_((function(each){
  1675. return smalltalk.withContext(function($ctx2) {
  1676. return _st(each)._printString();
  1677. $ctx2.sendIdx["printString"]=1;
  1678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1679. $ctx1.sendIdx["collect:"]=3;
  1680. self._assert_equals_($6,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $11=self._collection();
  1683. $ctx1.sendIdx["collection"]=3;
  1684. $10=_st($11)._collect_((function(){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. return self._sampleNewValue();
  1687. $ctx2.sendIdx["sampleNewValue"]=1;
  1688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1689. $ctx1.sendIdx["collect:"]=4;
  1690. $9=_st($10)._detect_((function(){
  1691. return true;
  1692. }));
  1693. self._assert_equals_($9,self._sampleNewValue());
  1694. $ctx1.sendIdx["assert:equals:"]=4;
  1695. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1696. return smalltalk.withContext(function($ctx2) {
  1697. return _st(each)._printString();
  1698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1699. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1700. args: [],
  1701. 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",
  1702. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.CollectionTest);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "testComma",
  1709. protocol: 'tests',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1714. $2=self._collection();
  1715. $ctx1.sendIdx["collection"]=1;
  1716. $4=self._collectionClass();
  1717. $ctx1.sendIdx["collectionClass"]=1;
  1718. $3=_st($4)._new();
  1719. $ctx1.sendIdx["new"]=1;
  1720. $1=_st($2).__comma($3);
  1721. $ctx1.sendIdx[","]=1;
  1722. $5=self._collection();
  1723. $ctx1.sendIdx["collection"]=2;
  1724. self._assert_equals_($1,$5);
  1725. $ctx1.sendIdx["assert:equals:"]=1;
  1726. $8=self._collectionClass();
  1727. $ctx1.sendIdx["collectionClass"]=2;
  1728. $7=_st($8)._new();
  1729. $ctx1.sendIdx["new"]=2;
  1730. $9=self._collection();
  1731. $ctx1.sendIdx["collection"]=3;
  1732. $6=_st($7).__comma($9);
  1733. $ctx1.sendIdx[","]=2;
  1734. $10=self._collection();
  1735. $ctx1.sendIdx["collection"]=4;
  1736. self._assert_equals_($6,$10);
  1737. $ctx1.sendIdx["assert:equals:"]=2;
  1738. $13=self._collectionClass();
  1739. $ctx1.sendIdx["collectionClass"]=3;
  1740. $12=_st($13)._new();
  1741. $ctx1.sendIdx["new"]=3;
  1742. $15=self._collectionClass();
  1743. $ctx1.sendIdx["collectionClass"]=4;
  1744. $14=_st($15)._new();
  1745. $ctx1.sendIdx["new"]=4;
  1746. $11=_st($12).__comma($14);
  1747. $ctx1.sendIdx[","]=3;
  1748. self._assert_equals_($11,_st(self._collectionClass())._new());
  1749. $ctx1.sendIdx["assert:equals:"]=3;
  1750. $17=self._collection();
  1751. $ctx1.sendIdx["collection"]=5;
  1752. $18=self._sampleNewValueAsCollection();
  1753. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1754. $16=_st($17).__comma($18);
  1755. $ctx1.sendIdx[","]=4;
  1756. $19=self._collectionWithNewValue();
  1757. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1758. self._assert_equals_($16,$19);
  1759. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1761. args: [],
  1762. 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",
  1763. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1764. referencedClasses: []
  1765. }),
  1766. globals.CollectionTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testDetect",
  1770. protocol: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $1,$2,$3,$4,$6,$5,$7;
  1776. self._shouldnt_raise_((function(){
  1777. return smalltalk.withContext(function($ctx2) {
  1778. $1=self._collection();
  1779. $ctx2.sendIdx["collection"]=1;
  1780. return _st($1)._detect_((function(){
  1781. return true;
  1782. }));
  1783. $ctx2.sendIdx["detect:"]=1;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1785. self._should_raise_((function(){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. $2=self._collection();
  1788. $ctx2.sendIdx["collection"]=2;
  1789. return _st($2)._detect_((function(){
  1790. return false;
  1791. }));
  1792. $ctx2.sendIdx["detect:"]=2;
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1794. $ctx1.sendIdx["should:raise:"]=1;
  1795. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1796. return true;
  1797. }));
  1798. $ctx1.sendIdx["detect:"]=3;
  1799. $4=self._sampleNewValue();
  1800. $ctx1.sendIdx["sampleNewValue"]=1;
  1801. self._assert_equals_($3,$4);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. $6=self._sampleNewValue();
  1806. $ctx2.sendIdx["sampleNewValue"]=2;
  1807. return _st(each).__eq($6);
  1808. $ctx2.sendIdx["="]=1;
  1809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:"]=4;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=3;
  1813. self._assert_equals_($5,$7);
  1814. self._should_raise_((function(){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. return _st(self._collection())._detect_((function(each){
  1817. return smalltalk.withContext(function($ctx3) {
  1818. return _st(each).__eq(self._sampleNewValue());
  1819. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1821. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1822. args: [],
  1823. 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",
  1824. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1825. referencedClasses: ["Error"]
  1826. }),
  1827. globals.CollectionTest);
  1828. smalltalk.addMethod(
  1829. smalltalk.method({
  1830. selector: "testDetectIfNone",
  1831. protocol: 'tests',
  1832. fn: function (){
  1833. var self=this;
  1834. var sentinel;
  1835. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1836. return smalltalk.withContext(function($ctx1) {
  1837. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1838. sentinel=_st($Object())._new();
  1839. $3=self._collection();
  1840. $ctx1.sendIdx["collection"]=1;
  1841. $2=_st($3)._detect_ifNone_((function(){
  1842. return true;
  1843. }),(function(){
  1844. return sentinel;
  1845. }));
  1846. $ctx1.sendIdx["detect:ifNone:"]=1;
  1847. $1=_st($2).__tild_eq(sentinel);
  1848. self._assert_($1);
  1849. $5=self._collection();
  1850. $ctx1.sendIdx["collection"]=2;
  1851. $4=_st($5)._detect_ifNone_((function(){
  1852. return false;
  1853. }),(function(){
  1854. return sentinel;
  1855. }));
  1856. $ctx1.sendIdx["detect:ifNone:"]=2;
  1857. self._assert_equals_($4,sentinel);
  1858. $ctx1.sendIdx["assert:equals:"]=1;
  1859. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1860. return true;
  1861. }),(function(){
  1862. return sentinel;
  1863. }));
  1864. $ctx1.sendIdx["detect:ifNone:"]=3;
  1865. $7=self._sampleNewValue();
  1866. $ctx1.sendIdx["sampleNewValue"]=1;
  1867. self._assert_equals_($6,$7);
  1868. $ctx1.sendIdx["assert:equals:"]=2;
  1869. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. $9=self._sampleNewValue();
  1872. $ctx2.sendIdx["sampleNewValue"]=2;
  1873. return _st(each).__eq($9);
  1874. $ctx2.sendIdx["="]=1;
  1875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1876. return sentinel;
  1877. }));
  1878. $ctx1.sendIdx["detect:ifNone:"]=4;
  1879. $10=self._sampleNewValue();
  1880. $ctx1.sendIdx["sampleNewValue"]=3;
  1881. self._assert_equals_($8,$10);
  1882. $ctx1.sendIdx["assert:equals:"]=3;
  1883. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1884. return smalltalk.withContext(function($ctx2) {
  1885. return _st(each).__eq(self._sampleNewValue());
  1886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1887. return sentinel;
  1888. })),sentinel);
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1890. args: [],
  1891. 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",
  1892. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1893. referencedClasses: ["Object"]
  1894. }),
  1895. globals.CollectionTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testDo",
  1899. protocol: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. var newCollection;
  1903. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1904. return smalltalk.withContext(function($ctx1) {
  1905. var $1,$2;
  1906. newCollection=_st($OrderedCollection())._new();
  1907. $ctx1.sendIdx["new"]=1;
  1908. $1=self._collection();
  1909. $ctx1.sendIdx["collection"]=1;
  1910. _st($1)._do_((function(each){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return _st(newCollection)._add_(each);
  1913. $ctx2.sendIdx["add:"]=1;
  1914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1915. $ctx1.sendIdx["do:"]=1;
  1916. self._assertSameContents_as_(self._collection(),newCollection);
  1917. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1918. newCollection=_st($OrderedCollection())._new();
  1919. $2=self._collectionWithDuplicates();
  1920. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1921. _st($2)._do_((function(each){
  1922. return smalltalk.withContext(function($ctx2) {
  1923. return _st(newCollection)._add_(each);
  1924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1925. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1926. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1927. args: [],
  1928. 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",
  1929. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1930. referencedClasses: ["OrderedCollection"]
  1931. }),
  1932. globals.CollectionTest);
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "testIfEmptyFamily",
  1936. protocol: 'tests',
  1937. fn: function (){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  1941. $3=self._collectionClass();
  1942. $ctx1.sendIdx["collectionClass"]=1;
  1943. $2=_st($3)._new();
  1944. $ctx1.sendIdx["new"]=1;
  1945. $1=_st($2)._ifEmpty_((function(){
  1946. return (42);
  1947. }));
  1948. $ctx1.sendIdx["ifEmpty:"]=1;
  1949. self._assert_equals_($1,(42));
  1950. $ctx1.sendIdx["assert:equals:"]=1;
  1951. $5=self._collection();
  1952. $ctx1.sendIdx["collection"]=1;
  1953. $4=_st($5)._ifEmpty_((function(){
  1954. return (42);
  1955. }));
  1956. $6=self._collection();
  1957. $ctx1.sendIdx["collection"]=2;
  1958. self._assert_equals_($4,$6);
  1959. $ctx1.sendIdx["assert:equals:"]=2;
  1960. $9=self._collectionClass();
  1961. $ctx1.sendIdx["collectionClass"]=2;
  1962. $8=_st($9)._new();
  1963. $ctx1.sendIdx["new"]=2;
  1964. $7=_st($8)._ifNotEmpty_((function(){
  1965. return (42);
  1966. }));
  1967. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1968. $11=self._collectionClass();
  1969. $ctx1.sendIdx["collectionClass"]=3;
  1970. $10=_st($11)._new();
  1971. $ctx1.sendIdx["new"]=3;
  1972. self._assert_equals_($7,$10);
  1973. $ctx1.sendIdx["assert:equals:"]=3;
  1974. $13=self._collection();
  1975. $ctx1.sendIdx["collection"]=3;
  1976. $12=_st($13)._ifNotEmpty_((function(){
  1977. return (42);
  1978. }));
  1979. $ctx1.sendIdx["ifNotEmpty:"]=2;
  1980. self._assert_equals_($12,(42));
  1981. $ctx1.sendIdx["assert:equals:"]=4;
  1982. $15=self._collection();
  1983. $ctx1.sendIdx["collection"]=4;
  1984. $14=_st($15)._ifNotEmpty_((function(col){
  1985. return col;
  1986. }));
  1987. $16=self._collection();
  1988. $ctx1.sendIdx["collection"]=5;
  1989. self._assert_equals_($14,$16);
  1990. $ctx1.sendIdx["assert:equals:"]=5;
  1991. $19=self._collectionClass();
  1992. $ctx1.sendIdx["collectionClass"]=4;
  1993. $18=_st($19)._new();
  1994. $ctx1.sendIdx["new"]=4;
  1995. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1996. return (42);
  1997. }),(function(){
  1998. return (999);
  1999. }));
  2000. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  2001. self._assert_equals_($17,(42));
  2002. $ctx1.sendIdx["assert:equals:"]=6;
  2003. $21=self._collection();
  2004. $ctx1.sendIdx["collection"]=6;
  2005. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  2006. return (42);
  2007. }),(function(){
  2008. return (999);
  2009. }));
  2010. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  2011. self._assert_equals_($20,(999));
  2012. $ctx1.sendIdx["assert:equals:"]=7;
  2013. $23=self._collection();
  2014. $ctx1.sendIdx["collection"]=7;
  2015. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  2016. return (42);
  2017. }),(function(col){
  2018. return col;
  2019. }));
  2020. $24=self._collection();
  2021. $ctx1.sendIdx["collection"]=8;
  2022. self._assert_equals_($22,$24);
  2023. $ctx1.sendIdx["assert:equals:"]=8;
  2024. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  2025. return (42);
  2026. }),(function(){
  2027. return (999);
  2028. }));
  2029. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  2030. self._assert_equals_($25,(999));
  2031. $ctx1.sendIdx["assert:equals:"]=9;
  2032. $27=self._collection();
  2033. $ctx1.sendIdx["collection"]=9;
  2034. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  2035. return (42);
  2036. }),(function(){
  2037. return (999);
  2038. }));
  2039. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  2040. self._assert_equals_($26,(42));
  2041. $ctx1.sendIdx["assert:equals:"]=10;
  2042. $29=self._collection();
  2043. $ctx1.sendIdx["collection"]=10;
  2044. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  2045. return col;
  2046. }),(function(){
  2047. return (999);
  2048. }));
  2049. self._assert_equals_($28,self._collection());
  2050. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  2051. args: [],
  2052. 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\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\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\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  2053. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2054. referencedClasses: []
  2055. }),
  2056. globals.CollectionTest);
  2057. smalltalk.addMethod(
  2058. smalltalk.method({
  2059. selector: "testIsEmpty",
  2060. protocol: 'tests',
  2061. fn: function (){
  2062. var self=this;
  2063. return smalltalk.withContext(function($ctx1) {
  2064. var $1;
  2065. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2066. $ctx1.sendIdx["isEmpty"]=1;
  2067. self._assert_($1);
  2068. self._deny_(_st(self._collection())._isEmpty());
  2069. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2070. args: [],
  2071. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2072. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2073. referencedClasses: []
  2074. }),
  2075. globals.CollectionTest);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "testNoneSatisfy",
  2079. protocol: 'tests',
  2080. fn: function (){
  2081. var self=this;
  2082. var anyOne;
  2083. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2084. return smalltalk.withContext(function($ctx1) {
  2085. var $1,$3,$2;
  2086. $1=self._collection();
  2087. $ctx1.sendIdx["collection"]=1;
  2088. anyOne=_st($1)._anyOne();
  2089. $3=self._collection();
  2090. $ctx1.sendIdx["collection"]=2;
  2091. $2=_st($3)._noneSatisfy_((function(each){
  2092. return smalltalk.withContext(function($ctx2) {
  2093. return _st(each).__eq(anyOne);
  2094. $ctx2.sendIdx["="]=1;
  2095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2096. $ctx1.sendIdx["noneSatisfy:"]=1;
  2097. self._deny_($2);
  2098. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2099. return smalltalk.withContext(function($ctx2) {
  2100. return _st(each).__eq(_st($Object())._new());
  2101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2102. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2103. args: [],
  2104. 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 ])",
  2105. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2106. referencedClasses: ["Object"]
  2107. }),
  2108. globals.CollectionTest);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "testRemoveAll",
  2112. protocol: 'tests',
  2113. fn: function (){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. var $1,$2;
  2117. $1=self._collection();
  2118. _st($1)._removeAll();
  2119. $2=_st($1)._yourself();
  2120. self._assert_equals_($2,_st(self._collectionClass())._new());
  2121. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2122. args: [],
  2123. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2124. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2125. referencedClasses: []
  2126. }),
  2127. globals.CollectionTest);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "testSelect",
  2131. protocol: 'tests',
  2132. fn: function (){
  2133. var self=this;
  2134. return smalltalk.withContext(function($ctx1) {
  2135. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2136. $2=self._collection();
  2137. $ctx1.sendIdx["collection"]=1;
  2138. $1=_st($2)._select_((function(){
  2139. return false;
  2140. }));
  2141. $ctx1.sendIdx["select:"]=1;
  2142. $4=self._collectionClass();
  2143. $ctx1.sendIdx["collectionClass"]=1;
  2144. $3=_st($4)._new();
  2145. $ctx1.sendIdx["new"]=1;
  2146. self._assert_equals_($1,$3);
  2147. $ctx1.sendIdx["assert:equals:"]=1;
  2148. $6=self._collection();
  2149. $ctx1.sendIdx["collection"]=2;
  2150. $5=_st($6)._select_((function(){
  2151. return true;
  2152. }));
  2153. $ctx1.sendIdx["select:"]=2;
  2154. $7=self._collection();
  2155. $ctx1.sendIdx["collection"]=3;
  2156. self._assert_equals_($5,$7);
  2157. $ctx1.sendIdx["assert:equals:"]=2;
  2158. $9=self._collectionWithNewValue();
  2159. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2160. $8=_st($9)._select_((function(each){
  2161. return smalltalk.withContext(function($ctx2) {
  2162. $10=self._sampleNewValue();
  2163. $ctx2.sendIdx["sampleNewValue"]=1;
  2164. return _st(each).__eq($10);
  2165. $ctx2.sendIdx["="]=1;
  2166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2167. $ctx1.sendIdx["select:"]=3;
  2168. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2169. $ctx1.sendIdx["assert:equals:"]=3;
  2170. $12=self._collectionWithNewValue();
  2171. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2172. $11=_st($12)._select_((function(each){
  2173. return smalltalk.withContext(function($ctx2) {
  2174. $13=self._sampleNewValue();
  2175. $ctx2.sendIdx["sampleNewValue"]=2;
  2176. return _st(each).__tild_eq($13);
  2177. $ctx2.sendIdx["~="]=1;
  2178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2179. $ctx1.sendIdx["select:"]=4;
  2180. $14=self._collection();
  2181. $ctx1.sendIdx["collection"]=4;
  2182. self._assert_equals_($11,$14);
  2183. $ctx1.sendIdx["assert:equals:"]=4;
  2184. $16=self._collection();
  2185. $ctx1.sendIdx["collection"]=5;
  2186. $15=_st($16)._select_((function(each){
  2187. return smalltalk.withContext(function($ctx2) {
  2188. $17=self._sampleNewValue();
  2189. $ctx2.sendIdx["sampleNewValue"]=3;
  2190. return _st(each).__eq($17);
  2191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2192. $ctx1.sendIdx["select:"]=5;
  2193. self._assert_equals_($15,_st(self._collectionClass())._new());
  2194. $ctx1.sendIdx["assert:equals:"]=5;
  2195. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2196. return smalltalk.withContext(function($ctx2) {
  2197. return _st(each).__tild_eq(self._sampleNewValue());
  2198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2200. args: [],
  2201. 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",
  2202. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2203. referencedClasses: []
  2204. }),
  2205. globals.CollectionTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testSize",
  2209. protocol: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. return smalltalk.withContext(function($ctx1) {
  2213. var $1,$2;
  2214. $1=_st(_st(self._collectionClass())._new())._size();
  2215. $ctx1.sendIdx["size"]=1;
  2216. self._assert_equals_($1,(0));
  2217. $ctx1.sendIdx["assert:equals:"]=1;
  2218. $2=_st(self._sampleNewValueAsCollection())._size();
  2219. $ctx1.sendIdx["size"]=2;
  2220. self._assert_equals_($2,(1));
  2221. $ctx1.sendIdx["assert:equals:"]=2;
  2222. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2227. referencedClasses: []
  2228. }),
  2229. globals.CollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "collectionClass",
  2233. protocol: 'fixture',
  2234. fn: function (){
  2235. var self=this;
  2236. return nil;
  2237. },
  2238. args: [],
  2239. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. globals.CollectionTest.klass);
  2244. smalltalk.addMethod(
  2245. smalltalk.method({
  2246. selector: "isAbstract",
  2247. protocol: 'testing',
  2248. fn: function (){
  2249. var self=this;
  2250. return smalltalk.withContext(function($ctx1) {
  2251. var $1;
  2252. $1=_st(self._collectionClass())._isNil();
  2253. return $1;
  2254. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2255. args: [],
  2256. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2257. messageSends: ["isNil", "collectionClass"],
  2258. referencedClasses: []
  2259. }),
  2260. globals.CollectionTest.klass);
  2261. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "collectionWithNewValue",
  2265. protocol: 'fixture',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) {
  2269. self._subclassResponsibility();
  2270. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2271. args: [],
  2272. 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",
  2273. messageSends: ["subclassResponsibility"],
  2274. referencedClasses: []
  2275. }),
  2276. globals.IndexableCollectionTest);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "sampleNewIndex",
  2280. protocol: 'fixture',
  2281. fn: function (){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. self._subclassResponsibility();
  2285. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2286. args: [],
  2287. 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",
  2288. messageSends: ["subclassResponsibility"],
  2289. referencedClasses: []
  2290. }),
  2291. globals.IndexableCollectionTest);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "sampleNonIndexesDo:",
  2295. protocol: 'fixture',
  2296. fn: function (aBlock){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. self._subclassResponsibility();
  2300. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2301. args: ["aBlock"],
  2302. 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",
  2303. messageSends: ["subclassResponsibility"],
  2304. referencedClasses: []
  2305. }),
  2306. globals.IndexableCollectionTest);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "samplesDo:",
  2310. protocol: 'fixture',
  2311. fn: function (aBlock){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. self._subclassResponsibility();
  2315. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2316. args: ["aBlock"],
  2317. 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",
  2318. messageSends: ["subclassResponsibility"],
  2319. referencedClasses: []
  2320. }),
  2321. globals.IndexableCollectionTest);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "testAt",
  2325. protocol: 'tests',
  2326. fn: function (){
  2327. var self=this;
  2328. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2329. return smalltalk.withContext(function($ctx1) {
  2330. var $1;
  2331. self._nonIndexesDo_((function(each){
  2332. return smalltalk.withContext(function($ctx2) {
  2333. return self._should_raise_((function(){
  2334. return smalltalk.withContext(function($ctx3) {
  2335. $1=self._collection();
  2336. $ctx3.sendIdx["collection"]=1;
  2337. return _st($1)._at_(each);
  2338. $ctx3.sendIdx["at:"]=1;
  2339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2341. self._samplesDo_((function(index,value){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2344. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2345. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2346. args: [],
  2347. 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 ]",
  2348. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2349. referencedClasses: ["Error"]
  2350. }),
  2351. globals.IndexableCollectionTest);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "testAtIfAbsent",
  2355. protocol: 'tests',
  2356. fn: function (){
  2357. var self=this;
  2358. return smalltalk.withContext(function($ctx1) {
  2359. var $2,$1,$3;
  2360. self._nonIndexesDo_((function(each){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. $2=self._collection();
  2363. $ctx2.sendIdx["collection"]=1;
  2364. $1=_st($2)._at_ifAbsent_(each,(function(){
  2365. return smalltalk.withContext(function($ctx3) {
  2366. return self._sampleNewValue();
  2367. $ctx3.sendIdx["sampleNewValue"]=1;
  2368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2369. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2370. $3=self._sampleNewValue();
  2371. $ctx2.sendIdx["sampleNewValue"]=2;
  2372. return self._assert_equals_($1,$3);
  2373. $ctx2.sendIdx["assert:equals:"]=1;
  2374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2375. self._samplesDo_((function(index,value){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2378. return smalltalk.withContext(function($ctx3) {
  2379. return self._sampleNewValue();
  2380. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2381. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2382. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2383. args: [],
  2384. 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 ].",
  2385. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2386. referencedClasses: []
  2387. }),
  2388. globals.IndexableCollectionTest);
  2389. smalltalk.addMethod(
  2390. smalltalk.method({
  2391. selector: "testAtIfAbsentPut",
  2392. protocol: 'tests',
  2393. fn: function (){
  2394. var self=this;
  2395. var newCollection;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. var $1;
  2398. newCollection=self._collection();
  2399. $ctx1.sendIdx["collection"]=1;
  2400. self._samplesDo_((function(index,value){
  2401. return smalltalk.withContext(function($ctx2) {
  2402. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2403. return smalltalk.withContext(function($ctx3) {
  2404. return self._sampleNewValue();
  2405. $ctx3.sendIdx["sampleNewValue"]=1;
  2406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2407. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2408. return self._assert_equals_($1,value);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2411. self._assert_equals_(newCollection,self._collection());
  2412. $ctx1.sendIdx["assert:equals:"]=2;
  2413. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2414. return smalltalk.withContext(function($ctx2) {
  2415. return self._sampleNewValue();
  2416. $ctx2.sendIdx["sampleNewValue"]=2;
  2417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2418. $ctx1.sendIdx["assert:equals:"]=3;
  2419. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2420. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2421. args: [],
  2422. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2423. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2424. referencedClasses: []
  2425. }),
  2426. globals.IndexableCollectionTest);
  2427. smalltalk.addMethod(
  2428. smalltalk.method({
  2429. selector: "testAtIfPresent",
  2430. protocol: 'tests',
  2431. fn: function (){
  2432. var self=this;
  2433. var visited,sentinel;
  2434. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2435. return smalltalk.withContext(function($ctx1) {
  2436. var $2,$1,$4,$3;
  2437. sentinel=_st($Object())._new();
  2438. self._nonIndexesDo_((function(each){
  2439. return smalltalk.withContext(function($ctx2) {
  2440. visited=nil;
  2441. visited;
  2442. $2=self._collection();
  2443. $ctx2.sendIdx["collection"]=1;
  2444. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2445. visited=value1;
  2446. visited;
  2447. return sentinel;
  2448. }));
  2449. $ctx2.sendIdx["at:ifPresent:"]=1;
  2450. self._assert_equals_($1,nil);
  2451. $ctx2.sendIdx["assert:equals:"]=1;
  2452. return self._assert_(_st(visited)._isNil());
  2453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2454. self._samplesDo_((function(index,value){
  2455. return smalltalk.withContext(function($ctx2) {
  2456. visited=nil;
  2457. visited;
  2458. $4=self._collection();
  2459. $ctx2.sendIdx["collection"]=2;
  2460. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2461. visited=value2;
  2462. visited;
  2463. return sentinel;
  2464. }));
  2465. self._assert_equals_($3,sentinel);
  2466. $ctx2.sendIdx["assert:equals:"]=2;
  2467. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. globals.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtIfPresentIfAbsent",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var visited,sentinel;
  2483. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2484. return smalltalk.withContext(function($ctx1) {
  2485. var $2,$1,$3,$5,$4;
  2486. sentinel=_st($Object())._new();
  2487. self._nonIndexesDo_((function(each){
  2488. return smalltalk.withContext(function($ctx2) {
  2489. visited=nil;
  2490. visited;
  2491. $2=self._collection();
  2492. $ctx2.sendIdx["collection"]=1;
  2493. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2494. visited=value1;
  2495. visited;
  2496. return sentinel;
  2497. }),(function(){
  2498. return smalltalk.withContext(function($ctx3) {
  2499. return self._sampleNewValue();
  2500. $ctx3.sendIdx["sampleNewValue"]=1;
  2501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2502. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2503. $3=self._sampleNewValue();
  2504. $ctx2.sendIdx["sampleNewValue"]=2;
  2505. self._assert_equals_($1,$3);
  2506. $ctx2.sendIdx["assert:equals:"]=1;
  2507. return self._assert_(_st(visited)._isNil());
  2508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2509. self._samplesDo_((function(index,value){
  2510. return smalltalk.withContext(function($ctx2) {
  2511. visited=nil;
  2512. visited;
  2513. $5=self._collection();
  2514. $ctx2.sendIdx["collection"]=2;
  2515. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2516. visited=value2;
  2517. visited;
  2518. return sentinel;
  2519. }),(function(){
  2520. return smalltalk.withContext(function($ctx3) {
  2521. return self._sampleNewValue();
  2522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2523. self._assert_equals_($4,sentinel);
  2524. $ctx2.sendIdx["assert:equals:"]=2;
  2525. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2526. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2527. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2528. args: [],
  2529. 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) ]",
  2530. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2531. referencedClasses: ["Object"]
  2532. }),
  2533. globals.IndexableCollectionTest);
  2534. smalltalk.addMethod(
  2535. smalltalk.method({
  2536. selector: "testAtPut",
  2537. protocol: 'tests',
  2538. fn: function (){
  2539. var self=this;
  2540. var newCollection;
  2541. return smalltalk.withContext(function($ctx1) {
  2542. newCollection=self._collection();
  2543. $ctx1.sendIdx["collection"]=1;
  2544. self._samplesDo_((function(index,value){
  2545. return smalltalk.withContext(function($ctx2) {
  2546. return _st(newCollection)._at_put_(index,value);
  2547. $ctx2.sendIdx["at:put:"]=1;
  2548. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2549. self._assert_equals_(newCollection,self._collection());
  2550. $ctx1.sendIdx["assert:equals:"]=1;
  2551. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2552. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2553. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2554. args: [],
  2555. 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",
  2556. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2557. referencedClasses: []
  2558. }),
  2559. globals.IndexableCollectionTest);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "testEquality",
  2563. protocol: 'tests',
  2564. fn: function (){
  2565. var self=this;
  2566. return smalltalk.withContext(function($ctx1) {
  2567. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2568. $2=self._collectionClass();
  2569. $ctx1.sendIdx["collectionClass"]=1;
  2570. $1=_st($2)._new();
  2571. $ctx1.sendIdx["new"]=1;
  2572. $4=self._collectionClass();
  2573. $ctx1.sendIdx["collectionClass"]=2;
  2574. $3=_st($4)._new();
  2575. $ctx1.sendIdx["new"]=2;
  2576. self._assert_equals_($1,$3);
  2577. $ctx1.sendIdx["assert:equals:"]=1;
  2578. $5=self._collection();
  2579. $ctx1.sendIdx["collection"]=1;
  2580. $6=self._collection();
  2581. $ctx1.sendIdx["collection"]=2;
  2582. self._assert_equals_($5,$6);
  2583. $ctx1.sendIdx["assert:equals:"]=2;
  2584. $7=self._collectionWithNewValue();
  2585. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2586. self._assert_equals_($7,self._collectionWithNewValue());
  2587. $10=self._collectionClass();
  2588. $ctx1.sendIdx["collectionClass"]=3;
  2589. $9=_st($10)._new();
  2590. $ctx1.sendIdx["new"]=3;
  2591. $11=self._collection();
  2592. $ctx1.sendIdx["collection"]=3;
  2593. $8=_st($9).__eq($11);
  2594. $ctx1.sendIdx["="]=1;
  2595. self._deny_($8);
  2596. $ctx1.sendIdx["deny:"]=1;
  2597. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2598. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2599. args: [],
  2600. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2601. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2602. referencedClasses: []
  2603. }),
  2604. globals.IndexableCollectionTest);
  2605. smalltalk.addMethod(
  2606. smalltalk.method({
  2607. selector: "testIndexOf",
  2608. protocol: 'tests',
  2609. fn: function (){
  2610. var self=this;
  2611. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2612. return smalltalk.withContext(function($ctx1) {
  2613. var $1;
  2614. self._should_raise_((function(){
  2615. return smalltalk.withContext(function($ctx2) {
  2616. $1=self._collection();
  2617. $ctx2.sendIdx["collection"]=1;
  2618. return _st($1)._indexOf_(self._sampleNewValue());
  2619. $ctx2.sendIdx["indexOf:"]=1;
  2620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2621. self._samplesDo_((function(index,value){
  2622. return smalltalk.withContext(function($ctx2) {
  2623. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2624. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2625. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2626. args: [],
  2627. 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 ]",
  2628. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2629. referencedClasses: ["Error"]
  2630. }),
  2631. globals.IndexableCollectionTest);
  2632. smalltalk.addMethod(
  2633. smalltalk.method({
  2634. selector: "testIndexOfWithNull",
  2635. protocol: 'tests',
  2636. fn: function (){
  2637. var self=this;
  2638. var jsNull;
  2639. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2640. return smalltalk.withContext(function($ctx1) {
  2641. var $1,$2;
  2642. jsNull=_st($JSON())._parse_("null");
  2643. self._samplesDo_((function(index,value){
  2644. return smalltalk.withContext(function($ctx2) {
  2645. $1=self._collection();
  2646. _st($1)._at_put_(index,jsNull);
  2647. $2=_st($1)._indexOf_(jsNull);
  2648. return self._assert_equals_($2,index);
  2649. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2650. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2651. args: [],
  2652. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2653. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2654. referencedClasses: ["JSON"]
  2655. }),
  2656. globals.IndexableCollectionTest);
  2657. smalltalk.addMethod(
  2658. smalltalk.method({
  2659. selector: "testWithIndexDo",
  2660. protocol: 'tests',
  2661. fn: function (){
  2662. var self=this;
  2663. var collection;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. collection=self._collection();
  2666. $ctx1.sendIdx["collection"]=1;
  2667. _st(self._collection())._withIndexDo_((function(each,index){
  2668. return smalltalk.withContext(function($ctx2) {
  2669. return self._assert_equals_(_st(collection)._at_(index),each);
  2670. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2671. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2672. args: [],
  2673. 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 ]",
  2674. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2675. referencedClasses: []
  2676. }),
  2677. globals.IndexableCollectionTest);
  2678. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2679. smalltalk.addMethod(
  2680. smalltalk.method({
  2681. selector: "collectionKeys",
  2682. protocol: 'fixture',
  2683. fn: function (){
  2684. var self=this;
  2685. return smalltalk.withContext(function($ctx1) {
  2686. self._subclassResponsibility();
  2687. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2688. args: [],
  2689. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2690. messageSends: ["subclassResponsibility"],
  2691. referencedClasses: []
  2692. }),
  2693. globals.AssociativeCollectionTest);
  2694. smalltalk.addMethod(
  2695. smalltalk.method({
  2696. selector: "collectionValues",
  2697. protocol: 'fixture',
  2698. fn: function (){
  2699. var self=this;
  2700. return smalltalk.withContext(function($ctx1) {
  2701. self._subclassResponsibility();
  2702. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2703. args: [],
  2704. source: "collectionValues\x0a\x09self subclassResponsibility",
  2705. messageSends: ["subclassResponsibility"],
  2706. referencedClasses: []
  2707. }),
  2708. globals.AssociativeCollectionTest);
  2709. smalltalk.addMethod(
  2710. smalltalk.method({
  2711. selector: "nonIndexesDo:",
  2712. protocol: 'fixture',
  2713. fn: function (aBlock){
  2714. var self=this;
  2715. return smalltalk.withContext(function($ctx1) {
  2716. _st(aBlock)._value_((5));
  2717. $ctx1.sendIdx["value:"]=1;
  2718. _st(aBlock)._value_("z");
  2719. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2720. args: ["aBlock"],
  2721. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2722. messageSends: ["value:"],
  2723. referencedClasses: []
  2724. }),
  2725. globals.AssociativeCollectionTest);
  2726. smalltalk.addMethod(
  2727. smalltalk.method({
  2728. selector: "sampleNewIndex",
  2729. protocol: 'fixture',
  2730. fn: function (){
  2731. var self=this;
  2732. return "new";
  2733. },
  2734. args: [],
  2735. source: "sampleNewIndex\x0a\x09^ 'new'",
  2736. messageSends: [],
  2737. referencedClasses: []
  2738. }),
  2739. globals.AssociativeCollectionTest);
  2740. smalltalk.addMethod(
  2741. smalltalk.method({
  2742. selector: "samplesDo:",
  2743. protocol: 'fixture',
  2744. fn: function (aBlock){
  2745. var self=this;
  2746. return smalltalk.withContext(function($ctx1) {
  2747. _st(aBlock)._value_value_("a",(2));
  2748. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2749. args: ["aBlock"],
  2750. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2751. messageSends: ["value:value:"],
  2752. referencedClasses: []
  2753. }),
  2754. globals.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testAddAll",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. return smalltalk.withContext(function($ctx1) {
  2762. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2763. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2764. $ctx1.supercall = false;
  2765. $2=self._collection();
  2766. $ctx1.sendIdx["collection"]=1;
  2767. $3=$2;
  2768. $4=self._collection();
  2769. $ctx1.sendIdx["collection"]=2;
  2770. _st($3)._addAll_($4);
  2771. $ctx1.sendIdx["addAll:"]=1;
  2772. $5=_st($2)._yourself();
  2773. $ctx1.sendIdx["yourself"]=1;
  2774. $1=$5;
  2775. $6=self._collection();
  2776. $ctx1.sendIdx["collection"]=3;
  2777. self._assert_equals_($1,$6);
  2778. $ctx1.sendIdx["assert:equals:"]=1;
  2779. $8=self._collection();
  2780. $ctx1.sendIdx["collection"]=4;
  2781. $9=$8;
  2782. $10=self._collectionWithNewValue();
  2783. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2784. _st($9)._addAll_($10);
  2785. $ctx1.sendIdx["addAll:"]=2;
  2786. $11=_st($8)._yourself();
  2787. $ctx1.sendIdx["yourself"]=2;
  2788. $7=$11;
  2789. $12=self._collectionWithNewValue();
  2790. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2791. self._assert_equals_($7,$12);
  2792. $ctx1.sendIdx["assert:equals:"]=2;
  2793. $14=self._collectionWithNewValue();
  2794. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2795. _st($14)._addAll_(self._collection());
  2796. $15=_st($14)._yourself();
  2797. $13=$15;
  2798. self._assert_equals_($13,self._collectionWithNewValue());
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2800. args: [],
  2801. 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",
  2802. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2803. referencedClasses: []
  2804. }),
  2805. globals.AssociativeCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testAsDictionary",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2813. return smalltalk.withContext(function($ctx1) {
  2814. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2815. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2816. args: [],
  2817. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2818. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2819. referencedClasses: ["Dictionary"]
  2820. }),
  2821. globals.AssociativeCollectionTest);
  2822. smalltalk.addMethod(
  2823. smalltalk.method({
  2824. selector: "testAsHashedCollection",
  2825. protocol: 'tests',
  2826. fn: function (){
  2827. var self=this;
  2828. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2829. return smalltalk.withContext(function($ctx1) {
  2830. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2831. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2832. args: [],
  2833. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2834. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2835. referencedClasses: ["HashedCollection"]
  2836. }),
  2837. globals.AssociativeCollectionTest);
  2838. smalltalk.addMethod(
  2839. smalltalk.method({
  2840. selector: "testComma",
  2841. protocol: 'tests',
  2842. fn: function (){
  2843. var self=this;
  2844. return smalltalk.withContext(function($ctx1) {
  2845. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2846. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2847. $ctx1.supercall = false;
  2848. $2=self._collection();
  2849. $ctx1.sendIdx["collection"]=1;
  2850. $3=self._collection();
  2851. $ctx1.sendIdx["collection"]=2;
  2852. $1=_st($2).__comma($3);
  2853. $ctx1.sendIdx[","]=1;
  2854. $4=self._collection();
  2855. $ctx1.sendIdx["collection"]=3;
  2856. self._assert_equals_($1,$4);
  2857. $ctx1.sendIdx["assert:equals:"]=1;
  2858. $6=self._collection();
  2859. $ctx1.sendIdx["collection"]=4;
  2860. $7=self._collectionWithNewValue();
  2861. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2862. $5=_st($6).__comma($7);
  2863. $ctx1.sendIdx[","]=2;
  2864. $8=self._collectionWithNewValue();
  2865. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2866. self._assert_equals_($5,$8);
  2867. $ctx1.sendIdx["assert:equals:"]=2;
  2868. $10=self._collectionWithNewValue();
  2869. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2870. $9=_st($10).__comma(self._collection());
  2871. self._assert_equals_($9,self._collectionWithNewValue());
  2872. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2873. args: [],
  2874. 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",
  2875. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2876. referencedClasses: []
  2877. }),
  2878. globals.AssociativeCollectionTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "testFrom",
  2882. protocol: 'tests',
  2883. fn: function (){
  2884. var self=this;
  2885. var associations;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. var $1;
  2888. $1="a".__minus_gt((1));
  2889. $ctx1.sendIdx["->"]=1;
  2890. associations=[$1,"b".__minus_gt((2))];
  2891. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2892. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2893. args: [],
  2894. 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 }.",
  2895. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2896. referencedClasses: []
  2897. }),
  2898. globals.AssociativeCollectionTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "testKeys",
  2902. protocol: 'tests',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. var $2,$1,$3,$4;
  2907. $2=_st(_st(self._collectionClass())._new())._keys();
  2908. $ctx1.sendIdx["keys"]=1;
  2909. $1=_st($2)._isEmpty();
  2910. self._assert_($1);
  2911. $3=_st(self._collection())._keys();
  2912. $ctx1.sendIdx["keys"]=2;
  2913. $4=self._collectionKeys();
  2914. $ctx1.sendIdx["collectionKeys"]=1;
  2915. self._assertSameContents_as_($3,$4);
  2916. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2917. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2918. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2919. args: [],
  2920. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2921. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2922. referencedClasses: []
  2923. }),
  2924. globals.AssociativeCollectionTest);
  2925. smalltalk.addMethod(
  2926. smalltalk.method({
  2927. selector: "testNewFromPairs",
  2928. protocol: 'tests',
  2929. fn: function (){
  2930. var self=this;
  2931. var flattenedAssociations;
  2932. return smalltalk.withContext(function($ctx1) {
  2933. flattenedAssociations=["a",(1),"b",(2)];
  2934. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2935. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2936. args: [],
  2937. 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 }.",
  2938. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2939. referencedClasses: []
  2940. }),
  2941. globals.AssociativeCollectionTest);
  2942. smalltalk.addMethod(
  2943. smalltalk.method({
  2944. selector: "testPrintString",
  2945. protocol: 'tests',
  2946. fn: function (){
  2947. var self=this;
  2948. return smalltalk.withContext(function($ctx1) {
  2949. var $3,$2,$4,$1,$5;
  2950. $3=self._collectionClass();
  2951. $ctx1.sendIdx["collectionClass"]=1;
  2952. $2=_st($3)._new();
  2953. _st($2)._at_put_("firstname","James");
  2954. $ctx1.sendIdx["at:put:"]=1;
  2955. _st($2)._at_put_("lastname","Bond");
  2956. $4=_st($2)._printString();
  2957. $1=$4;
  2958. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2959. $ctx1.sendIdx[","]=1;
  2960. self._assert_equals_($1,$5);
  2961. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2962. args: [],
  2963. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass 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 ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2964. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2965. referencedClasses: []
  2966. }),
  2967. globals.AssociativeCollectionTest);
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "testRemoveKey",
  2971. protocol: 'tests',
  2972. fn: function (){
  2973. var self=this;
  2974. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2975. return smalltalk.withContext(function($ctx1) {
  2976. var $1,$2,$3,$5,$6,$4,$7,$8;
  2977. self._nonIndexesDo_((function(each){
  2978. var collection;
  2979. return smalltalk.withContext(function($ctx2) {
  2980. collection=self._collection();
  2981. $ctx2.sendIdx["collection"]=1;
  2982. collection;
  2983. self._should_raise_((function(){
  2984. return smalltalk.withContext(function($ctx3) {
  2985. return _st(collection)._removeKey_(each);
  2986. $ctx3.sendIdx["removeKey:"]=1;
  2987. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2988. $1=collection;
  2989. $2=self._collection();
  2990. $ctx2.sendIdx["collection"]=2;
  2991. return self._assert_equals_($1,$2);
  2992. $ctx2.sendIdx["assert:equals:"]=1;
  2993. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2994. self._samplesDo_((function(index,value){
  2995. var collection;
  2996. return smalltalk.withContext(function($ctx2) {
  2997. collection=self._collection();
  2998. $ctx2.sendIdx["collection"]=3;
  2999. collection;
  3000. $3=_st(collection)._removeKey_(index);
  3001. $ctx2.sendIdx["removeKey:"]=2;
  3002. self._assert_equals_($3,value);
  3003. $ctx2.sendIdx["assert:equals:"]=2;
  3004. $5=collection;
  3005. $6=self._collection();
  3006. $ctx2.sendIdx["collection"]=4;
  3007. $4=_st($5).__eq($6);
  3008. return self._deny_($4);
  3009. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3010. $7=self._collectionWithNewValue();
  3011. _st($7)._removeKey_(self._sampleNewIndex());
  3012. $8=_st($7)._yourself();
  3013. self._assert_equals_($8,self._collection());
  3014. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  3015. args: [],
  3016. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  3017. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  3018. referencedClasses: ["Error"]
  3019. }),
  3020. globals.AssociativeCollectionTest);
  3021. smalltalk.addMethod(
  3022. smalltalk.method({
  3023. selector: "testRemoveKeyIfAbsent",
  3024. protocol: 'tests',
  3025. fn: function (){
  3026. var self=this;
  3027. return smalltalk.withContext(function($ctx1) {
  3028. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  3029. self._nonIndexesDo_((function(each){
  3030. var collection;
  3031. return smalltalk.withContext(function($ctx2) {
  3032. collection=self._collection();
  3033. $ctx2.sendIdx["collection"]=1;
  3034. collection;
  3035. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  3036. return smalltalk.withContext(function($ctx3) {
  3037. return self._sampleNewValue();
  3038. $ctx3.sendIdx["sampleNewValue"]=1;
  3039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  3040. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  3041. $2=self._sampleNewValue();
  3042. $ctx2.sendIdx["sampleNewValue"]=2;
  3043. self._assert_equals_($1,$2);
  3044. $ctx2.sendIdx["assert:equals:"]=1;
  3045. $3=collection;
  3046. $4=self._collection();
  3047. $ctx2.sendIdx["collection"]=2;
  3048. return self._assert_equals_($3,$4);
  3049. $ctx2.sendIdx["assert:equals:"]=2;
  3050. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3051. self._samplesDo_((function(index,value){
  3052. var collection;
  3053. return smalltalk.withContext(function($ctx2) {
  3054. collection=self._collection();
  3055. $ctx2.sendIdx["collection"]=3;
  3056. collection;
  3057. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3058. return smalltalk.withContext(function($ctx3) {
  3059. return self._sampleNewValue();
  3060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3061. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3062. self._assert_equals_($5,value);
  3063. $ctx2.sendIdx["assert:equals:"]=3;
  3064. $7=collection;
  3065. $8=self._collection();
  3066. $ctx2.sendIdx["collection"]=4;
  3067. $6=_st($7).__eq($8);
  3068. return self._deny_($6);
  3069. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3070. $9=self._collectionWithNewValue();
  3071. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3072. return smalltalk.withContext(function($ctx2) {
  3073. return self._assert_(false);
  3074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3075. $10=_st($9)._yourself();
  3076. self._assert_equals_($10,self._collection());
  3077. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3078. args: [],
  3079. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  3080. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3081. referencedClasses: []
  3082. }),
  3083. globals.AssociativeCollectionTest);
  3084. smalltalk.addMethod(
  3085. smalltalk.method({
  3086. selector: "testValues",
  3087. protocol: 'tests',
  3088. fn: function (){
  3089. var self=this;
  3090. return smalltalk.withContext(function($ctx1) {
  3091. var $2,$1,$3,$4;
  3092. $2=_st(_st(self._collectionClass())._new())._values();
  3093. $ctx1.sendIdx["values"]=1;
  3094. $1=_st($2)._isEmpty();
  3095. self._assert_($1);
  3096. $3=_st(self._collection())._values();
  3097. $ctx1.sendIdx["values"]=2;
  3098. $4=self._collectionValues();
  3099. $ctx1.sendIdx["collectionValues"]=1;
  3100. self._assertSameContents_as_($3,$4);
  3101. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3102. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3103. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3104. args: [],
  3105. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  3106. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3107. referencedClasses: []
  3108. }),
  3109. globals.AssociativeCollectionTest);
  3110. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3111. smalltalk.addMethod(
  3112. smalltalk.method({
  3113. selector: "collection",
  3114. protocol: 'fixture',
  3115. fn: function (){
  3116. var self=this;
  3117. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3118. return smalltalk.withContext(function($ctx1) {
  3119. var $2,$3,$1;
  3120. $2=_st($Dictionary())._new();
  3121. _st($2)._at_put_((1),(1));
  3122. $ctx1.sendIdx["at:put:"]=1;
  3123. _st($2)._at_put_("a",(2));
  3124. $ctx1.sendIdx["at:put:"]=2;
  3125. _st($2)._at_put_(true,(3));
  3126. $ctx1.sendIdx["at:put:"]=3;
  3127. _st($2)._at_put_((1).__at((3)),(-4));
  3128. $3=_st($2)._yourself();
  3129. $1=$3;
  3130. return $1;
  3131. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3132. args: [],
  3133. 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",
  3134. messageSends: ["at:put:", "new", "@", "yourself"],
  3135. referencedClasses: ["Dictionary"]
  3136. }),
  3137. globals.DictionaryTest);
  3138. smalltalk.addMethod(
  3139. smalltalk.method({
  3140. selector: "collectionKeys",
  3141. protocol: 'fixture',
  3142. fn: function (){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) {
  3145. var $1;
  3146. $1=[(1),"a",true,(1).__at((3))];
  3147. return $1;
  3148. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3149. args: [],
  3150. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3151. messageSends: ["@"],
  3152. referencedClasses: []
  3153. }),
  3154. globals.DictionaryTest);
  3155. smalltalk.addMethod(
  3156. smalltalk.method({
  3157. selector: "collectionOfPrintStrings",
  3158. protocol: 'fixture',
  3159. fn: function (){
  3160. var self=this;
  3161. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3162. return smalltalk.withContext(function($ctx1) {
  3163. var $2,$3,$1;
  3164. $2=_st($Dictionary())._new();
  3165. _st($2)._at_put_((1),"1");
  3166. $ctx1.sendIdx["at:put:"]=1;
  3167. _st($2)._at_put_("a","2");
  3168. $ctx1.sendIdx["at:put:"]=2;
  3169. _st($2)._at_put_(true,"3");
  3170. $ctx1.sendIdx["at:put:"]=3;
  3171. _st($2)._at_put_((1).__at((3)),"-4");
  3172. $3=_st($2)._yourself();
  3173. $1=$3;
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3176. args: [],
  3177. 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",
  3178. messageSends: ["at:put:", "new", "@", "yourself"],
  3179. referencedClasses: ["Dictionary"]
  3180. }),
  3181. globals.DictionaryTest);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "collectionSize",
  3185. protocol: 'fixture',
  3186. fn: function (){
  3187. var self=this;
  3188. return (4);
  3189. },
  3190. args: [],
  3191. source: "collectionSize\x0a\x09^ 4",
  3192. messageSends: [],
  3193. referencedClasses: []
  3194. }),
  3195. globals.DictionaryTest);
  3196. smalltalk.addMethod(
  3197. smalltalk.method({
  3198. selector: "collectionValues",
  3199. protocol: 'fixture',
  3200. fn: function (){
  3201. var self=this;
  3202. var $1;
  3203. $1=[(1),(2),(3),(-4)];
  3204. return $1;
  3205. },
  3206. args: [],
  3207. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3208. messageSends: [],
  3209. referencedClasses: []
  3210. }),
  3211. globals.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "collectionWithDuplicates",
  3215. protocol: 'fixture',
  3216. fn: function (){
  3217. var self=this;
  3218. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3219. return smalltalk.withContext(function($ctx1) {
  3220. var $2,$3,$1;
  3221. $2=_st($Dictionary())._new();
  3222. _st($2)._at_put_((1),(1));
  3223. $ctx1.sendIdx["at:put:"]=1;
  3224. _st($2)._at_put_("a",(2));
  3225. $ctx1.sendIdx["at:put:"]=2;
  3226. _st($2)._at_put_(true,(3));
  3227. $ctx1.sendIdx["at:put:"]=3;
  3228. _st($2)._at_put_((4),(-4));
  3229. $ctx1.sendIdx["at:put:"]=4;
  3230. _st($2)._at_put_("b",(1));
  3231. $ctx1.sendIdx["at:put:"]=5;
  3232. _st($2)._at_put_((3),(3));
  3233. $ctx1.sendIdx["at:put:"]=6;
  3234. _st($2)._at_put_(false,(12));
  3235. $3=_st($2)._yourself();
  3236. $1=$3;
  3237. return $1;
  3238. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3239. args: [],
  3240. 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",
  3241. messageSends: ["at:put:", "new", "yourself"],
  3242. referencedClasses: ["Dictionary"]
  3243. }),
  3244. globals.DictionaryTest);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "collectionWithNewValue",
  3248. protocol: 'fixture',
  3249. fn: function (){
  3250. var self=this;
  3251. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3252. return smalltalk.withContext(function($ctx1) {
  3253. var $2,$3,$1;
  3254. $2=_st($Dictionary())._new();
  3255. _st($2)._at_put_((1),(1));
  3256. $ctx1.sendIdx["at:put:"]=1;
  3257. _st($2)._at_put_("a",(2));
  3258. $ctx1.sendIdx["at:put:"]=2;
  3259. _st($2)._at_put_(true,(3));
  3260. $ctx1.sendIdx["at:put:"]=3;
  3261. _st($2)._at_put_((1).__at((3)),(-4));
  3262. $ctx1.sendIdx["at:put:"]=4;
  3263. _st($2)._at_put_("new","N");
  3264. $3=_st($2)._yourself();
  3265. $1=$3;
  3266. return $1;
  3267. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3268. args: [],
  3269. 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",
  3270. messageSends: ["at:put:", "new", "@", "yourself"],
  3271. referencedClasses: ["Dictionary"]
  3272. }),
  3273. globals.DictionaryTest);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "sampleNewValueAsCollection",
  3277. protocol: 'fixture',
  3278. fn: function (){
  3279. var self=this;
  3280. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $2,$3,$1;
  3283. $2=_st($Dictionary())._new();
  3284. _st($2)._at_put_("new","N");
  3285. $3=_st($2)._yourself();
  3286. $1=$3;
  3287. return $1;
  3288. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3289. args: [],
  3290. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3291. messageSends: ["at:put:", "new", "yourself"],
  3292. referencedClasses: ["Dictionary"]
  3293. }),
  3294. globals.DictionaryTest);
  3295. smalltalk.addMethod(
  3296. smalltalk.method({
  3297. selector: "samplesDo:",
  3298. protocol: 'fixture',
  3299. fn: function (aBlock){
  3300. var self=this;
  3301. return smalltalk.withContext(function($ctx1) {
  3302. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3303. $ctx1.supercall = false;
  3304. _st(aBlock)._value_value_(true,(3));
  3305. $ctx1.sendIdx["value:value:"]=1;
  3306. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3307. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3308. args: ["aBlock"],
  3309. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3310. messageSends: ["samplesDo:", "value:value:", "@"],
  3311. referencedClasses: []
  3312. }),
  3313. globals.DictionaryTest);
  3314. smalltalk.addMethod(
  3315. smalltalk.method({
  3316. selector: "testAccessing",
  3317. protocol: 'tests',
  3318. fn: function (){
  3319. var self=this;
  3320. var d;
  3321. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3322. return smalltalk.withContext(function($ctx1) {
  3323. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3324. d=_st($Dictionary())._new();
  3325. _st(d)._at_put_("hello","world");
  3326. $ctx1.sendIdx["at:put:"]=1;
  3327. $1=_st(d)._at_("hello");
  3328. $ctx1.sendIdx["at:"]=1;
  3329. self._assert_equals_($1,"world");
  3330. $ctx1.sendIdx["assert:equals:"]=1;
  3331. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3332. return nil;
  3333. }));
  3334. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3335. self._assert_equals_($2,"world");
  3336. $ctx1.sendIdx["assert:equals:"]=2;
  3337. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3338. return nil;
  3339. }))).__eq("world"));
  3340. $ctx1.sendIdx["deny:"]=1;
  3341. $3=_st(d)._includesKey_("hello");
  3342. $ctx1.sendIdx["includesKey:"]=1;
  3343. self._assert_($3);
  3344. $ctx1.sendIdx["assert:"]=1;
  3345. $4=_st(d)._includesKey_("foo");
  3346. $ctx1.sendIdx["includesKey:"]=2;
  3347. self._deny_($4);
  3348. $ctx1.sendIdx["deny:"]=2;
  3349. _st(d)._at_put_((1),(2));
  3350. $ctx1.sendIdx["at:put:"]=2;
  3351. $5=_st(d)._at_((1));
  3352. $ctx1.sendIdx["at:"]=2;
  3353. self._assert_equals_($5,(2));
  3354. $ctx1.sendIdx["assert:equals:"]=3;
  3355. $6=d;
  3356. $7=(1).__at((3));
  3357. $ctx1.sendIdx["@"]=1;
  3358. _st($6)._at_put_($7,(3));
  3359. $9=d;
  3360. $10=(1).__at((3));
  3361. $ctx1.sendIdx["@"]=2;
  3362. $8=_st($9)._at_($10);
  3363. self._assert_equals_($8,(3));
  3364. $12=d;
  3365. $13=(1).__at((3));
  3366. $ctx1.sendIdx["@"]=3;
  3367. $11=_st($12)._includesKey_($13);
  3368. $ctx1.sendIdx["includesKey:"]=3;
  3369. self._assert_($11);
  3370. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3371. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3372. args: [],
  3373. 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)",
  3374. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3375. referencedClasses: ["Dictionary"]
  3376. }),
  3377. globals.DictionaryTest);
  3378. smalltalk.addMethod(
  3379. smalltalk.method({
  3380. selector: "testDynamicDictionaries",
  3381. protocol: 'tests',
  3382. fn: function (){
  3383. var self=this;
  3384. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3385. return smalltalk.withContext(function($ctx1) {
  3386. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3387. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3388. args: [],
  3389. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3390. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3391. referencedClasses: ["Dictionary"]
  3392. }),
  3393. globals.DictionaryTest);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "collectionClass",
  3397. protocol: 'fixture',
  3398. fn: function (){
  3399. var self=this;
  3400. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3401. return $Dictionary();
  3402. },
  3403. args: [],
  3404. source: "collectionClass\x0a\x09^ Dictionary",
  3405. messageSends: [],
  3406. referencedClasses: ["Dictionary"]
  3407. }),
  3408. globals.DictionaryTest.klass);
  3409. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "collection",
  3413. protocol: 'fixture',
  3414. fn: function (){
  3415. var self=this;
  3416. var $1;
  3417. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3418. return $1;
  3419. },
  3420. args: [],
  3421. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3422. messageSends: [],
  3423. referencedClasses: []
  3424. }),
  3425. globals.HashedCollectionTest);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "collectionKeys",
  3429. protocol: 'fixture',
  3430. fn: function (){
  3431. var self=this;
  3432. var $1;
  3433. $1=["b","a","c","d"];
  3434. return $1;
  3435. },
  3436. args: [],
  3437. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3438. messageSends: [],
  3439. referencedClasses: []
  3440. }),
  3441. globals.HashedCollectionTest);
  3442. smalltalk.addMethod(
  3443. smalltalk.method({
  3444. selector: "collectionOfPrintStrings",
  3445. protocol: 'fixture',
  3446. fn: function (){
  3447. var self=this;
  3448. var $1;
  3449. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3450. return $1;
  3451. },
  3452. args: [],
  3453. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3454. messageSends: [],
  3455. referencedClasses: []
  3456. }),
  3457. globals.HashedCollectionTest);
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "collectionSize",
  3461. protocol: 'fixture',
  3462. fn: function (){
  3463. var self=this;
  3464. return (4);
  3465. },
  3466. args: [],
  3467. source: "collectionSize\x0a\x09^ 4",
  3468. messageSends: [],
  3469. referencedClasses: []
  3470. }),
  3471. globals.HashedCollectionTest);
  3472. smalltalk.addMethod(
  3473. smalltalk.method({
  3474. selector: "collectionValues",
  3475. protocol: 'fixture',
  3476. fn: function (){
  3477. var self=this;
  3478. var $1;
  3479. $1=[(1),(2),(3),(-4)];
  3480. return $1;
  3481. },
  3482. args: [],
  3483. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3484. messageSends: [],
  3485. referencedClasses: []
  3486. }),
  3487. globals.HashedCollectionTest);
  3488. smalltalk.addMethod(
  3489. smalltalk.method({
  3490. selector: "collectionWithDuplicates",
  3491. protocol: 'fixture',
  3492. fn: function (){
  3493. var self=this;
  3494. var $1;
  3495. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3496. return $1;
  3497. },
  3498. args: [],
  3499. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3500. messageSends: [],
  3501. referencedClasses: []
  3502. }),
  3503. globals.HashedCollectionTest);
  3504. smalltalk.addMethod(
  3505. smalltalk.method({
  3506. selector: "collectionWithNewValue",
  3507. protocol: 'fixture',
  3508. fn: function (){
  3509. var self=this;
  3510. var $1;
  3511. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3512. return $1;
  3513. },
  3514. args: [],
  3515. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3516. messageSends: [],
  3517. referencedClasses: []
  3518. }),
  3519. globals.HashedCollectionTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "sampleNewValueAsCollection",
  3523. protocol: 'fixture',
  3524. fn: function (){
  3525. var self=this;
  3526. var $1;
  3527. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3528. return $1;
  3529. },
  3530. args: [],
  3531. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3532. messageSends: [],
  3533. referencedClasses: []
  3534. }),
  3535. globals.HashedCollectionTest);
  3536. smalltalk.addMethod(
  3537. smalltalk.method({
  3538. selector: "testDynamicDictionaries",
  3539. protocol: 'tests',
  3540. fn: function (){
  3541. var self=this;
  3542. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3543. return smalltalk.withContext(function($ctx1) {
  3544. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3545. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3546. args: [],
  3547. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3548. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3549. referencedClasses: ["HashedCollection"]
  3550. }),
  3551. globals.HashedCollectionTest);
  3552. smalltalk.addMethod(
  3553. smalltalk.method({
  3554. selector: "collectionClass",
  3555. protocol: 'fixture',
  3556. fn: function (){
  3557. var self=this;
  3558. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3559. return $HashedCollection();
  3560. },
  3561. args: [],
  3562. source: "collectionClass\x0a\x09^ HashedCollection",
  3563. messageSends: [],
  3564. referencedClasses: ["HashedCollection"]
  3565. }),
  3566. globals.HashedCollectionTest.klass);
  3567. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "collectionFirst",
  3571. protocol: 'fixture',
  3572. fn: function (){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. self._subclassResponsibility();
  3576. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3577. args: [],
  3578. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3579. messageSends: ["subclassResponsibility"],
  3580. referencedClasses: []
  3581. }),
  3582. globals.SequenceableCollectionTest);
  3583. smalltalk.addMethod(
  3584. smalltalk.method({
  3585. selector: "collectionFirstTwo",
  3586. protocol: 'fixture',
  3587. fn: function (){
  3588. var self=this;
  3589. return smalltalk.withContext(function($ctx1) {
  3590. self._subclassResponsibility();
  3591. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3592. args: [],
  3593. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3594. messageSends: ["subclassResponsibility"],
  3595. referencedClasses: []
  3596. }),
  3597. globals.SequenceableCollectionTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "collectionLast",
  3601. protocol: 'fixture',
  3602. fn: function (){
  3603. var self=this;
  3604. return smalltalk.withContext(function($ctx1) {
  3605. self._subclassResponsibility();
  3606. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3607. args: [],
  3608. source: "collectionLast\x0a\x09self subclassResponsibility",
  3609. messageSends: ["subclassResponsibility"],
  3610. referencedClasses: []
  3611. }),
  3612. globals.SequenceableCollectionTest);
  3613. smalltalk.addMethod(
  3614. smalltalk.method({
  3615. selector: "collectionLastTwo",
  3616. protocol: 'fixture',
  3617. fn: function (){
  3618. var self=this;
  3619. return smalltalk.withContext(function($ctx1) {
  3620. self._subclassResponsibility();
  3621. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3622. args: [],
  3623. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3624. messageSends: ["subclassResponsibility"],
  3625. referencedClasses: []
  3626. }),
  3627. globals.SequenceableCollectionTest);
  3628. smalltalk.addMethod(
  3629. smalltalk.method({
  3630. selector: "nonIndexesDo:",
  3631. protocol: 'fixture',
  3632. fn: function (aBlock){
  3633. var self=this;
  3634. return smalltalk.withContext(function($ctx1) {
  3635. _st(aBlock)._value_((0));
  3636. $ctx1.sendIdx["value:"]=1;
  3637. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3638. $ctx1.sendIdx["value:"]=2;
  3639. _st(aBlock)._value_("z");
  3640. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3641. args: ["aBlock"],
  3642. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3643. messageSends: ["value:", "+", "collectionSize"],
  3644. referencedClasses: []
  3645. }),
  3646. globals.SequenceableCollectionTest);
  3647. smalltalk.addMethod(
  3648. smalltalk.method({
  3649. selector: "samplesDo:",
  3650. protocol: 'fixture',
  3651. fn: function (aBlock){
  3652. var self=this;
  3653. return smalltalk.withContext(function($ctx1) {
  3654. _st(aBlock)._value_value_((1),self._collectionFirst());
  3655. $ctx1.sendIdx["value:value:"]=1;
  3656. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3657. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3658. args: ["aBlock"],
  3659. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3660. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3661. referencedClasses: []
  3662. }),
  3663. globals.SequenceableCollectionTest);
  3664. smalltalk.addMethod(
  3665. smalltalk.method({
  3666. selector: "testBeginsWith",
  3667. protocol: 'tests',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) {
  3671. var $2,$1,$4,$5,$3,$7,$6;
  3672. $2=self._collection();
  3673. $ctx1.sendIdx["collection"]=1;
  3674. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3675. $ctx1.sendIdx["beginsWith:"]=1;
  3676. self._assert_($1);
  3677. $ctx1.sendIdx["assert:"]=1;
  3678. $4=self._collection();
  3679. $ctx1.sendIdx["collection"]=2;
  3680. $5=self._collection();
  3681. $ctx1.sendIdx["collection"]=3;
  3682. $3=_st($4)._beginsWith_($5);
  3683. $ctx1.sendIdx["beginsWith:"]=2;
  3684. self._assert_($3);
  3685. $ctx1.sendIdx["assert:"]=2;
  3686. $7=self._collection();
  3687. $ctx1.sendIdx["collection"]=4;
  3688. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3689. $ctx1.sendIdx["beginsWith:"]=3;
  3690. self._assert_($6);
  3691. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3693. args: [],
  3694. 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)",
  3695. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3696. referencedClasses: []
  3697. }),
  3698. globals.SequenceableCollectionTest);
  3699. smalltalk.addMethod(
  3700. smalltalk.method({
  3701. selector: "testEndsWith",
  3702. protocol: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. var $2,$1,$4,$5,$3,$7,$6;
  3707. $2=self._collection();
  3708. $ctx1.sendIdx["collection"]=1;
  3709. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3710. $ctx1.sendIdx["endsWith:"]=1;
  3711. self._assert_($1);
  3712. $ctx1.sendIdx["assert:"]=1;
  3713. $4=self._collection();
  3714. $ctx1.sendIdx["collection"]=2;
  3715. $5=self._collection();
  3716. $ctx1.sendIdx["collection"]=3;
  3717. $3=_st($4)._endsWith_($5);
  3718. $ctx1.sendIdx["endsWith:"]=2;
  3719. self._assert_($3);
  3720. $ctx1.sendIdx["assert:"]=2;
  3721. $7=self._collection();
  3722. $ctx1.sendIdx["collection"]=4;
  3723. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3724. $ctx1.sendIdx["endsWith:"]=3;
  3725. self._assert_($6);
  3726. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3727. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3728. args: [],
  3729. 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)",
  3730. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3731. referencedClasses: []
  3732. }),
  3733. globals.SequenceableCollectionTest);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "testFirst",
  3737. protocol: 'tests',
  3738. fn: function (){
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3742. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3743. args: [],
  3744. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3745. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3746. referencedClasses: []
  3747. }),
  3748. globals.SequenceableCollectionTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "testFirstN",
  3752. protocol: 'tests',
  3753. fn: function (){
  3754. var self=this;
  3755. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3756. return smalltalk.withContext(function($ctx1) {
  3757. var $2,$1,$4,$3,$6,$5,$7;
  3758. $2=self._collection();
  3759. $ctx1.sendIdx["collection"]=1;
  3760. $1=_st($2)._first_((2));
  3761. $ctx1.sendIdx["first:"]=1;
  3762. self._assert_equals_($1,self._collectionFirstTwo());
  3763. $ctx1.sendIdx["assert:equals:"]=1;
  3764. $4=self._collection();
  3765. $ctx1.sendIdx["collection"]=2;
  3766. $3=_st($4)._first_((0));
  3767. $ctx1.sendIdx["first:"]=2;
  3768. self._assert_equals_($3,_st(self._collectionClass())._new());
  3769. $ctx1.sendIdx["assert:equals:"]=2;
  3770. $6=self._collection();
  3771. $ctx1.sendIdx["collection"]=3;
  3772. $5=_st($6)._first_(self._collectionSize());
  3773. $ctx1.sendIdx["first:"]=3;
  3774. $7=self._collection();
  3775. $ctx1.sendIdx["collection"]=4;
  3776. self._assert_equals_($5,$7);
  3777. self._should_raise_((function(){
  3778. return smalltalk.withContext(function($ctx2) {
  3779. return _st(self._collection())._first_((33));
  3780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3782. args: [],
  3783. 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",
  3784. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3785. referencedClasses: ["Error"]
  3786. }),
  3787. globals.SequenceableCollectionTest);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "testFourth",
  3791. protocol: 'tests',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. var $2,$1;
  3796. $2=self._collection();
  3797. $ctx1.sendIdx["collection"]=1;
  3798. $1=_st($2)._fourth();
  3799. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3800. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3801. args: [],
  3802. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3803. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3804. referencedClasses: []
  3805. }),
  3806. globals.SequenceableCollectionTest);
  3807. smalltalk.addMethod(
  3808. smalltalk.method({
  3809. selector: "testIndexOfStartingAt",
  3810. protocol: 'tests',
  3811. fn: function (){
  3812. var self=this;
  3813. var jsNull;
  3814. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3815. return smalltalk.withContext(function($ctx1) {
  3816. var $2,$1,$4,$3;
  3817. jsNull=_st($JSON())._parse_("null");
  3818. self._samplesDo_((function(index,value){
  3819. return smalltalk.withContext(function($ctx2) {
  3820. $2=self._collection();
  3821. $ctx2.sendIdx["collection"]=1;
  3822. $1=_st($2)._indexOf_startingAt_(value,(1));
  3823. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3824. self._assert_equals_($1,index);
  3825. $ctx2.sendIdx["assert:equals:"]=1;
  3826. $4=self._collection();
  3827. $ctx2.sendIdx["collection"]=2;
  3828. $3=_st($4)._indexOf_startingAt_(value,index);
  3829. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3830. self._assert_equals_($3,index);
  3831. $ctx2.sendIdx["assert:equals:"]=2;
  3832. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3833. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3834. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3835. args: [],
  3836. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3837. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3838. referencedClasses: ["JSON"]
  3839. }),
  3840. globals.SequenceableCollectionTest);
  3841. smalltalk.addMethod(
  3842. smalltalk.method({
  3843. selector: "testIndexOfStartingAtWithNull",
  3844. protocol: 'tests',
  3845. fn: function (){
  3846. var self=this;
  3847. var jsNull;
  3848. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3849. return smalltalk.withContext(function($ctx1) {
  3850. var $1,$2;
  3851. jsNull=_st($JSON())._parse_("null");
  3852. self._samplesDo_((function(index,value){
  3853. var collection;
  3854. return smalltalk.withContext(function($ctx2) {
  3855. collection=self._collection();
  3856. collection;
  3857. _st(collection)._at_put_(index,jsNull);
  3858. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3859. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3860. self._assert_equals_($1,index);
  3861. $ctx2.sendIdx["assert:equals:"]=1;
  3862. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3863. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3864. self._assert_equals_($2,index);
  3865. $ctx2.sendIdx["assert:equals:"]=2;
  3866. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3867. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3868. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3869. args: [],
  3870. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3871. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3872. referencedClasses: ["JSON"]
  3873. }),
  3874. globals.SequenceableCollectionTest);
  3875. smalltalk.addMethod(
  3876. smalltalk.method({
  3877. selector: "testLast",
  3878. protocol: 'tests',
  3879. fn: function (){
  3880. var self=this;
  3881. return smalltalk.withContext(function($ctx1) {
  3882. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3883. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3884. args: [],
  3885. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3886. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3887. referencedClasses: []
  3888. }),
  3889. globals.SequenceableCollectionTest);
  3890. smalltalk.addMethod(
  3891. smalltalk.method({
  3892. selector: "testLastN",
  3893. protocol: 'tests',
  3894. fn: function (){
  3895. var self=this;
  3896. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3897. return smalltalk.withContext(function($ctx1) {
  3898. var $2,$1,$4,$3,$6,$5,$7;
  3899. $2=self._collection();
  3900. $ctx1.sendIdx["collection"]=1;
  3901. $1=_st($2)._last_((2));
  3902. $ctx1.sendIdx["last:"]=1;
  3903. self._assert_equals_($1,self._collectionLastTwo());
  3904. $ctx1.sendIdx["assert:equals:"]=1;
  3905. $4=self._collection();
  3906. $ctx1.sendIdx["collection"]=2;
  3907. $3=_st($4)._last_((0));
  3908. $ctx1.sendIdx["last:"]=2;
  3909. self._assert_equals_($3,_st(self._collectionClass())._new());
  3910. $ctx1.sendIdx["assert:equals:"]=2;
  3911. $6=self._collection();
  3912. $ctx1.sendIdx["collection"]=3;
  3913. $5=_st($6)._last_(self._collectionSize());
  3914. $ctx1.sendIdx["last:"]=3;
  3915. $7=self._collection();
  3916. $ctx1.sendIdx["collection"]=4;
  3917. self._assert_equals_($5,$7);
  3918. self._should_raise_((function(){
  3919. return smalltalk.withContext(function($ctx2) {
  3920. return _st(self._collection())._last_((33));
  3921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3922. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3923. args: [],
  3924. 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",
  3925. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3926. referencedClasses: ["Error"]
  3927. }),
  3928. globals.SequenceableCollectionTest);
  3929. smalltalk.addMethod(
  3930. smalltalk.method({
  3931. selector: "testSecond",
  3932. protocol: 'tests',
  3933. fn: function (){
  3934. var self=this;
  3935. return smalltalk.withContext(function($ctx1) {
  3936. var $2,$1;
  3937. $2=self._collection();
  3938. $ctx1.sendIdx["collection"]=1;
  3939. $1=_st($2)._second();
  3940. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3941. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3942. args: [],
  3943. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3944. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3945. referencedClasses: []
  3946. }),
  3947. globals.SequenceableCollectionTest);
  3948. smalltalk.addMethod(
  3949. smalltalk.method({
  3950. selector: "testThird",
  3951. protocol: 'tests',
  3952. fn: function (){
  3953. var self=this;
  3954. return smalltalk.withContext(function($ctx1) {
  3955. var $2,$1;
  3956. $2=self._collection();
  3957. $ctx1.sendIdx["collection"]=1;
  3958. $1=_st($2)._third();
  3959. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3960. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3961. args: [],
  3962. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3963. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3964. referencedClasses: []
  3965. }),
  3966. globals.SequenceableCollectionTest);
  3967. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3968. smalltalk.addMethod(
  3969. smalltalk.method({
  3970. selector: "collection",
  3971. protocol: 'fixture',
  3972. fn: function (){
  3973. var self=this;
  3974. var $1;
  3975. $1=[(1), (2), (3), (-4)];
  3976. return $1;
  3977. },
  3978. args: [],
  3979. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3980. messageSends: [],
  3981. referencedClasses: []
  3982. }),
  3983. globals.ArrayTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "collectionFirst",
  3987. protocol: 'fixture',
  3988. fn: function (){
  3989. var self=this;
  3990. return (1);
  3991. },
  3992. args: [],
  3993. source: "collectionFirst\x0a\x09^ 1",
  3994. messageSends: [],
  3995. referencedClasses: []
  3996. }),
  3997. globals.ArrayTest);
  3998. smalltalk.addMethod(
  3999. smalltalk.method({
  4000. selector: "collectionFirstTwo",
  4001. protocol: 'fixture',
  4002. fn: function (){
  4003. var self=this;
  4004. var $1;
  4005. $1=[(1), (2)];
  4006. return $1;
  4007. },
  4008. args: [],
  4009. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. globals.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLast",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. return (-4);
  4021. },
  4022. args: [],
  4023. source: "collectionLast\x0a\x09^ -4",
  4024. messageSends: [],
  4025. referencedClasses: []
  4026. }),
  4027. globals.ArrayTest);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "collectionLastTwo",
  4031. protocol: 'fixture',
  4032. fn: function (){
  4033. var self=this;
  4034. var $1;
  4035. $1=[(3), (-4)];
  4036. return $1;
  4037. },
  4038. args: [],
  4039. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. globals.ArrayTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "collectionOfPrintStrings",
  4047. protocol: 'fixture',
  4048. fn: function (){
  4049. var self=this;
  4050. var $1;
  4051. $1=["1", "2", "3", "-4"];
  4052. return $1;
  4053. },
  4054. args: [],
  4055. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. globals.ArrayTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "collectionSize",
  4063. protocol: 'fixture',
  4064. fn: function (){
  4065. var self=this;
  4066. return (4);
  4067. },
  4068. args: [],
  4069. source: "collectionSize\x0a\x09^ 4",
  4070. messageSends: [],
  4071. referencedClasses: []
  4072. }),
  4073. globals.ArrayTest);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "collectionWithDuplicates",
  4077. protocol: 'fixture',
  4078. fn: function (){
  4079. var self=this;
  4080. var $1;
  4081. $1=["a", "b", "c", (1), (2), (1), "a"];
  4082. return $1;
  4083. },
  4084. args: [],
  4085. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4086. messageSends: [],
  4087. referencedClasses: []
  4088. }),
  4089. globals.ArrayTest);
  4090. smalltalk.addMethod(
  4091. smalltalk.method({
  4092. selector: "collectionWithNewValue",
  4093. protocol: 'fixture',
  4094. fn: function (){
  4095. var self=this;
  4096. var $1;
  4097. $1=[(1), (2), (3), (-4), "N"];
  4098. return $1;
  4099. },
  4100. args: [],
  4101. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4102. messageSends: [],
  4103. referencedClasses: []
  4104. }),
  4105. globals.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "sampleNewIndex",
  4109. protocol: 'fixture',
  4110. fn: function (){
  4111. var self=this;
  4112. return (5);
  4113. },
  4114. args: [],
  4115. source: "sampleNewIndex\x0a\x09^ 5",
  4116. messageSends: [],
  4117. referencedClasses: []
  4118. }),
  4119. globals.ArrayTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "samplesDo:",
  4123. protocol: 'fixture',
  4124. fn: function (aBlock){
  4125. var self=this;
  4126. return smalltalk.withContext(function($ctx1) {
  4127. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4128. $ctx1.supercall = false;
  4129. _st(aBlock)._value_value_((3),(3));
  4130. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4131. args: ["aBlock"],
  4132. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4133. messageSends: ["samplesDo:", "value:value:"],
  4134. referencedClasses: []
  4135. }),
  4136. globals.ArrayTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "testAdd",
  4140. protocol: 'tests',
  4141. fn: function (){
  4142. var self=this;
  4143. var array;
  4144. return smalltalk.withContext(function($ctx1) {
  4145. array=self._collection();
  4146. _st(array)._add_((6));
  4147. self._assert_equals_(_st(array)._last(),(6));
  4148. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4149. args: [],
  4150. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4151. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4152. referencedClasses: []
  4153. }),
  4154. globals.ArrayTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testAddFirst",
  4158. protocol: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. var $1,$2;
  4163. $1=self._collection();
  4164. _st($1)._addFirst_((0));
  4165. $2=_st($1)._yourself();
  4166. self._assert_equals_(_st($2)._first(),(0));
  4167. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4168. args: [],
  4169. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4170. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4171. referencedClasses: []
  4172. }),
  4173. globals.ArrayTest);
  4174. smalltalk.addMethod(
  4175. smalltalk.method({
  4176. selector: "testPrintString",
  4177. protocol: 'tests',
  4178. fn: function (){
  4179. var self=this;
  4180. var array;
  4181. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4182. return smalltalk.withContext(function($ctx1) {
  4183. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4184. array=_st($Array())._new();
  4185. $1=_st(array)._printString();
  4186. $ctx1.sendIdx["printString"]=1;
  4187. self._assert_equals_($1,"an Array ()");
  4188. $ctx1.sendIdx["assert:equals:"]=1;
  4189. $2=array;
  4190. _st($2)._add_((1));
  4191. $ctx1.sendIdx["add:"]=1;
  4192. $3=_st($2)._add_((3));
  4193. $ctx1.sendIdx["add:"]=2;
  4194. $4=_st(array)._printString();
  4195. $ctx1.sendIdx["printString"]=2;
  4196. self._assert_equals_($4,"an Array (1 3)");
  4197. $ctx1.sendIdx["assert:equals:"]=2;
  4198. _st(array)._add_("foo");
  4199. $5=_st(array)._printString();
  4200. $ctx1.sendIdx["printString"]=3;
  4201. self._assert_equals_($5,"an Array (1 3 'foo')");
  4202. $ctx1.sendIdx["assert:equals:"]=3;
  4203. $6=array;
  4204. _st($6)._remove_((1));
  4205. $ctx1.sendIdx["remove:"]=1;
  4206. $7=_st($6)._remove_((3));
  4207. $8=_st(array)._printString();
  4208. $ctx1.sendIdx["printString"]=4;
  4209. self._assert_equals_($8,"an Array ('foo')");
  4210. $ctx1.sendIdx["assert:equals:"]=4;
  4211. _st(array)._addLast_((3));
  4212. $ctx1.sendIdx["addLast:"]=1;
  4213. $9=_st(array)._printString();
  4214. $ctx1.sendIdx["printString"]=5;
  4215. self._assert_equals_($9,"an Array ('foo' 3)");
  4216. $ctx1.sendIdx["assert:equals:"]=5;
  4217. _st(array)._addLast_((3));
  4218. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4219. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4220. args: [],
  4221. 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)'.",
  4222. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4223. referencedClasses: ["Array"]
  4224. }),
  4225. globals.ArrayTest);
  4226. smalltalk.addMethod(
  4227. smalltalk.method({
  4228. selector: "testRemove",
  4229. protocol: 'tests',
  4230. fn: function (){
  4231. var self=this;
  4232. var array;
  4233. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4234. return smalltalk.withContext(function($ctx1) {
  4235. array=[(1), (2), (3), (4), (5)];
  4236. _st(array)._remove_((3));
  4237. $ctx1.sendIdx["remove:"]=1;
  4238. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4239. self._should_raise_((function(){
  4240. return smalltalk.withContext(function($ctx2) {
  4241. return _st(array)._remove_((3));
  4242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4243. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4244. args: [],
  4245. 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",
  4246. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4247. referencedClasses: ["Error"]
  4248. }),
  4249. globals.ArrayTest);
  4250. smalltalk.addMethod(
  4251. smalltalk.method({
  4252. selector: "testRemoveFromTo",
  4253. protocol: 'tests',
  4254. fn: function (){
  4255. var self=this;
  4256. return smalltalk.withContext(function($ctx1) {
  4257. var $1,$2;
  4258. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4259. $ctx1.sendIdx["removeFrom:to:"]=1;
  4260. self._assert_equals_($1,[(4)]);
  4261. $ctx1.sendIdx["assert:equals:"]=1;
  4262. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4263. $ctx1.sendIdx["removeFrom:to:"]=2;
  4264. self._assert_equals_($2,[(1), (4)]);
  4265. $ctx1.sendIdx["assert:equals:"]=2;
  4266. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4267. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4268. args: [],
  4269. 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)",
  4270. messageSends: ["assert:equals:", "removeFrom:to:"],
  4271. referencedClasses: []
  4272. }),
  4273. globals.ArrayTest);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "testRemoveIndex",
  4277. protocol: 'tests',
  4278. fn: function (){
  4279. var self=this;
  4280. return smalltalk.withContext(function($ctx1) {
  4281. var $1,$2;
  4282. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4283. $ctx1.sendIdx["removeIndex:"]=1;
  4284. self._assert_equals_($1,[(1), (3), (4)]);
  4285. $ctx1.sendIdx["assert:equals:"]=1;
  4286. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4287. $ctx1.sendIdx["removeIndex:"]=2;
  4288. self._assert_equals_($2,[(2), (3), (4)]);
  4289. $ctx1.sendIdx["assert:equals:"]=2;
  4290. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4292. args: [],
  4293. 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: #()",
  4294. messageSends: ["assert:equals:", "removeIndex:"],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testRemoveLast",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. var array;
  4305. return smalltalk.withContext(function($ctx1) {
  4306. array=[(1), (2)];
  4307. _st(array)._removeLast();
  4308. self._assert_equals_(_st(array)._last(),(1));
  4309. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4310. args: [],
  4311. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4312. messageSends: ["removeLast", "assert:equals:", "last"],
  4313. referencedClasses: []
  4314. }),
  4315. globals.ArrayTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "testReversed",
  4319. protocol: 'tests',
  4320. fn: function (){
  4321. var self=this;
  4322. var array;
  4323. return smalltalk.withContext(function($ctx1) {
  4324. array=[(5), (4), (3), (2), (1)];
  4325. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4326. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4327. args: [],
  4328. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4329. messageSends: ["assert:equals:", "reversed"],
  4330. referencedClasses: []
  4331. }),
  4332. globals.ArrayTest);
  4333. smalltalk.addMethod(
  4334. smalltalk.method({
  4335. selector: "testSort",
  4336. protocol: 'tests',
  4337. fn: function (){
  4338. var self=this;
  4339. var array;
  4340. return smalltalk.withContext(function($ctx1) {
  4341. array=[(10), (1), (5)];
  4342. _st(array)._sort();
  4343. self._assert_equals_(array,[(1), (5), (10)]);
  4344. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4345. args: [],
  4346. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4347. messageSends: ["sort", "assert:equals:"],
  4348. referencedClasses: []
  4349. }),
  4350. globals.ArrayTest);
  4351. smalltalk.addMethod(
  4352. smalltalk.method({
  4353. selector: "collectionClass",
  4354. protocol: 'fixture',
  4355. fn: function (){
  4356. var self=this;
  4357. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4358. return $Array();
  4359. },
  4360. args: [],
  4361. source: "collectionClass\x0a\x09^ Array",
  4362. messageSends: [],
  4363. referencedClasses: ["Array"]
  4364. }),
  4365. globals.ArrayTest.klass);
  4366. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "collection",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. return "helLo";
  4374. },
  4375. args: [],
  4376. source: "collection\x0a\x09^ 'helLo'",
  4377. messageSends: [],
  4378. referencedClasses: []
  4379. }),
  4380. globals.StringTest);
  4381. smalltalk.addMethod(
  4382. smalltalk.method({
  4383. selector: "collectionFirst",
  4384. protocol: 'fixture',
  4385. fn: function (){
  4386. var self=this;
  4387. return "h";
  4388. },
  4389. args: [],
  4390. source: "collectionFirst\x0a\x09^ 'h'",
  4391. messageSends: [],
  4392. referencedClasses: []
  4393. }),
  4394. globals.StringTest);
  4395. smalltalk.addMethod(
  4396. smalltalk.method({
  4397. selector: "collectionFirstTwo",
  4398. protocol: 'fixture',
  4399. fn: function (){
  4400. var self=this;
  4401. return "he";
  4402. },
  4403. args: [],
  4404. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4405. messageSends: [],
  4406. referencedClasses: []
  4407. }),
  4408. globals.StringTest);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "collectionLast",
  4412. protocol: 'fixture',
  4413. fn: function (){
  4414. var self=this;
  4415. return "o";
  4416. },
  4417. args: [],
  4418. source: "collectionLast\x0a\x09^ 'o'",
  4419. messageSends: [],
  4420. referencedClasses: []
  4421. }),
  4422. globals.StringTest);
  4423. smalltalk.addMethod(
  4424. smalltalk.method({
  4425. selector: "collectionLastTwo",
  4426. protocol: 'fixture',
  4427. fn: function (){
  4428. var self=this;
  4429. return "Lo";
  4430. },
  4431. args: [],
  4432. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4433. messageSends: [],
  4434. referencedClasses: []
  4435. }),
  4436. globals.StringTest);
  4437. smalltalk.addMethod(
  4438. smalltalk.method({
  4439. selector: "collectionOfPrintStrings",
  4440. protocol: 'fixture',
  4441. fn: function (){
  4442. var self=this;
  4443. return "'h''e''l''L''o'";
  4444. },
  4445. args: [],
  4446. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4447. messageSends: [],
  4448. referencedClasses: []
  4449. }),
  4450. globals.StringTest);
  4451. smalltalk.addMethod(
  4452. smalltalk.method({
  4453. selector: "collectionSize",
  4454. protocol: 'fixture',
  4455. fn: function (){
  4456. var self=this;
  4457. return (5);
  4458. },
  4459. args: [],
  4460. source: "collectionSize\x0a\x09^ 5",
  4461. messageSends: [],
  4462. referencedClasses: []
  4463. }),
  4464. globals.StringTest);
  4465. smalltalk.addMethod(
  4466. smalltalk.method({
  4467. selector: "collectionWithDuplicates",
  4468. protocol: 'fixture',
  4469. fn: function (){
  4470. var self=this;
  4471. return "abbaerte";
  4472. },
  4473. args: [],
  4474. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4475. messageSends: [],
  4476. referencedClasses: []
  4477. }),
  4478. globals.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "collectionWithNewValue",
  4482. protocol: 'fixture',
  4483. fn: function (){
  4484. var self=this;
  4485. return "helLoN";
  4486. },
  4487. args: [],
  4488. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4489. messageSends: [],
  4490. referencedClasses: []
  4491. }),
  4492. globals.StringTest);
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "sampleNewValueAsCollection",
  4496. protocol: 'fixture',
  4497. fn: function (){
  4498. var self=this;
  4499. return "N";
  4500. },
  4501. args: [],
  4502. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4503. messageSends: [],
  4504. referencedClasses: []
  4505. }),
  4506. globals.StringTest);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "samplesDo:",
  4510. protocol: 'fixture',
  4511. fn: function (aBlock){
  4512. var self=this;
  4513. return smalltalk.withContext(function($ctx1) {
  4514. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4515. $ctx1.supercall = false;
  4516. _st(aBlock)._value_value_((3),"l");
  4517. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4518. args: ["aBlock"],
  4519. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4520. messageSends: ["samplesDo:", "value:value:"],
  4521. referencedClasses: []
  4522. }),
  4523. globals.StringTest);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "testAddAll",
  4527. protocol: 'tests',
  4528. fn: function (){
  4529. var self=this;
  4530. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4531. return smalltalk.withContext(function($ctx1) {
  4532. var $1;
  4533. self._should_raise_((function(){
  4534. return smalltalk.withContext(function($ctx2) {
  4535. $1=self._collection();
  4536. $ctx2.sendIdx["collection"]=1;
  4537. return _st($1)._addAll_(self._collection());
  4538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4539. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4540. args: [],
  4541. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4542. messageSends: ["should:raise:", "addAll:", "collection"],
  4543. referencedClasses: ["Error"]
  4544. }),
  4545. globals.StringTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testAddRemove",
  4549. protocol: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4553. return smalltalk.withContext(function($ctx1) {
  4554. self._should_raise_((function(){
  4555. return smalltalk.withContext(function($ctx2) {
  4556. return "hello"._add_("a");
  4557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4558. $ctx1.sendIdx["should:raise:"]=1;
  4559. self._should_raise_((function(){
  4560. return smalltalk.withContext(function($ctx2) {
  4561. return "hello"._remove_("h");
  4562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4564. args: [],
  4565. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4566. messageSends: ["should:raise:", "add:", "remove:"],
  4567. referencedClasses: ["Error"]
  4568. }),
  4569. globals.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testAsArray",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4578. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4579. args: [],
  4580. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4581. messageSends: ["assert:equals:", "asArray"],
  4582. referencedClasses: []
  4583. }),
  4584. globals.StringTest);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "testAsLowerCase",
  4588. protocol: 'tests',
  4589. fn: function (){
  4590. var self=this;
  4591. return smalltalk.withContext(function($ctx1) {
  4592. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4593. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4594. args: [],
  4595. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4596. messageSends: ["assert:equals:", "asLowercase"],
  4597. referencedClasses: []
  4598. }),
  4599. globals.StringTest);
  4600. smalltalk.addMethod(
  4601. smalltalk.method({
  4602. selector: "testAsNumber",
  4603. protocol: 'tests',
  4604. fn: function (){
  4605. var self=this;
  4606. return smalltalk.withContext(function($ctx1) {
  4607. var $1,$2;
  4608. $1="3"._asNumber();
  4609. $ctx1.sendIdx["asNumber"]=1;
  4610. self._assert_equals_($1,(3));
  4611. $ctx1.sendIdx["assert:equals:"]=1;
  4612. $2="-3"._asNumber();
  4613. $ctx1.sendIdx["asNumber"]=2;
  4614. self._assert_equals_($2,(-3));
  4615. $ctx1.sendIdx["assert:equals:"]=2;
  4616. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4617. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4618. args: [],
  4619. 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.",
  4620. messageSends: ["assert:equals:", "asNumber"],
  4621. referencedClasses: []
  4622. }),
  4623. globals.StringTest);
  4624. smalltalk.addMethod(
  4625. smalltalk.method({
  4626. selector: "testAsUpperCase",
  4627. protocol: 'tests',
  4628. fn: function (){
  4629. var self=this;
  4630. return smalltalk.withContext(function($ctx1) {
  4631. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4632. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4633. args: [],
  4634. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4635. messageSends: ["assert:equals:", "asUppercase"],
  4636. referencedClasses: []
  4637. }),
  4638. globals.StringTest);
  4639. smalltalk.addMethod(
  4640. smalltalk.method({
  4641. selector: "testAsciiValue",
  4642. protocol: 'tests',
  4643. fn: function (){
  4644. var self=this;
  4645. var characterA,characterU;
  4646. return smalltalk.withContext(function($ctx1) {
  4647. var $1;
  4648. characterA="A";
  4649. characterU="U";
  4650. $1=_st(characterA)._asciiValue();
  4651. $ctx1.sendIdx["asciiValue"]=1;
  4652. self._assert_equals_($1,(65));
  4653. $ctx1.sendIdx["assert:equals:"]=1;
  4654. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4655. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4656. args: [],
  4657. 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",
  4658. messageSends: ["assert:equals:", "asciiValue"],
  4659. referencedClasses: []
  4660. }),
  4661. globals.StringTest);
  4662. smalltalk.addMethod(
  4663. smalltalk.method({
  4664. selector: "testAtIfAbsentPut",
  4665. protocol: 'tests',
  4666. fn: function (){
  4667. var self=this;
  4668. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4669. return smalltalk.withContext(function($ctx1) {
  4670. self._should_raise_((function(){
  4671. return smalltalk.withContext(function($ctx2) {
  4672. return "hello"._at_ifAbsentPut_((6),(function(){
  4673. return "a";
  4674. }));
  4675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4676. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4677. args: [],
  4678. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4679. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4680. referencedClasses: ["Error"]
  4681. }),
  4682. globals.StringTest);
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "testAtPut",
  4686. protocol: 'tests',
  4687. fn: function (){
  4688. var self=this;
  4689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4690. return smalltalk.withContext(function($ctx1) {
  4691. self._should_raise_((function(){
  4692. return smalltalk.withContext(function($ctx2) {
  4693. return "hello"._at_put_((1),"a");
  4694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4695. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4696. args: [],
  4697. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4698. messageSends: ["should:raise:", "at:put:"],
  4699. referencedClasses: ["Error"]
  4700. }),
  4701. globals.StringTest);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "testCapitalized",
  4705. protocol: 'tests',
  4706. fn: function (){
  4707. var self=this;
  4708. return smalltalk.withContext(function($ctx1) {
  4709. var $1,$2,$3;
  4710. $1="test"._capitalized();
  4711. $ctx1.sendIdx["capitalized"]=1;
  4712. self._assert_equals_($1,"Test");
  4713. $ctx1.sendIdx["assert:equals:"]=1;
  4714. $2="Test"._capitalized();
  4715. $ctx1.sendIdx["capitalized"]=2;
  4716. self._assert_equals_($2,"Test");
  4717. $ctx1.sendIdx["assert:equals:"]=2;
  4718. self._assert_equals_(""._capitalized(),"");
  4719. $ctx1.sendIdx["assert:equals:"]=3;
  4720. $3="Test"._isCapitalized();
  4721. $ctx1.sendIdx["isCapitalized"]=1;
  4722. self._assert_equals_($3,true);
  4723. $ctx1.sendIdx["assert:equals:"]=4;
  4724. self._assert_equals_("test"._isCapitalized(),false);
  4725. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4726. args: [],
  4727. 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.",
  4728. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4729. referencedClasses: []
  4730. }),
  4731. globals.StringTest);
  4732. smalltalk.addMethod(
  4733. smalltalk.method({
  4734. selector: "testCharCodeAt",
  4735. protocol: 'tests',
  4736. fn: function (){
  4737. var self=this;
  4738. return smalltalk.withContext(function($ctx1) {
  4739. var $1,$2,$3,$4,$5;
  4740. $1="jackie"._charCodeAt_((1));
  4741. $ctx1.sendIdx["charCodeAt:"]=1;
  4742. self._assert_equals_($1,(106));
  4743. $ctx1.sendIdx["assert:equals:"]=1;
  4744. $2="jackie"._charCodeAt_((2));
  4745. $ctx1.sendIdx["charCodeAt:"]=2;
  4746. self._assert_equals_($2,(97));
  4747. $ctx1.sendIdx["assert:equals:"]=2;
  4748. $3="jackie"._charCodeAt_((3));
  4749. $ctx1.sendIdx["charCodeAt:"]=3;
  4750. self._assert_equals_($3,(99));
  4751. $ctx1.sendIdx["assert:equals:"]=3;
  4752. $4="jackie"._charCodeAt_((4));
  4753. $ctx1.sendIdx["charCodeAt:"]=4;
  4754. self._assert_equals_($4,(107));
  4755. $ctx1.sendIdx["assert:equals:"]=4;
  4756. $5="jackie"._charCodeAt_((5));
  4757. $ctx1.sendIdx["charCodeAt:"]=5;
  4758. self._assert_equals_($5,(105));
  4759. $ctx1.sendIdx["assert:equals:"]=5;
  4760. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4761. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4762. args: [],
  4763. 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",
  4764. messageSends: ["assert:equals:", "charCodeAt:"],
  4765. referencedClasses: []
  4766. }),
  4767. globals.StringTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "testCopyFromTo",
  4771. protocol: 'tests',
  4772. fn: function (){
  4773. var self=this;
  4774. return smalltalk.withContext(function($ctx1) {
  4775. var $1;
  4776. $1="jackie"._copyFrom_to_((1),(3));
  4777. $ctx1.sendIdx["copyFrom:to:"]=1;
  4778. self._assert_equals_($1,"jac");
  4779. $ctx1.sendIdx["assert:equals:"]=1;
  4780. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4781. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4782. args: [],
  4783. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4784. messageSends: ["assert:equals:", "copyFrom:to:"],
  4785. referencedClasses: []
  4786. }),
  4787. globals.StringTest);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "testCopyWithoutAll",
  4791. protocol: 'tests',
  4792. fn: function (){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4797. args: [],
  4798. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4799. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4800. referencedClasses: []
  4801. }),
  4802. globals.StringTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testEquality",
  4806. protocol: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1,$2,$3;
  4811. self._assert_equals_("hello","hello");
  4812. $ctx1.sendIdx["assert:equals:"]=1;
  4813. $1="hello".__eq("world");
  4814. $ctx1.sendIdx["="]=1;
  4815. self._deny_($1);
  4816. $ctx1.sendIdx["deny:"]=1;
  4817. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4818. })));
  4819. $ctx1.sendIdx["="]=2;
  4820. self._deny_($2);
  4821. $ctx1.sendIdx["deny:"]=2;
  4822. $3="hello"._yourself();
  4823. $ctx1.sendIdx["yourself"]=1;
  4824. self._assert_equals_("hello",$3);
  4825. $ctx1.sendIdx["assert:equals:"]=2;
  4826. self._assert_equals_("hello"._yourself(),"hello");
  4827. self._deny_("".__eq((0)));
  4828. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4829. args: [],
  4830. 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",
  4831. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4832. referencedClasses: []
  4833. }),
  4834. globals.StringTest);
  4835. smalltalk.addMethod(
  4836. smalltalk.method({
  4837. selector: "testIdentity",
  4838. protocol: 'tests',
  4839. fn: function (){
  4840. var self=this;
  4841. return smalltalk.withContext(function($ctx1) {
  4842. var $1,$2,$4,$3,$5;
  4843. $1="hello".__eq_eq("hello");
  4844. $ctx1.sendIdx["=="]=1;
  4845. self._assert_($1);
  4846. $ctx1.sendIdx["assert:"]=1;
  4847. $2="hello".__eq_eq("world");
  4848. $ctx1.sendIdx["=="]=2;
  4849. self._deny_($2);
  4850. $ctx1.sendIdx["deny:"]=1;
  4851. $4="hello"._yourself();
  4852. $ctx1.sendIdx["yourself"]=1;
  4853. $3="hello".__eq_eq($4);
  4854. $ctx1.sendIdx["=="]=3;
  4855. self._assert_($3);
  4856. $ctx1.sendIdx["assert:"]=2;
  4857. $5=_st("hello"._yourself()).__eq_eq("hello");
  4858. $ctx1.sendIdx["=="]=4;
  4859. self._assert_($5);
  4860. self._deny_("".__eq_eq((0)));
  4861. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4862. args: [],
  4863. 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",
  4864. messageSends: ["assert:", "==", "deny:", "yourself"],
  4865. referencedClasses: []
  4866. }),
  4867. globals.StringTest);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testIdentityHash",
  4871. protocol: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. return smalltalk.withContext(function($ctx1) {
  4875. var $1,$2,$4,$3;
  4876. $1="foo"._identityHash();
  4877. $ctx1.sendIdx["identityHash"]=1;
  4878. $2="foo"._identityHash();
  4879. $ctx1.sendIdx["identityHash"]=2;
  4880. self._assert_equals_($1,$2);
  4881. $4="foo"._identityHash();
  4882. $ctx1.sendIdx["identityHash"]=3;
  4883. $3=_st($4).__eq("bar"._identityHash());
  4884. self._deny_($3);
  4885. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4886. args: [],
  4887. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4888. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4889. referencedClasses: []
  4890. }),
  4891. globals.StringTest);
  4892. smalltalk.addMethod(
  4893. smalltalk.method({
  4894. selector: "testIncludesSubString",
  4895. protocol: 'tests',
  4896. fn: function (){
  4897. var self=this;
  4898. return smalltalk.withContext(function($ctx1) {
  4899. var $1;
  4900. $1="amber"._includesSubString_("ber");
  4901. $ctx1.sendIdx["includesSubString:"]=1;
  4902. self._assert_($1);
  4903. self._deny_("amber"._includesSubString_("zork"));
  4904. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4905. args: [],
  4906. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4907. messageSends: ["assert:", "includesSubString:", "deny:"],
  4908. referencedClasses: []
  4909. }),
  4910. globals.StringTest);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "testIndexOfStartingAtWithNull",
  4914. protocol: 'tests',
  4915. fn: function (){
  4916. var self=this;
  4917. return self},
  4918. args: [],
  4919. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4920. messageSends: [],
  4921. referencedClasses: []
  4922. }),
  4923. globals.StringTest);
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "testIndexOfWithNull",
  4927. protocol: 'tests',
  4928. fn: function (){
  4929. var self=this;
  4930. return self},
  4931. args: [],
  4932. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4933. messageSends: [],
  4934. referencedClasses: []
  4935. }),
  4936. globals.StringTest);
  4937. smalltalk.addMethod(
  4938. smalltalk.method({
  4939. selector: "testIsVowel",
  4940. protocol: 'tests',
  4941. fn: function (){
  4942. var self=this;
  4943. var vowel,consonant;
  4944. return smalltalk.withContext(function($ctx1) {
  4945. var $1;
  4946. vowel="u";
  4947. consonant="z";
  4948. $1=_st(vowel)._isVowel();
  4949. $ctx1.sendIdx["isVowel"]=1;
  4950. self._assert_equals_($1,true);
  4951. $ctx1.sendIdx["assert:equals:"]=1;
  4952. self._assert_equals_(_st(consonant)._isVowel(),false);
  4953. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4954. args: [],
  4955. 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",
  4956. messageSends: ["assert:equals:", "isVowel"],
  4957. referencedClasses: []
  4958. }),
  4959. globals.StringTest);
  4960. smalltalk.addMethod(
  4961. smalltalk.method({
  4962. selector: "testJoin",
  4963. protocol: 'tests',
  4964. fn: function (){
  4965. var self=this;
  4966. return smalltalk.withContext(function($ctx1) {
  4967. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4968. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4969. args: [],
  4970. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4971. messageSends: ["assert:equals:", "join:"],
  4972. referencedClasses: []
  4973. }),
  4974. globals.StringTest);
  4975. smalltalk.addMethod(
  4976. smalltalk.method({
  4977. selector: "testRemoveAll",
  4978. protocol: 'tests',
  4979. fn: function (){
  4980. var self=this;
  4981. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4982. return smalltalk.withContext(function($ctx1) {
  4983. self._should_raise_((function(){
  4984. return smalltalk.withContext(function($ctx2) {
  4985. return _st(self._collection())._removeAll();
  4986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4987. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4988. args: [],
  4989. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4990. messageSends: ["should:raise:", "removeAll", "collection"],
  4991. referencedClasses: ["Error"]
  4992. }),
  4993. globals.StringTest);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "testReversed",
  4997. protocol: 'tests',
  4998. fn: function (){
  4999. var self=this;
  5000. return smalltalk.withContext(function($ctx1) {
  5001. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5002. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  5003. args: [],
  5004. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5005. messageSends: ["assert:equals:", "reversed"],
  5006. referencedClasses: []
  5007. }),
  5008. globals.StringTest);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "testStreamContents",
  5012. protocol: 'tests',
  5013. fn: function (){
  5014. var self=this;
  5015. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5016. return smalltalk.withContext(function($ctx1) {
  5017. var $1;
  5018. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5019. return smalltalk.withContext(function($ctx2) {
  5020. _st(aStream)._nextPutAll_("hello");
  5021. $ctx2.sendIdx["nextPutAll:"]=1;
  5022. _st(aStream)._space();
  5023. $1=_st(aStream)._nextPutAll_("world");
  5024. return $1;
  5025. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5026. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  5027. args: [],
  5028. 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'",
  5029. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5030. referencedClasses: ["String"]
  5031. }),
  5032. globals.StringTest);
  5033. smalltalk.addMethod(
  5034. smalltalk.method({
  5035. selector: "testSubStrings",
  5036. protocol: 'tests',
  5037. fn: function (){
  5038. var self=this;
  5039. return smalltalk.withContext(function($ctx1) {
  5040. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5041. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5042. args: [],
  5043. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5044. messageSends: ["assert:equals:", "subStrings:"],
  5045. referencedClasses: []
  5046. }),
  5047. globals.StringTest);
  5048. smalltalk.addMethod(
  5049. smalltalk.method({
  5050. selector: "testTrim",
  5051. protocol: 'tests',
  5052. fn: function (){
  5053. var self=this;
  5054. return smalltalk.withContext(function($ctx1) {
  5055. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5056. $ctx1.sendIdx["assert:equals:"]=1;
  5057. self._assert_equals_("jackie "._trimRight(),"jackie");
  5058. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5059. args: [],
  5060. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5061. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5062. referencedClasses: []
  5063. }),
  5064. globals.StringTest);
  5065. smalltalk.addMethod(
  5066. smalltalk.method({
  5067. selector: "testValue",
  5068. protocol: 'tests',
  5069. fn: function (){
  5070. var self=this;
  5071. return smalltalk.withContext(function($ctx1) {
  5072. self._assert_equals_("asString"._value_((1)),"1");
  5073. $ctx1.sendIdx["assert:equals:"]=1;
  5074. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5075. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5076. args: [],
  5077. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  5078. messageSends: ["assert:equals:", "value:", "collect:"],
  5079. referencedClasses: []
  5080. }),
  5081. globals.StringTest);
  5082. smalltalk.addMethod(
  5083. smalltalk.method({
  5084. selector: "collectionClass",
  5085. protocol: 'fixture',
  5086. fn: function (){
  5087. var self=this;
  5088. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5089. return $String();
  5090. },
  5091. args: [],
  5092. source: "collectionClass\x0a\x09^ String",
  5093. messageSends: [],
  5094. referencedClasses: ["String"]
  5095. }),
  5096. globals.StringTest.klass);
  5097. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5098. smalltalk.addMethod(
  5099. smalltalk.method({
  5100. selector: "collection",
  5101. protocol: 'fixture',
  5102. fn: function (){
  5103. var self=this;
  5104. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5105. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5106. return smalltalk.withContext(function($ctx1) {
  5107. var $2,$3,$1;
  5108. $2=_st($Set())._new();
  5109. _st($2)._add_($Smalltalk());
  5110. $ctx1.sendIdx["add:"]=1;
  5111. _st($2)._add_(nil);
  5112. $ctx1.sendIdx["add:"]=2;
  5113. _st($2)._add_((3).__at((3)));
  5114. $ctx1.sendIdx["add:"]=3;
  5115. _st($2)._add_(false);
  5116. $3=_st($2)._yourself();
  5117. $1=$3;
  5118. return $1;
  5119. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5120. args: [],
  5121. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5122. messageSends: ["add:", "new", "@", "yourself"],
  5123. referencedClasses: ["Set", "Smalltalk"]
  5124. }),
  5125. globals.SetTest);
  5126. smalltalk.addMethod(
  5127. smalltalk.method({
  5128. selector: "collectionOfPrintStrings",
  5129. protocol: 'fixture',
  5130. fn: function (){
  5131. var self=this;
  5132. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5133. return smalltalk.withContext(function($ctx1) {
  5134. var $2,$3,$1;
  5135. $2=_st($Set())._new();
  5136. _st($2)._add_("a SmalltalkImage");
  5137. $ctx1.sendIdx["add:"]=1;
  5138. _st($2)._add_("nil");
  5139. $ctx1.sendIdx["add:"]=2;
  5140. _st($2)._add_("3@3");
  5141. $ctx1.sendIdx["add:"]=3;
  5142. _st($2)._add_("false");
  5143. $3=_st($2)._yourself();
  5144. $1=$3;
  5145. return $1;
  5146. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5147. args: [],
  5148. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5149. messageSends: ["add:", "new", "yourself"],
  5150. referencedClasses: ["Set"]
  5151. }),
  5152. globals.SetTest);
  5153. smalltalk.addMethod(
  5154. smalltalk.method({
  5155. selector: "collectionSize",
  5156. protocol: 'fixture',
  5157. fn: function (){
  5158. var self=this;
  5159. return (4);
  5160. },
  5161. args: [],
  5162. source: "collectionSize\x0a\x09^ 4",
  5163. messageSends: [],
  5164. referencedClasses: []
  5165. }),
  5166. globals.SetTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "collectionWithDuplicates",
  5170. protocol: 'fixture',
  5171. fn: function (){
  5172. var self=this;
  5173. return smalltalk.withContext(function($ctx1) {
  5174. var $2,$3,$1;
  5175. $2=self._collection();
  5176. _st($2)._add_((0));
  5177. $3=_st($2)._yourself();
  5178. $1=$3;
  5179. return $1;
  5180. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5181. args: [],
  5182. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5183. messageSends: ["add:", "collection", "yourself"],
  5184. referencedClasses: []
  5185. }),
  5186. globals.SetTest);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "collectionWithNewValue",
  5190. protocol: 'fixture',
  5191. fn: function (){
  5192. var self=this;
  5193. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5194. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5195. return smalltalk.withContext(function($ctx1) {
  5196. var $2,$3,$1;
  5197. $2=_st($Set())._new();
  5198. _st($2)._add_($Smalltalk());
  5199. $ctx1.sendIdx["add:"]=1;
  5200. _st($2)._add_(nil);
  5201. $ctx1.sendIdx["add:"]=2;
  5202. _st($2)._add_((3).__at((3)));
  5203. $ctx1.sendIdx["add:"]=3;
  5204. _st($2)._add_("N");
  5205. $ctx1.sendIdx["add:"]=4;
  5206. _st($2)._add_(false);
  5207. $3=_st($2)._yourself();
  5208. $1=$3;
  5209. return $1;
  5210. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5211. args: [],
  5212. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5213. messageSends: ["add:", "new", "@", "yourself"],
  5214. referencedClasses: ["Set", "Smalltalk"]
  5215. }),
  5216. globals.SetTest);
  5217. smalltalk.addMethod(
  5218. smalltalk.method({
  5219. selector: "testAddAll",
  5220. protocol: 'tests',
  5221. fn: function (){
  5222. var self=this;
  5223. return smalltalk.withContext(function($ctx1) {
  5224. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5225. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5226. $ctx1.supercall = false;
  5227. $2=self._collection();
  5228. $ctx1.sendIdx["collection"]=1;
  5229. $3=$2;
  5230. $4=self._collection();
  5231. $ctx1.sendIdx["collection"]=2;
  5232. _st($3)._addAll_($4);
  5233. $ctx1.sendIdx["addAll:"]=1;
  5234. $5=_st($2)._yourself();
  5235. $ctx1.sendIdx["yourself"]=1;
  5236. $1=$5;
  5237. $6=self._collection();
  5238. $ctx1.sendIdx["collection"]=3;
  5239. self._assert_equals_($1,$6);
  5240. $ctx1.sendIdx["assert:equals:"]=1;
  5241. $8=self._collection();
  5242. $ctx1.sendIdx["collection"]=4;
  5243. $9=$8;
  5244. $10=self._collectionWithNewValue();
  5245. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5246. _st($9)._addAll_($10);
  5247. $ctx1.sendIdx["addAll:"]=2;
  5248. $11=_st($8)._yourself();
  5249. $ctx1.sendIdx["yourself"]=2;
  5250. $7=$11;
  5251. $12=self._collectionWithNewValue();
  5252. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5253. self._assert_equals_($7,$12);
  5254. $ctx1.sendIdx["assert:equals:"]=2;
  5255. $14=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5257. _st($14)._addAll_(self._collection());
  5258. $15=_st($14)._yourself();
  5259. $13=$15;
  5260. self._assert_equals_($13,self._collectionWithNewValue());
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5262. args: [],
  5263. 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",
  5264. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5265. referencedClasses: []
  5266. }),
  5267. globals.SetTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "testAddRemove",
  5271. protocol: 'tests',
  5272. fn: function (){
  5273. var self=this;
  5274. var set;
  5275. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5276. return smalltalk.withContext(function($ctx1) {
  5277. var $1,$2;
  5278. set=_st($Set())._new();
  5279. self._assert_(_st(set)._isEmpty());
  5280. $ctx1.sendIdx["assert:"]=1;
  5281. _st(set)._add_((3));
  5282. $ctx1.sendIdx["add:"]=1;
  5283. $1=_st(set)._includes_((3));
  5284. $ctx1.sendIdx["includes:"]=1;
  5285. self._assert_($1);
  5286. $ctx1.sendIdx["assert:"]=2;
  5287. _st(set)._add_((5));
  5288. $2=_st(set)._includes_((5));
  5289. $ctx1.sendIdx["includes:"]=2;
  5290. self._assert_($2);
  5291. _st(set)._remove_((3));
  5292. self._deny_(_st(set)._includes_((3)));
  5293. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5294. args: [],
  5295. 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)",
  5296. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5297. referencedClasses: ["Set"]
  5298. }),
  5299. globals.SetTest);
  5300. smalltalk.addMethod(
  5301. smalltalk.method({
  5302. selector: "testAt",
  5303. protocol: 'tests',
  5304. fn: function (){
  5305. var self=this;
  5306. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5307. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5308. return smalltalk.withContext(function($ctx1) {
  5309. self._should_raise_((function(){
  5310. return smalltalk.withContext(function($ctx2) {
  5311. return _st(_st($Set())._new())._at_put_((1),(2));
  5312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5313. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5314. args: [],
  5315. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5316. messageSends: ["should:raise:", "at:put:", "new"],
  5317. referencedClasses: ["Set", "Error"]
  5318. }),
  5319. globals.SetTest);
  5320. smalltalk.addMethod(
  5321. smalltalk.method({
  5322. selector: "testCollect",
  5323. protocol: 'tests',
  5324. fn: function (){
  5325. var self=this;
  5326. return smalltalk.withContext(function($ctx1) {
  5327. var $2,$1;
  5328. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5329. $ctx1.supercall = false;
  5330. $2=[(5), (6), (8)]._asSet();
  5331. $ctx1.sendIdx["asSet"]=1;
  5332. $1=_st($2)._collect_((function(x){
  5333. return smalltalk.withContext(function($ctx2) {
  5334. return _st(x).__backslash_backslash((3));
  5335. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5336. self._assert_equals_($1,[(0), (2)]._asSet());
  5337. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5338. args: [],
  5339. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5340. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5341. referencedClasses: []
  5342. }),
  5343. globals.SetTest);
  5344. smalltalk.addMethod(
  5345. smalltalk.method({
  5346. selector: "testComma",
  5347. protocol: 'tests',
  5348. fn: function (){
  5349. var self=this;
  5350. return smalltalk.withContext(function($ctx1) {
  5351. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5352. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5353. $ctx1.supercall = false;
  5354. $2=self._collection();
  5355. $ctx1.sendIdx["collection"]=1;
  5356. $3=self._collection();
  5357. $ctx1.sendIdx["collection"]=2;
  5358. $1=_st($2).__comma($3);
  5359. $ctx1.sendIdx[","]=1;
  5360. $4=self._collection();
  5361. $ctx1.sendIdx["collection"]=3;
  5362. self._assert_equals_($1,$4);
  5363. $ctx1.sendIdx["assert:equals:"]=1;
  5364. $6=self._collection();
  5365. $ctx1.sendIdx["collection"]=4;
  5366. $7=self._collectionWithNewValue();
  5367. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5368. $5=_st($6).__comma($7);
  5369. $ctx1.sendIdx[","]=2;
  5370. $8=self._collectionWithNewValue();
  5371. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5372. self._assert_equals_($5,$8);
  5373. $ctx1.sendIdx["assert:equals:"]=2;
  5374. $10=self._collectionWithNewValue();
  5375. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5376. $9=_st($10).__comma(self._collection());
  5377. self._assert_equals_($9,self._collectionWithNewValue());
  5378. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5379. args: [],
  5380. 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",
  5381. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5382. referencedClasses: []
  5383. }),
  5384. globals.SetTest);
  5385. smalltalk.addMethod(
  5386. smalltalk.method({
  5387. selector: "testComparing",
  5388. protocol: 'tests',
  5389. fn: function (){
  5390. var self=this;
  5391. return smalltalk.withContext(function($ctx1) {
  5392. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5393. $1=[(0), (2)]._asSet();
  5394. $ctx1.sendIdx["asSet"]=1;
  5395. $2=[(0), (2)]._asSet();
  5396. $ctx1.sendIdx["asSet"]=2;
  5397. self._assert_equals_($1,$2);
  5398. $ctx1.sendIdx["assert:equals:"]=1;
  5399. $3=[(2), (0)]._asSet();
  5400. $ctx1.sendIdx["asSet"]=3;
  5401. $4=[(0), (2)]._asSet();
  5402. $ctx1.sendIdx["asSet"]=4;
  5403. self._assert_equals_($3,$4);
  5404. $6=[(0), (2), (3)]._asSet();
  5405. $ctx1.sendIdx["asSet"]=5;
  5406. $7=[(0), (2)]._asSet();
  5407. $ctx1.sendIdx["asSet"]=6;
  5408. $5=_st($6).__eq($7);
  5409. $ctx1.sendIdx["="]=1;
  5410. self._deny_($5);
  5411. $ctx1.sendIdx["deny:"]=1;
  5412. $9=[(1), (2)]._asSet();
  5413. $ctx1.sendIdx["asSet"]=7;
  5414. $8=_st($9).__eq([(0), (2)]._asSet());
  5415. self._deny_($8);
  5416. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5417. args: [],
  5418. 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",
  5419. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5420. referencedClasses: []
  5421. }),
  5422. globals.SetTest);
  5423. smalltalk.addMethod(
  5424. smalltalk.method({
  5425. selector: "testPrintString",
  5426. protocol: 'tests',
  5427. fn: function (){
  5428. var self=this;
  5429. var set;
  5430. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5431. return smalltalk.withContext(function($ctx1) {
  5432. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5433. set=_st($Set())._new();
  5434. $1=_st(set)._printString();
  5435. $ctx1.sendIdx["printString"]=1;
  5436. self._assert_equals_($1,"a Set ()");
  5437. $ctx1.sendIdx["assert:equals:"]=1;
  5438. $2=set;
  5439. _st($2)._add_((1));
  5440. $ctx1.sendIdx["add:"]=1;
  5441. $3=_st($2)._add_((3));
  5442. $ctx1.sendIdx["add:"]=2;
  5443. $4=_st(set)._printString();
  5444. $ctx1.sendIdx["printString"]=2;
  5445. self._assert_equals_($4,"a Set (1 3)");
  5446. $ctx1.sendIdx["assert:equals:"]=2;
  5447. _st(set)._add_("foo");
  5448. $ctx1.sendIdx["add:"]=3;
  5449. $5=_st(set)._printString();
  5450. $ctx1.sendIdx["printString"]=3;
  5451. self._assert_equals_($5,"a Set (1 3 'foo')");
  5452. $ctx1.sendIdx["assert:equals:"]=3;
  5453. $6=set;
  5454. _st($6)._remove_((1));
  5455. $ctx1.sendIdx["remove:"]=1;
  5456. $7=_st($6)._remove_((3));
  5457. $8=_st(set)._printString();
  5458. $ctx1.sendIdx["printString"]=4;
  5459. self._assert_equals_($8,"a Set ('foo')");
  5460. $ctx1.sendIdx["assert:equals:"]=4;
  5461. _st(set)._add_((3));
  5462. $ctx1.sendIdx["add:"]=4;
  5463. $9=_st(set)._printString();
  5464. $ctx1.sendIdx["printString"]=5;
  5465. self._assert_equals_($9,"a Set (3 'foo')");
  5466. $ctx1.sendIdx["assert:equals:"]=5;
  5467. _st(set)._add_((3));
  5468. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5469. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5470. args: [],
  5471. 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 (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5472. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5473. referencedClasses: ["Set"]
  5474. }),
  5475. globals.SetTest);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "testUnboxedObjects",
  5479. protocol: 'tests',
  5480. fn: function (){
  5481. var self=this;
  5482. return smalltalk.withContext(function($ctx1) {
  5483. var $4,$3,$2,$1;
  5484. $4="foo"._yourself();
  5485. $ctx1.sendIdx["yourself"]=1;
  5486. $3=[$4,"foo"._yourself()];
  5487. $2=_st($3)._asSet();
  5488. $1=_st($2)._asArray();
  5489. self._assert_equals_($1,["foo"]);
  5490. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5491. args: [],
  5492. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5493. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5494. referencedClasses: []
  5495. }),
  5496. globals.SetTest);
  5497. smalltalk.addMethod(
  5498. smalltalk.method({
  5499. selector: "testUnicity",
  5500. protocol: 'tests',
  5501. fn: function (){
  5502. var self=this;
  5503. var set;
  5504. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5505. return smalltalk.withContext(function($ctx1) {
  5506. var $1;
  5507. set=_st($Set())._new();
  5508. _st(set)._add_((21));
  5509. $ctx1.sendIdx["add:"]=1;
  5510. _st(set)._add_("hello");
  5511. $ctx1.sendIdx["add:"]=2;
  5512. _st(set)._add_((21));
  5513. $ctx1.sendIdx["add:"]=3;
  5514. $1=_st(set)._size();
  5515. $ctx1.sendIdx["size"]=1;
  5516. self._assert_equals_($1,(2));
  5517. $ctx1.sendIdx["assert:equals:"]=1;
  5518. _st(set)._add_("hello");
  5519. self._assert_equals_(_st(set)._size(),(2));
  5520. $ctx1.sendIdx["assert:equals:"]=2;
  5521. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5522. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5523. args: [],
  5524. 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')",
  5525. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5526. referencedClasses: ["Set"]
  5527. }),
  5528. globals.SetTest);
  5529. smalltalk.addMethod(
  5530. smalltalk.method({
  5531. selector: "collectionClass",
  5532. protocol: 'fixture',
  5533. fn: function (){
  5534. var self=this;
  5535. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5536. return $Set();
  5537. },
  5538. args: [],
  5539. source: "collectionClass\x0a\x09^ Set",
  5540. messageSends: [],
  5541. referencedClasses: ["Set"]
  5542. }),
  5543. globals.SetTest.klass);
  5544. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5545. smalltalk.addMethod(
  5546. smalltalk.method({
  5547. selector: "testShow",
  5548. protocol: 'tests',
  5549. fn: function (){
  5550. var self=this;
  5551. var originalTranscript;
  5552. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5553. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5554. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5555. return smalltalk.withContext(function($ctx1) {
  5556. originalTranscript=_st($Transcript())._current();
  5557. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5558. $ctx1.sendIdx["register:"]=1;
  5559. self._shouldnt_raise_((function(){
  5560. return smalltalk.withContext(function($ctx2) {
  5561. return _st($Transcript())._show_("Hello console!");
  5562. $ctx2.sendIdx["show:"]=1;
  5563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5564. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5565. self._shouldnt_raise_((function(){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. return _st($Transcript())._show_(console);
  5568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5569. _st($Transcript())._register_(originalTranscript);
  5570. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5571. args: [],
  5572. 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.",
  5573. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5574. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5575. }),
  5576. globals.ConsoleTranscriptTest);
  5577. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "jsNull",
  5581. protocol: 'accessing',
  5582. fn: function (){
  5583. var self=this;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. return null;
  5586. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)})},
  5587. args: [],
  5588. source: "jsNull\x0a\x09<return null>",
  5589. messageSends: [],
  5590. referencedClasses: []
  5591. }),
  5592. globals.JSObjectProxyTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "jsObject",
  5596. protocol: 'accessing',
  5597. fn: function (){
  5598. var self=this;
  5599. return smalltalk.withContext(function($ctx1) {
  5600. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5601. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5602. args: [],
  5603. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5604. messageSends: [],
  5605. referencedClasses: []
  5606. }),
  5607. globals.JSObjectProxyTest);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "jsUndefined",
  5611. protocol: 'accessing',
  5612. fn: function (){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. return;
  5616. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)})},
  5617. args: [],
  5618. source: "jsUndefined\x0a\x09<return>",
  5619. messageSends: [],
  5620. referencedClasses: []
  5621. }),
  5622. globals.JSObjectProxyTest);
  5623. smalltalk.addMethod(
  5624. smalltalk.method({
  5625. selector: "testAtIfAbsent",
  5626. protocol: 'tests',
  5627. fn: function (){
  5628. var self=this;
  5629. var testObject;
  5630. return smalltalk.withContext(function($ctx1) {
  5631. var $1,$2,$3;
  5632. testObject=self._jsObject();
  5633. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5634. return "Property does not exist";
  5635. }));
  5636. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5637. self._assert_equals_($1,"Property does not exist");
  5638. $ctx1.sendIdx["assert:equals:"]=1;
  5639. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5640. return "Property does not exist";
  5641. }));
  5642. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5643. self._assert_equals_($2,nil);
  5644. $ctx1.sendIdx["assert:equals:"]=2;
  5645. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5646. return "Property does not exist";
  5647. }));
  5648. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5649. self._assert_equals_($3,(1));
  5650. $ctx1.sendIdx["assert:equals:"]=3;
  5651. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5652. return "Property does not exist";
  5653. })),nil);
  5654. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5655. args: [],
  5656. 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.",
  5657. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5658. referencedClasses: []
  5659. }),
  5660. globals.JSObjectProxyTest);
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "testAtIfPresent",
  5664. protocol: 'tests',
  5665. fn: function (){
  5666. var self=this;
  5667. var testObject;
  5668. return smalltalk.withContext(function($ctx1) {
  5669. var $2,$1,$4,$3,$6,$5;
  5670. testObject=self._jsObject();
  5671. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5672. return smalltalk.withContext(function($ctx2) {
  5673. $2=_st(x)._asString();
  5674. $ctx2.sendIdx["asString"]=1;
  5675. return "hello ".__comma($2);
  5676. $ctx2.sendIdx[","]=1;
  5677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5678. $ctx1.sendIdx["at:ifPresent:"]=1;
  5679. self._assert_equals_($1,nil);
  5680. $ctx1.sendIdx["assert:equals:"]=1;
  5681. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5682. return smalltalk.withContext(function($ctx2) {
  5683. $4=_st(x)._asString();
  5684. $ctx2.sendIdx["asString"]=2;
  5685. return "hello ".__comma($4);
  5686. $ctx2.sendIdx[","]=2;
  5687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5688. $ctx1.sendIdx["at:ifPresent:"]=2;
  5689. self._assert_equals_($3,"hello nil");
  5690. $ctx1.sendIdx["assert:equals:"]=2;
  5691. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5692. return smalltalk.withContext(function($ctx2) {
  5693. $6=_st(x)._asString();
  5694. $ctx2.sendIdx["asString"]=3;
  5695. return "hello ".__comma($6);
  5696. $ctx2.sendIdx[","]=3;
  5697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5698. $ctx1.sendIdx["at:ifPresent:"]=3;
  5699. self._assert_equals_($5,"hello 1");
  5700. $ctx1.sendIdx["assert:equals:"]=3;
  5701. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5702. return smalltalk.withContext(function($ctx2) {
  5703. return "hello ".__comma(_st(x)._asString());
  5704. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5705. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5706. args: [],
  5707. 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'.",
  5708. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5709. referencedClasses: []
  5710. }),
  5711. globals.JSObjectProxyTest);
  5712. smalltalk.addMethod(
  5713. smalltalk.method({
  5714. selector: "testAtIfPresentIfAbsent",
  5715. protocol: 'tests',
  5716. fn: function (){
  5717. var self=this;
  5718. var testObject;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. var $2,$1,$4,$3,$6,$5;
  5721. testObject=self._jsObject();
  5722. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5723. return smalltalk.withContext(function($ctx2) {
  5724. $2=_st(x)._asString();
  5725. $ctx2.sendIdx["asString"]=1;
  5726. return "hello ".__comma($2);
  5727. $ctx2.sendIdx[","]=1;
  5728. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5729. return "not present";
  5730. }));
  5731. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5732. self._assert_equals_($1,"not present");
  5733. $ctx1.sendIdx["assert:equals:"]=1;
  5734. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5735. return smalltalk.withContext(function($ctx2) {
  5736. $4=_st(x)._asString();
  5737. $ctx2.sendIdx["asString"]=2;
  5738. return "hello ".__comma($4);
  5739. $ctx2.sendIdx[","]=2;
  5740. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5741. return "not present";
  5742. }));
  5743. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5744. self._assert_equals_($3,"hello nil");
  5745. $ctx1.sendIdx["assert:equals:"]=2;
  5746. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5747. return smalltalk.withContext(function($ctx2) {
  5748. $6=_st(x)._asString();
  5749. $ctx2.sendIdx["asString"]=3;
  5750. return "hello ".__comma($6);
  5751. $ctx2.sendIdx[","]=3;
  5752. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5753. return "not present";
  5754. }));
  5755. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5756. self._assert_equals_($5,"hello 1");
  5757. $ctx1.sendIdx["assert:equals:"]=3;
  5758. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5759. return smalltalk.withContext(function($ctx2) {
  5760. return "hello ".__comma(_st(x)._asString());
  5761. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5762. return "not present";
  5763. })),"hello nil");
  5764. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5765. args: [],
  5766. 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'.",
  5767. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5768. referencedClasses: []
  5769. }),
  5770. globals.JSObjectProxyTest);
  5771. smalltalk.addMethod(
  5772. smalltalk.method({
  5773. selector: "testAtPut",
  5774. protocol: 'tests',
  5775. fn: function (){
  5776. var self=this;
  5777. var testObject;
  5778. return smalltalk.withContext(function($ctx1) {
  5779. var $2,$1;
  5780. testObject=self._jsObject();
  5781. $2=_st(testObject)._at_("abc");
  5782. $ctx1.sendIdx["at:"]=1;
  5783. $1=_st($2).__tild_eq("xyz");
  5784. self._assert_($1);
  5785. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5786. $ctx1.sendIdx["assert:equals:"]=1;
  5787. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5788. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5789. args: [],
  5790. 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'",
  5791. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5792. referencedClasses: []
  5793. }),
  5794. globals.JSObjectProxyTest);
  5795. smalltalk.addMethod(
  5796. smalltalk.method({
  5797. selector: "testComparison",
  5798. protocol: 'tests',
  5799. fn: function (){
  5800. var self=this;
  5801. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5802. return smalltalk.withContext(function($ctx1) {
  5803. var $1,$2;
  5804. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5805. $1=_st(console).__eq(console);
  5806. $ctx1.sendIdx["="]=1;
  5807. self._assert_($1);
  5808. $2=_st(console).__eq(_st($Object())._new());
  5809. $ctx1.sendIdx["="]=2;
  5810. self._deny_($2);
  5811. $ctx1.sendIdx["deny:"]=1;
  5812. self._deny_(_st(console).__eq(self._jsObject()));
  5813. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5814. args: [],
  5815. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5816. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5817. referencedClasses: ["Object"]
  5818. }),
  5819. globals.JSObjectProxyTest);
  5820. smalltalk.addMethod(
  5821. smalltalk.method({
  5822. selector: "testDNU",
  5823. protocol: 'tests',
  5824. fn: function (){
  5825. var self=this;
  5826. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5827. return smalltalk.withContext(function($ctx1) {
  5828. self._should_raise_((function(){
  5829. return smalltalk.withContext(function($ctx2) {
  5830. return _st(self._jsObject())._foo();
  5831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5832. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5833. args: [],
  5834. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5835. messageSends: ["should:raise:", "foo", "jsObject"],
  5836. referencedClasses: ["MessageNotUnderstood"]
  5837. }),
  5838. globals.JSObjectProxyTest);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "testDNURegression1057",
  5842. protocol: 'tests',
  5843. fn: function (){
  5844. var self=this;
  5845. var jsObject;
  5846. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5847. return smalltalk.withContext(function($ctx1) {
  5848. var $1;
  5849. jsObject=[];
  5850. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  5851. $ctx1.sendIdx["basicAt:put:"]=1;
  5852. _st(jsObject)._basicAt_put_("foo",(3));
  5853. self._shouldnt_raise_((function(){
  5854. return smalltalk.withContext(function($ctx2) {
  5855. return _st(jsObject)._foo();
  5856. $ctx2.sendIdx["foo"]=1;
  5857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5858. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5859. $1=_st(jsObject)._foo();
  5860. $ctx1.sendIdx["foo"]=2;
  5861. self._assert_equals_($1,(3));
  5862. $ctx1.sendIdx["assert:equals:"]=1;
  5863. self._shouldnt_raise_((function(){
  5864. return smalltalk.withContext(function($ctx2) {
  5865. return _st(jsObject)._foo_((4));
  5866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5867. self._assert_equals_(_st(jsObject)._foo(),(4));
  5868. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5869. args: [],
  5870. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  5871. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"],
  5872. referencedClasses: ["Error"]
  5873. }),
  5874. globals.JSObjectProxyTest);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "testDNURegression1059",
  5878. protocol: 'tests',
  5879. fn: function (){
  5880. var self=this;
  5881. var jsObject;
  5882. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5883. return smalltalk.withContext(function($ctx1) {
  5884. jsObject=[];
  5885. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  5886. $ctx1.sendIdx["basicAt:put:"]=1;
  5887. _st(jsObject)._basicAt_put_("x",(3));
  5888. $ctx1.sendIdx["basicAt:put:"]=2;
  5889. _st(jsObject)._basicAt_put_("x:",(function(){
  5890. return smalltalk.withContext(function($ctx2) {
  5891. return self._error();
  5892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5893. self._shouldnt_raise_((function(){
  5894. return smalltalk.withContext(function($ctx2) {
  5895. return _st(jsObject)._x_((4));
  5896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5897. self._assert_equals_(_st(jsObject)._x(),(4));
  5898. return self}, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5899. args: [],
  5900. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4\x0a\x09",
  5901. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"],
  5902. referencedClasses: ["Error"]
  5903. }),
  5904. globals.JSObjectProxyTest);
  5905. smalltalk.addMethod(
  5906. smalltalk.method({
  5907. selector: "testMessageSend",
  5908. protocol: 'tests',
  5909. fn: function (){
  5910. var self=this;
  5911. return smalltalk.withContext(function($ctx1) {
  5912. var $2,$1,$4,$3;
  5913. $2=self._jsObject();
  5914. $ctx1.sendIdx["jsObject"]=1;
  5915. $1=_st($2)._a();
  5916. self._assert_equals_($1,(1));
  5917. $ctx1.sendIdx["assert:equals:"]=1;
  5918. $4=self._jsObject();
  5919. $ctx1.sendIdx["jsObject"]=2;
  5920. $3=_st($4)._b();
  5921. self._assert_equals_($3,(2));
  5922. $ctx1.sendIdx["assert:equals:"]=2;
  5923. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5924. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5925. args: [],
  5926. 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",
  5927. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5928. referencedClasses: []
  5929. }),
  5930. globals.JSObjectProxyTest);
  5931. smalltalk.addMethod(
  5932. smalltalk.method({
  5933. selector: "testMethodWithArguments",
  5934. protocol: 'tests',
  5935. fn: function (){
  5936. var self=this;
  5937. return smalltalk.withContext(function($ctx1) {
  5938. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5939. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5940. args: [],
  5941. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5942. messageSends: ["assert:equals:", "c:", "jsObject"],
  5943. referencedClasses: []
  5944. }),
  5945. globals.JSObjectProxyTest);
  5946. smalltalk.addMethod(
  5947. smalltalk.method({
  5948. selector: "testPrinting",
  5949. protocol: 'tests',
  5950. fn: function (){
  5951. var self=this;
  5952. return smalltalk.withContext(function($ctx1) {
  5953. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5954. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5955. args: [],
  5956. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5957. messageSends: ["assert:equals:", "printString", "jsObject"],
  5958. referencedClasses: []
  5959. }),
  5960. globals.JSObjectProxyTest);
  5961. smalltalk.addMethod(
  5962. smalltalk.method({
  5963. selector: "testPropertyThatReturnsEmptyString",
  5964. protocol: 'tests',
  5965. fn: function (){
  5966. var self=this;
  5967. var object;
  5968. return smalltalk.withContext(function($ctx1) {
  5969. var $1;
  5970. object=self._jsObject();
  5971. $1=_st(object)._d();
  5972. $ctx1.sendIdx["d"]=1;
  5973. self._assert_equals_($1,"");
  5974. $ctx1.sendIdx["assert:equals:"]=1;
  5975. _st(object)._d_("hello");
  5976. self._assert_equals_(_st(object)._d(),"hello");
  5977. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5978. args: [],
  5979. 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'",
  5980. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5981. referencedClasses: []
  5982. }),
  5983. globals.JSObjectProxyTest);
  5984. smalltalk.addMethod(
  5985. smalltalk.method({
  5986. selector: "testPropertyThatReturnsUndefined",
  5987. protocol: 'tests',
  5988. fn: function (){
  5989. var self=this;
  5990. var object;
  5991. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5992. return smalltalk.withContext(function($ctx1) {
  5993. object=self._jsObject();
  5994. self._shouldnt_raise_((function(){
  5995. return smalltalk.withContext(function($ctx2) {
  5996. return _st(object)._e();
  5997. $ctx2.sendIdx["e"]=1;
  5998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5999. self._assert_(_st(_st(object)._e())._isNil());
  6000. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  6001. args: [],
  6002. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  6003. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  6004. referencedClasses: ["MessageNotUnderstood"]
  6005. }),
  6006. globals.JSObjectProxyTest);
  6007. smalltalk.addMethod(
  6008. smalltalk.method({
  6009. selector: "testSetPropertyWithFalsyValue",
  6010. protocol: 'tests',
  6011. fn: function (){
  6012. var self=this;
  6013. var jsObject;
  6014. return smalltalk.withContext(function($ctx1) {
  6015. var $1,$2,$3,$4,$5;
  6016. jsObject=self._jsObject();
  6017. $1=_st(jsObject)._a();
  6018. $ctx1.sendIdx["a"]=1;
  6019. self._assert_equals_($1,(1));
  6020. $ctx1.sendIdx["assert:equals:"]=1;
  6021. _st(jsObject)._a_(self._jsNull());
  6022. $ctx1.sendIdx["a:"]=1;
  6023. $2=_st(jsObject)._a();
  6024. $ctx1.sendIdx["a"]=2;
  6025. self._assert_equals_($2,nil);
  6026. $ctx1.sendIdx["assert:equals:"]=2;
  6027. _st(jsObject)._a_((0));
  6028. $ctx1.sendIdx["a:"]=2;
  6029. $3=_st(jsObject)._a();
  6030. $ctx1.sendIdx["a"]=3;
  6031. self._assert_equals_($3,(0));
  6032. $ctx1.sendIdx["assert:equals:"]=3;
  6033. _st(jsObject)._a_(self._jsUndefined());
  6034. $ctx1.sendIdx["a:"]=3;
  6035. $4=_st(jsObject)._a();
  6036. $ctx1.sendIdx["a"]=4;
  6037. self._assert_equals_($4,nil);
  6038. $ctx1.sendIdx["assert:equals:"]=4;
  6039. _st(jsObject)._a_("");
  6040. $ctx1.sendIdx["a:"]=4;
  6041. $5=_st(jsObject)._a();
  6042. $ctx1.sendIdx["a"]=5;
  6043. self._assert_equals_($5,"");
  6044. $ctx1.sendIdx["assert:equals:"]=5;
  6045. _st(jsObject)._a_(false);
  6046. self._assert_equals_(_st(jsObject)._a(),false);
  6047. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  6048. args: [],
  6049. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  6050. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  6051. referencedClasses: []
  6052. }),
  6053. globals.JSObjectProxyTest);
  6054. smalltalk.addMethod(
  6055. smalltalk.method({
  6056. selector: "testValue",
  6057. protocol: 'tests',
  6058. fn: function (){
  6059. var self=this;
  6060. var testObject;
  6061. return smalltalk.withContext(function($ctx1) {
  6062. testObject=self._jsObject();
  6063. _st(testObject)._at_put_("value","aValue");
  6064. self._assert_equals_(_st(testObject)._value(),"aValue");
  6065. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  6066. args: [],
  6067. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  6068. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  6069. referencedClasses: []
  6070. }),
  6071. globals.JSObjectProxyTest);
  6072. smalltalk.addMethod(
  6073. smalltalk.method({
  6074. selector: "testYourself",
  6075. protocol: 'tests',
  6076. fn: function (){
  6077. var self=this;
  6078. var object;
  6079. return smalltalk.withContext(function($ctx1) {
  6080. var $1,$2;
  6081. $1=self._jsObject();
  6082. _st($1)._d_("test");
  6083. $2=_st($1)._yourself();
  6084. object=$2;
  6085. self._assert_equals_(_st(object)._d(),"test");
  6086. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  6087. args: [],
  6088. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  6089. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  6090. referencedClasses: []
  6091. }),
  6092. globals.JSObjectProxyTest);
  6093. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  6094. smalltalk.addMethod(
  6095. smalltalk.method({
  6096. selector: "testCatchingException",
  6097. protocol: 'tests',
  6098. fn: function (){
  6099. var self=this;
  6100. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6101. return smalltalk.withContext(function($ctx1) {
  6102. _st((function(){
  6103. return smalltalk.withContext(function($ctx2) {
  6104. return self._throwException();
  6105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  6106. return smalltalk.withContext(function($ctx2) {
  6107. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  6108. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  6109. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  6110. args: [],
  6111. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  6112. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  6113. referencedClasses: ["Error"]
  6114. }),
  6115. globals.JavaScriptExceptionTest);
  6116. smalltalk.addMethod(
  6117. smalltalk.method({
  6118. selector: "testRaisingException",
  6119. protocol: 'tests',
  6120. fn: function (){
  6121. var self=this;
  6122. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6123. return smalltalk.withContext(function($ctx1) {
  6124. self._should_raise_((function(){
  6125. return smalltalk.withContext(function($ctx2) {
  6126. return self._throwException();
  6127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  6128. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  6129. args: [],
  6130. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  6131. messageSends: ["should:raise:", "throwException"],
  6132. referencedClasses: ["JavaScriptException"]
  6133. }),
  6134. globals.JavaScriptExceptionTest);
  6135. smalltalk.addMethod(
  6136. smalltalk.method({
  6137. selector: "throwException",
  6138. protocol: 'helpers',
  6139. fn: function (){
  6140. var self=this;
  6141. return smalltalk.withContext(function($ctx1) {
  6142. throw 'test';
  6143. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  6144. args: [],
  6145. source: "throwException\x0a\x09<throw 'test'>",
  6146. messageSends: [],
  6147. referencedClasses: []
  6148. }),
  6149. globals.JavaScriptExceptionTest);
  6150. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  6151. smalltalk.addMethod(
  6152. smalltalk.method({
  6153. selector: "testValue",
  6154. protocol: 'tests',
  6155. fn: function (){
  6156. var self=this;
  6157. var messageSend;
  6158. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6159. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6160. return smalltalk.withContext(function($ctx1) {
  6161. var $1,$2;
  6162. $1=_st($MessageSend())._new();
  6163. $ctx1.sendIdx["new"]=1;
  6164. _st($1)._receiver_(_st($Object())._new());
  6165. _st($1)._selector_("asString");
  6166. $2=_st($1)._yourself();
  6167. messageSend=$2;
  6168. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6169. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  6170. args: [],
  6171. 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'",
  6172. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6173. referencedClasses: ["MessageSend", "Object"]
  6174. }),
  6175. globals.MessageSendTest);
  6176. smalltalk.addMethod(
  6177. smalltalk.method({
  6178. selector: "testValueWithArguments",
  6179. protocol: 'tests',
  6180. fn: function (){
  6181. var self=this;
  6182. var messageSend;
  6183. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6184. return smalltalk.withContext(function($ctx1) {
  6185. var $1,$2;
  6186. $1=_st($MessageSend())._new();
  6187. _st($1)._receiver_((2));
  6188. _st($1)._selector_("+");
  6189. $2=_st($1)._yourself();
  6190. messageSend=$2;
  6191. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6192. $ctx1.sendIdx["assert:equals:"]=1;
  6193. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6194. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6195. args: [],
  6196. 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",
  6197. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6198. referencedClasses: ["MessageSend"]
  6199. }),
  6200. globals.MessageSendTest);
  6201. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6202. smalltalk.addMethod(
  6203. smalltalk.method({
  6204. selector: "codeGeneratorClass",
  6205. protocol: 'accessing',
  6206. fn: function (){
  6207. var self=this;
  6208. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6209. return $CodeGenerator();
  6210. },
  6211. args: [],
  6212. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6213. messageSends: [],
  6214. referencedClasses: ["CodeGenerator"]
  6215. }),
  6216. globals.MethodInheritanceTest);
  6217. smalltalk.addMethod(
  6218. smalltalk.method({
  6219. selector: "compiler",
  6220. protocol: 'factory',
  6221. fn: function (){
  6222. var self=this;
  6223. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6224. return smalltalk.withContext(function($ctx1) {
  6225. var $2,$3,$1;
  6226. $2=_st($Compiler())._new();
  6227. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6228. $3=_st($2)._yourself();
  6229. $1=$3;
  6230. return $1;
  6231. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6232. args: [],
  6233. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6234. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6235. referencedClasses: ["Compiler"]
  6236. }),
  6237. globals.MethodInheritanceTest);
  6238. smalltalk.addMethod(
  6239. smalltalk.method({
  6240. selector: "deinstallBottom",
  6241. protocol: 'testing',
  6242. fn: function (){
  6243. var self=this;
  6244. return smalltalk.withContext(function($ctx1) {
  6245. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6246. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6247. args: [],
  6248. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6249. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6250. referencedClasses: []
  6251. }),
  6252. globals.MethodInheritanceTest);
  6253. smalltalk.addMethod(
  6254. smalltalk.method({
  6255. selector: "deinstallMiddle",
  6256. protocol: 'testing',
  6257. fn: function (){
  6258. var self=this;
  6259. return smalltalk.withContext(function($ctx1) {
  6260. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6261. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6262. args: [],
  6263. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6264. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6265. referencedClasses: []
  6266. }),
  6267. globals.MethodInheritanceTest);
  6268. smalltalk.addMethod(
  6269. smalltalk.method({
  6270. selector: "deinstallTop",
  6271. protocol: 'testing',
  6272. fn: function (){
  6273. var self=this;
  6274. return smalltalk.withContext(function($ctx1) {
  6275. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6276. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6277. args: [],
  6278. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6279. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6280. referencedClasses: []
  6281. }),
  6282. globals.MethodInheritanceTest);
  6283. smalltalk.addMethod(
  6284. smalltalk.method({
  6285. selector: "installBottom:",
  6286. protocol: 'testing',
  6287. fn: function (aString){
  6288. var self=this;
  6289. return smalltalk.withContext(function($ctx1) {
  6290. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6291. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6292. args: ["aString"],
  6293. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6294. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6295. referencedClasses: []
  6296. }),
  6297. globals.MethodInheritanceTest);
  6298. smalltalk.addMethod(
  6299. smalltalk.method({
  6300. selector: "installMiddle:",
  6301. protocol: 'testing',
  6302. fn: function (aString){
  6303. var self=this;
  6304. return smalltalk.withContext(function($ctx1) {
  6305. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6306. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6307. args: ["aString"],
  6308. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6309. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6310. referencedClasses: []
  6311. }),
  6312. globals.MethodInheritanceTest);
  6313. smalltalk.addMethod(
  6314. smalltalk.method({
  6315. selector: "installTop:",
  6316. protocol: 'testing',
  6317. fn: function (aString){
  6318. var self=this;
  6319. return smalltalk.withContext(function($ctx1) {
  6320. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6321. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6322. args: ["aString"],
  6323. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6324. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6325. referencedClasses: []
  6326. }),
  6327. globals.MethodInheritanceTest);
  6328. smalltalk.addMethod(
  6329. smalltalk.method({
  6330. selector: "setUp",
  6331. protocol: 'initialization',
  6332. fn: function (){
  6333. var self=this;
  6334. return smalltalk.withContext(function($ctx1) {
  6335. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6336. $ctx1.sendIdx["new"]=1;
  6337. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6338. $ctx1.sendIdx["new"]=2;
  6339. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6340. self["@method"]=nil;
  6341. self["@performBlock"]=(function(){
  6342. return smalltalk.withContext(function($ctx2) {
  6343. return self._error_("performBlock not initialized");
  6344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6345. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6346. args: [],
  6347. 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' ]",
  6348. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6349. referencedClasses: []
  6350. }),
  6351. globals.MethodInheritanceTest);
  6352. smalltalk.addMethod(
  6353. smalltalk.method({
  6354. selector: "shouldMNU",
  6355. protocol: 'testing',
  6356. fn: function (){
  6357. var self=this;
  6358. return smalltalk.withContext(function($ctx1) {
  6359. self._shouldMNUTop();
  6360. self._shouldMNUMiddle();
  6361. self._shouldMNUBottom();
  6362. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6363. args: [],
  6364. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6365. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6366. referencedClasses: []
  6367. }),
  6368. globals.MethodInheritanceTest);
  6369. smalltalk.addMethod(
  6370. smalltalk.method({
  6371. selector: "shouldMNUBottom",
  6372. protocol: 'testing',
  6373. fn: function (){
  6374. var self=this;
  6375. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6376. return smalltalk.withContext(function($ctx1) {
  6377. self._should_raise_((function(){
  6378. return smalltalk.withContext(function($ctx2) {
  6379. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6381. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6382. args: [],
  6383. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6384. messageSends: ["should:raise:", "value:"],
  6385. referencedClasses: ["MessageNotUnderstood"]
  6386. }),
  6387. globals.MethodInheritanceTest);
  6388. smalltalk.addMethod(
  6389. smalltalk.method({
  6390. selector: "shouldMNUMiddle",
  6391. protocol: 'testing',
  6392. fn: function (){
  6393. var self=this;
  6394. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6395. return smalltalk.withContext(function($ctx1) {
  6396. self._should_raise_((function(){
  6397. return smalltalk.withContext(function($ctx2) {
  6398. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6400. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6401. args: [],
  6402. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6403. messageSends: ["should:raise:", "value:"],
  6404. referencedClasses: ["MessageNotUnderstood"]
  6405. }),
  6406. globals.MethodInheritanceTest);
  6407. smalltalk.addMethod(
  6408. smalltalk.method({
  6409. selector: "shouldMNUTop",
  6410. protocol: 'testing',
  6411. fn: function (){
  6412. var self=this;
  6413. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6414. return smalltalk.withContext(function($ctx1) {
  6415. self._should_raise_((function(){
  6416. return smalltalk.withContext(function($ctx2) {
  6417. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6419. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6420. args: [],
  6421. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6422. messageSends: ["should:raise:", "value:"],
  6423. referencedClasses: ["MessageNotUnderstood"]
  6424. }),
  6425. globals.MethodInheritanceTest);
  6426. smalltalk.addMethod(
  6427. smalltalk.method({
  6428. selector: "shouldReturn:",
  6429. protocol: 'testing',
  6430. fn: function (anObject){
  6431. var self=this;
  6432. var result;
  6433. return smalltalk.withContext(function($ctx1) {
  6434. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6435. $ctx1.sendIdx["value:"]=1;
  6436. self._assert_equals_(["top",anObject],["top",result]);
  6437. $ctx1.sendIdx["assert:equals:"]=1;
  6438. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6439. $ctx1.sendIdx["value:"]=2;
  6440. self._assert_equals_(["middle",anObject],["middle",result]);
  6441. $ctx1.sendIdx["assert:equals:"]=2;
  6442. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6443. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6444. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6445. args: ["anObject"],
  6446. 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 }",
  6447. messageSends: ["value:", "assert:equals:"],
  6448. referencedClasses: []
  6449. }),
  6450. globals.MethodInheritanceTest);
  6451. smalltalk.addMethod(
  6452. smalltalk.method({
  6453. selector: "shouldReturn:and:and:",
  6454. protocol: 'testing',
  6455. fn: function (anObject,anObject2,anObject3){
  6456. var self=this;
  6457. var result;
  6458. return smalltalk.withContext(function($ctx1) {
  6459. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6460. $ctx1.sendIdx["value:"]=1;
  6461. self._assert_equals_(["top",anObject],["top",result]);
  6462. $ctx1.sendIdx["assert:equals:"]=1;
  6463. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6464. $ctx1.sendIdx["value:"]=2;
  6465. self._assert_equals_(["middle",anObject2],["middle",result]);
  6466. $ctx1.sendIdx["assert:equals:"]=2;
  6467. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6468. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6469. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6470. args: ["anObject", "anObject2", "anObject3"],
  6471. 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 }",
  6472. messageSends: ["value:", "assert:equals:"],
  6473. referencedClasses: []
  6474. }),
  6475. globals.MethodInheritanceTest);
  6476. smalltalk.addMethod(
  6477. smalltalk.method({
  6478. selector: "targetClassBottom",
  6479. protocol: 'accessing',
  6480. fn: function (){
  6481. var self=this;
  6482. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6483. return $JavaScriptException();
  6484. },
  6485. args: [],
  6486. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6487. messageSends: [],
  6488. referencedClasses: ["JavaScriptException"]
  6489. }),
  6490. globals.MethodInheritanceTest);
  6491. smalltalk.addMethod(
  6492. smalltalk.method({
  6493. selector: "targetClassMiddle",
  6494. protocol: 'accessing',
  6495. fn: function (){
  6496. var self=this;
  6497. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6498. return $Error();
  6499. },
  6500. args: [],
  6501. source: "targetClassMiddle\x0a\x09^ Error",
  6502. messageSends: [],
  6503. referencedClasses: ["Error"]
  6504. }),
  6505. globals.MethodInheritanceTest);
  6506. smalltalk.addMethod(
  6507. smalltalk.method({
  6508. selector: "targetClassTop",
  6509. protocol: 'accessing',
  6510. fn: function (){
  6511. var self=this;
  6512. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6513. return $Object();
  6514. },
  6515. args: [],
  6516. source: "targetClassTop\x0a\x09^ Object",
  6517. messageSends: [],
  6518. referencedClasses: ["Object"]
  6519. }),
  6520. globals.MethodInheritanceTest);
  6521. smalltalk.addMethod(
  6522. smalltalk.method({
  6523. selector: "tearDown",
  6524. protocol: 'initialization',
  6525. fn: function (){
  6526. var self=this;
  6527. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6528. return smalltalk.withContext(function($ctx1) {
  6529. _st((function(){
  6530. return smalltalk.withContext(function($ctx2) {
  6531. return self._deinstallTop();
  6532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6533. }));
  6534. $ctx1.sendIdx["on:do:"]=1;
  6535. _st((function(){
  6536. return smalltalk.withContext(function($ctx2) {
  6537. return self._deinstallMiddle();
  6538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6539. }));
  6540. $ctx1.sendIdx["on:do:"]=2;
  6541. _st((function(){
  6542. return smalltalk.withContext(function($ctx2) {
  6543. return self._deinstallBottom();
  6544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6545. }));
  6546. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6547. args: [],
  6548. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6549. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6550. referencedClasses: ["Error"]
  6551. }),
  6552. globals.MethodInheritanceTest);
  6553. smalltalk.addMethod(
  6554. smalltalk.method({
  6555. selector: "testMNU11",
  6556. protocol: 'tests',
  6557. fn: function (){
  6558. var self=this;
  6559. return smalltalk.withContext(function($ctx1) {
  6560. self["@performBlock"]=(function(x){
  6561. return smalltalk.withContext(function($ctx2) {
  6562. return _st(x)._foo();
  6563. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6564. self._shouldMNU();
  6565. $ctx1.sendIdx["shouldMNU"]=1;
  6566. self._installTop_("foo ^ false");
  6567. $ctx1.sendIdx["installTop:"]=1;
  6568. self._installTop_("foo ^ true");
  6569. self._deinstallTop();
  6570. self._shouldMNU();
  6571. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6572. args: [],
  6573. 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",
  6574. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6575. referencedClasses: []
  6576. }),
  6577. globals.MethodInheritanceTest);
  6578. smalltalk.addMethod(
  6579. smalltalk.method({
  6580. selector: "testMNU22",
  6581. protocol: 'tests',
  6582. fn: function (){
  6583. var self=this;
  6584. return smalltalk.withContext(function($ctx1) {
  6585. self["@performBlock"]=(function(x){
  6586. return smalltalk.withContext(function($ctx2) {
  6587. return _st(x)._foo();
  6588. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6589. self._shouldMNU();
  6590. $ctx1.sendIdx["shouldMNU"]=1;
  6591. self._installMiddle_("foo ^ false");
  6592. $ctx1.sendIdx["installMiddle:"]=1;
  6593. self._installMiddle_("foo ^ true");
  6594. self._deinstallMiddle();
  6595. self._shouldMNU();
  6596. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6597. args: [],
  6598. 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",
  6599. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6600. referencedClasses: []
  6601. }),
  6602. globals.MethodInheritanceTest);
  6603. smalltalk.addMethod(
  6604. smalltalk.method({
  6605. selector: "testReturns1",
  6606. protocol: 'tests',
  6607. fn: function (){
  6608. var self=this;
  6609. return smalltalk.withContext(function($ctx1) {
  6610. self["@performBlock"]=(function(x){
  6611. return smalltalk.withContext(function($ctx2) {
  6612. return _st(x)._foo();
  6613. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6614. self._installTop_("foo ^ false");
  6615. $ctx1.sendIdx["installTop:"]=1;
  6616. self._shouldReturn_(false);
  6617. $ctx1.sendIdx["shouldReturn:"]=1;
  6618. self._installTop_("foo ^ true");
  6619. self._shouldReturn_(true);
  6620. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6621. args: [],
  6622. 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",
  6623. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6624. referencedClasses: []
  6625. }),
  6626. globals.MethodInheritanceTest);
  6627. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6628. smalltalk.addMethod(
  6629. smalltalk.method({
  6630. selector: "testAbs",
  6631. protocol: 'tests',
  6632. fn: function (){
  6633. var self=this;
  6634. return smalltalk.withContext(function($ctx1) {
  6635. var $1;
  6636. $1=(4)._abs();
  6637. $ctx1.sendIdx["abs"]=1;
  6638. self._assert_equals_($1,(4));
  6639. $ctx1.sendIdx["assert:equals:"]=1;
  6640. self._assert_equals_((-4)._abs(),(4));
  6641. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6642. args: [],
  6643. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6644. messageSends: ["assert:equals:", "abs"],
  6645. referencedClasses: []
  6646. }),
  6647. globals.NumberTest);
  6648. smalltalk.addMethod(
  6649. smalltalk.method({
  6650. selector: "testArithmetic",
  6651. protocol: 'tests',
  6652. fn: function (){
  6653. var self=this;
  6654. return smalltalk.withContext(function($ctx1) {
  6655. var $1,$2,$3,$5,$4;
  6656. $1=(1.5).__plus((1));
  6657. $ctx1.sendIdx["+"]=1;
  6658. self._assert_equals_($1,(2.5));
  6659. $ctx1.sendIdx["assert:equals:"]=1;
  6660. $2=(2).__minus((1));
  6661. $ctx1.sendIdx["-"]=1;
  6662. self._assert_equals_($2,(1));
  6663. $ctx1.sendIdx["assert:equals:"]=2;
  6664. self._assert_equals_((-2).__minus((1)),(-3));
  6665. $ctx1.sendIdx["assert:equals:"]=3;
  6666. self._assert_equals_((12).__slash((2)),(6));
  6667. $ctx1.sendIdx["assert:equals:"]=4;
  6668. $3=(3).__star((4));
  6669. $ctx1.sendIdx["*"]=1;
  6670. self._assert_equals_($3,(12));
  6671. $ctx1.sendIdx["assert:equals:"]=5;
  6672. self._assert_equals_((7).__slash_slash((2)),(3));
  6673. $ctx1.sendIdx["assert:equals:"]=6;
  6674. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6675. $ctx1.sendIdx["assert:equals:"]=7;
  6676. $5=(1).__plus((2));
  6677. $ctx1.sendIdx["+"]=2;
  6678. $4=_st($5).__star((3));
  6679. $ctx1.sendIdx["*"]=2;
  6680. self._assert_equals_($4,(9));
  6681. $ctx1.sendIdx["assert:equals:"]=8;
  6682. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6683. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6684. args: [],
  6685. 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",
  6686. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6687. referencedClasses: []
  6688. }),
  6689. globals.NumberTest);
  6690. smalltalk.addMethod(
  6691. smalltalk.method({
  6692. selector: "testAsNumber",
  6693. protocol: 'tests',
  6694. fn: function (){
  6695. var self=this;
  6696. return smalltalk.withContext(function($ctx1) {
  6697. self._assert_equals_((3)._asNumber(),(3));
  6698. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6699. args: [],
  6700. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6701. messageSends: ["assert:equals:", "asNumber"],
  6702. referencedClasses: []
  6703. }),
  6704. globals.NumberTest);
  6705. smalltalk.addMethod(
  6706. smalltalk.method({
  6707. selector: "testCeiling",
  6708. protocol: 'tests',
  6709. fn: function (){
  6710. var self=this;
  6711. return smalltalk.withContext(function($ctx1) {
  6712. var $1,$2;
  6713. $1=(1.2)._ceiling();
  6714. $ctx1.sendIdx["ceiling"]=1;
  6715. self._assert_equals_($1,(2));
  6716. $ctx1.sendIdx["assert:equals:"]=1;
  6717. $2=(-1.2)._ceiling();
  6718. $ctx1.sendIdx["ceiling"]=2;
  6719. self._assert_equals_($2,(-1));
  6720. $ctx1.sendIdx["assert:equals:"]=2;
  6721. self._assert_equals_((1)._ceiling(),(1));
  6722. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6723. args: [],
  6724. 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.",
  6725. messageSends: ["assert:equals:", "ceiling"],
  6726. referencedClasses: []
  6727. }),
  6728. globals.NumberTest);
  6729. smalltalk.addMethod(
  6730. smalltalk.method({
  6731. selector: "testComparison",
  6732. protocol: 'tests',
  6733. fn: function (){
  6734. var self=this;
  6735. return smalltalk.withContext(function($ctx1) {
  6736. var $1,$2,$3,$4;
  6737. $1=(3).__gt((2));
  6738. $ctx1.sendIdx[">"]=1;
  6739. self._assert_($1);
  6740. $ctx1.sendIdx["assert:"]=1;
  6741. $2=(2).__lt((3));
  6742. $ctx1.sendIdx["<"]=1;
  6743. self._assert_($2);
  6744. $ctx1.sendIdx["assert:"]=2;
  6745. self._deny_((3).__lt((2)));
  6746. $ctx1.sendIdx["deny:"]=1;
  6747. self._deny_((2).__gt((3)));
  6748. $3=(3).__gt_eq((3));
  6749. $ctx1.sendIdx[">="]=1;
  6750. self._assert_($3);
  6751. $ctx1.sendIdx["assert:"]=3;
  6752. self._assert_((3.1).__gt_eq((3)));
  6753. $ctx1.sendIdx["assert:"]=4;
  6754. $4=(3).__lt_eq((3));
  6755. $ctx1.sendIdx["<="]=1;
  6756. self._assert_($4);
  6757. $ctx1.sendIdx["assert:"]=5;
  6758. self._assert_((3).__lt_eq((3.1)));
  6759. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6760. args: [],
  6761. 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",
  6762. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6763. referencedClasses: []
  6764. }),
  6765. globals.NumberTest);
  6766. smalltalk.addMethod(
  6767. smalltalk.method({
  6768. selector: "testCopying",
  6769. protocol: 'tests',
  6770. fn: function (){
  6771. var self=this;
  6772. return smalltalk.withContext(function($ctx1) {
  6773. var $1;
  6774. $1=_st((1)._copy()).__eq_eq((1));
  6775. $ctx1.sendIdx["=="]=1;
  6776. self._assert_($1);
  6777. $ctx1.sendIdx["assert:"]=1;
  6778. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6779. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6780. args: [],
  6781. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6782. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6783. referencedClasses: []
  6784. }),
  6785. globals.NumberTest);
  6786. smalltalk.addMethod(
  6787. smalltalk.method({
  6788. selector: "testEquality",
  6789. protocol: 'tests',
  6790. fn: function (){
  6791. var self=this;
  6792. return smalltalk.withContext(function($ctx1) {
  6793. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6794. $1=(1).__eq((1));
  6795. $ctx1.sendIdx["="]=1;
  6796. self._assert_($1);
  6797. $ctx1.sendIdx["assert:"]=1;
  6798. $2=(0).__eq((0));
  6799. $ctx1.sendIdx["="]=2;
  6800. self._assert_($2);
  6801. $ctx1.sendIdx["assert:"]=2;
  6802. $3=(1).__eq((0));
  6803. $ctx1.sendIdx["="]=3;
  6804. self._deny_($3);
  6805. $ctx1.sendIdx["deny:"]=1;
  6806. $5=(1)._yourself();
  6807. $ctx1.sendIdx["yourself"]=1;
  6808. $4=_st($5).__eq((1));
  6809. $ctx1.sendIdx["="]=4;
  6810. self._assert_($4);
  6811. $ctx1.sendIdx["assert:"]=3;
  6812. $7=(1)._yourself();
  6813. $ctx1.sendIdx["yourself"]=2;
  6814. $6=(1).__eq($7);
  6815. $ctx1.sendIdx["="]=5;
  6816. self._assert_($6);
  6817. $ctx1.sendIdx["assert:"]=4;
  6818. $9=(1)._yourself();
  6819. $ctx1.sendIdx["yourself"]=3;
  6820. $8=_st($9).__eq((1)._yourself());
  6821. $ctx1.sendIdx["="]=6;
  6822. self._assert_($8);
  6823. $10=(0).__eq(false);
  6824. $ctx1.sendIdx["="]=7;
  6825. self._deny_($10);
  6826. $ctx1.sendIdx["deny:"]=2;
  6827. $11=false.__eq((0));
  6828. $ctx1.sendIdx["="]=8;
  6829. self._deny_($11);
  6830. $ctx1.sendIdx["deny:"]=3;
  6831. $12="".__eq((0));
  6832. $ctx1.sendIdx["="]=9;
  6833. self._deny_($12);
  6834. $ctx1.sendIdx["deny:"]=4;
  6835. self._deny_((0).__eq(""));
  6836. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6837. args: [],
  6838. 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 = ''",
  6839. messageSends: ["assert:", "=", "deny:", "yourself"],
  6840. referencedClasses: []
  6841. }),
  6842. globals.NumberTest);
  6843. smalltalk.addMethod(
  6844. smalltalk.method({
  6845. selector: "testFloor",
  6846. protocol: 'tests',
  6847. fn: function (){
  6848. var self=this;
  6849. return smalltalk.withContext(function($ctx1) {
  6850. var $1,$2;
  6851. $1=(1.2)._floor();
  6852. $ctx1.sendIdx["floor"]=1;
  6853. self._assert_equals_($1,(1));
  6854. $ctx1.sendIdx["assert:equals:"]=1;
  6855. $2=(-1.2)._floor();
  6856. $ctx1.sendIdx["floor"]=2;
  6857. self._assert_equals_($2,(-2));
  6858. $ctx1.sendIdx["assert:equals:"]=2;
  6859. self._assert_equals_((1)._floor(),(1));
  6860. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6861. args: [],
  6862. 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.",
  6863. messageSends: ["assert:equals:", "floor"],
  6864. referencedClasses: []
  6865. }),
  6866. globals.NumberTest);
  6867. smalltalk.addMethod(
  6868. smalltalk.method({
  6869. selector: "testHexNumbers",
  6870. protocol: 'tests',
  6871. fn: function (){
  6872. var self=this;
  6873. return smalltalk.withContext(function($ctx1) {
  6874. var $1,$2,$3,$4,$5;
  6875. self._assert_equals_((9),(9));
  6876. $ctx1.sendIdx["assert:equals:"]=1;
  6877. $1=(10)._truncated();
  6878. $ctx1.sendIdx["truncated"]=1;
  6879. self._assert_equals_($1,(10));
  6880. $ctx1.sendIdx["assert:equals:"]=2;
  6881. $2=(11)._truncated();
  6882. $ctx1.sendIdx["truncated"]=2;
  6883. self._assert_equals_($2,(11));
  6884. $ctx1.sendIdx["assert:equals:"]=3;
  6885. $3=(12)._truncated();
  6886. $ctx1.sendIdx["truncated"]=3;
  6887. self._assert_equals_($3,(12));
  6888. $ctx1.sendIdx["assert:equals:"]=4;
  6889. $4=(13)._truncated();
  6890. $ctx1.sendIdx["truncated"]=4;
  6891. self._assert_equals_($4,(13));
  6892. $ctx1.sendIdx["assert:equals:"]=5;
  6893. $5=(14)._truncated();
  6894. $ctx1.sendIdx["truncated"]=5;
  6895. self._assert_equals_($5,(14));
  6896. $ctx1.sendIdx["assert:equals:"]=6;
  6897. self._assert_equals_((15)._truncated(),(15));
  6898. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6899. args: [],
  6900. 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",
  6901. messageSends: ["assert:equals:", "truncated"],
  6902. referencedClasses: []
  6903. }),
  6904. globals.NumberTest);
  6905. smalltalk.addMethod(
  6906. smalltalk.method({
  6907. selector: "testIdentity",
  6908. protocol: 'tests',
  6909. fn: function (){
  6910. var self=this;
  6911. return smalltalk.withContext(function($ctx1) {
  6912. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6913. $1=(1).__eq_eq((1));
  6914. $ctx1.sendIdx["=="]=1;
  6915. self._assert_($1);
  6916. $ctx1.sendIdx["assert:"]=1;
  6917. $2=(0).__eq_eq((0));
  6918. $ctx1.sendIdx["=="]=2;
  6919. self._assert_($2);
  6920. $ctx1.sendIdx["assert:"]=2;
  6921. $3=(1).__eq_eq((0));
  6922. $ctx1.sendIdx["=="]=3;
  6923. self._deny_($3);
  6924. $ctx1.sendIdx["deny:"]=1;
  6925. $5=(1)._yourself();
  6926. $ctx1.sendIdx["yourself"]=1;
  6927. $4=_st($5).__eq_eq((1));
  6928. $ctx1.sendIdx["=="]=4;
  6929. self._assert_($4);
  6930. $ctx1.sendIdx["assert:"]=3;
  6931. $7=(1)._yourself();
  6932. $ctx1.sendIdx["yourself"]=2;
  6933. $6=(1).__eq_eq($7);
  6934. $ctx1.sendIdx["=="]=5;
  6935. self._assert_($6);
  6936. $ctx1.sendIdx["assert:"]=4;
  6937. $9=(1)._yourself();
  6938. $ctx1.sendIdx["yourself"]=3;
  6939. $8=_st($9).__eq_eq((1)._yourself());
  6940. $ctx1.sendIdx["=="]=6;
  6941. self._assert_($8);
  6942. self._deny_((1).__eq_eq((2)));
  6943. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6944. args: [],
  6945. 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",
  6946. messageSends: ["assert:", "==", "deny:", "yourself"],
  6947. referencedClasses: []
  6948. }),
  6949. globals.NumberTest);
  6950. smalltalk.addMethod(
  6951. smalltalk.method({
  6952. selector: "testInvalidHexNumbers",
  6953. protocol: 'tests',
  6954. fn: function (){
  6955. var self=this;
  6956. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6957. return smalltalk.withContext(function($ctx1) {
  6958. self._should_raise_((function(){
  6959. return smalltalk.withContext(function($ctx2) {
  6960. return (16)._rG();
  6961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6962. $ctx1.sendIdx["should:raise:"]=1;
  6963. self._should_raise_((function(){
  6964. return smalltalk.withContext(function($ctx2) {
  6965. return (16)._rg();
  6966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6967. $ctx1.sendIdx["should:raise:"]=2;
  6968. self._should_raise_((function(){
  6969. return smalltalk.withContext(function($ctx2) {
  6970. return (16)._rH();
  6971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6972. $ctx1.sendIdx["should:raise:"]=3;
  6973. self._should_raise_((function(){
  6974. return smalltalk.withContext(function($ctx2) {
  6975. return (16)._rh();
  6976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6977. $ctx1.sendIdx["should:raise:"]=4;
  6978. self._should_raise_((function(){
  6979. return smalltalk.withContext(function($ctx2) {
  6980. return (16)._rI();
  6981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6982. $ctx1.sendIdx["should:raise:"]=5;
  6983. self._should_raise_((function(){
  6984. return smalltalk.withContext(function($ctx2) {
  6985. return (16)._ri();
  6986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6987. $ctx1.sendIdx["should:raise:"]=6;
  6988. self._should_raise_((function(){
  6989. return smalltalk.withContext(function($ctx2) {
  6990. return (16)._rJ();
  6991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6992. $ctx1.sendIdx["should:raise:"]=7;
  6993. self._should_raise_((function(){
  6994. return smalltalk.withContext(function($ctx2) {
  6995. return (16)._rj();
  6996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6997. $ctx1.sendIdx["should:raise:"]=8;
  6998. self._should_raise_((function(){
  6999. return smalltalk.withContext(function($ctx2) {
  7000. return (16)._rK();
  7001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  7002. $ctx1.sendIdx["should:raise:"]=9;
  7003. self._should_raise_((function(){
  7004. return smalltalk.withContext(function($ctx2) {
  7005. return (16)._rk();
  7006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  7007. $ctx1.sendIdx["should:raise:"]=10;
  7008. self._should_raise_((function(){
  7009. return smalltalk.withContext(function($ctx2) {
  7010. return (16)._rL();
  7011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  7012. $ctx1.sendIdx["should:raise:"]=11;
  7013. self._should_raise_((function(){
  7014. return smalltalk.withContext(function($ctx2) {
  7015. return (16)._rl();
  7016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  7017. $ctx1.sendIdx["should:raise:"]=12;
  7018. self._should_raise_((function(){
  7019. return smalltalk.withContext(function($ctx2) {
  7020. return (16)._rM();
  7021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  7022. $ctx1.sendIdx["should:raise:"]=13;
  7023. self._should_raise_((function(){
  7024. return smalltalk.withContext(function($ctx2) {
  7025. return (16)._rm();
  7026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  7027. $ctx1.sendIdx["should:raise:"]=14;
  7028. self._should_raise_((function(){
  7029. return smalltalk.withContext(function($ctx2) {
  7030. return (16)._rN();
  7031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  7032. $ctx1.sendIdx["should:raise:"]=15;
  7033. self._should_raise_((function(){
  7034. return smalltalk.withContext(function($ctx2) {
  7035. return (16)._rn();
  7036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  7037. $ctx1.sendIdx["should:raise:"]=16;
  7038. self._should_raise_((function(){
  7039. return smalltalk.withContext(function($ctx2) {
  7040. return (16)._rO();
  7041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  7042. $ctx1.sendIdx["should:raise:"]=17;
  7043. self._should_raise_((function(){
  7044. return smalltalk.withContext(function($ctx2) {
  7045. return (16)._ro();
  7046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  7047. $ctx1.sendIdx["should:raise:"]=18;
  7048. self._should_raise_((function(){
  7049. return smalltalk.withContext(function($ctx2) {
  7050. return (16)._rP();
  7051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  7052. $ctx1.sendIdx["should:raise:"]=19;
  7053. self._should_raise_((function(){
  7054. return smalltalk.withContext(function($ctx2) {
  7055. return (16)._rp();
  7056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  7057. $ctx1.sendIdx["should:raise:"]=20;
  7058. self._should_raise_((function(){
  7059. return smalltalk.withContext(function($ctx2) {
  7060. return (16)._rQ();
  7061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  7062. $ctx1.sendIdx["should:raise:"]=21;
  7063. self._should_raise_((function(){
  7064. return smalltalk.withContext(function($ctx2) {
  7065. return (16)._rq();
  7066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  7067. $ctx1.sendIdx["should:raise:"]=22;
  7068. self._should_raise_((function(){
  7069. return smalltalk.withContext(function($ctx2) {
  7070. return (16)._rR();
  7071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  7072. $ctx1.sendIdx["should:raise:"]=23;
  7073. self._should_raise_((function(){
  7074. return smalltalk.withContext(function($ctx2) {
  7075. return (16)._rr();
  7076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  7077. $ctx1.sendIdx["should:raise:"]=24;
  7078. self._should_raise_((function(){
  7079. return smalltalk.withContext(function($ctx2) {
  7080. return (16)._rS();
  7081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  7082. $ctx1.sendIdx["should:raise:"]=25;
  7083. self._should_raise_((function(){
  7084. return smalltalk.withContext(function($ctx2) {
  7085. return (16)._rs();
  7086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  7087. $ctx1.sendIdx["should:raise:"]=26;
  7088. self._should_raise_((function(){
  7089. return smalltalk.withContext(function($ctx2) {
  7090. return (16)._rT();
  7091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  7092. $ctx1.sendIdx["should:raise:"]=27;
  7093. self._should_raise_((function(){
  7094. return smalltalk.withContext(function($ctx2) {
  7095. return (16)._rt();
  7096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  7097. $ctx1.sendIdx["should:raise:"]=28;
  7098. self._should_raise_((function(){
  7099. return smalltalk.withContext(function($ctx2) {
  7100. return (16)._rU();
  7101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  7102. $ctx1.sendIdx["should:raise:"]=29;
  7103. self._should_raise_((function(){
  7104. return smalltalk.withContext(function($ctx2) {
  7105. return (16)._ru();
  7106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  7107. $ctx1.sendIdx["should:raise:"]=30;
  7108. self._should_raise_((function(){
  7109. return smalltalk.withContext(function($ctx2) {
  7110. return (16)._rV();
  7111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  7112. $ctx1.sendIdx["should:raise:"]=31;
  7113. self._should_raise_((function(){
  7114. return smalltalk.withContext(function($ctx2) {
  7115. return (16)._rv();
  7116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  7117. $ctx1.sendIdx["should:raise:"]=32;
  7118. self._should_raise_((function(){
  7119. return smalltalk.withContext(function($ctx2) {
  7120. return (16)._rW();
  7121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  7122. $ctx1.sendIdx["should:raise:"]=33;
  7123. self._should_raise_((function(){
  7124. return smalltalk.withContext(function($ctx2) {
  7125. return (16)._rw();
  7126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  7127. $ctx1.sendIdx["should:raise:"]=34;
  7128. self._should_raise_((function(){
  7129. return smalltalk.withContext(function($ctx2) {
  7130. return (16)._rX();
  7131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  7132. $ctx1.sendIdx["should:raise:"]=35;
  7133. self._should_raise_((function(){
  7134. return smalltalk.withContext(function($ctx2) {
  7135. return (16)._rx();
  7136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  7137. $ctx1.sendIdx["should:raise:"]=36;
  7138. self._should_raise_((function(){
  7139. return smalltalk.withContext(function($ctx2) {
  7140. return (16)._rY();
  7141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7142. $ctx1.sendIdx["should:raise:"]=37;
  7143. self._should_raise_((function(){
  7144. return smalltalk.withContext(function($ctx2) {
  7145. return (16)._ry();
  7146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7147. $ctx1.sendIdx["should:raise:"]=38;
  7148. self._should_raise_((function(){
  7149. return smalltalk.withContext(function($ctx2) {
  7150. return (16)._rZ();
  7151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7152. $ctx1.sendIdx["should:raise:"]=39;
  7153. self._should_raise_((function(){
  7154. return smalltalk.withContext(function($ctx2) {
  7155. return (16)._rz();
  7156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7157. $ctx1.sendIdx["should:raise:"]=40;
  7158. self._should_raise_((function(){
  7159. return smalltalk.withContext(function($ctx2) {
  7160. return (11259375)._Z();
  7161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7162. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  7163. args: [],
  7164. 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.",
  7165. 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"],
  7166. referencedClasses: ["MessageNotUnderstood"]
  7167. }),
  7168. globals.NumberTest);
  7169. smalltalk.addMethod(
  7170. smalltalk.method({
  7171. selector: "testLog",
  7172. protocol: 'tests',
  7173. fn: function (){
  7174. var self=this;
  7175. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7176. return smalltalk.withContext(function($ctx1) {
  7177. self._assert_equals_((10000)._log(),(4));
  7178. $ctx1.sendIdx["assert:equals:"]=1;
  7179. self._assert_equals_((512)._log_((2)),(9));
  7180. $ctx1.sendIdx["assert:equals:"]=2;
  7181. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7182. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7183. args: [],
  7184. 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.",
  7185. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7186. referencedClasses: ["Number"]
  7187. }),
  7188. globals.NumberTest);
  7189. smalltalk.addMethod(
  7190. smalltalk.method({
  7191. selector: "testMinMax",
  7192. protocol: 'tests',
  7193. fn: function (){
  7194. var self=this;
  7195. return smalltalk.withContext(function($ctx1) {
  7196. self._assert_equals_((2)._max_((5)),(5));
  7197. $ctx1.sendIdx["assert:equals:"]=1;
  7198. self._assert_equals_((2)._min_((5)),(2));
  7199. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7200. args: [],
  7201. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7202. messageSends: ["assert:equals:", "max:", "min:"],
  7203. referencedClasses: []
  7204. }),
  7205. globals.NumberTest);
  7206. smalltalk.addMethod(
  7207. smalltalk.method({
  7208. selector: "testNegated",
  7209. protocol: 'tests',
  7210. fn: function (){
  7211. var self=this;
  7212. return smalltalk.withContext(function($ctx1) {
  7213. var $1;
  7214. $1=(3)._negated();
  7215. $ctx1.sendIdx["negated"]=1;
  7216. self._assert_equals_($1,(-3));
  7217. $ctx1.sendIdx["assert:equals:"]=1;
  7218. self._assert_equals_((-3)._negated(),(3));
  7219. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7220. args: [],
  7221. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7222. messageSends: ["assert:equals:", "negated"],
  7223. referencedClasses: []
  7224. }),
  7225. globals.NumberTest);
  7226. smalltalk.addMethod(
  7227. smalltalk.method({
  7228. selector: "testPrintShowingDecimalPlaces",
  7229. protocol: 'tests',
  7230. fn: function (){
  7231. var self=this;
  7232. return smalltalk.withContext(function($ctx1) {
  7233. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7234. $1=(23)._printShowingDecimalPlaces_((2));
  7235. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7236. self._assert_equals_($1,"23.00");
  7237. $ctx1.sendIdx["assert:equals:"]=1;
  7238. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7239. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7240. self._assert_equals_($2,"23.57");
  7241. $ctx1.sendIdx["assert:equals:"]=2;
  7242. $4=(234.567)._negated();
  7243. $ctx1.sendIdx["negated"]=1;
  7244. $3=_st($4)._printShowingDecimalPlaces_((5));
  7245. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7246. self._assert_equals_($3,"-234.56700");
  7247. $ctx1.sendIdx["assert:equals:"]=3;
  7248. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7249. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7250. self._assert_equals_($5,"23");
  7251. $ctx1.sendIdx["assert:equals:"]=4;
  7252. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7253. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7254. self._assert_equals_($6,"24");
  7255. $ctx1.sendIdx["assert:equals:"]=5;
  7256. $8=(23.4567)._negated();
  7257. $ctx1.sendIdx["negated"]=2;
  7258. $7=_st($8)._printShowingDecimalPlaces_((0));
  7259. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7260. self._assert_equals_($7,"-23");
  7261. $ctx1.sendIdx["assert:equals:"]=6;
  7262. $10=(23.5567)._negated();
  7263. $ctx1.sendIdx["negated"]=3;
  7264. $9=_st($10)._printShowingDecimalPlaces_((0));
  7265. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7266. self._assert_equals_($9,"-24");
  7267. $ctx1.sendIdx["assert:equals:"]=7;
  7268. $11=(100000000)._printShowingDecimalPlaces_((1));
  7269. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7270. self._assert_equals_($11,"100000000.0");
  7271. $ctx1.sendIdx["assert:equals:"]=8;
  7272. $12=(0.98)._printShowingDecimalPlaces_((5));
  7273. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7274. self._assert_equals_($12,"0.98000");
  7275. $ctx1.sendIdx["assert:equals:"]=9;
  7276. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7277. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7278. self._assert_equals_($13,"-0.98");
  7279. $ctx1.sendIdx["assert:equals:"]=10;
  7280. $14=(2.567)._printShowingDecimalPlaces_((2));
  7281. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7282. self._assert_equals_($14,"2.57");
  7283. $ctx1.sendIdx["assert:equals:"]=11;
  7284. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7285. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7286. self._assert_equals_($15,"-2.57");
  7287. $ctx1.sendIdx["assert:equals:"]=12;
  7288. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7289. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7290. args: [],
  7291. 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'.",
  7292. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7293. referencedClasses: []
  7294. }),
  7295. globals.NumberTest);
  7296. smalltalk.addMethod(
  7297. smalltalk.method({
  7298. selector: "testRaisedTo",
  7299. protocol: 'tests',
  7300. fn: function (){
  7301. var self=this;
  7302. return smalltalk.withContext(function($ctx1) {
  7303. var $1,$2,$3;
  7304. $1=(2)._raisedTo_((4));
  7305. $ctx1.sendIdx["raisedTo:"]=1;
  7306. self._assert_equals_($1,(16));
  7307. $ctx1.sendIdx["assert:equals:"]=1;
  7308. $2=(2)._raisedTo_((0));
  7309. $ctx1.sendIdx["raisedTo:"]=2;
  7310. self._assert_equals_($2,(1));
  7311. $ctx1.sendIdx["assert:equals:"]=2;
  7312. $3=(2)._raisedTo_((-3));
  7313. $ctx1.sendIdx["raisedTo:"]=3;
  7314. self._assert_equals_($3,(0.125));
  7315. $ctx1.sendIdx["assert:equals:"]=3;
  7316. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7317. $ctx1.sendIdx["assert:equals:"]=4;
  7318. self._assert_equals_((2).__star_star((4)),(16));
  7319. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7320. args: [],
  7321. 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.",
  7322. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7323. referencedClasses: []
  7324. }),
  7325. globals.NumberTest);
  7326. smalltalk.addMethod(
  7327. smalltalk.method({
  7328. selector: "testRounded",
  7329. protocol: 'tests',
  7330. fn: function (){
  7331. var self=this;
  7332. return smalltalk.withContext(function($ctx1) {
  7333. var $1,$2;
  7334. $1=(3)._rounded();
  7335. $ctx1.sendIdx["rounded"]=1;
  7336. self._assert_equals_($1,(3));
  7337. $ctx1.sendIdx["assert:equals:"]=1;
  7338. $2=(3.212)._rounded();
  7339. $ctx1.sendIdx["rounded"]=2;
  7340. self._assert_equals_($2,(3));
  7341. $ctx1.sendIdx["assert:equals:"]=2;
  7342. self._assert_equals_((3.51)._rounded(),(4));
  7343. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7344. args: [],
  7345. 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",
  7346. messageSends: ["assert:equals:", "rounded"],
  7347. referencedClasses: []
  7348. }),
  7349. globals.NumberTest);
  7350. smalltalk.addMethod(
  7351. smalltalk.method({
  7352. selector: "testSign",
  7353. protocol: 'tests',
  7354. fn: function (){
  7355. var self=this;
  7356. return smalltalk.withContext(function($ctx1) {
  7357. var $1,$2;
  7358. $1=(5)._sign();
  7359. $ctx1.sendIdx["sign"]=1;
  7360. self._assert_equals_($1,(1));
  7361. $ctx1.sendIdx["assert:equals:"]=1;
  7362. $2=(0)._sign();
  7363. $ctx1.sendIdx["sign"]=2;
  7364. self._assert_equals_($2,(0));
  7365. $ctx1.sendIdx["assert:equals:"]=2;
  7366. self._assert_equals_((-1.4)._sign(),(-1));
  7367. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7368. args: [],
  7369. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7370. messageSends: ["assert:equals:", "sign"],
  7371. referencedClasses: []
  7372. }),
  7373. globals.NumberTest);
  7374. smalltalk.addMethod(
  7375. smalltalk.method({
  7376. selector: "testSqrt",
  7377. protocol: 'tests',
  7378. fn: function (){
  7379. var self=this;
  7380. return smalltalk.withContext(function($ctx1) {
  7381. var $1;
  7382. $1=(4)._sqrt();
  7383. $ctx1.sendIdx["sqrt"]=1;
  7384. self._assert_equals_($1,(2));
  7385. $ctx1.sendIdx["assert:equals:"]=1;
  7386. self._assert_equals_((16)._sqrt(),(4));
  7387. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7388. args: [],
  7389. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7390. messageSends: ["assert:equals:", "sqrt"],
  7391. referencedClasses: []
  7392. }),
  7393. globals.NumberTest);
  7394. smalltalk.addMethod(
  7395. smalltalk.method({
  7396. selector: "testSquared",
  7397. protocol: 'tests',
  7398. fn: function (){
  7399. var self=this;
  7400. return smalltalk.withContext(function($ctx1) {
  7401. self._assert_equals_((4)._squared(),(16));
  7402. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7403. args: [],
  7404. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7405. messageSends: ["assert:equals:", "squared"],
  7406. referencedClasses: []
  7407. }),
  7408. globals.NumberTest);
  7409. smalltalk.addMethod(
  7410. smalltalk.method({
  7411. selector: "testTimesRepeat",
  7412. protocol: 'tests',
  7413. fn: function (){
  7414. var self=this;
  7415. var i;
  7416. return smalltalk.withContext(function($ctx1) {
  7417. i=(0);
  7418. (0)._timesRepeat_((function(){
  7419. return smalltalk.withContext(function($ctx2) {
  7420. i=_st(i).__plus((1));
  7421. $ctx2.sendIdx["+"]=1;
  7422. return i;
  7423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7424. $ctx1.sendIdx["timesRepeat:"]=1;
  7425. self._assert_equals_(i,(0));
  7426. $ctx1.sendIdx["assert:equals:"]=1;
  7427. (5)._timesRepeat_((function(){
  7428. return smalltalk.withContext(function($ctx2) {
  7429. i=_st(i).__plus((1));
  7430. return i;
  7431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7432. self._assert_equals_(i,(5));
  7433. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7434. args: [],
  7435. 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",
  7436. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7437. referencedClasses: []
  7438. }),
  7439. globals.NumberTest);
  7440. smalltalk.addMethod(
  7441. smalltalk.method({
  7442. selector: "testTo",
  7443. protocol: 'tests',
  7444. fn: function (){
  7445. var self=this;
  7446. return smalltalk.withContext(function($ctx1) {
  7447. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7448. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7449. args: [],
  7450. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7451. messageSends: ["assert:equals:", "to:"],
  7452. referencedClasses: []
  7453. }),
  7454. globals.NumberTest);
  7455. smalltalk.addMethod(
  7456. smalltalk.method({
  7457. selector: "testToBy",
  7458. protocol: 'tests',
  7459. fn: function (){
  7460. var self=this;
  7461. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7462. return smalltalk.withContext(function($ctx1) {
  7463. var $1;
  7464. $1=(0)._to_by_((6),(2));
  7465. $ctx1.sendIdx["to:by:"]=1;
  7466. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7467. self._should_raise_((function(){
  7468. return smalltalk.withContext(function($ctx2) {
  7469. return (1)._to_by_((4),(0));
  7470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7471. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7472. args: [],
  7473. 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",
  7474. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7475. referencedClasses: ["Error"]
  7476. }),
  7477. globals.NumberTest);
  7478. smalltalk.addMethod(
  7479. smalltalk.method({
  7480. selector: "testTrigonometry",
  7481. protocol: 'tests',
  7482. fn: function (){
  7483. var self=this;
  7484. return smalltalk.withContext(function($ctx1) {
  7485. self._assert_equals_((0)._cos(),(1));
  7486. $ctx1.sendIdx["assert:equals:"]=1;
  7487. self._assert_equals_((0)._sin(),(0));
  7488. $ctx1.sendIdx["assert:equals:"]=2;
  7489. self._assert_equals_((0)._tan(),(0));
  7490. $ctx1.sendIdx["assert:equals:"]=3;
  7491. self._assert_equals_((1)._arcCos(),(0));
  7492. $ctx1.sendIdx["assert:equals:"]=4;
  7493. self._assert_equals_((0)._arcSin(),(0));
  7494. $ctx1.sendIdx["assert:equals:"]=5;
  7495. self._assert_equals_((0)._arcTan(),(0));
  7496. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7497. args: [],
  7498. 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.",
  7499. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7500. referencedClasses: []
  7501. }),
  7502. globals.NumberTest);
  7503. smalltalk.addMethod(
  7504. smalltalk.method({
  7505. selector: "testTruncated",
  7506. protocol: 'tests',
  7507. fn: function (){
  7508. var self=this;
  7509. return smalltalk.withContext(function($ctx1) {
  7510. var $1,$2;
  7511. $1=(3)._truncated();
  7512. $ctx1.sendIdx["truncated"]=1;
  7513. self._assert_equals_($1,(3));
  7514. $ctx1.sendIdx["assert:equals:"]=1;
  7515. $2=(3.212)._truncated();
  7516. $ctx1.sendIdx["truncated"]=2;
  7517. self._assert_equals_($2,(3));
  7518. $ctx1.sendIdx["assert:equals:"]=2;
  7519. self._assert_equals_((3.51)._truncated(),(3));
  7520. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7521. args: [],
  7522. 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",
  7523. messageSends: ["assert:equals:", "truncated"],
  7524. referencedClasses: []
  7525. }),
  7526. globals.NumberTest);
  7527. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7528. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7529. smalltalk.addMethod(
  7530. smalltalk.method({
  7531. selector: "foo",
  7532. protocol: 'not yet classified',
  7533. fn: function (){
  7534. var self=this;
  7535. var $1;
  7536. $1=self["@foo"];
  7537. return $1;
  7538. },
  7539. args: [],
  7540. source: "foo\x0a\x09^ foo",
  7541. messageSends: [],
  7542. referencedClasses: []
  7543. }),
  7544. globals.ObjectMock);
  7545. smalltalk.addMethod(
  7546. smalltalk.method({
  7547. selector: "foo:",
  7548. protocol: 'not yet classified',
  7549. fn: function (anObject){
  7550. var self=this;
  7551. self["@foo"]=anObject;
  7552. return self},
  7553. args: ["anObject"],
  7554. source: "foo: anObject\x0a\x09foo := anObject",
  7555. messageSends: [],
  7556. referencedClasses: []
  7557. }),
  7558. globals.ObjectMock);
  7559. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7560. smalltalk.addMethod(
  7561. smalltalk.method({
  7562. selector: "notDefined",
  7563. protocol: 'tests',
  7564. fn: function (){
  7565. var self=this;
  7566. return smalltalk.withContext(function($ctx1) {
  7567. return void 0;;
  7568. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7569. args: [],
  7570. source: "notDefined\x0a\x09<return void 0;>",
  7571. messageSends: [],
  7572. referencedClasses: []
  7573. }),
  7574. globals.ObjectTest);
  7575. smalltalk.addMethod(
  7576. smalltalk.method({
  7577. selector: "testBasicAccess",
  7578. protocol: 'tests',
  7579. fn: function (){
  7580. var self=this;
  7581. var o;
  7582. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7583. return smalltalk.withContext(function($ctx1) {
  7584. var $1;
  7585. o=_st($Object())._new();
  7586. _st(o)._basicAt_put_("a",(1));
  7587. $1=_st(o)._basicAt_("a");
  7588. $ctx1.sendIdx["basicAt:"]=1;
  7589. self._assert_equals_($1,(1));
  7590. $ctx1.sendIdx["assert:equals:"]=1;
  7591. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7592. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7593. args: [],
  7594. 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",
  7595. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7596. referencedClasses: ["Object"]
  7597. }),
  7598. globals.ObjectTest);
  7599. smalltalk.addMethod(
  7600. smalltalk.method({
  7601. selector: "testBasicPerform",
  7602. protocol: 'tests',
  7603. fn: function (){
  7604. var self=this;
  7605. var o;
  7606. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7607. return smalltalk.withContext(function($ctx1) {
  7608. o=_st($Object())._new();
  7609. _st(o)._basicAt_put_("func",(function(){
  7610. return "hello";
  7611. }));
  7612. $ctx1.sendIdx["basicAt:put:"]=1;
  7613. _st(o)._basicAt_put_("func2",(function(a){
  7614. return smalltalk.withContext(function($ctx2) {
  7615. return _st(a).__plus((1));
  7616. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7617. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7618. $ctx1.sendIdx["assert:equals:"]=1;
  7619. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7620. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7621. args: [],
  7622. 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",
  7623. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7624. referencedClasses: ["Object"]
  7625. }),
  7626. globals.ObjectTest);
  7627. smalltalk.addMethod(
  7628. smalltalk.method({
  7629. selector: "testDNU",
  7630. protocol: 'tests',
  7631. fn: function (){
  7632. var self=this;
  7633. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7634. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7635. return smalltalk.withContext(function($ctx1) {
  7636. self._should_raise_((function(){
  7637. return smalltalk.withContext(function($ctx2) {
  7638. return _st(_st($Object())._new())._foo();
  7639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7640. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7641. args: [],
  7642. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7643. messageSends: ["should:raise:", "foo", "new"],
  7644. referencedClasses: ["Object", "MessageNotUnderstood"]
  7645. }),
  7646. globals.ObjectTest);
  7647. smalltalk.addMethod(
  7648. smalltalk.method({
  7649. selector: "testEquality",
  7650. protocol: 'tests',
  7651. fn: function (){
  7652. var self=this;
  7653. var o;
  7654. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7655. return smalltalk.withContext(function($ctx1) {
  7656. var $1,$2,$4,$3;
  7657. o=_st($Object())._new();
  7658. $ctx1.sendIdx["new"]=1;
  7659. $1=_st(o).__eq(_st($Object())._new());
  7660. $ctx1.sendIdx["="]=1;
  7661. self._deny_($1);
  7662. $2=_st(o).__eq(o);
  7663. $ctx1.sendIdx["="]=2;
  7664. self._assert_($2);
  7665. $ctx1.sendIdx["assert:"]=1;
  7666. $4=_st(o)._yourself();
  7667. $ctx1.sendIdx["yourself"]=1;
  7668. $3=_st($4).__eq(o);
  7669. $ctx1.sendIdx["="]=3;
  7670. self._assert_($3);
  7671. $ctx1.sendIdx["assert:"]=2;
  7672. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7673. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7674. args: [],
  7675. 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)",
  7676. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7677. referencedClasses: ["Object"]
  7678. }),
  7679. globals.ObjectTest);
  7680. smalltalk.addMethod(
  7681. smalltalk.method({
  7682. selector: "testHalt",
  7683. protocol: 'tests',
  7684. fn: function (){
  7685. var self=this;
  7686. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7687. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7688. return smalltalk.withContext(function($ctx1) {
  7689. self._should_raise_((function(){
  7690. return smalltalk.withContext(function($ctx2) {
  7691. return _st(_st($Object())._new())._halt();
  7692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7693. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7694. args: [],
  7695. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7696. messageSends: ["should:raise:", "halt", "new"],
  7697. referencedClasses: ["Object", "Error"]
  7698. }),
  7699. globals.ObjectTest);
  7700. smalltalk.addMethod(
  7701. smalltalk.method({
  7702. selector: "testIdentity",
  7703. protocol: 'tests',
  7704. fn: function (){
  7705. var self=this;
  7706. var o;
  7707. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7708. return smalltalk.withContext(function($ctx1) {
  7709. var $1,$2,$4,$3;
  7710. o=_st($Object())._new();
  7711. $ctx1.sendIdx["new"]=1;
  7712. $1=_st(o).__eq_eq(_st($Object())._new());
  7713. $ctx1.sendIdx["=="]=1;
  7714. self._deny_($1);
  7715. $2=_st(o).__eq_eq(o);
  7716. $ctx1.sendIdx["=="]=2;
  7717. self._assert_($2);
  7718. $ctx1.sendIdx["assert:"]=1;
  7719. $4=_st(o)._yourself();
  7720. $ctx1.sendIdx["yourself"]=1;
  7721. $3=_st($4).__eq_eq(o);
  7722. $ctx1.sendIdx["=="]=3;
  7723. self._assert_($3);
  7724. $ctx1.sendIdx["assert:"]=2;
  7725. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7726. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7727. args: [],
  7728. 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",
  7729. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7730. referencedClasses: ["Object"]
  7731. }),
  7732. globals.ObjectTest);
  7733. smalltalk.addMethod(
  7734. smalltalk.method({
  7735. selector: "testIfNil",
  7736. protocol: 'tests',
  7737. fn: function (){
  7738. var self=this;
  7739. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7740. return smalltalk.withContext(function($ctx1) {
  7741. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7742. $2=_st($Object())._new();
  7743. $ctx1.sendIdx["new"]=1;
  7744. $1=_st($2)._isNil();
  7745. self._deny_($1);
  7746. $ctx1.sendIdx["deny:"]=1;
  7747. $5=_st($Object())._new();
  7748. $ctx1.sendIdx["new"]=2;
  7749. if(($receiver = $5) == null || $receiver.isNil){
  7750. $4=true;
  7751. } else {
  7752. $4=$5;
  7753. };
  7754. $3=_st($4).__eq(true);
  7755. self._deny_($3);
  7756. $7=_st($Object())._new();
  7757. $ctx1.sendIdx["new"]=3;
  7758. if(($receiver = $7) == null || $receiver.isNil){
  7759. $6=$7;
  7760. } else {
  7761. $6=true;
  7762. };
  7763. self._assert_equals_($6,true);
  7764. $ctx1.sendIdx["assert:equals:"]=1;
  7765. $9=_st($Object())._new();
  7766. $ctx1.sendIdx["new"]=4;
  7767. if(($receiver = $9) == null || $receiver.isNil){
  7768. $8=false;
  7769. } else {
  7770. $8=true;
  7771. };
  7772. self._assert_equals_($8,true);
  7773. $ctx1.sendIdx["assert:equals:"]=2;
  7774. $11=_st($Object())._new();
  7775. if(($receiver = $11) == null || $receiver.isNil){
  7776. $10=false;
  7777. } else {
  7778. $10=true;
  7779. };
  7780. self._assert_equals_($10,true);
  7781. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7782. args: [],
  7783. 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",
  7784. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7785. referencedClasses: ["Object"]
  7786. }),
  7787. globals.ObjectTest);
  7788. smalltalk.addMethod(
  7789. smalltalk.method({
  7790. selector: "testInstVars",
  7791. protocol: 'tests',
  7792. fn: function (){
  7793. var self=this;
  7794. var o;
  7795. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7796. return smalltalk.withContext(function($ctx1) {
  7797. var $1,$2;
  7798. o=_st($ObjectMock())._new();
  7799. $1=_st(o)._instVarAt_("foo");
  7800. $ctx1.sendIdx["instVarAt:"]=1;
  7801. self._assert_equals_($1,nil);
  7802. $ctx1.sendIdx["assert:equals:"]=1;
  7803. _st(o)._instVarAt_put_("foo",(1));
  7804. $2=_st(o)._instVarAt_("foo");
  7805. $ctx1.sendIdx["instVarAt:"]=2;
  7806. self._assert_equals_($2,(1));
  7807. $ctx1.sendIdx["assert:equals:"]=2;
  7808. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7809. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7810. args: [],
  7811. 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",
  7812. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7813. referencedClasses: ["ObjectMock"]
  7814. }),
  7815. globals.ObjectTest);
  7816. smalltalk.addMethod(
  7817. smalltalk.method({
  7818. selector: "testNilUndefined",
  7819. protocol: 'tests',
  7820. fn: function (){
  7821. var self=this;
  7822. return smalltalk.withContext(function($ctx1) {
  7823. self._assert_equals_(self._notDefined(),nil);
  7824. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7825. args: [],
  7826. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7827. messageSends: ["assert:equals:", "notDefined"],
  7828. referencedClasses: []
  7829. }),
  7830. globals.ObjectTest);
  7831. smalltalk.addMethod(
  7832. smalltalk.method({
  7833. selector: "testYourself",
  7834. protocol: 'tests',
  7835. fn: function (){
  7836. var self=this;
  7837. var o;
  7838. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7839. return smalltalk.withContext(function($ctx1) {
  7840. o=_st($ObjectMock())._new();
  7841. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7842. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7843. args: [],
  7844. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7845. messageSends: ["new", "assert:", "==", "yourself"],
  7846. referencedClasses: ["ObjectMock"]
  7847. }),
  7848. globals.ObjectTest);
  7849. smalltalk.addMethod(
  7850. smalltalk.method({
  7851. selector: "testidentityHash",
  7852. protocol: 'tests',
  7853. fn: function (){
  7854. var self=this;
  7855. var o1,o2;
  7856. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7857. return smalltalk.withContext(function($ctx1) {
  7858. var $2,$3,$1,$5,$4;
  7859. o1=_st($Object())._new();
  7860. $ctx1.sendIdx["new"]=1;
  7861. o2=_st($Object())._new();
  7862. $2=_st(o1)._identityHash();
  7863. $ctx1.sendIdx["identityHash"]=1;
  7864. $3=_st(o1)._identityHash();
  7865. $ctx1.sendIdx["identityHash"]=2;
  7866. $1=_st($2).__eq_eq($3);
  7867. $ctx1.sendIdx["=="]=1;
  7868. self._assert_($1);
  7869. $5=_st(o1)._identityHash();
  7870. $ctx1.sendIdx["identityHash"]=3;
  7871. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7872. self._deny_($4);
  7873. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7874. args: [],
  7875. 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",
  7876. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7877. referencedClasses: ["Object"]
  7878. }),
  7879. globals.ObjectTest);
  7880. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7881. smalltalk.addMethod(
  7882. smalltalk.method({
  7883. selector: "testAccessing",
  7884. protocol: 'tests',
  7885. fn: function (){
  7886. var self=this;
  7887. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7888. return smalltalk.withContext(function($ctx1) {
  7889. var $2,$1,$3,$6,$5,$4;
  7890. $2=_st($Point())._x_y_((3),(4));
  7891. $ctx1.sendIdx["x:y:"]=1;
  7892. $1=_st($2)._x();
  7893. $ctx1.sendIdx["x"]=1;
  7894. self._assert_equals_($1,(3));
  7895. $ctx1.sendIdx["assert:equals:"]=1;
  7896. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7897. $ctx1.sendIdx["y"]=1;
  7898. self._assert_equals_($3,(4));
  7899. $ctx1.sendIdx["assert:equals:"]=2;
  7900. $6=_st($Point())._new();
  7901. $ctx1.sendIdx["new"]=1;
  7902. $5=_st($6)._x_((3));
  7903. $4=_st($5)._x();
  7904. self._assert_equals_($4,(3));
  7905. $ctx1.sendIdx["assert:equals:"]=3;
  7906. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7907. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7908. args: [],
  7909. 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",
  7910. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7911. referencedClasses: ["Point"]
  7912. }),
  7913. globals.PointTest);
  7914. smalltalk.addMethod(
  7915. smalltalk.method({
  7916. selector: "testArithmetic",
  7917. protocol: 'tests',
  7918. fn: function (){
  7919. var self=this;
  7920. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7921. return smalltalk.withContext(function($ctx1) {
  7922. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7923. $2=(3).__at((4));
  7924. $ctx1.sendIdx["@"]=1;
  7925. $3=(3).__at((4));
  7926. $ctx1.sendIdx["@"]=2;
  7927. $1=_st($2).__star($3);
  7928. $4=_st($Point())._x_y_((9),(16));
  7929. $ctx1.sendIdx["x:y:"]=1;
  7930. self._assert_equals_($1,$4);
  7931. $ctx1.sendIdx["assert:equals:"]=1;
  7932. $6=(3).__at((4));
  7933. $ctx1.sendIdx["@"]=3;
  7934. $7=(3).__at((4));
  7935. $ctx1.sendIdx["@"]=4;
  7936. $5=_st($6).__plus($7);
  7937. $8=_st($Point())._x_y_((6),(8));
  7938. $ctx1.sendIdx["x:y:"]=2;
  7939. self._assert_equals_($5,$8);
  7940. $ctx1.sendIdx["assert:equals:"]=2;
  7941. $10=(3).__at((4));
  7942. $ctx1.sendIdx["@"]=5;
  7943. $11=(3).__at((4));
  7944. $ctx1.sendIdx["@"]=6;
  7945. $9=_st($10).__minus($11);
  7946. $12=_st($Point())._x_y_((0),(0));
  7947. $ctx1.sendIdx["x:y:"]=3;
  7948. self._assert_equals_($9,$12);
  7949. $ctx1.sendIdx["assert:equals:"]=3;
  7950. $14=(6).__at((8));
  7951. $ctx1.sendIdx["@"]=7;
  7952. $13=_st($14).__slash((3).__at((4)));
  7953. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7954. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7955. args: [],
  7956. 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)",
  7957. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7958. referencedClasses: ["Point"]
  7959. }),
  7960. globals.PointTest);
  7961. smalltalk.addMethod(
  7962. smalltalk.method({
  7963. selector: "testAt",
  7964. protocol: 'tests',
  7965. fn: function (){
  7966. var self=this;
  7967. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7968. return smalltalk.withContext(function($ctx1) {
  7969. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7970. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7971. args: [],
  7972. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7973. messageSends: ["assert:equals:", "@", "x:y:"],
  7974. referencedClasses: ["Point"]
  7975. }),
  7976. globals.PointTest);
  7977. smalltalk.addMethod(
  7978. smalltalk.method({
  7979. selector: "testComparison",
  7980. protocol: 'tests',
  7981. fn: function (){
  7982. var self=this;
  7983. return smalltalk.withContext(function($ctx1) {
  7984. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7985. $2=(3).__at((4));
  7986. $ctx1.sendIdx["@"]=1;
  7987. $3=(4).__at((5));
  7988. $ctx1.sendIdx["@"]=2;
  7989. $1=_st($2).__lt($3);
  7990. $ctx1.sendIdx["<"]=1;
  7991. self._assert_($1);
  7992. $ctx1.sendIdx["assert:"]=1;
  7993. $5=(3).__at((4));
  7994. $ctx1.sendIdx["@"]=3;
  7995. $6=(4).__at((4));
  7996. $ctx1.sendIdx["@"]=4;
  7997. $4=_st($5).__lt($6);
  7998. self._deny_($4);
  7999. $ctx1.sendIdx["deny:"]=1;
  8000. $8=(4).__at((5));
  8001. $ctx1.sendIdx["@"]=5;
  8002. $9=(4).__at((5));
  8003. $ctx1.sendIdx["@"]=6;
  8004. $7=_st($8).__lt_eq($9);
  8005. $ctx1.sendIdx["<="]=1;
  8006. self._assert_($7);
  8007. $ctx1.sendIdx["assert:"]=2;
  8008. $11=(4).__at((5));
  8009. $ctx1.sendIdx["@"]=7;
  8010. $12=(3).__at((5));
  8011. $ctx1.sendIdx["@"]=8;
  8012. $10=_st($11).__lt_eq($12);
  8013. self._deny_($10);
  8014. $ctx1.sendIdx["deny:"]=2;
  8015. $14=(5).__at((6));
  8016. $ctx1.sendIdx["@"]=9;
  8017. $15=(4).__at((5));
  8018. $ctx1.sendIdx["@"]=10;
  8019. $13=_st($14).__gt($15);
  8020. $ctx1.sendIdx[">"]=1;
  8021. self._assert_($13);
  8022. $ctx1.sendIdx["assert:"]=3;
  8023. $17=(5).__at((6));
  8024. $ctx1.sendIdx["@"]=11;
  8025. $18=(6).__at((6));
  8026. $ctx1.sendIdx["@"]=12;
  8027. $16=_st($17).__gt($18);
  8028. self._deny_($16);
  8029. $ctx1.sendIdx["deny:"]=3;
  8030. $20=(4).__at((5));
  8031. $ctx1.sendIdx["@"]=13;
  8032. $21=(4).__at((5));
  8033. $ctx1.sendIdx["@"]=14;
  8034. $19=_st($20).__gt_eq($21);
  8035. $ctx1.sendIdx[">="]=1;
  8036. self._assert_($19);
  8037. $23=(4).__at((5));
  8038. $ctx1.sendIdx["@"]=15;
  8039. $22=_st($23).__gt_eq((5).__at((5)));
  8040. self._deny_($22);
  8041. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  8042. args: [],
  8043. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  8044. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  8045. referencedClasses: []
  8046. }),
  8047. globals.PointTest);
  8048. smalltalk.addMethod(
  8049. smalltalk.method({
  8050. selector: "testEgality",
  8051. protocol: 'tests',
  8052. fn: function (){
  8053. var self=this;
  8054. return smalltalk.withContext(function($ctx1) {
  8055. var $2,$3,$1,$5,$4;
  8056. $2=(3).__at((4));
  8057. $ctx1.sendIdx["@"]=1;
  8058. $3=(3).__at((4));
  8059. $ctx1.sendIdx["@"]=2;
  8060. $1=_st($2).__eq($3);
  8061. $ctx1.sendIdx["="]=1;
  8062. self._assert_($1);
  8063. $5=(3).__at((5));
  8064. $ctx1.sendIdx["@"]=3;
  8065. $4=_st($5).__eq((3).__at((6)));
  8066. self._deny_($4);
  8067. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  8068. args: [],
  8069. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  8070. messageSends: ["assert:", "=", "@", "deny:"],
  8071. referencedClasses: []
  8072. }),
  8073. globals.PointTest);
  8074. smalltalk.addMethod(
  8075. smalltalk.method({
  8076. selector: "testNew",
  8077. protocol: 'tests',
  8078. fn: function (){
  8079. var self=this;
  8080. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8081. return smalltalk.withContext(function($ctx1) {
  8082. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  8083. $3=_st($Point())._new();
  8084. $ctx1.sendIdx["new"]=1;
  8085. $2=_st($3)._x_((3));
  8086. $ctx1.sendIdx["x:"]=1;
  8087. $1=_st($2)._y();
  8088. $ctx1.sendIdx["y"]=1;
  8089. self._assert_equals_($1,nil);
  8090. $ctx1.sendIdx["assert:equals:"]=1;
  8091. $7=_st($Point())._new();
  8092. $ctx1.sendIdx["new"]=2;
  8093. $6=_st($7)._x_((3));
  8094. $5=_st($6)._x();
  8095. $ctx1.sendIdx["x"]=1;
  8096. $4=_st($5).__eq((0));
  8097. $ctx1.sendIdx["="]=1;
  8098. self._deny_($4);
  8099. $ctx1.sendIdx["deny:"]=1;
  8100. $10=_st($Point())._new();
  8101. $ctx1.sendIdx["new"]=3;
  8102. $9=_st($10)._y_((4));
  8103. $ctx1.sendIdx["y:"]=1;
  8104. $8=_st($9)._x();
  8105. self._assert_equals_($8,nil);
  8106. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  8107. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  8108. args: [],
  8109. 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",
  8110. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  8111. referencedClasses: ["Point"]
  8112. }),
  8113. globals.PointTest);
  8114. smalltalk.addMethod(
  8115. smalltalk.method({
  8116. selector: "testTranslateBy",
  8117. protocol: 'tests',
  8118. fn: function (){
  8119. var self=this;
  8120. return smalltalk.withContext(function($ctx1) {
  8121. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  8122. $2=(3).__at((3));
  8123. $ctx1.sendIdx["@"]=1;
  8124. $3=(0).__at((1));
  8125. $ctx1.sendIdx["@"]=2;
  8126. $1=_st($2)._translateBy_($3);
  8127. $ctx1.sendIdx["translateBy:"]=1;
  8128. $4=(3).__at((4));
  8129. $ctx1.sendIdx["@"]=3;
  8130. self._assert_equals_($1,$4);
  8131. $ctx1.sendIdx["assert:equals:"]=1;
  8132. $6=(3).__at((3));
  8133. $ctx1.sendIdx["@"]=4;
  8134. $8=(1)._negated();
  8135. $ctx1.sendIdx["negated"]=1;
  8136. $7=(0).__at($8);
  8137. $ctx1.sendIdx["@"]=5;
  8138. $5=_st($6)._translateBy_($7);
  8139. $ctx1.sendIdx["translateBy:"]=2;
  8140. $9=(3).__at((2));
  8141. $ctx1.sendIdx["@"]=6;
  8142. self._assert_equals_($5,$9);
  8143. $ctx1.sendIdx["assert:equals:"]=2;
  8144. $11=(3).__at((3));
  8145. $ctx1.sendIdx["@"]=7;
  8146. $12=(2).__at((3));
  8147. $ctx1.sendIdx["@"]=8;
  8148. $10=_st($11)._translateBy_($12);
  8149. $ctx1.sendIdx["translateBy:"]=3;
  8150. $13=(5).__at((6));
  8151. $ctx1.sendIdx["@"]=9;
  8152. self._assert_equals_($10,$13);
  8153. $ctx1.sendIdx["assert:equals:"]=3;
  8154. $15=(3).__at((3));
  8155. $ctx1.sendIdx["@"]=10;
  8156. $16=_st((3)._negated()).__at((0));
  8157. $ctx1.sendIdx["@"]=11;
  8158. $14=_st($15)._translateBy_($16);
  8159. self._assert_equals_($14,(0).__at((3)));
  8160. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  8161. args: [],
  8162. 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.",
  8163. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  8164. referencedClasses: []
  8165. }),
  8166. globals.PointTest);
  8167. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  8168. smalltalk.addMethod(
  8169. smalltalk.method({
  8170. selector: "testNextIfAbsent",
  8171. protocol: 'tests',
  8172. fn: function (){
  8173. var self=this;
  8174. var queue;
  8175. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8176. return smalltalk.withContext(function($ctx1) {
  8177. var $2,$1;
  8178. queue=_st($Queue())._new();
  8179. _st(queue)._nextPut_("index1");
  8180. $2=_st(queue)._nextIfAbsent_("empty");
  8181. $ctx1.sendIdx["nextIfAbsent:"]=1;
  8182. $1=_st($2).__eq("index1");
  8183. $ctx1.sendIdx["="]=1;
  8184. self._assert_($1);
  8185. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  8186. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  8187. args: [],
  8188. 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'",
  8189. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  8190. referencedClasses: ["Queue"]
  8191. }),
  8192. globals.QueueTest);
  8193. smalltalk.addMethod(
  8194. smalltalk.method({
  8195. selector: "testQueueNext",
  8196. protocol: 'tests',
  8197. fn: function (){
  8198. var self=this;
  8199. var queue;
  8200. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8201. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8202. return smalltalk.withContext(function($ctx1) {
  8203. var $1,$2,$4,$3,$6,$5;
  8204. queue=_st($Queue())._new();
  8205. $1=queue;
  8206. _st($1)._nextPut_("index1");
  8207. $ctx1.sendIdx["nextPut:"]=1;
  8208. $2=_st($1)._nextPut_("index2");
  8209. $4=_st(queue)._next();
  8210. $ctx1.sendIdx["next"]=1;
  8211. $3=_st($4).__eq("index1");
  8212. $ctx1.sendIdx["="]=1;
  8213. self._assert_($3);
  8214. $6=_st(queue)._next();
  8215. $ctx1.sendIdx["next"]=2;
  8216. $5=_st($6).__eq("index");
  8217. self._deny_($5);
  8218. self._should_raise_((function(){
  8219. return smalltalk.withContext(function($ctx2) {
  8220. return _st(queue)._next();
  8221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8222. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8223. args: [],
  8224. 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",
  8225. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8226. referencedClasses: ["Queue", "Error"]
  8227. }),
  8228. globals.QueueTest);
  8229. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8230. smalltalk.addMethod(
  8231. smalltalk.method({
  8232. selector: "testAtRandomNumber",
  8233. protocol: 'tests',
  8234. fn: function (){
  8235. var self=this;
  8236. var val;
  8237. return smalltalk.withContext(function($ctx1) {
  8238. (100)._timesRepeat_((function(){
  8239. return smalltalk.withContext(function($ctx2) {
  8240. val=(10)._atRandom();
  8241. val;
  8242. self._assert_(_st(val).__gt((0)));
  8243. $ctx2.sendIdx["assert:"]=1;
  8244. return self._assert_(_st(val).__lt((11)));
  8245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8246. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8247. args: [],
  8248. 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]",
  8249. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8250. referencedClasses: []
  8251. }),
  8252. globals.RandomTest);
  8253. smalltalk.addMethod(
  8254. smalltalk.method({
  8255. selector: "testAtRandomSequenceableCollection",
  8256. protocol: 'tests',
  8257. fn: function (){
  8258. var self=this;
  8259. var val;
  8260. return smalltalk.withContext(function($ctx1) {
  8261. var $3,$4,$2,$1;
  8262. (100)._timesRepeat_((function(){
  8263. return smalltalk.withContext(function($ctx2) {
  8264. val="abc"._atRandom();
  8265. val;
  8266. $3=_st(val).__eq("a");
  8267. $ctx2.sendIdx["="]=1;
  8268. $4=_st(val).__eq("b");
  8269. $ctx2.sendIdx["="]=2;
  8270. $2=_st($3).__or($4);
  8271. $1=_st($2).__or(_st(val).__eq("c"));
  8272. $ctx2.sendIdx["|"]=1;
  8273. return self._assert_($1);
  8274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8275. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8276. args: [],
  8277. 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].",
  8278. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8279. referencedClasses: []
  8280. }),
  8281. globals.RandomTest);
  8282. smalltalk.addMethod(
  8283. smalltalk.method({
  8284. selector: "textNext",
  8285. protocol: 'tests',
  8286. fn: function (){
  8287. var self=this;
  8288. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8289. return smalltalk.withContext(function($ctx1) {
  8290. var $1;
  8291. (10000)._timesRepeat_((function(){
  8292. var current,next;
  8293. return smalltalk.withContext(function($ctx2) {
  8294. next=_st(_st($Random())._new())._next();
  8295. next;
  8296. self._assert_(_st(next).__gt_eq((0)));
  8297. $ctx2.sendIdx["assert:"]=1;
  8298. self._assert_(_st(next).__lt((1)));
  8299. $1=_st(current).__eq(next);
  8300. $ctx2.sendIdx["="]=1;
  8301. self._deny_($1);
  8302. return _st(next).__eq(current);
  8303. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8304. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8305. args: [],
  8306. 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 ]",
  8307. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8308. referencedClasses: ["Random"]
  8309. }),
  8310. globals.RandomTest);
  8311. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8312. smalltalk.addMethod(
  8313. smalltalk.method({
  8314. selector: "collectionClass",
  8315. protocol: 'accessing',
  8316. fn: function (){
  8317. var self=this;
  8318. return smalltalk.withContext(function($ctx1) {
  8319. var $1;
  8320. $1=_st(self._class())._collectionClass();
  8321. return $1;
  8322. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8323. args: [],
  8324. source: "collectionClass\x0a\x09^ self class collectionClass",
  8325. messageSends: ["collectionClass", "class"],
  8326. referencedClasses: []
  8327. }),
  8328. globals.StreamTest);
  8329. smalltalk.addMethod(
  8330. smalltalk.method({
  8331. selector: "newCollection",
  8332. protocol: 'accessing',
  8333. fn: function (){
  8334. var self=this;
  8335. return smalltalk.withContext(function($ctx1) {
  8336. var $1;
  8337. $1=_st(self._collectionClass())._new();
  8338. return $1;
  8339. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8340. args: [],
  8341. source: "newCollection\x0a\x09^ self collectionClass new",
  8342. messageSends: ["new", "collectionClass"],
  8343. referencedClasses: []
  8344. }),
  8345. globals.StreamTest);
  8346. smalltalk.addMethod(
  8347. smalltalk.method({
  8348. selector: "newStream",
  8349. protocol: 'accessing',
  8350. fn: function (){
  8351. var self=this;
  8352. return smalltalk.withContext(function($ctx1) {
  8353. var $1;
  8354. $1=_st(_st(self._collectionClass())._new())._stream();
  8355. return $1;
  8356. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8357. args: [],
  8358. source: "newStream\x0a\x09^ self collectionClass new stream",
  8359. messageSends: ["stream", "new", "collectionClass"],
  8360. referencedClasses: []
  8361. }),
  8362. globals.StreamTest);
  8363. smalltalk.addMethod(
  8364. smalltalk.method({
  8365. selector: "testAtStartAtEnd",
  8366. protocol: 'tests',
  8367. fn: function (){
  8368. var self=this;
  8369. var stream;
  8370. return smalltalk.withContext(function($ctx1) {
  8371. var $1,$2,$3,$4;
  8372. stream=self._newStream();
  8373. $1=_st(stream)._atStart();
  8374. $ctx1.sendIdx["atStart"]=1;
  8375. self._assert_($1);
  8376. $ctx1.sendIdx["assert:"]=1;
  8377. $2=_st(stream)._atEnd();
  8378. $ctx1.sendIdx["atEnd"]=1;
  8379. self._assert_($2);
  8380. $ctx1.sendIdx["assert:"]=2;
  8381. _st(stream)._nextPutAll_(self._newCollection());
  8382. $3=_st(stream)._atEnd();
  8383. $ctx1.sendIdx["atEnd"]=2;
  8384. self._assert_($3);
  8385. $4=_st(stream)._atStart();
  8386. $ctx1.sendIdx["atStart"]=2;
  8387. self._deny_($4);
  8388. $ctx1.sendIdx["deny:"]=1;
  8389. _st(stream)._position_((1));
  8390. self._deny_(_st(stream)._atEnd());
  8391. $ctx1.sendIdx["deny:"]=2;
  8392. self._deny_(_st(stream)._atStart());
  8393. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8394. args: [],
  8395. 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",
  8396. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8397. referencedClasses: []
  8398. }),
  8399. globals.StreamTest);
  8400. smalltalk.addMethod(
  8401. smalltalk.method({
  8402. selector: "testContents",
  8403. protocol: 'tests',
  8404. fn: function (){
  8405. var self=this;
  8406. var stream;
  8407. return smalltalk.withContext(function($ctx1) {
  8408. var $1,$2;
  8409. stream=self._newStream();
  8410. $1=stream;
  8411. $2=self._newCollection();
  8412. $ctx1.sendIdx["newCollection"]=1;
  8413. _st($1)._nextPutAll_($2);
  8414. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8415. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8416. args: [],
  8417. 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",
  8418. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8419. referencedClasses: []
  8420. }),
  8421. globals.StreamTest);
  8422. smalltalk.addMethod(
  8423. smalltalk.method({
  8424. selector: "testIsEmpty",
  8425. protocol: 'tests',
  8426. fn: function (){
  8427. var self=this;
  8428. var stream;
  8429. return smalltalk.withContext(function($ctx1) {
  8430. var $1;
  8431. stream=self._newStream();
  8432. $1=_st(stream)._isEmpty();
  8433. $ctx1.sendIdx["isEmpty"]=1;
  8434. self._assert_($1);
  8435. _st(stream)._nextPutAll_(self._newCollection());
  8436. self._deny_(_st(stream)._isEmpty());
  8437. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8438. args: [],
  8439. 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",
  8440. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8441. referencedClasses: []
  8442. }),
  8443. globals.StreamTest);
  8444. smalltalk.addMethod(
  8445. smalltalk.method({
  8446. selector: "testPosition",
  8447. protocol: 'tests',
  8448. fn: function (){
  8449. var self=this;
  8450. var collection,stream;
  8451. return smalltalk.withContext(function($ctx1) {
  8452. var $1,$2,$3;
  8453. collection=self._newCollection();
  8454. stream=self._newStream();
  8455. _st(stream)._nextPutAll_(collection);
  8456. $1=_st(stream)._position();
  8457. $ctx1.sendIdx["position"]=1;
  8458. self._assert_equals_($1,_st(collection)._size());
  8459. $ctx1.sendIdx["assert:equals:"]=1;
  8460. _st(stream)._position_((0));
  8461. $2=_st(stream)._position();
  8462. $ctx1.sendIdx["position"]=2;
  8463. self._assert_equals_($2,(0));
  8464. $ctx1.sendIdx["assert:equals:"]=2;
  8465. _st(stream)._next();
  8466. $ctx1.sendIdx["next"]=1;
  8467. $3=_st(stream)._position();
  8468. $ctx1.sendIdx["position"]=3;
  8469. self._assert_equals_($3,(1));
  8470. $ctx1.sendIdx["assert:equals:"]=3;
  8471. _st(stream)._next();
  8472. self._assert_equals_(_st(stream)._position(),(2));
  8473. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8474. args: [],
  8475. 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",
  8476. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8477. referencedClasses: []
  8478. }),
  8479. globals.StreamTest);
  8480. smalltalk.addMethod(
  8481. smalltalk.method({
  8482. selector: "testReading",
  8483. protocol: 'tests',
  8484. fn: function (){
  8485. var self=this;
  8486. var stream,collection;
  8487. return smalltalk.withContext(function($ctx1) {
  8488. var $1,$2,$3;
  8489. collection=self._newCollection();
  8490. stream=self._newStream();
  8491. $1=stream;
  8492. _st($1)._nextPutAll_(collection);
  8493. $2=_st($1)._position_((0));
  8494. _st(collection)._do_((function(each){
  8495. return smalltalk.withContext(function($ctx2) {
  8496. $3=_st(stream)._next();
  8497. $ctx2.sendIdx["next"]=1;
  8498. return self._assert_equals_($3,each);
  8499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8500. self._assert_(_st(_st(stream)._next())._isNil());
  8501. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8502. args: [],
  8503. 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",
  8504. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8505. referencedClasses: []
  8506. }),
  8507. globals.StreamTest);
  8508. smalltalk.addMethod(
  8509. smalltalk.method({
  8510. selector: "testStreamContents",
  8511. protocol: 'tests',
  8512. fn: function (){
  8513. var self=this;
  8514. return self},
  8515. args: [],
  8516. source: "testStreamContents",
  8517. messageSends: [],
  8518. referencedClasses: []
  8519. }),
  8520. globals.StreamTest);
  8521. smalltalk.addMethod(
  8522. smalltalk.method({
  8523. selector: "testWrite",
  8524. protocol: 'tests',
  8525. fn: function (){
  8526. var self=this;
  8527. var stream,collection;
  8528. return smalltalk.withContext(function($ctx1) {
  8529. collection=self._newCollection();
  8530. stream=self._newStream();
  8531. _st(collection)._do_((function(each){
  8532. return smalltalk.withContext(function($ctx2) {
  8533. return _st(stream).__lt_lt(each);
  8534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8535. self._assert_equals_(_st(stream)._contents(),collection);
  8536. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8537. args: [],
  8538. 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",
  8539. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8540. referencedClasses: []
  8541. }),
  8542. globals.StreamTest);
  8543. smalltalk.addMethod(
  8544. smalltalk.method({
  8545. selector: "testWriting",
  8546. protocol: 'tests',
  8547. fn: function (){
  8548. var self=this;
  8549. var stream,collection;
  8550. return smalltalk.withContext(function($ctx1) {
  8551. var $1;
  8552. collection=self._newCollection();
  8553. stream=self._newStream();
  8554. $ctx1.sendIdx["newStream"]=1;
  8555. _st(collection)._do_((function(each){
  8556. return smalltalk.withContext(function($ctx2) {
  8557. return _st(stream)._nextPut_(each);
  8558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8559. $1=_st(stream)._contents();
  8560. $ctx1.sendIdx["contents"]=1;
  8561. self._assert_equals_($1,collection);
  8562. $ctx1.sendIdx["assert:equals:"]=1;
  8563. stream=self._newStream();
  8564. _st(stream)._nextPutAll_(collection);
  8565. self._assert_equals_(_st(stream)._contents(),collection);
  8566. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8567. args: [],
  8568. 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",
  8569. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8570. referencedClasses: []
  8571. }),
  8572. globals.StreamTest);
  8573. smalltalk.addMethod(
  8574. smalltalk.method({
  8575. selector: "collectionClass",
  8576. protocol: 'accessing',
  8577. fn: function (){
  8578. var self=this;
  8579. return nil;
  8580. },
  8581. args: [],
  8582. source: "collectionClass\x0a\x09^ nil",
  8583. messageSends: [],
  8584. referencedClasses: []
  8585. }),
  8586. globals.StreamTest.klass);
  8587. smalltalk.addMethod(
  8588. smalltalk.method({
  8589. selector: "isAbstract",
  8590. protocol: 'testing',
  8591. fn: function (){
  8592. var self=this;
  8593. return smalltalk.withContext(function($ctx1) {
  8594. var $1;
  8595. $1=_st(self._collectionClass())._isNil();
  8596. return $1;
  8597. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8598. args: [],
  8599. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8600. messageSends: ["isNil", "collectionClass"],
  8601. referencedClasses: []
  8602. }),
  8603. globals.StreamTest.klass);
  8604. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8605. smalltalk.addMethod(
  8606. smalltalk.method({
  8607. selector: "newCollection",
  8608. protocol: 'accessing',
  8609. fn: function (){
  8610. var self=this;
  8611. return smalltalk.withContext(function($ctx1) {
  8612. var $1;
  8613. $1=[true,(1),(3).__at((4)),"foo"];
  8614. return $1;
  8615. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8616. args: [],
  8617. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8618. messageSends: ["@"],
  8619. referencedClasses: []
  8620. }),
  8621. globals.ArrayStreamTest);
  8622. smalltalk.addMethod(
  8623. smalltalk.method({
  8624. selector: "collectionClass",
  8625. protocol: 'accessing',
  8626. fn: function (){
  8627. var self=this;
  8628. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8629. return $Array();
  8630. },
  8631. args: [],
  8632. source: "collectionClass\x0a\x09^ Array",
  8633. messageSends: [],
  8634. referencedClasses: ["Array"]
  8635. }),
  8636. globals.ArrayStreamTest.klass);
  8637. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8638. smalltalk.addMethod(
  8639. smalltalk.method({
  8640. selector: "newCollection",
  8641. protocol: 'accessing',
  8642. fn: function (){
  8643. var self=this;
  8644. return "hello world";
  8645. },
  8646. args: [],
  8647. source: "newCollection\x0a\x09^ 'hello world'",
  8648. messageSends: [],
  8649. referencedClasses: []
  8650. }),
  8651. globals.StringStreamTest);
  8652. smalltalk.addMethod(
  8653. smalltalk.method({
  8654. selector: "collectionClass",
  8655. protocol: 'accessing',
  8656. fn: function (){
  8657. var self=this;
  8658. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8659. return $String();
  8660. },
  8661. args: [],
  8662. source: "collectionClass\x0a\x09^ String",
  8663. messageSends: [],
  8664. referencedClasses: ["String"]
  8665. }),
  8666. globals.StringStreamTest.klass);
  8667. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8668. smalltalk.addMethod(
  8669. smalltalk.method({
  8670. selector: "testCopying",
  8671. protocol: 'tests',
  8672. fn: function (){
  8673. var self=this;
  8674. return smalltalk.withContext(function($ctx1) {
  8675. self._assert_equals_(nil._copy(),nil);
  8676. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8677. args: [],
  8678. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8679. messageSends: ["assert:equals:", "copy"],
  8680. referencedClasses: []
  8681. }),
  8682. globals.UndefinedTest);
  8683. smalltalk.addMethod(
  8684. smalltalk.method({
  8685. selector: "testDeepCopy",
  8686. protocol: 'tests',
  8687. fn: function (){
  8688. var self=this;
  8689. return smalltalk.withContext(function($ctx1) {
  8690. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8691. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8692. args: [],
  8693. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8694. messageSends: ["assert:", "=", "deepCopy"],
  8695. referencedClasses: []
  8696. }),
  8697. globals.UndefinedTest);
  8698. smalltalk.addMethod(
  8699. smalltalk.method({
  8700. selector: "testIfNil",
  8701. protocol: 'tests',
  8702. fn: function (){
  8703. var self=this;
  8704. return smalltalk.withContext(function($ctx1) {
  8705. var $1,$3,$2,$4,$6,$5,$receiver;
  8706. if(($receiver = nil) == null || $receiver.isNil){
  8707. $1=true;
  8708. } else {
  8709. $1=nil;
  8710. };
  8711. self._assert_equals_($1,true);
  8712. $ctx1.sendIdx["assert:equals:"]=1;
  8713. if(($receiver = nil) == null || $receiver.isNil){
  8714. $3=nil;
  8715. } else {
  8716. $3=true;
  8717. };
  8718. $2=_st($3).__eq(true);
  8719. $ctx1.sendIdx["="]=1;
  8720. self._deny_($2);
  8721. $ctx1.sendIdx["deny:"]=1;
  8722. if(($receiver = nil) == null || $receiver.isNil){
  8723. $4=true;
  8724. } else {
  8725. $4=false;
  8726. };
  8727. self._assert_equals_($4,true);
  8728. if(($receiver = nil) == null || $receiver.isNil){
  8729. $6=false;
  8730. } else {
  8731. $6=true;
  8732. };
  8733. $5=_st($6).__eq(true);
  8734. self._deny_($5);
  8735. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8736. args: [],
  8737. 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",
  8738. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8739. referencedClasses: []
  8740. }),
  8741. globals.UndefinedTest);
  8742. smalltalk.addMethod(
  8743. smalltalk.method({
  8744. selector: "testIsNil",
  8745. protocol: 'tests',
  8746. fn: function (){
  8747. var self=this;
  8748. return smalltalk.withContext(function($ctx1) {
  8749. self._assert_(nil._isNil());
  8750. self._deny_(nil._notNil());
  8751. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8752. args: [],
  8753. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8754. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8755. referencedClasses: []
  8756. }),
  8757. globals.UndefinedTest);
  8758. });