2
0

Kernel-Tests.js 337 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfAbsentPut",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var newCollection;
  2334. return smalltalk.withContext(function($ctx1) {
  2335. var $1;
  2336. newCollection=self._collection();
  2337. $ctx1.sendIdx["collection"]=1;
  2338. self._samplesDo_((function(index,value){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2341. return smalltalk.withContext(function($ctx3) {
  2342. return self._sampleNewValue();
  2343. $ctx3.sendIdx["sampleNewValue"]=1;
  2344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2345. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2346. return self._assert_equals_($1,value);
  2347. $ctx2.sendIdx["assert:equals:"]=1;
  2348. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2349. self._assert_equals_(newCollection,self._collection());
  2350. $ctx1.sendIdx["assert:equals:"]=2;
  2351. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2352. return smalltalk.withContext(function($ctx2) {
  2353. return self._sampleNewValue();
  2354. $ctx2.sendIdx["sampleNewValue"]=2;
  2355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2356. $ctx1.sendIdx["assert:equals:"]=3;
  2357. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2358. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2359. args: [],
  2360. 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",
  2361. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2362. referencedClasses: []
  2363. }),
  2364. smalltalk.IndexableCollectionTest);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "testAtIfPresent",
  2368. protocol: 'tests',
  2369. fn: function (){
  2370. var self=this;
  2371. var visited,sentinel;
  2372. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2373. return smalltalk.withContext(function($ctx1) {
  2374. var $2,$1,$4,$3;
  2375. sentinel=_st($Object())._new();
  2376. self._nonIndexesDo_((function(each){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. visited=nil;
  2379. visited;
  2380. $2=self._collection();
  2381. $ctx2.sendIdx["collection"]=1;
  2382. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2383. return smalltalk.withContext(function($ctx3) {
  2384. visited=value1;
  2385. visited;
  2386. return sentinel;
  2387. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2388. $ctx2.sendIdx["at:ifPresent:"]=1;
  2389. self._assert_equals_($1,nil);
  2390. $ctx2.sendIdx["assert:equals:"]=1;
  2391. return self._assert_(_st(visited)._isNil());
  2392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2393. self._samplesDo_((function(index,value){
  2394. return smalltalk.withContext(function($ctx2) {
  2395. visited=nil;
  2396. visited;
  2397. $4=self._collection();
  2398. $ctx2.sendIdx["collection"]=2;
  2399. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2400. return smalltalk.withContext(function($ctx3) {
  2401. visited=value2;
  2402. visited;
  2403. return sentinel;
  2404. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2405. self._assert_equals_($3,sentinel);
  2406. $ctx2.sendIdx["assert:equals:"]=2;
  2407. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2408. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2409. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2410. args: [],
  2411. 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) ]",
  2412. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2413. referencedClasses: ["Object"]
  2414. }),
  2415. smalltalk.IndexableCollectionTest);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "testAtIfPresentIfAbsent",
  2419. protocol: 'tests',
  2420. fn: function (){
  2421. var self=this;
  2422. var visited,sentinel;
  2423. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2424. return smalltalk.withContext(function($ctx1) {
  2425. var $2,$1,$3,$5,$4;
  2426. sentinel=_st($Object())._new();
  2427. self._nonIndexesDo_((function(each){
  2428. return smalltalk.withContext(function($ctx2) {
  2429. visited=nil;
  2430. visited;
  2431. $2=self._collection();
  2432. $ctx2.sendIdx["collection"]=1;
  2433. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2434. return smalltalk.withContext(function($ctx3) {
  2435. visited=value1;
  2436. visited;
  2437. return sentinel;
  2438. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2439. return smalltalk.withContext(function($ctx3) {
  2440. return self._sampleNewValue();
  2441. $ctx3.sendIdx["sampleNewValue"]=1;
  2442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2443. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2444. $3=self._sampleNewValue();
  2445. $ctx2.sendIdx["sampleNewValue"]=2;
  2446. self._assert_equals_($1,$3);
  2447. $ctx2.sendIdx["assert:equals:"]=1;
  2448. return self._assert_(_st(visited)._isNil());
  2449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2450. self._samplesDo_((function(index,value){
  2451. return smalltalk.withContext(function($ctx2) {
  2452. visited=nil;
  2453. visited;
  2454. $5=self._collection();
  2455. $ctx2.sendIdx["collection"]=2;
  2456. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2457. return smalltalk.withContext(function($ctx3) {
  2458. visited=value2;
  2459. visited;
  2460. return sentinel;
  2461. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2462. return smalltalk.withContext(function($ctx3) {
  2463. return self._sampleNewValue();
  2464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2465. self._assert_equals_($4,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,4)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. smalltalk.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtPut",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var newCollection;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. newCollection=self._collection();
  2485. $ctx1.sendIdx["collection"]=1;
  2486. self._samplesDo_((function(index,value){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return _st(newCollection)._at_put_(index,value);
  2489. $ctx2.sendIdx["at:put:"]=1;
  2490. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2491. self._assert_equals_(newCollection,self._collection());
  2492. $ctx1.sendIdx["assert:equals:"]=1;
  2493. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2494. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2495. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2496. args: [],
  2497. 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",
  2498. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2499. referencedClasses: []
  2500. }),
  2501. smalltalk.IndexableCollectionTest);
  2502. smalltalk.addMethod(
  2503. smalltalk.method({
  2504. selector: "testEquality",
  2505. protocol: 'tests',
  2506. fn: function (){
  2507. var self=this;
  2508. return smalltalk.withContext(function($ctx1) {
  2509. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2510. $2=self._collectionClass();
  2511. $ctx1.sendIdx["collectionClass"]=1;
  2512. $1=_st($2)._new();
  2513. $ctx1.sendIdx["new"]=1;
  2514. $4=self._collectionClass();
  2515. $ctx1.sendIdx["collectionClass"]=2;
  2516. $3=_st($4)._new();
  2517. $ctx1.sendIdx["new"]=2;
  2518. self._assert_equals_($1,$3);
  2519. $ctx1.sendIdx["assert:equals:"]=1;
  2520. $5=self._collection();
  2521. $ctx1.sendIdx["collection"]=1;
  2522. $6=self._collection();
  2523. $ctx1.sendIdx["collection"]=2;
  2524. self._assert_equals_($5,$6);
  2525. $ctx1.sendIdx["assert:equals:"]=2;
  2526. $7=self._collectionWithNewValue();
  2527. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2528. self._assert_equals_($7,self._collectionWithNewValue());
  2529. $10=self._collectionClass();
  2530. $ctx1.sendIdx["collectionClass"]=3;
  2531. $9=_st($10)._new();
  2532. $ctx1.sendIdx["new"]=3;
  2533. $11=self._collection();
  2534. $ctx1.sendIdx["collection"]=3;
  2535. $8=_st($9).__eq($11);
  2536. $ctx1.sendIdx["="]=1;
  2537. self._deny_($8);
  2538. $ctx1.sendIdx["deny:"]=1;
  2539. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.IndexableCollectionTest)})},
  2541. args: [],
  2542. 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",
  2543. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.IndexableCollectionTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testIndexOf",
  2550. protocol: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2554. return smalltalk.withContext(function($ctx1) {
  2555. var $1;
  2556. self._should_raise_((function(){
  2557. return smalltalk.withContext(function($ctx2) {
  2558. $1=self._collection();
  2559. $ctx2.sendIdx["collection"]=1;
  2560. return _st($1)._indexOf_(self._sampleNewValue());
  2561. $ctx2.sendIdx["indexOf:"]=1;
  2562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2563. self._samplesDo_((function(index,value){
  2564. return smalltalk.withContext(function($ctx2) {
  2565. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2566. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2567. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2568. args: [],
  2569. 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 ]",
  2570. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2571. referencedClasses: ["Error"]
  2572. }),
  2573. smalltalk.IndexableCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "testIndexOfWithNull",
  2577. protocol: 'tests',
  2578. fn: function (){
  2579. var self=this;
  2580. var jsNull;
  2581. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2582. return smalltalk.withContext(function($ctx1) {
  2583. var $1,$2;
  2584. jsNull=_st($JSON())._parse_("null");
  2585. self._samplesDo_((function(index,value){
  2586. return smalltalk.withContext(function($ctx2) {
  2587. $1=self._collection();
  2588. _st($1)._at_put_(index,jsNull);
  2589. $2=_st($1)._indexOf_(jsNull);
  2590. return self._assert_equals_($2,index);
  2591. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2592. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},smalltalk.IndexableCollectionTest)})},
  2593. args: [],
  2594. 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 ]",
  2595. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2596. referencedClasses: ["JSON"]
  2597. }),
  2598. smalltalk.IndexableCollectionTest);
  2599. smalltalk.addMethod(
  2600. smalltalk.method({
  2601. selector: "testWithIndexDo",
  2602. protocol: 'tests',
  2603. fn: function (){
  2604. var self=this;
  2605. var collection;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. collection=self._collection();
  2608. $ctx1.sendIdx["collection"]=1;
  2609. _st(self._collection())._withIndexDo_((function(each,index){
  2610. return smalltalk.withContext(function($ctx2) {
  2611. return self._assert_equals_(_st(collection)._at_(index),each);
  2612. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2613. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2614. args: [],
  2615. 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 ]",
  2616. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2617. referencedClasses: []
  2618. }),
  2619. smalltalk.IndexableCollectionTest);
  2620. smalltalk.addClass('AssociativeCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2621. smalltalk.addMethod(
  2622. smalltalk.method({
  2623. selector: "collectionKeys",
  2624. protocol: 'fixture',
  2625. fn: function (){
  2626. var self=this;
  2627. return smalltalk.withContext(function($ctx1) {
  2628. self._subclassResponsibility();
  2629. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.AssociativeCollectionTest)})},
  2630. args: [],
  2631. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2632. messageSends: ["subclassResponsibility"],
  2633. referencedClasses: []
  2634. }),
  2635. smalltalk.AssociativeCollectionTest);
  2636. smalltalk.addMethod(
  2637. smalltalk.method({
  2638. selector: "collectionValues",
  2639. protocol: 'fixture',
  2640. fn: function (){
  2641. var self=this;
  2642. return smalltalk.withContext(function($ctx1) {
  2643. self._subclassResponsibility();
  2644. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.AssociativeCollectionTest)})},
  2645. args: [],
  2646. source: "collectionValues\x0a\x09self subclassResponsibility",
  2647. messageSends: ["subclassResponsibility"],
  2648. referencedClasses: []
  2649. }),
  2650. smalltalk.AssociativeCollectionTest);
  2651. smalltalk.addMethod(
  2652. smalltalk.method({
  2653. selector: "nonIndexesDo:",
  2654. protocol: 'fixture',
  2655. fn: function (aBlock){
  2656. var self=this;
  2657. return smalltalk.withContext(function($ctx1) {
  2658. _st(aBlock)._value_((5));
  2659. $ctx1.sendIdx["value:"]=1;
  2660. _st(aBlock)._value_("z");
  2661. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2662. args: ["aBlock"],
  2663. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2664. messageSends: ["value:"],
  2665. referencedClasses: []
  2666. }),
  2667. smalltalk.AssociativeCollectionTest);
  2668. smalltalk.addMethod(
  2669. smalltalk.method({
  2670. selector: "sampleNewIndex",
  2671. protocol: 'fixture',
  2672. fn: function (){
  2673. var self=this;
  2674. return smalltalk.withContext(function($ctx1) {
  2675. return "new";
  2676. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.AssociativeCollectionTest)})},
  2677. args: [],
  2678. source: "sampleNewIndex\x0a\x09^ 'new'",
  2679. messageSends: [],
  2680. referencedClasses: []
  2681. }),
  2682. smalltalk.AssociativeCollectionTest);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "samplesDo:",
  2686. protocol: 'fixture',
  2687. fn: function (aBlock){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. _st(aBlock)._value_value_("a",(2));
  2691. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2692. args: ["aBlock"],
  2693. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2694. messageSends: ["value:value:"],
  2695. referencedClasses: []
  2696. }),
  2697. smalltalk.AssociativeCollectionTest);
  2698. smalltalk.addMethod(
  2699. smalltalk.method({
  2700. selector: "testAddAll",
  2701. protocol: 'tests',
  2702. fn: function (){
  2703. var self=this;
  2704. return smalltalk.withContext(function($ctx1) {
  2705. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2706. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2707. $2=self._collection();
  2708. $ctx1.sendIdx["collection"]=1;
  2709. $3=$2;
  2710. $4=self._collection();
  2711. $ctx1.sendIdx["collection"]=2;
  2712. _st($3)._addAll_($4);
  2713. $ctx1.sendIdx["addAll:"]=1;
  2714. $5=_st($2)._yourself();
  2715. $ctx1.sendIdx["yourself"]=1;
  2716. $1=$5;
  2717. $6=self._collection();
  2718. $ctx1.sendIdx["collection"]=3;
  2719. self._assert_equals_($1,$6);
  2720. $ctx1.sendIdx["assert:equals:"]=1;
  2721. $8=self._collection();
  2722. $ctx1.sendIdx["collection"]=4;
  2723. $9=$8;
  2724. $10=self._collectionWithNewValue();
  2725. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2726. _st($9)._addAll_($10);
  2727. $ctx1.sendIdx["addAll:"]=2;
  2728. $11=_st($8)._yourself();
  2729. $ctx1.sendIdx["yourself"]=2;
  2730. $7=$11;
  2731. $12=self._collectionWithNewValue();
  2732. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2733. self._assert_equals_($7,$12);
  2734. $ctx1.sendIdx["assert:equals:"]=2;
  2735. $14=self._collectionWithNewValue();
  2736. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2737. _st($14)._addAll_(self._collection());
  2738. $15=_st($14)._yourself();
  2739. $13=$15;
  2740. self._assert_equals_($13,self._collectionWithNewValue());
  2741. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.AssociativeCollectionTest)})},
  2742. args: [],
  2743. 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",
  2744. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2745. referencedClasses: []
  2746. }),
  2747. smalltalk.AssociativeCollectionTest);
  2748. smalltalk.addMethod(
  2749. smalltalk.method({
  2750. selector: "testAsDictionary",
  2751. protocol: 'tests',
  2752. fn: function (){
  2753. var self=this;
  2754. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2755. return smalltalk.withContext(function($ctx1) {
  2756. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2757. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.AssociativeCollectionTest)})},
  2758. args: [],
  2759. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2760. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2761. referencedClasses: ["Dictionary"]
  2762. }),
  2763. smalltalk.AssociativeCollectionTest);
  2764. smalltalk.addMethod(
  2765. smalltalk.method({
  2766. selector: "testAsHashedCollection",
  2767. protocol: 'tests',
  2768. fn: function (){
  2769. var self=this;
  2770. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2771. return smalltalk.withContext(function($ctx1) {
  2772. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2773. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.AssociativeCollectionTest)})},
  2774. args: [],
  2775. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2776. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2777. referencedClasses: ["HashedCollection"]
  2778. }),
  2779. smalltalk.AssociativeCollectionTest);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "testComma",
  2783. protocol: 'tests',
  2784. fn: function (){
  2785. var self=this;
  2786. return smalltalk.withContext(function($ctx1) {
  2787. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2788. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2789. $2=self._collection();
  2790. $ctx1.sendIdx["collection"]=1;
  2791. $3=self._collection();
  2792. $ctx1.sendIdx["collection"]=2;
  2793. $1=_st($2).__comma($3);
  2794. $ctx1.sendIdx[","]=1;
  2795. $4=self._collection();
  2796. $ctx1.sendIdx["collection"]=3;
  2797. self._assert_equals_($1,$4);
  2798. $ctx1.sendIdx["assert:equals:"]=1;
  2799. $6=self._collection();
  2800. $ctx1.sendIdx["collection"]=4;
  2801. $7=self._collectionWithNewValue();
  2802. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2803. $5=_st($6).__comma($7);
  2804. $ctx1.sendIdx[","]=2;
  2805. $8=self._collectionWithNewValue();
  2806. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2807. self._assert_equals_($5,$8);
  2808. $ctx1.sendIdx["assert:equals:"]=2;
  2809. $10=self._collectionWithNewValue();
  2810. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2811. $9=_st($10).__comma(self._collection());
  2812. self._assert_equals_($9,self._collectionWithNewValue());
  2813. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.AssociativeCollectionTest)})},
  2814. args: [],
  2815. 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",
  2816. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2817. referencedClasses: []
  2818. }),
  2819. smalltalk.AssociativeCollectionTest);
  2820. smalltalk.addMethod(
  2821. smalltalk.method({
  2822. selector: "testFrom",
  2823. protocol: 'tests',
  2824. fn: function (){
  2825. var self=this;
  2826. var associations;
  2827. return smalltalk.withContext(function($ctx1) {
  2828. var $1,$2,$3,$5,$4;
  2829. $1="a".__minus_gt((1));
  2830. $ctx1.sendIdx["->"]=1;
  2831. $2="b".__minus_gt((2));
  2832. $ctx1.sendIdx["->"]=2;
  2833. associations=[$1,$2];
  2834. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2835. $5="a".__minus_gt((1));
  2836. $ctx1.sendIdx["->"]=3;
  2837. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2838. self._assertSameContents_as_($3,$4);
  2839. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.AssociativeCollectionTest)})},
  2840. args: [],
  2841. 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 }.",
  2842. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2843. referencedClasses: []
  2844. }),
  2845. smalltalk.AssociativeCollectionTest);
  2846. smalltalk.addMethod(
  2847. smalltalk.method({
  2848. selector: "testKeys",
  2849. protocol: 'tests',
  2850. fn: function (){
  2851. var self=this;
  2852. return smalltalk.withContext(function($ctx1) {
  2853. var $2,$1,$3,$4;
  2854. $2=_st(_st(self._collectionClass())._new())._keys();
  2855. $ctx1.sendIdx["keys"]=1;
  2856. $1=_st($2)._isEmpty();
  2857. self._assert_($1);
  2858. $3=_st(self._collection())._keys();
  2859. $ctx1.sendIdx["keys"]=2;
  2860. $4=self._collectionKeys();
  2861. $ctx1.sendIdx["collectionKeys"]=1;
  2862. self._assertSameContents_as_($3,$4);
  2863. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2864. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2865. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},smalltalk.AssociativeCollectionTest)})},
  2866. args: [],
  2867. 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 }",
  2868. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2869. referencedClasses: []
  2870. }),
  2871. smalltalk.AssociativeCollectionTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "testNewFromPairs",
  2875. protocol: 'tests',
  2876. fn: function (){
  2877. var self=this;
  2878. var flattenedAssociations;
  2879. return smalltalk.withContext(function($ctx1) {
  2880. var $1,$3,$2;
  2881. flattenedAssociations=["a",(1),"b",(2)];
  2882. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2883. $3="a".__minus_gt((1));
  2884. $ctx1.sendIdx["->"]=1;
  2885. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2886. self._assertSameContents_as_($1,$2);
  2887. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.AssociativeCollectionTest)})},
  2888. args: [],
  2889. 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 }.",
  2890. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2891. referencedClasses: []
  2892. }),
  2893. smalltalk.AssociativeCollectionTest);
  2894. smalltalk.addMethod(
  2895. smalltalk.method({
  2896. selector: "testPrintString",
  2897. protocol: 'tests',
  2898. fn: function (){
  2899. var self=this;
  2900. return smalltalk.withContext(function($ctx1) {
  2901. var $3,$2,$4,$1,$5;
  2902. $3=self._collectionClass();
  2903. $ctx1.sendIdx["collectionClass"]=1;
  2904. $2=_st($3)._new();
  2905. _st($2)._at_put_("firstname","James");
  2906. $ctx1.sendIdx["at:put:"]=1;
  2907. _st($2)._at_put_("lastname","Bond");
  2908. $4=_st($2)._printString();
  2909. $1=$4;
  2910. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2911. $ctx1.sendIdx[","]=1;
  2912. self._assert_equals_($1,$5);
  2913. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.AssociativeCollectionTest)})},
  2914. args: [],
  2915. 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'')'",
  2916. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2917. referencedClasses: []
  2918. }),
  2919. smalltalk.AssociativeCollectionTest);
  2920. smalltalk.addMethod(
  2921. smalltalk.method({
  2922. selector: "testRemoveKey",
  2923. protocol: 'tests',
  2924. fn: function (){
  2925. var self=this;
  2926. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2927. return smalltalk.withContext(function($ctx1) {
  2928. var $1,$2,$3,$5,$6,$4,$7,$8;
  2929. self._nonIndexesDo_((function(each){
  2930. var collection;
  2931. return smalltalk.withContext(function($ctx2) {
  2932. collection=self._collection();
  2933. $ctx2.sendIdx["collection"]=1;
  2934. collection;
  2935. self._should_raise_((function(){
  2936. return smalltalk.withContext(function($ctx3) {
  2937. return _st(collection)._removeKey_(each);
  2938. $ctx3.sendIdx["removeKey:"]=1;
  2939. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2940. $1=collection;
  2941. $2=self._collection();
  2942. $ctx2.sendIdx["collection"]=2;
  2943. return self._assert_equals_($1,$2);
  2944. $ctx2.sendIdx["assert:equals:"]=1;
  2945. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2946. self._samplesDo_((function(index,value){
  2947. var collection;
  2948. return smalltalk.withContext(function($ctx2) {
  2949. collection=self._collection();
  2950. $ctx2.sendIdx["collection"]=3;
  2951. collection;
  2952. $3=_st(collection)._removeKey_(index);
  2953. $ctx2.sendIdx["removeKey:"]=2;
  2954. self._assert_equals_($3,value);
  2955. $ctx2.sendIdx["assert:equals:"]=2;
  2956. $5=collection;
  2957. $6=self._collection();
  2958. $ctx2.sendIdx["collection"]=4;
  2959. $4=_st($5).__eq($6);
  2960. return self._deny_($4);
  2961. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2962. $7=self._collectionWithNewValue();
  2963. _st($7)._removeKey_(self._sampleNewIndex());
  2964. $8=_st($7)._yourself();
  2965. self._assert_equals_($8,self._collection());
  2966. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},smalltalk.AssociativeCollectionTest)})},
  2967. args: [],
  2968. 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",
  2969. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2970. referencedClasses: ["Error"]
  2971. }),
  2972. smalltalk.AssociativeCollectionTest);
  2973. smalltalk.addMethod(
  2974. smalltalk.method({
  2975. selector: "testRemoveKeyIfAbsent",
  2976. protocol: 'tests',
  2977. fn: function (){
  2978. var self=this;
  2979. return smalltalk.withContext(function($ctx1) {
  2980. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2981. self._nonIndexesDo_((function(each){
  2982. var collection;
  2983. return smalltalk.withContext(function($ctx2) {
  2984. collection=self._collection();
  2985. $ctx2.sendIdx["collection"]=1;
  2986. collection;
  2987. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2988. return smalltalk.withContext(function($ctx3) {
  2989. return self._sampleNewValue();
  2990. $ctx3.sendIdx["sampleNewValue"]=1;
  2991. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2992. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2993. $2=self._sampleNewValue();
  2994. $ctx2.sendIdx["sampleNewValue"]=2;
  2995. self._assert_equals_($1,$2);
  2996. $ctx2.sendIdx["assert:equals:"]=1;
  2997. $3=collection;
  2998. $4=self._collection();
  2999. $ctx2.sendIdx["collection"]=2;
  3000. return self._assert_equals_($3,$4);
  3001. $ctx2.sendIdx["assert:equals:"]=2;
  3002. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3003. self._samplesDo_((function(index,value){
  3004. var collection;
  3005. return smalltalk.withContext(function($ctx2) {
  3006. collection=self._collection();
  3007. $ctx2.sendIdx["collection"]=3;
  3008. collection;
  3009. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3010. return smalltalk.withContext(function($ctx3) {
  3011. return self._sampleNewValue();
  3012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3013. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3014. self._assert_equals_($5,value);
  3015. $ctx2.sendIdx["assert:equals:"]=3;
  3016. $7=collection;
  3017. $8=self._collection();
  3018. $ctx2.sendIdx["collection"]=4;
  3019. $6=_st($7).__eq($8);
  3020. return self._deny_($6);
  3021. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3022. $9=self._collectionWithNewValue();
  3023. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3024. return smalltalk.withContext(function($ctx2) {
  3025. return self._assert_(false);
  3026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3027. $10=_st($9)._yourself();
  3028. self._assert_equals_($10,self._collection());
  3029. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},smalltalk.AssociativeCollectionTest)})},
  3030. args: [],
  3031. 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",
  3032. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3033. referencedClasses: []
  3034. }),
  3035. smalltalk.AssociativeCollectionTest);
  3036. smalltalk.addMethod(
  3037. smalltalk.method({
  3038. selector: "testValues",
  3039. protocol: 'tests',
  3040. fn: function (){
  3041. var self=this;
  3042. return smalltalk.withContext(function($ctx1) {
  3043. var $2,$1,$3,$4;
  3044. $2=_st(_st(self._collectionClass())._new())._values();
  3045. $ctx1.sendIdx["values"]=1;
  3046. $1=_st($2)._isEmpty();
  3047. self._assert_($1);
  3048. $3=_st(self._collection())._values();
  3049. $ctx1.sendIdx["values"]=2;
  3050. $4=self._collectionValues();
  3051. $ctx1.sendIdx["collectionValues"]=1;
  3052. self._assertSameContents_as_($3,$4);
  3053. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3054. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3055. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},smalltalk.AssociativeCollectionTest)})},
  3056. args: [],
  3057. 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 }",
  3058. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3059. referencedClasses: []
  3060. }),
  3061. smalltalk.AssociativeCollectionTest);
  3062. smalltalk.addClass('DictionaryTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3063. smalltalk.addMethod(
  3064. smalltalk.method({
  3065. selector: "collection",
  3066. protocol: 'fixture',
  3067. fn: function (){
  3068. var self=this;
  3069. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3070. return smalltalk.withContext(function($ctx1) {
  3071. var $2,$3,$1;
  3072. $2=_st($Dictionary())._new();
  3073. _st($2)._at_put_((1),(1));
  3074. $ctx1.sendIdx["at:put:"]=1;
  3075. _st($2)._at_put_("a",(2));
  3076. $ctx1.sendIdx["at:put:"]=2;
  3077. _st($2)._at_put_(true,(3));
  3078. $ctx1.sendIdx["at:put:"]=3;
  3079. _st($2)._at_put_((1).__at((3)),(-4));
  3080. $3=_st($2)._yourself();
  3081. $1=$3;
  3082. return $1;
  3083. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  3084. args: [],
  3085. 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",
  3086. messageSends: ["at:put:", "new", "@", "yourself"],
  3087. referencedClasses: ["Dictionary"]
  3088. }),
  3089. smalltalk.DictionaryTest);
  3090. smalltalk.addMethod(
  3091. smalltalk.method({
  3092. selector: "collectionKeys",
  3093. protocol: 'fixture',
  3094. fn: function (){
  3095. var self=this;
  3096. return smalltalk.withContext(function($ctx1) {
  3097. var $1;
  3098. $1=[(1),"a",true,(1).__at((3))];
  3099. return $1;
  3100. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.DictionaryTest)})},
  3101. args: [],
  3102. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3103. messageSends: ["@"],
  3104. referencedClasses: []
  3105. }),
  3106. smalltalk.DictionaryTest);
  3107. smalltalk.addMethod(
  3108. smalltalk.method({
  3109. selector: "collectionOfPrintStrings",
  3110. protocol: 'fixture',
  3111. fn: function (){
  3112. var self=this;
  3113. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3114. return smalltalk.withContext(function($ctx1) {
  3115. var $2,$3,$1;
  3116. $2=_st($Dictionary())._new();
  3117. _st($2)._at_put_((1),"1");
  3118. $ctx1.sendIdx["at:put:"]=1;
  3119. _st($2)._at_put_("a","2");
  3120. $ctx1.sendIdx["at:put:"]=2;
  3121. _st($2)._at_put_(true,"3");
  3122. $ctx1.sendIdx["at:put:"]=3;
  3123. _st($2)._at_put_((1).__at((3)),"-4");
  3124. $3=_st($2)._yourself();
  3125. $1=$3;
  3126. return $1;
  3127. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  3128. args: [],
  3129. 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",
  3130. messageSends: ["at:put:", "new", "@", "yourself"],
  3131. referencedClasses: ["Dictionary"]
  3132. }),
  3133. smalltalk.DictionaryTest);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "collectionSize",
  3137. protocol: 'fixture',
  3138. fn: function (){
  3139. var self=this;
  3140. return smalltalk.withContext(function($ctx1) {
  3141. return (4);
  3142. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  3143. args: [],
  3144. source: "collectionSize\x0a\x09^ 4",
  3145. messageSends: [],
  3146. referencedClasses: []
  3147. }),
  3148. smalltalk.DictionaryTest);
  3149. smalltalk.addMethod(
  3150. smalltalk.method({
  3151. selector: "collectionValues",
  3152. protocol: 'fixture',
  3153. fn: function (){
  3154. var self=this;
  3155. return smalltalk.withContext(function($ctx1) {
  3156. var $1;
  3157. $1=[(1),(2),(3),(-4)];
  3158. return $1;
  3159. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.DictionaryTest)})},
  3160. args: [],
  3161. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3162. messageSends: [],
  3163. referencedClasses: []
  3164. }),
  3165. smalltalk.DictionaryTest);
  3166. smalltalk.addMethod(
  3167. smalltalk.method({
  3168. selector: "collectionWithDuplicates",
  3169. protocol: 'fixture',
  3170. fn: function (){
  3171. var self=this;
  3172. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3173. return smalltalk.withContext(function($ctx1) {
  3174. var $2,$3,$1;
  3175. $2=_st($Dictionary())._new();
  3176. _st($2)._at_put_((1),(1));
  3177. $ctx1.sendIdx["at:put:"]=1;
  3178. _st($2)._at_put_("a",(2));
  3179. $ctx1.sendIdx["at:put:"]=2;
  3180. _st($2)._at_put_(true,(3));
  3181. $ctx1.sendIdx["at:put:"]=3;
  3182. _st($2)._at_put_((4),(-4));
  3183. $ctx1.sendIdx["at:put:"]=4;
  3184. _st($2)._at_put_("b",(1));
  3185. $ctx1.sendIdx["at:put:"]=5;
  3186. _st($2)._at_put_((3),(3));
  3187. $ctx1.sendIdx["at:put:"]=6;
  3188. _st($2)._at_put_(false,(12));
  3189. $3=_st($2)._yourself();
  3190. $1=$3;
  3191. return $1;
  3192. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  3193. args: [],
  3194. 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",
  3195. messageSends: ["at:put:", "new", "yourself"],
  3196. referencedClasses: ["Dictionary"]
  3197. }),
  3198. smalltalk.DictionaryTest);
  3199. smalltalk.addMethod(
  3200. smalltalk.method({
  3201. selector: "collectionWithNewValue",
  3202. protocol: 'fixture',
  3203. fn: function (){
  3204. var self=this;
  3205. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3206. return smalltalk.withContext(function($ctx1) {
  3207. var $2,$3,$1;
  3208. $2=_st($Dictionary())._new();
  3209. _st($2)._at_put_((1),(1));
  3210. $ctx1.sendIdx["at:put:"]=1;
  3211. _st($2)._at_put_("a",(2));
  3212. $ctx1.sendIdx["at:put:"]=2;
  3213. _st($2)._at_put_(true,(3));
  3214. $ctx1.sendIdx["at:put:"]=3;
  3215. _st($2)._at_put_((1).__at((3)),(-4));
  3216. $ctx1.sendIdx["at:put:"]=4;
  3217. _st($2)._at_put_("new","N");
  3218. $3=_st($2)._yourself();
  3219. $1=$3;
  3220. return $1;
  3221. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3222. args: [],
  3223. 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",
  3224. messageSends: ["at:put:", "new", "@", "yourself"],
  3225. referencedClasses: ["Dictionary"]
  3226. }),
  3227. smalltalk.DictionaryTest);
  3228. smalltalk.addMethod(
  3229. smalltalk.method({
  3230. selector: "sampleNewValueAsCollection",
  3231. protocol: 'fixture',
  3232. fn: function (){
  3233. var self=this;
  3234. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3235. return smalltalk.withContext(function($ctx1) {
  3236. var $2,$3,$1;
  3237. $2=_st($Dictionary())._new();
  3238. _st($2)._at_put_("new","N");
  3239. $3=_st($2)._yourself();
  3240. $1=$3;
  3241. return $1;
  3242. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3243. args: [],
  3244. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3245. messageSends: ["at:put:", "new", "yourself"],
  3246. referencedClasses: ["Dictionary"]
  3247. }),
  3248. smalltalk.DictionaryTest);
  3249. smalltalk.addMethod(
  3250. smalltalk.method({
  3251. selector: "samplesDo:",
  3252. protocol: 'fixture',
  3253. fn: function (aBlock){
  3254. var self=this;
  3255. return smalltalk.withContext(function($ctx1) {
  3256. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3257. _st(aBlock)._value_value_(true,(3));
  3258. $ctx1.sendIdx["value:value:"]=1;
  3259. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3260. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3261. args: ["aBlock"],
  3262. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3263. messageSends: ["samplesDo:", "value:value:", "@"],
  3264. referencedClasses: []
  3265. }),
  3266. smalltalk.DictionaryTest);
  3267. smalltalk.addMethod(
  3268. smalltalk.method({
  3269. selector: "testAccessing",
  3270. protocol: 'tests',
  3271. fn: function (){
  3272. var self=this;
  3273. var d;
  3274. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3275. return smalltalk.withContext(function($ctx1) {
  3276. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3277. d=_st($Dictionary())._new();
  3278. _st(d)._at_put_("hello","world");
  3279. $ctx1.sendIdx["at:put:"]=1;
  3280. $1=_st(d)._at_("hello");
  3281. $ctx1.sendIdx["at:"]=1;
  3282. self._assert_equals_($1,"world");
  3283. $ctx1.sendIdx["assert:equals:"]=1;
  3284. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3285. return smalltalk.withContext(function($ctx2) {
  3286. return nil;
  3287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3288. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3289. self._assert_equals_($2,"world");
  3290. $ctx1.sendIdx["assert:equals:"]=2;
  3291. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3292. return smalltalk.withContext(function($ctx2) {
  3293. return nil;
  3294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3295. $ctx1.sendIdx["deny:"]=1;
  3296. $3=_st(d)._includesKey_("hello");
  3297. $ctx1.sendIdx["includesKey:"]=1;
  3298. self._assert_($3);
  3299. $ctx1.sendIdx["assert:"]=1;
  3300. $4=_st(d)._includesKey_("foo");
  3301. $ctx1.sendIdx["includesKey:"]=2;
  3302. self._deny_($4);
  3303. $ctx1.sendIdx["deny:"]=2;
  3304. _st(d)._at_put_((1),(2));
  3305. $ctx1.sendIdx["at:put:"]=2;
  3306. $5=_st(d)._at_((1));
  3307. $ctx1.sendIdx["at:"]=2;
  3308. self._assert_equals_($5,(2));
  3309. $ctx1.sendIdx["assert:equals:"]=3;
  3310. $6=d;
  3311. $7=(1).__at((3));
  3312. $ctx1.sendIdx["@"]=1;
  3313. _st($6)._at_put_($7,(3));
  3314. $9=d;
  3315. $10=(1).__at((3));
  3316. $ctx1.sendIdx["@"]=2;
  3317. $8=_st($9)._at_($10);
  3318. self._assert_equals_($8,(3));
  3319. $12=d;
  3320. $13=(1).__at((3));
  3321. $ctx1.sendIdx["@"]=3;
  3322. $11=_st($12)._includesKey_($13);
  3323. $ctx1.sendIdx["includesKey:"]=3;
  3324. self._assert_($11);
  3325. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3326. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3327. args: [],
  3328. 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)",
  3329. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3330. referencedClasses: ["Dictionary"]
  3331. }),
  3332. smalltalk.DictionaryTest);
  3333. smalltalk.addMethod(
  3334. smalltalk.method({
  3335. selector: "testDynamicDictionaries",
  3336. protocol: 'tests',
  3337. fn: function (){
  3338. var self=this;
  3339. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3340. return smalltalk.withContext(function($ctx1) {
  3341. var $3,$2,$1;
  3342. $3="hello".__minus_gt((1));
  3343. $ctx1.sendIdx["->"]=1;
  3344. $2=smalltalk.HashedCollection._from_([$3]);
  3345. $1=_st($2)._asDictionary();
  3346. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3347. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3348. args: [],
  3349. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3350. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3351. referencedClasses: ["Dictionary"]
  3352. }),
  3353. smalltalk.DictionaryTest);
  3354. smalltalk.addMethod(
  3355. smalltalk.method({
  3356. selector: "collectionClass",
  3357. protocol: 'fixture',
  3358. fn: function (){
  3359. var self=this;
  3360. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3361. return smalltalk.withContext(function($ctx1) {
  3362. return $Dictionary();
  3363. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3364. args: [],
  3365. source: "collectionClass\x0a\x09^ Dictionary",
  3366. messageSends: [],
  3367. referencedClasses: ["Dictionary"]
  3368. }),
  3369. smalltalk.DictionaryTest.klass);
  3370. smalltalk.addClass('HashedCollectionTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3371. smalltalk.addMethod(
  3372. smalltalk.method({
  3373. selector: "collection",
  3374. protocol: 'fixture',
  3375. fn: function (){
  3376. var self=this;
  3377. return smalltalk.withContext(function($ctx1) {
  3378. var $2,$3,$4,$1;
  3379. $2="b".__minus_gt((1));
  3380. $ctx1.sendIdx["->"]=1;
  3381. $3="a".__minus_gt((2));
  3382. $ctx1.sendIdx["->"]=2;
  3383. $4="c".__minus_gt((3));
  3384. $ctx1.sendIdx["->"]=3;
  3385. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3386. return $1;
  3387. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  3388. args: [],
  3389. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3390. messageSends: ["->"],
  3391. referencedClasses: []
  3392. }),
  3393. smalltalk.HashedCollectionTest);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "collectionKeys",
  3397. protocol: 'fixture',
  3398. fn: function (){
  3399. var self=this;
  3400. return smalltalk.withContext(function($ctx1) {
  3401. var $1;
  3402. $1=["b","a","c","d"];
  3403. return $1;
  3404. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.HashedCollectionTest)})},
  3405. args: [],
  3406. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3407. messageSends: [],
  3408. referencedClasses: []
  3409. }),
  3410. smalltalk.HashedCollectionTest);
  3411. smalltalk.addMethod(
  3412. smalltalk.method({
  3413. selector: "collectionOfPrintStrings",
  3414. protocol: 'fixture',
  3415. fn: function (){
  3416. var self=this;
  3417. return smalltalk.withContext(function($ctx1) {
  3418. var $2,$3,$4,$1;
  3419. $2="b".__minus_gt("1");
  3420. $ctx1.sendIdx["->"]=1;
  3421. $3="a".__minus_gt("2");
  3422. $ctx1.sendIdx["->"]=2;
  3423. $4="c".__minus_gt("3");
  3424. $ctx1.sendIdx["->"]=3;
  3425. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3426. return $1;
  3427. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  3428. args: [],
  3429. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3430. messageSends: ["->"],
  3431. referencedClasses: []
  3432. }),
  3433. smalltalk.HashedCollectionTest);
  3434. smalltalk.addMethod(
  3435. smalltalk.method({
  3436. selector: "collectionSize",
  3437. protocol: 'fixture',
  3438. fn: function (){
  3439. var self=this;
  3440. return smalltalk.withContext(function($ctx1) {
  3441. return (4);
  3442. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  3443. args: [],
  3444. source: "collectionSize\x0a\x09^ 4",
  3445. messageSends: [],
  3446. referencedClasses: []
  3447. }),
  3448. smalltalk.HashedCollectionTest);
  3449. smalltalk.addMethod(
  3450. smalltalk.method({
  3451. selector: "collectionValues",
  3452. protocol: 'fixture',
  3453. fn: function (){
  3454. var self=this;
  3455. return smalltalk.withContext(function($ctx1) {
  3456. var $1;
  3457. $1=[(1),(2),(3),(-4)];
  3458. return $1;
  3459. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.HashedCollectionTest)})},
  3460. args: [],
  3461. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3462. messageSends: [],
  3463. referencedClasses: []
  3464. }),
  3465. smalltalk.HashedCollectionTest);
  3466. smalltalk.addMethod(
  3467. smalltalk.method({
  3468. selector: "collectionWithDuplicates",
  3469. protocol: 'fixture',
  3470. fn: function (){
  3471. var self=this;
  3472. return smalltalk.withContext(function($ctx1) {
  3473. var $2,$3,$4,$5,$6,$7,$1;
  3474. $2="b".__minus_gt((1));
  3475. $ctx1.sendIdx["->"]=1;
  3476. $3="a".__minus_gt((2));
  3477. $ctx1.sendIdx["->"]=2;
  3478. $4="c".__minus_gt((3));
  3479. $ctx1.sendIdx["->"]=3;
  3480. $5="d".__minus_gt((-4));
  3481. $ctx1.sendIdx["->"]=4;
  3482. $6="e".__minus_gt((1));
  3483. $ctx1.sendIdx["->"]=5;
  3484. $7="f".__minus_gt((2));
  3485. $ctx1.sendIdx["->"]=6;
  3486. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3487. return $1;
  3488. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  3489. args: [],
  3490. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3491. messageSends: ["->"],
  3492. referencedClasses: []
  3493. }),
  3494. smalltalk.HashedCollectionTest);
  3495. smalltalk.addMethod(
  3496. smalltalk.method({
  3497. selector: "collectionWithNewValue",
  3498. protocol: 'fixture',
  3499. fn: function (){
  3500. var self=this;
  3501. return smalltalk.withContext(function($ctx1) {
  3502. var $2,$3,$4,$5,$1;
  3503. $2="b".__minus_gt((1));
  3504. $ctx1.sendIdx["->"]=1;
  3505. $3="a".__minus_gt((2));
  3506. $ctx1.sendIdx["->"]=2;
  3507. $4="c".__minus_gt((3));
  3508. $ctx1.sendIdx["->"]=3;
  3509. $5="d".__minus_gt((-4));
  3510. $ctx1.sendIdx["->"]=4;
  3511. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3512. return $1;
  3513. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  3514. args: [],
  3515. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3516. messageSends: ["->"],
  3517. referencedClasses: []
  3518. }),
  3519. smalltalk.HashedCollectionTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "sampleNewValueAsCollection",
  3523. protocol: 'fixture',
  3524. fn: function (){
  3525. var self=this;
  3526. return smalltalk.withContext(function($ctx1) {
  3527. var $1;
  3528. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  3529. return $1;
  3530. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  3531. args: [],
  3532. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3533. messageSends: ["->"],
  3534. referencedClasses: []
  3535. }),
  3536. smalltalk.HashedCollectionTest);
  3537. smalltalk.addMethod(
  3538. smalltalk.method({
  3539. selector: "testDynamicDictionaries",
  3540. protocol: 'tests',
  3541. fn: function (){
  3542. var self=this;
  3543. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3544. return smalltalk.withContext(function($ctx1) {
  3545. var $3,$2,$1;
  3546. $3="hello".__minus_gt((1));
  3547. $ctx1.sendIdx["->"]=1;
  3548. $2=smalltalk.HashedCollection._from_([$3]);
  3549. $1=_st($2)._asHashedCollection();
  3550. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3551. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.HashedCollectionTest)})},
  3552. args: [],
  3553. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3554. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3555. referencedClasses: ["HashedCollection"]
  3556. }),
  3557. smalltalk.HashedCollectionTest);
  3558. smalltalk.addMethod(
  3559. smalltalk.method({
  3560. selector: "collectionClass",
  3561. protocol: 'fixture',
  3562. fn: function (){
  3563. var self=this;
  3564. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3565. return smalltalk.withContext(function($ctx1) {
  3566. return $HashedCollection();
  3567. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  3568. args: [],
  3569. source: "collectionClass\x0a\x09^ HashedCollection",
  3570. messageSends: [],
  3571. referencedClasses: ["HashedCollection"]
  3572. }),
  3573. smalltalk.HashedCollectionTest.klass);
  3574. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3575. smalltalk.addMethod(
  3576. smalltalk.method({
  3577. selector: "collectionFirst",
  3578. protocol: 'fixture',
  3579. fn: function (){
  3580. var self=this;
  3581. return smalltalk.withContext(function($ctx1) {
  3582. self._subclassResponsibility();
  3583. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3584. args: [],
  3585. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3586. messageSends: ["subclassResponsibility"],
  3587. referencedClasses: []
  3588. }),
  3589. smalltalk.SequenceableCollectionTest);
  3590. smalltalk.addMethod(
  3591. smalltalk.method({
  3592. selector: "collectionFirstTwo",
  3593. protocol: 'fixture',
  3594. fn: function (){
  3595. var self=this;
  3596. return smalltalk.withContext(function($ctx1) {
  3597. self._subclassResponsibility();
  3598. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3599. args: [],
  3600. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3601. messageSends: ["subclassResponsibility"],
  3602. referencedClasses: []
  3603. }),
  3604. smalltalk.SequenceableCollectionTest);
  3605. smalltalk.addMethod(
  3606. smalltalk.method({
  3607. selector: "collectionLast",
  3608. protocol: 'fixture',
  3609. fn: function (){
  3610. var self=this;
  3611. return smalltalk.withContext(function($ctx1) {
  3612. self._subclassResponsibility();
  3613. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3614. args: [],
  3615. source: "collectionLast\x0a\x09self subclassResponsibility",
  3616. messageSends: ["subclassResponsibility"],
  3617. referencedClasses: []
  3618. }),
  3619. smalltalk.SequenceableCollectionTest);
  3620. smalltalk.addMethod(
  3621. smalltalk.method({
  3622. selector: "collectionLastTwo",
  3623. protocol: 'fixture',
  3624. fn: function (){
  3625. var self=this;
  3626. return smalltalk.withContext(function($ctx1) {
  3627. self._subclassResponsibility();
  3628. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3629. args: [],
  3630. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3631. messageSends: ["subclassResponsibility"],
  3632. referencedClasses: []
  3633. }),
  3634. smalltalk.SequenceableCollectionTest);
  3635. smalltalk.addMethod(
  3636. smalltalk.method({
  3637. selector: "nonIndexesDo:",
  3638. protocol: 'fixture',
  3639. fn: function (aBlock){
  3640. var self=this;
  3641. return smalltalk.withContext(function($ctx1) {
  3642. _st(aBlock)._value_((0));
  3643. $ctx1.sendIdx["value:"]=1;
  3644. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3645. $ctx1.sendIdx["value:"]=2;
  3646. _st(aBlock)._value_("z");
  3647. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3648. args: ["aBlock"],
  3649. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3650. messageSends: ["value:", "+", "collectionSize"],
  3651. referencedClasses: []
  3652. }),
  3653. smalltalk.SequenceableCollectionTest);
  3654. smalltalk.addMethod(
  3655. smalltalk.method({
  3656. selector: "samplesDo:",
  3657. protocol: 'fixture',
  3658. fn: function (aBlock){
  3659. var self=this;
  3660. return smalltalk.withContext(function($ctx1) {
  3661. _st(aBlock)._value_value_((1),self._collectionFirst());
  3662. $ctx1.sendIdx["value:value:"]=1;
  3663. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3664. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3665. args: ["aBlock"],
  3666. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3667. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3668. referencedClasses: []
  3669. }),
  3670. smalltalk.SequenceableCollectionTest);
  3671. smalltalk.addMethod(
  3672. smalltalk.method({
  3673. selector: "testBeginsWith",
  3674. protocol: 'tests',
  3675. fn: function (){
  3676. var self=this;
  3677. return smalltalk.withContext(function($ctx1) {
  3678. var $2,$1,$4,$5,$3,$7,$6;
  3679. $2=self._collection();
  3680. $ctx1.sendIdx["collection"]=1;
  3681. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3682. $ctx1.sendIdx["beginsWith:"]=1;
  3683. self._assert_($1);
  3684. $ctx1.sendIdx["assert:"]=1;
  3685. $4=self._collection();
  3686. $ctx1.sendIdx["collection"]=2;
  3687. $5=self._collection();
  3688. $ctx1.sendIdx["collection"]=3;
  3689. $3=_st($4)._beginsWith_($5);
  3690. $ctx1.sendIdx["beginsWith:"]=2;
  3691. self._assert_($3);
  3692. $ctx1.sendIdx["assert:"]=2;
  3693. $7=self._collection();
  3694. $ctx1.sendIdx["collection"]=4;
  3695. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3696. $ctx1.sendIdx["beginsWith:"]=3;
  3697. self._assert_($6);
  3698. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3699. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3700. args: [],
  3701. 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)",
  3702. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3703. referencedClasses: []
  3704. }),
  3705. smalltalk.SequenceableCollectionTest);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "testEndsWith",
  3709. protocol: 'tests',
  3710. fn: function (){
  3711. var self=this;
  3712. return smalltalk.withContext(function($ctx1) {
  3713. var $2,$1,$4,$5,$3,$7,$6;
  3714. $2=self._collection();
  3715. $ctx1.sendIdx["collection"]=1;
  3716. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3717. $ctx1.sendIdx["endsWith:"]=1;
  3718. self._assert_($1);
  3719. $ctx1.sendIdx["assert:"]=1;
  3720. $4=self._collection();
  3721. $ctx1.sendIdx["collection"]=2;
  3722. $5=self._collection();
  3723. $ctx1.sendIdx["collection"]=3;
  3724. $3=_st($4)._endsWith_($5);
  3725. $ctx1.sendIdx["endsWith:"]=2;
  3726. self._assert_($3);
  3727. $ctx1.sendIdx["assert:"]=2;
  3728. $7=self._collection();
  3729. $ctx1.sendIdx["collection"]=4;
  3730. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3731. $ctx1.sendIdx["endsWith:"]=3;
  3732. self._assert_($6);
  3733. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3734. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3735. args: [],
  3736. 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)",
  3737. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3738. referencedClasses: []
  3739. }),
  3740. smalltalk.SequenceableCollectionTest);
  3741. smalltalk.addMethod(
  3742. smalltalk.method({
  3743. selector: "testFirst",
  3744. protocol: 'tests',
  3745. fn: function (){
  3746. var self=this;
  3747. return smalltalk.withContext(function($ctx1) {
  3748. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3749. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3750. args: [],
  3751. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3752. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3753. referencedClasses: []
  3754. }),
  3755. smalltalk.SequenceableCollectionTest);
  3756. smalltalk.addMethod(
  3757. smalltalk.method({
  3758. selector: "testFirstN",
  3759. protocol: 'tests',
  3760. fn: function (){
  3761. var self=this;
  3762. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3763. return smalltalk.withContext(function($ctx1) {
  3764. var $2,$1,$4,$3,$6,$5,$7;
  3765. $2=self._collection();
  3766. $ctx1.sendIdx["collection"]=1;
  3767. $1=_st($2)._first_((2));
  3768. $ctx1.sendIdx["first:"]=1;
  3769. self._assert_equals_($1,self._collectionFirstTwo());
  3770. $ctx1.sendIdx["assert:equals:"]=1;
  3771. $4=self._collection();
  3772. $ctx1.sendIdx["collection"]=2;
  3773. $3=_st($4)._first_((0));
  3774. $ctx1.sendIdx["first:"]=2;
  3775. self._assert_equals_($3,_st(self._collectionClass())._new());
  3776. $ctx1.sendIdx["assert:equals:"]=2;
  3777. $6=self._collection();
  3778. $ctx1.sendIdx["collection"]=3;
  3779. $5=_st($6)._first_(self._collectionSize());
  3780. $ctx1.sendIdx["first:"]=3;
  3781. $7=self._collection();
  3782. $ctx1.sendIdx["collection"]=4;
  3783. self._assert_equals_($5,$7);
  3784. self._should_raise_((function(){
  3785. return smalltalk.withContext(function($ctx2) {
  3786. return _st(self._collection())._first_((33));
  3787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3788. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3789. args: [],
  3790. 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",
  3791. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3792. referencedClasses: ["Error"]
  3793. }),
  3794. smalltalk.SequenceableCollectionTest);
  3795. smalltalk.addMethod(
  3796. smalltalk.method({
  3797. selector: "testFourth",
  3798. protocol: 'tests',
  3799. fn: function (){
  3800. var self=this;
  3801. return smalltalk.withContext(function($ctx1) {
  3802. var $2,$1;
  3803. $2=self._collection();
  3804. $ctx1.sendIdx["collection"]=1;
  3805. $1=_st($2)._fourth();
  3806. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3807. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3808. args: [],
  3809. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3810. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3811. referencedClasses: []
  3812. }),
  3813. smalltalk.SequenceableCollectionTest);
  3814. smalltalk.addMethod(
  3815. smalltalk.method({
  3816. selector: "testIndexOfStartingAt",
  3817. protocol: 'tests',
  3818. fn: function (){
  3819. var self=this;
  3820. var jsNull;
  3821. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3822. return smalltalk.withContext(function($ctx1) {
  3823. var $2,$1,$4,$3;
  3824. jsNull=_st($JSON())._parse_("null");
  3825. self._samplesDo_((function(index,value){
  3826. return smalltalk.withContext(function($ctx2) {
  3827. $2=self._collection();
  3828. $ctx2.sendIdx["collection"]=1;
  3829. $1=_st($2)._indexOf_startingAt_(value,(1));
  3830. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3831. self._assert_equals_($1,index);
  3832. $ctx2.sendIdx["assert:equals:"]=1;
  3833. $4=self._collection();
  3834. $ctx2.sendIdx["collection"]=2;
  3835. $3=_st($4)._indexOf_startingAt_(value,index);
  3836. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3837. self._assert_equals_($3,index);
  3838. $ctx2.sendIdx["assert:equals:"]=2;
  3839. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3840. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3841. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3842. args: [],
  3843. 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 ]",
  3844. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3845. referencedClasses: ["JSON"]
  3846. }),
  3847. smalltalk.SequenceableCollectionTest);
  3848. smalltalk.addMethod(
  3849. smalltalk.method({
  3850. selector: "testIndexOfStartingAtWithNull",
  3851. protocol: 'tests',
  3852. fn: function (){
  3853. var self=this;
  3854. var jsNull;
  3855. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3856. return smalltalk.withContext(function($ctx1) {
  3857. var $1,$2;
  3858. jsNull=_st($JSON())._parse_("null");
  3859. self._samplesDo_((function(index,value){
  3860. var collection;
  3861. return smalltalk.withContext(function($ctx2) {
  3862. collection=self._collection();
  3863. collection;
  3864. _st(collection)._at_put_(index,jsNull);
  3865. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3866. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3867. self._assert_equals_($1,index);
  3868. $ctx2.sendIdx["assert:equals:"]=1;
  3869. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3870. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3871. self._assert_equals_($2,index);
  3872. $ctx2.sendIdx["assert:equals:"]=2;
  3873. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3874. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3875. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3876. args: [],
  3877. 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 ]",
  3878. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3879. referencedClasses: ["JSON"]
  3880. }),
  3881. smalltalk.SequenceableCollectionTest);
  3882. smalltalk.addMethod(
  3883. smalltalk.method({
  3884. selector: "testLast",
  3885. protocol: 'tests',
  3886. fn: function (){
  3887. var self=this;
  3888. return smalltalk.withContext(function($ctx1) {
  3889. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3890. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3891. args: [],
  3892. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3893. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3894. referencedClasses: []
  3895. }),
  3896. smalltalk.SequenceableCollectionTest);
  3897. smalltalk.addMethod(
  3898. smalltalk.method({
  3899. selector: "testLastN",
  3900. protocol: 'tests',
  3901. fn: function (){
  3902. var self=this;
  3903. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3904. return smalltalk.withContext(function($ctx1) {
  3905. var $2,$1,$4,$3,$6,$5,$7;
  3906. $2=self._collection();
  3907. $ctx1.sendIdx["collection"]=1;
  3908. $1=_st($2)._last_((2));
  3909. $ctx1.sendIdx["last:"]=1;
  3910. self._assert_equals_($1,self._collectionLastTwo());
  3911. $ctx1.sendIdx["assert:equals:"]=1;
  3912. $4=self._collection();
  3913. $ctx1.sendIdx["collection"]=2;
  3914. $3=_st($4)._last_((0));
  3915. $ctx1.sendIdx["last:"]=2;
  3916. self._assert_equals_($3,_st(self._collectionClass())._new());
  3917. $ctx1.sendIdx["assert:equals:"]=2;
  3918. $6=self._collection();
  3919. $ctx1.sendIdx["collection"]=3;
  3920. $5=_st($6)._last_(self._collectionSize());
  3921. $ctx1.sendIdx["last:"]=3;
  3922. $7=self._collection();
  3923. $ctx1.sendIdx["collection"]=4;
  3924. self._assert_equals_($5,$7);
  3925. self._should_raise_((function(){
  3926. return smalltalk.withContext(function($ctx2) {
  3927. return _st(self._collection())._last_((33));
  3928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3929. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3930. args: [],
  3931. 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",
  3932. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3933. referencedClasses: ["Error"]
  3934. }),
  3935. smalltalk.SequenceableCollectionTest);
  3936. smalltalk.addMethod(
  3937. smalltalk.method({
  3938. selector: "testSecond",
  3939. protocol: 'tests',
  3940. fn: function (){
  3941. var self=this;
  3942. return smalltalk.withContext(function($ctx1) {
  3943. var $2,$1;
  3944. $2=self._collection();
  3945. $ctx1.sendIdx["collection"]=1;
  3946. $1=_st($2)._second();
  3947. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3948. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3949. args: [],
  3950. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3951. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3952. referencedClasses: []
  3953. }),
  3954. smalltalk.SequenceableCollectionTest);
  3955. smalltalk.addMethod(
  3956. smalltalk.method({
  3957. selector: "testThird",
  3958. protocol: 'tests',
  3959. fn: function (){
  3960. var self=this;
  3961. return smalltalk.withContext(function($ctx1) {
  3962. var $2,$1;
  3963. $2=self._collection();
  3964. $ctx1.sendIdx["collection"]=1;
  3965. $1=_st($2)._third();
  3966. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3967. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3968. args: [],
  3969. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3970. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3971. referencedClasses: []
  3972. }),
  3973. smalltalk.SequenceableCollectionTest);
  3974. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3975. smalltalk.addMethod(
  3976. smalltalk.method({
  3977. selector: "collection",
  3978. protocol: 'fixture',
  3979. fn: function (){
  3980. var self=this;
  3981. return smalltalk.withContext(function($ctx1) {
  3982. var $1;
  3983. $1=[(1), (2), (3), (-4)];
  3984. return $1;
  3985. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3986. args: [],
  3987. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3988. messageSends: [],
  3989. referencedClasses: []
  3990. }),
  3991. smalltalk.ArrayTest);
  3992. smalltalk.addMethod(
  3993. smalltalk.method({
  3994. selector: "collectionFirst",
  3995. protocol: 'fixture',
  3996. fn: function (){
  3997. var self=this;
  3998. return smalltalk.withContext(function($ctx1) {
  3999. return (1);
  4000. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  4001. args: [],
  4002. source: "collectionFirst\x0a\x09^ 1",
  4003. messageSends: [],
  4004. referencedClasses: []
  4005. }),
  4006. smalltalk.ArrayTest);
  4007. smalltalk.addMethod(
  4008. smalltalk.method({
  4009. selector: "collectionFirstTwo",
  4010. protocol: 'fixture',
  4011. fn: function (){
  4012. var self=this;
  4013. return smalltalk.withContext(function($ctx1) {
  4014. var $1;
  4015. $1=[(1), (2)];
  4016. return $1;
  4017. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  4018. args: [],
  4019. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4020. messageSends: [],
  4021. referencedClasses: []
  4022. }),
  4023. smalltalk.ArrayTest);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "collectionLast",
  4027. protocol: 'fixture',
  4028. fn: function (){
  4029. var self=this;
  4030. return smalltalk.withContext(function($ctx1) {
  4031. return (-4);
  4032. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  4033. args: [],
  4034. source: "collectionLast\x0a\x09^ -4",
  4035. messageSends: [],
  4036. referencedClasses: []
  4037. }),
  4038. smalltalk.ArrayTest);
  4039. smalltalk.addMethod(
  4040. smalltalk.method({
  4041. selector: "collectionLastTwo",
  4042. protocol: 'fixture',
  4043. fn: function (){
  4044. var self=this;
  4045. return smalltalk.withContext(function($ctx1) {
  4046. var $1;
  4047. $1=[(3), (-4)];
  4048. return $1;
  4049. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  4050. args: [],
  4051. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4052. messageSends: [],
  4053. referencedClasses: []
  4054. }),
  4055. smalltalk.ArrayTest);
  4056. smalltalk.addMethod(
  4057. smalltalk.method({
  4058. selector: "collectionOfPrintStrings",
  4059. protocol: 'fixture',
  4060. fn: function (){
  4061. var self=this;
  4062. return smalltalk.withContext(function($ctx1) {
  4063. var $1;
  4064. $1=["1", "2", "3", "-4"];
  4065. return $1;
  4066. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  4067. args: [],
  4068. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4069. messageSends: [],
  4070. referencedClasses: []
  4071. }),
  4072. smalltalk.ArrayTest);
  4073. smalltalk.addMethod(
  4074. smalltalk.method({
  4075. selector: "collectionSize",
  4076. protocol: 'fixture',
  4077. fn: function (){
  4078. var self=this;
  4079. return smalltalk.withContext(function($ctx1) {
  4080. return (4);
  4081. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  4082. args: [],
  4083. source: "collectionSize\x0a\x09^ 4",
  4084. messageSends: [],
  4085. referencedClasses: []
  4086. }),
  4087. smalltalk.ArrayTest);
  4088. smalltalk.addMethod(
  4089. smalltalk.method({
  4090. selector: "collectionWithDuplicates",
  4091. protocol: 'fixture',
  4092. fn: function (){
  4093. var self=this;
  4094. return smalltalk.withContext(function($ctx1) {
  4095. var $1;
  4096. $1=["a", "b", "c", (1), (2), (1), "a"];
  4097. return $1;
  4098. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  4099. args: [],
  4100. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4101. messageSends: [],
  4102. referencedClasses: []
  4103. }),
  4104. smalltalk.ArrayTest);
  4105. smalltalk.addMethod(
  4106. smalltalk.method({
  4107. selector: "collectionWithNewValue",
  4108. protocol: 'fixture',
  4109. fn: function (){
  4110. var self=this;
  4111. return smalltalk.withContext(function($ctx1) {
  4112. var $1;
  4113. $1=[(1), (2), (3), (-4), "N"];
  4114. return $1;
  4115. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  4116. args: [],
  4117. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4118. messageSends: [],
  4119. referencedClasses: []
  4120. }),
  4121. smalltalk.ArrayTest);
  4122. smalltalk.addMethod(
  4123. smalltalk.method({
  4124. selector: "sampleNewIndex",
  4125. protocol: 'fixture',
  4126. fn: function (){
  4127. var self=this;
  4128. return smalltalk.withContext(function($ctx1) {
  4129. return (5);
  4130. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  4131. args: [],
  4132. source: "sampleNewIndex\x0a\x09^ 5",
  4133. messageSends: [],
  4134. referencedClasses: []
  4135. }),
  4136. smalltalk.ArrayTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "samplesDo:",
  4140. protocol: 'fixture',
  4141. fn: function (aBlock){
  4142. var self=this;
  4143. return smalltalk.withContext(function($ctx1) {
  4144. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4145. _st(aBlock)._value_value_((3),(3));
  4146. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  4147. args: ["aBlock"],
  4148. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4149. messageSends: ["samplesDo:", "value:value:"],
  4150. referencedClasses: []
  4151. }),
  4152. smalltalk.ArrayTest);
  4153. smalltalk.addMethod(
  4154. smalltalk.method({
  4155. selector: "testAdd",
  4156. protocol: 'tests',
  4157. fn: function (){
  4158. var self=this;
  4159. var array;
  4160. return smalltalk.withContext(function($ctx1) {
  4161. array=self._collection();
  4162. _st(array)._add_((6));
  4163. self._assert_equals_(_st(array)._last(),(6));
  4164. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  4165. args: [],
  4166. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4167. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4168. referencedClasses: []
  4169. }),
  4170. smalltalk.ArrayTest);
  4171. smalltalk.addMethod(
  4172. smalltalk.method({
  4173. selector: "testAddFirst",
  4174. protocol: 'tests',
  4175. fn: function (){
  4176. var self=this;
  4177. return smalltalk.withContext(function($ctx1) {
  4178. var $1,$2;
  4179. $1=self._collection();
  4180. _st($1)._addFirst_((0));
  4181. $2=_st($1)._yourself();
  4182. self._assert_equals_(_st($2)._first(),(0));
  4183. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  4184. args: [],
  4185. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4186. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4187. referencedClasses: []
  4188. }),
  4189. smalltalk.ArrayTest);
  4190. smalltalk.addMethod(
  4191. smalltalk.method({
  4192. selector: "testPrintString",
  4193. protocol: 'tests',
  4194. fn: function (){
  4195. var self=this;
  4196. var array;
  4197. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4198. return smalltalk.withContext(function($ctx1) {
  4199. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4200. array=_st($Array())._new();
  4201. $1=_st(array)._printString();
  4202. $ctx1.sendIdx["printString"]=1;
  4203. self._assert_equals_($1,"an Array ()");
  4204. $ctx1.sendIdx["assert:equals:"]=1;
  4205. $2=array;
  4206. _st($2)._add_((1));
  4207. $ctx1.sendIdx["add:"]=1;
  4208. $3=_st($2)._add_((3));
  4209. $ctx1.sendIdx["add:"]=2;
  4210. $4=_st(array)._printString();
  4211. $ctx1.sendIdx["printString"]=2;
  4212. self._assert_equals_($4,"an Array (1 3)");
  4213. $ctx1.sendIdx["assert:equals:"]=2;
  4214. _st(array)._add_("foo");
  4215. $5=_st(array)._printString();
  4216. $ctx1.sendIdx["printString"]=3;
  4217. self._assert_equals_($5,"an Array (1 3 'foo')");
  4218. $ctx1.sendIdx["assert:equals:"]=3;
  4219. $6=array;
  4220. _st($6)._remove_((1));
  4221. $ctx1.sendIdx["remove:"]=1;
  4222. $7=_st($6)._remove_((3));
  4223. $8=_st(array)._printString();
  4224. $ctx1.sendIdx["printString"]=4;
  4225. self._assert_equals_($8,"an Array ('foo')");
  4226. $ctx1.sendIdx["assert:equals:"]=4;
  4227. _st(array)._addLast_((3));
  4228. $ctx1.sendIdx["addLast:"]=1;
  4229. $9=_st(array)._printString();
  4230. $ctx1.sendIdx["printString"]=5;
  4231. self._assert_equals_($9,"an Array ('foo' 3)");
  4232. $ctx1.sendIdx["assert:equals:"]=5;
  4233. _st(array)._addLast_((3));
  4234. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4235. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4236. args: [],
  4237. 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)'.",
  4238. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4239. referencedClasses: ["Array"]
  4240. }),
  4241. smalltalk.ArrayTest);
  4242. smalltalk.addMethod(
  4243. smalltalk.method({
  4244. selector: "testRemove",
  4245. protocol: 'tests',
  4246. fn: function (){
  4247. var self=this;
  4248. var array;
  4249. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4250. return smalltalk.withContext(function($ctx1) {
  4251. array=[(1), (2), (3), (4), (5)];
  4252. _st(array)._remove_((3));
  4253. $ctx1.sendIdx["remove:"]=1;
  4254. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4255. self._should_raise_((function(){
  4256. return smalltalk.withContext(function($ctx2) {
  4257. return _st(array)._remove_((3));
  4258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4259. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4260. args: [],
  4261. 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",
  4262. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4263. referencedClasses: ["Error"]
  4264. }),
  4265. smalltalk.ArrayTest);
  4266. smalltalk.addMethod(
  4267. smalltalk.method({
  4268. selector: "testRemoveFromTo",
  4269. protocol: 'tests',
  4270. fn: function (){
  4271. var self=this;
  4272. return smalltalk.withContext(function($ctx1) {
  4273. var $1,$2;
  4274. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4275. $ctx1.sendIdx["removeFrom:to:"]=1;
  4276. self._assert_equals_($1,[(4)]);
  4277. $ctx1.sendIdx["assert:equals:"]=1;
  4278. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4279. $ctx1.sendIdx["removeFrom:to:"]=2;
  4280. self._assert_equals_($2,[(1), (4)]);
  4281. $ctx1.sendIdx["assert:equals:"]=2;
  4282. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4283. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4284. args: [],
  4285. 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)",
  4286. messageSends: ["assert:equals:", "removeFrom:to:"],
  4287. referencedClasses: []
  4288. }),
  4289. smalltalk.ArrayTest);
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "testRemoveIndex",
  4293. protocol: 'tests',
  4294. fn: function (){
  4295. var self=this;
  4296. return smalltalk.withContext(function($ctx1) {
  4297. var $1,$2;
  4298. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4299. $ctx1.sendIdx["removeIndex:"]=1;
  4300. self._assert_equals_($1,[(1), (3), (4)]);
  4301. $ctx1.sendIdx["assert:equals:"]=1;
  4302. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4303. $ctx1.sendIdx["removeIndex:"]=2;
  4304. self._assert_equals_($2,[(2), (3), (4)]);
  4305. $ctx1.sendIdx["assert:equals:"]=2;
  4306. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4307. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4308. args: [],
  4309. 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: #()",
  4310. messageSends: ["assert:equals:", "removeIndex:"],
  4311. referencedClasses: []
  4312. }),
  4313. smalltalk.ArrayTest);
  4314. smalltalk.addMethod(
  4315. smalltalk.method({
  4316. selector: "testRemoveLast",
  4317. protocol: 'tests',
  4318. fn: function (){
  4319. var self=this;
  4320. var array;
  4321. return smalltalk.withContext(function($ctx1) {
  4322. array=[(1), (2)];
  4323. _st(array)._removeLast();
  4324. self._assert_equals_(_st(array)._last(),(1));
  4325. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4326. args: [],
  4327. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4328. messageSends: ["removeLast", "assert:equals:", "last"],
  4329. referencedClasses: []
  4330. }),
  4331. smalltalk.ArrayTest);
  4332. smalltalk.addMethod(
  4333. smalltalk.method({
  4334. selector: "testReversed",
  4335. protocol: 'tests',
  4336. fn: function (){
  4337. var self=this;
  4338. var array;
  4339. return smalltalk.withContext(function($ctx1) {
  4340. array=[(5), (4), (3), (2), (1)];
  4341. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4342. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4343. args: [],
  4344. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4345. messageSends: ["assert:equals:", "reversed"],
  4346. referencedClasses: []
  4347. }),
  4348. smalltalk.ArrayTest);
  4349. smalltalk.addMethod(
  4350. smalltalk.method({
  4351. selector: "testSort",
  4352. protocol: 'tests',
  4353. fn: function (){
  4354. var self=this;
  4355. var array;
  4356. return smalltalk.withContext(function($ctx1) {
  4357. array=[(3), (1), (4), (5), (2)];
  4358. _st(array)._sort();
  4359. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4360. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4361. args: [],
  4362. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4363. messageSends: ["sort", "assert:equals:"],
  4364. referencedClasses: []
  4365. }),
  4366. smalltalk.ArrayTest);
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "collectionClass",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4374. return smalltalk.withContext(function($ctx1) {
  4375. return $Array();
  4376. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4377. args: [],
  4378. source: "collectionClass\x0a\x09^ Array",
  4379. messageSends: [],
  4380. referencedClasses: ["Array"]
  4381. }),
  4382. smalltalk.ArrayTest.klass);
  4383. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4384. smalltalk.addMethod(
  4385. smalltalk.method({
  4386. selector: "collection",
  4387. protocol: 'fixture',
  4388. fn: function (){
  4389. var self=this;
  4390. return smalltalk.withContext(function($ctx1) {
  4391. return "helLo";
  4392. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4393. args: [],
  4394. source: "collection\x0a\x09^ 'helLo'",
  4395. messageSends: [],
  4396. referencedClasses: []
  4397. }),
  4398. smalltalk.StringTest);
  4399. smalltalk.addMethod(
  4400. smalltalk.method({
  4401. selector: "collectionFirst",
  4402. protocol: 'fixture',
  4403. fn: function (){
  4404. var self=this;
  4405. return smalltalk.withContext(function($ctx1) {
  4406. return "h";
  4407. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4408. args: [],
  4409. source: "collectionFirst\x0a\x09^ 'h'",
  4410. messageSends: [],
  4411. referencedClasses: []
  4412. }),
  4413. smalltalk.StringTest);
  4414. smalltalk.addMethod(
  4415. smalltalk.method({
  4416. selector: "collectionFirstTwo",
  4417. protocol: 'fixture',
  4418. fn: function (){
  4419. var self=this;
  4420. return smalltalk.withContext(function($ctx1) {
  4421. return "he";
  4422. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4423. args: [],
  4424. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4425. messageSends: [],
  4426. referencedClasses: []
  4427. }),
  4428. smalltalk.StringTest);
  4429. smalltalk.addMethod(
  4430. smalltalk.method({
  4431. selector: "collectionLast",
  4432. protocol: 'fixture',
  4433. fn: function (){
  4434. var self=this;
  4435. return smalltalk.withContext(function($ctx1) {
  4436. return "o";
  4437. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4438. args: [],
  4439. source: "collectionLast\x0a\x09^ 'o'",
  4440. messageSends: [],
  4441. referencedClasses: []
  4442. }),
  4443. smalltalk.StringTest);
  4444. smalltalk.addMethod(
  4445. smalltalk.method({
  4446. selector: "collectionLastTwo",
  4447. protocol: 'fixture',
  4448. fn: function (){
  4449. var self=this;
  4450. return smalltalk.withContext(function($ctx1) {
  4451. return "Lo";
  4452. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4453. args: [],
  4454. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4455. messageSends: [],
  4456. referencedClasses: []
  4457. }),
  4458. smalltalk.StringTest);
  4459. smalltalk.addMethod(
  4460. smalltalk.method({
  4461. selector: "collectionOfPrintStrings",
  4462. protocol: 'fixture',
  4463. fn: function (){
  4464. var self=this;
  4465. return smalltalk.withContext(function($ctx1) {
  4466. return "'h''e''l''L''o'";
  4467. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4468. args: [],
  4469. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4470. messageSends: [],
  4471. referencedClasses: []
  4472. }),
  4473. smalltalk.StringTest);
  4474. smalltalk.addMethod(
  4475. smalltalk.method({
  4476. selector: "collectionSize",
  4477. protocol: 'fixture',
  4478. fn: function (){
  4479. var self=this;
  4480. return smalltalk.withContext(function($ctx1) {
  4481. return (5);
  4482. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4483. args: [],
  4484. source: "collectionSize\x0a\x09^ 5",
  4485. messageSends: [],
  4486. referencedClasses: []
  4487. }),
  4488. smalltalk.StringTest);
  4489. smalltalk.addMethod(
  4490. smalltalk.method({
  4491. selector: "collectionWithDuplicates",
  4492. protocol: 'fixture',
  4493. fn: function (){
  4494. var self=this;
  4495. return smalltalk.withContext(function($ctx1) {
  4496. return "abbaerte";
  4497. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4498. args: [],
  4499. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4500. messageSends: [],
  4501. referencedClasses: []
  4502. }),
  4503. smalltalk.StringTest);
  4504. smalltalk.addMethod(
  4505. smalltalk.method({
  4506. selector: "collectionWithNewValue",
  4507. protocol: 'fixture',
  4508. fn: function (){
  4509. var self=this;
  4510. return smalltalk.withContext(function($ctx1) {
  4511. return "helLoN";
  4512. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4513. args: [],
  4514. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4515. messageSends: [],
  4516. referencedClasses: []
  4517. }),
  4518. smalltalk.StringTest);
  4519. smalltalk.addMethod(
  4520. smalltalk.method({
  4521. selector: "sampleNewValueAsCollection",
  4522. protocol: 'fixture',
  4523. fn: function (){
  4524. var self=this;
  4525. return smalltalk.withContext(function($ctx1) {
  4526. return "N";
  4527. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4528. args: [],
  4529. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4530. messageSends: [],
  4531. referencedClasses: []
  4532. }),
  4533. smalltalk.StringTest);
  4534. smalltalk.addMethod(
  4535. smalltalk.method({
  4536. selector: "samplesDo:",
  4537. protocol: 'fixture',
  4538. fn: function (aBlock){
  4539. var self=this;
  4540. return smalltalk.withContext(function($ctx1) {
  4541. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4542. _st(aBlock)._value_value_((3),"l");
  4543. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4544. args: ["aBlock"],
  4545. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4546. messageSends: ["samplesDo:", "value:value:"],
  4547. referencedClasses: []
  4548. }),
  4549. smalltalk.StringTest);
  4550. smalltalk.addMethod(
  4551. smalltalk.method({
  4552. selector: "testAddAll",
  4553. protocol: 'tests',
  4554. fn: function (){
  4555. var self=this;
  4556. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4557. return smalltalk.withContext(function($ctx1) {
  4558. var $1;
  4559. self._should_raise_((function(){
  4560. return smalltalk.withContext(function($ctx2) {
  4561. $1=self._collection();
  4562. $ctx2.sendIdx["collection"]=1;
  4563. return _st($1)._addAll_(self._collection());
  4564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4565. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4566. args: [],
  4567. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4568. messageSends: ["should:raise:", "addAll:", "collection"],
  4569. referencedClasses: ["Error"]
  4570. }),
  4571. smalltalk.StringTest);
  4572. smalltalk.addMethod(
  4573. smalltalk.method({
  4574. selector: "testAddRemove",
  4575. protocol: 'tests',
  4576. fn: function (){
  4577. var self=this;
  4578. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4579. return smalltalk.withContext(function($ctx1) {
  4580. self._should_raise_((function(){
  4581. return smalltalk.withContext(function($ctx2) {
  4582. return "hello"._add_("a");
  4583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4584. $ctx1.sendIdx["should:raise:"]=1;
  4585. self._should_raise_((function(){
  4586. return smalltalk.withContext(function($ctx2) {
  4587. return "hello"._remove_("h");
  4588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4589. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4590. args: [],
  4591. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4592. messageSends: ["should:raise:", "add:", "remove:"],
  4593. referencedClasses: ["Error"]
  4594. }),
  4595. smalltalk.StringTest);
  4596. smalltalk.addMethod(
  4597. smalltalk.method({
  4598. selector: "testAsArray",
  4599. protocol: 'tests',
  4600. fn: function (){
  4601. var self=this;
  4602. return smalltalk.withContext(function($ctx1) {
  4603. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4604. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4605. args: [],
  4606. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4607. messageSends: ["assert:equals:", "asArray"],
  4608. referencedClasses: []
  4609. }),
  4610. smalltalk.StringTest);
  4611. smalltalk.addMethod(
  4612. smalltalk.method({
  4613. selector: "testAsLowerCase",
  4614. protocol: 'tests',
  4615. fn: function (){
  4616. var self=this;
  4617. return smalltalk.withContext(function($ctx1) {
  4618. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4619. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4620. args: [],
  4621. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4622. messageSends: ["assert:equals:", "asLowercase"],
  4623. referencedClasses: []
  4624. }),
  4625. smalltalk.StringTest);
  4626. smalltalk.addMethod(
  4627. smalltalk.method({
  4628. selector: "testAsNumber",
  4629. protocol: 'tests',
  4630. fn: function (){
  4631. var self=this;
  4632. return smalltalk.withContext(function($ctx1) {
  4633. var $1,$2;
  4634. $1="3"._asNumber();
  4635. $ctx1.sendIdx["asNumber"]=1;
  4636. self._assert_equals_($1,(3));
  4637. $ctx1.sendIdx["assert:equals:"]=1;
  4638. $2="-3"._asNumber();
  4639. $ctx1.sendIdx["asNumber"]=2;
  4640. self._assert_equals_($2,(-3));
  4641. $ctx1.sendIdx["assert:equals:"]=2;
  4642. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4643. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4644. args: [],
  4645. 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.",
  4646. messageSends: ["assert:equals:", "asNumber"],
  4647. referencedClasses: []
  4648. }),
  4649. smalltalk.StringTest);
  4650. smalltalk.addMethod(
  4651. smalltalk.method({
  4652. selector: "testAsUpperCase",
  4653. protocol: 'tests',
  4654. fn: function (){
  4655. var self=this;
  4656. return smalltalk.withContext(function($ctx1) {
  4657. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4658. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4659. args: [],
  4660. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4661. messageSends: ["assert:equals:", "asUppercase"],
  4662. referencedClasses: []
  4663. }),
  4664. smalltalk.StringTest);
  4665. smalltalk.addMethod(
  4666. smalltalk.method({
  4667. selector: "testAsciiValue",
  4668. protocol: 'tests',
  4669. fn: function (){
  4670. var self=this;
  4671. var characterA,characterU;
  4672. return smalltalk.withContext(function($ctx1) {
  4673. var $1;
  4674. characterA="A";
  4675. characterU="U";
  4676. $1=_st(characterA)._asciiValue();
  4677. $ctx1.sendIdx["asciiValue"]=1;
  4678. self._assert_equals_($1,(65));
  4679. $ctx1.sendIdx["assert:equals:"]=1;
  4680. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4681. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4682. args: [],
  4683. 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",
  4684. messageSends: ["assert:equals:", "asciiValue"],
  4685. referencedClasses: []
  4686. }),
  4687. smalltalk.StringTest);
  4688. smalltalk.addMethod(
  4689. smalltalk.method({
  4690. selector: "testAtIfAbsentPut",
  4691. protocol: 'tests',
  4692. fn: function (){
  4693. var self=this;
  4694. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4695. return smalltalk.withContext(function($ctx1) {
  4696. self._should_raise_((function(){
  4697. return smalltalk.withContext(function($ctx2) {
  4698. return "hello"._at_ifAbsentPut_((6),(function(){
  4699. return smalltalk.withContext(function($ctx3) {
  4700. return "a";
  4701. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4703. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4704. args: [],
  4705. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4706. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4707. referencedClasses: ["Error"]
  4708. }),
  4709. smalltalk.StringTest);
  4710. smalltalk.addMethod(
  4711. smalltalk.method({
  4712. selector: "testAtPut",
  4713. protocol: 'tests',
  4714. fn: function (){
  4715. var self=this;
  4716. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4717. return smalltalk.withContext(function($ctx1) {
  4718. self._should_raise_((function(){
  4719. return smalltalk.withContext(function($ctx2) {
  4720. return "hello"._at_put_((1),"a");
  4721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4722. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4723. args: [],
  4724. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4725. messageSends: ["should:raise:", "at:put:"],
  4726. referencedClasses: ["Error"]
  4727. }),
  4728. smalltalk.StringTest);
  4729. smalltalk.addMethod(
  4730. smalltalk.method({
  4731. selector: "testCapitalized",
  4732. protocol: 'tests',
  4733. fn: function (){
  4734. var self=this;
  4735. return smalltalk.withContext(function($ctx1) {
  4736. var $1,$2,$3;
  4737. $1="test"._capitalized();
  4738. $ctx1.sendIdx["capitalized"]=1;
  4739. self._assert_equals_($1,"Test");
  4740. $ctx1.sendIdx["assert:equals:"]=1;
  4741. $2="Test"._capitalized();
  4742. $ctx1.sendIdx["capitalized"]=2;
  4743. self._assert_equals_($2,"Test");
  4744. $ctx1.sendIdx["assert:equals:"]=2;
  4745. self._assert_equals_(""._capitalized(),"");
  4746. $ctx1.sendIdx["assert:equals:"]=3;
  4747. $3="Test"._isCapitalized();
  4748. $ctx1.sendIdx["isCapitalized"]=1;
  4749. self._assert_equals_($3,true);
  4750. $ctx1.sendIdx["assert:equals:"]=4;
  4751. self._assert_equals_("test"._isCapitalized(),false);
  4752. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4753. args: [],
  4754. 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.",
  4755. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4756. referencedClasses: []
  4757. }),
  4758. smalltalk.StringTest);
  4759. smalltalk.addMethod(
  4760. smalltalk.method({
  4761. selector: "testCharCodeAt",
  4762. protocol: 'tests',
  4763. fn: function (){
  4764. var self=this;
  4765. return smalltalk.withContext(function($ctx1) {
  4766. var $1,$2,$3,$4,$5;
  4767. $1="jackie"._charCodeAt_((1));
  4768. $ctx1.sendIdx["charCodeAt:"]=1;
  4769. self._assert_equals_($1,(106));
  4770. $ctx1.sendIdx["assert:equals:"]=1;
  4771. $2="jackie"._charCodeAt_((2));
  4772. $ctx1.sendIdx["charCodeAt:"]=2;
  4773. self._assert_equals_($2,(97));
  4774. $ctx1.sendIdx["assert:equals:"]=2;
  4775. $3="jackie"._charCodeAt_((3));
  4776. $ctx1.sendIdx["charCodeAt:"]=3;
  4777. self._assert_equals_($3,(99));
  4778. $ctx1.sendIdx["assert:equals:"]=3;
  4779. $4="jackie"._charCodeAt_((4));
  4780. $ctx1.sendIdx["charCodeAt:"]=4;
  4781. self._assert_equals_($4,(107));
  4782. $ctx1.sendIdx["assert:equals:"]=4;
  4783. $5="jackie"._charCodeAt_((5));
  4784. $ctx1.sendIdx["charCodeAt:"]=5;
  4785. self._assert_equals_($5,(105));
  4786. $ctx1.sendIdx["assert:equals:"]=5;
  4787. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4788. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4789. args: [],
  4790. 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",
  4791. messageSends: ["assert:equals:", "charCodeAt:"],
  4792. referencedClasses: []
  4793. }),
  4794. smalltalk.StringTest);
  4795. smalltalk.addMethod(
  4796. smalltalk.method({
  4797. selector: "testCopyFromTo",
  4798. protocol: 'tests',
  4799. fn: function (){
  4800. var self=this;
  4801. return smalltalk.withContext(function($ctx1) {
  4802. var $1;
  4803. $1="jackie"._copyFrom_to_((1),(3));
  4804. $ctx1.sendIdx["copyFrom:to:"]=1;
  4805. self._assert_equals_($1,"jac");
  4806. $ctx1.sendIdx["assert:equals:"]=1;
  4807. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4808. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4809. args: [],
  4810. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4811. messageSends: ["assert:equals:", "copyFrom:to:"],
  4812. referencedClasses: []
  4813. }),
  4814. smalltalk.StringTest);
  4815. smalltalk.addMethod(
  4816. smalltalk.method({
  4817. selector: "testCopyWithoutAll",
  4818. protocol: 'tests',
  4819. fn: function (){
  4820. var self=this;
  4821. return smalltalk.withContext(function($ctx1) {
  4822. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4823. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4824. args: [],
  4825. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4826. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4827. referencedClasses: []
  4828. }),
  4829. smalltalk.StringTest);
  4830. smalltalk.addMethod(
  4831. smalltalk.method({
  4832. selector: "testEquality",
  4833. protocol: 'tests',
  4834. fn: function (){
  4835. var self=this;
  4836. return smalltalk.withContext(function($ctx1) {
  4837. var $1,$2,$3;
  4838. self._assert_equals_("hello","hello");
  4839. $ctx1.sendIdx["assert:equals:"]=1;
  4840. $1="hello".__eq("world");
  4841. $ctx1.sendIdx["="]=1;
  4842. self._deny_($1);
  4843. $ctx1.sendIdx["deny:"]=1;
  4844. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4845. return smalltalk.withContext(function($ctx2) {
  4846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4847. $ctx1.sendIdx["="]=2;
  4848. self._deny_($2);
  4849. $ctx1.sendIdx["deny:"]=2;
  4850. $3="hello"._yourself();
  4851. $ctx1.sendIdx["yourself"]=1;
  4852. self._assert_equals_("hello",$3);
  4853. $ctx1.sendIdx["assert:equals:"]=2;
  4854. self._assert_equals_("hello"._yourself(),"hello");
  4855. self._deny_("".__eq((0)));
  4856. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4857. args: [],
  4858. 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",
  4859. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4860. referencedClasses: []
  4861. }),
  4862. smalltalk.StringTest);
  4863. smalltalk.addMethod(
  4864. smalltalk.method({
  4865. selector: "testIdentity",
  4866. protocol: 'tests',
  4867. fn: function (){
  4868. var self=this;
  4869. return smalltalk.withContext(function($ctx1) {
  4870. var $1,$2,$4,$3,$5;
  4871. $1="hello".__eq_eq("hello");
  4872. $ctx1.sendIdx["=="]=1;
  4873. self._assert_($1);
  4874. $ctx1.sendIdx["assert:"]=1;
  4875. $2="hello".__eq_eq("world");
  4876. $ctx1.sendIdx["=="]=2;
  4877. self._deny_($2);
  4878. $ctx1.sendIdx["deny:"]=1;
  4879. $4="hello"._yourself();
  4880. $ctx1.sendIdx["yourself"]=1;
  4881. $3="hello".__eq_eq($4);
  4882. $ctx1.sendIdx["=="]=3;
  4883. self._assert_($3);
  4884. $ctx1.sendIdx["assert:"]=2;
  4885. $5=_st("hello"._yourself()).__eq_eq("hello");
  4886. $ctx1.sendIdx["=="]=4;
  4887. self._assert_($5);
  4888. self._deny_("".__eq_eq((0)));
  4889. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4890. args: [],
  4891. 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",
  4892. messageSends: ["assert:", "==", "deny:", "yourself"],
  4893. referencedClasses: []
  4894. }),
  4895. smalltalk.StringTest);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "testIdentityHash",
  4899. protocol: 'tests',
  4900. fn: function (){
  4901. var self=this;
  4902. return smalltalk.withContext(function($ctx1) {
  4903. var $1,$2,$4,$3;
  4904. $1="foo"._identityHash();
  4905. $ctx1.sendIdx["identityHash"]=1;
  4906. $2="foo"._identityHash();
  4907. $ctx1.sendIdx["identityHash"]=2;
  4908. self._assert_equals_($1,$2);
  4909. $4="foo"._identityHash();
  4910. $ctx1.sendIdx["identityHash"]=3;
  4911. $3=_st($4).__eq("bar"._identityHash());
  4912. self._deny_($3);
  4913. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4914. args: [],
  4915. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4916. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4917. referencedClasses: []
  4918. }),
  4919. smalltalk.StringTest);
  4920. smalltalk.addMethod(
  4921. smalltalk.method({
  4922. selector: "testIncludesSubString",
  4923. protocol: 'tests',
  4924. fn: function (){
  4925. var self=this;
  4926. return smalltalk.withContext(function($ctx1) {
  4927. var $1;
  4928. $1="amber"._includesSubString_("ber");
  4929. $ctx1.sendIdx["includesSubString:"]=1;
  4930. self._assert_($1);
  4931. self._deny_("amber"._includesSubString_("zork"));
  4932. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4933. args: [],
  4934. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4935. messageSends: ["assert:", "includesSubString:", "deny:"],
  4936. referencedClasses: []
  4937. }),
  4938. smalltalk.StringTest);
  4939. smalltalk.addMethod(
  4940. smalltalk.method({
  4941. selector: "testIndexOfStartingAtWithNull",
  4942. protocol: 'tests',
  4943. fn: function (){
  4944. var self=this;
  4945. return smalltalk.withContext(function($ctx1) {
  4946. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{},smalltalk.StringTest)})},
  4947. args: [],
  4948. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4949. messageSends: [],
  4950. referencedClasses: []
  4951. }),
  4952. smalltalk.StringTest);
  4953. smalltalk.addMethod(
  4954. smalltalk.method({
  4955. selector: "testIndexOfWithNull",
  4956. protocol: 'tests',
  4957. fn: function (){
  4958. var self=this;
  4959. return smalltalk.withContext(function($ctx1) {
  4960. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{},smalltalk.StringTest)})},
  4961. args: [],
  4962. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4963. messageSends: [],
  4964. referencedClasses: []
  4965. }),
  4966. smalltalk.StringTest);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "testIsVowel",
  4970. protocol: 'tests',
  4971. fn: function (){
  4972. var self=this;
  4973. var vowel,consonant;
  4974. return smalltalk.withContext(function($ctx1) {
  4975. var $1;
  4976. vowel="u";
  4977. consonant="z";
  4978. $1=_st(vowel)._isVowel();
  4979. $ctx1.sendIdx["isVowel"]=1;
  4980. self._assert_equals_($1,true);
  4981. $ctx1.sendIdx["assert:equals:"]=1;
  4982. self._assert_equals_(_st(consonant)._isVowel(),false);
  4983. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4984. args: [],
  4985. 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",
  4986. messageSends: ["assert:equals:", "isVowel"],
  4987. referencedClasses: []
  4988. }),
  4989. smalltalk.StringTest);
  4990. smalltalk.addMethod(
  4991. smalltalk.method({
  4992. selector: "testJoin",
  4993. protocol: 'tests',
  4994. fn: function (){
  4995. var self=this;
  4996. return smalltalk.withContext(function($ctx1) {
  4997. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4998. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4999. args: [],
  5000. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  5001. messageSends: ["assert:equals:", "join:"],
  5002. referencedClasses: []
  5003. }),
  5004. smalltalk.StringTest);
  5005. smalltalk.addMethod(
  5006. smalltalk.method({
  5007. selector: "testRemoveAll",
  5008. protocol: 'tests',
  5009. fn: function (){
  5010. var self=this;
  5011. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5012. return smalltalk.withContext(function($ctx1) {
  5013. self._should_raise_((function(){
  5014. return smalltalk.withContext(function($ctx2) {
  5015. return _st(self._collection())._removeAll();
  5016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5017. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  5018. args: [],
  5019. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  5020. messageSends: ["should:raise:", "removeAll", "collection"],
  5021. referencedClasses: ["Error"]
  5022. }),
  5023. smalltalk.StringTest);
  5024. smalltalk.addMethod(
  5025. smalltalk.method({
  5026. selector: "testReversed",
  5027. protocol: 'tests',
  5028. fn: function (){
  5029. var self=this;
  5030. return smalltalk.withContext(function($ctx1) {
  5031. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5032. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  5033. args: [],
  5034. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5035. messageSends: ["assert:equals:", "reversed"],
  5036. referencedClasses: []
  5037. }),
  5038. smalltalk.StringTest);
  5039. smalltalk.addMethod(
  5040. smalltalk.method({
  5041. selector: "testStreamContents",
  5042. protocol: 'tests',
  5043. fn: function (){
  5044. var self=this;
  5045. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5046. return smalltalk.withContext(function($ctx1) {
  5047. var $1;
  5048. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5049. return smalltalk.withContext(function($ctx2) {
  5050. _st(aStream)._nextPutAll_("hello");
  5051. $ctx2.sendIdx["nextPutAll:"]=1;
  5052. _st(aStream)._space();
  5053. $1=_st(aStream)._nextPutAll_("world");
  5054. return $1;
  5055. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5056. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  5057. args: [],
  5058. 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'",
  5059. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5060. referencedClasses: ["String"]
  5061. }),
  5062. smalltalk.StringTest);
  5063. smalltalk.addMethod(
  5064. smalltalk.method({
  5065. selector: "testSubStrings",
  5066. protocol: 'tests',
  5067. fn: function (){
  5068. var self=this;
  5069. return smalltalk.withContext(function($ctx1) {
  5070. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5071. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  5072. args: [],
  5073. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5074. messageSends: ["assert:equals:", "subStrings:"],
  5075. referencedClasses: []
  5076. }),
  5077. smalltalk.StringTest);
  5078. smalltalk.addMethod(
  5079. smalltalk.method({
  5080. selector: "testTrim",
  5081. protocol: 'tests',
  5082. fn: function (){
  5083. var self=this;
  5084. return smalltalk.withContext(function($ctx1) {
  5085. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5086. $ctx1.sendIdx["assert:equals:"]=1;
  5087. self._assert_equals_("jackie "._trimRight(),"jackie");
  5088. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  5089. args: [],
  5090. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5091. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5092. referencedClasses: []
  5093. }),
  5094. smalltalk.StringTest);
  5095. smalltalk.addMethod(
  5096. smalltalk.method({
  5097. selector: "collectionClass",
  5098. protocol: 'fixture',
  5099. fn: function (){
  5100. var self=this;
  5101. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5102. return smalltalk.withContext(function($ctx1) {
  5103. return $String();
  5104. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  5105. args: [],
  5106. source: "collectionClass\x0a\x09^ String",
  5107. messageSends: [],
  5108. referencedClasses: ["String"]
  5109. }),
  5110. smalltalk.StringTest.klass);
  5111. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  5112. smalltalk.addMethod(
  5113. smalltalk.method({
  5114. selector: "collection",
  5115. protocol: 'fixture',
  5116. fn: function (){
  5117. var self=this;
  5118. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5119. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5120. return smalltalk.withContext(function($ctx1) {
  5121. var $2,$3,$1;
  5122. $2=_st($Set())._new();
  5123. _st($2)._add_(_st($Smalltalk())._current());
  5124. $ctx1.sendIdx["add:"]=1;
  5125. _st($2)._add_(nil);
  5126. $ctx1.sendIdx["add:"]=2;
  5127. _st($2)._add_((3).__at((3)));
  5128. $ctx1.sendIdx["add:"]=3;
  5129. _st($2)._add_(false);
  5130. $3=_st($2)._yourself();
  5131. $1=$3;
  5132. return $1;
  5133. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  5134. args: [],
  5135. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5136. messageSends: ["add:", "new", "current", "@", "yourself"],
  5137. referencedClasses: ["Set", "Smalltalk"]
  5138. }),
  5139. smalltalk.SetTest);
  5140. smalltalk.addMethod(
  5141. smalltalk.method({
  5142. selector: "collectionOfPrintStrings",
  5143. protocol: 'fixture',
  5144. fn: function (){
  5145. var self=this;
  5146. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5147. return smalltalk.withContext(function($ctx1) {
  5148. var $2,$3,$1;
  5149. $2=_st($Set())._new();
  5150. _st($2)._add_("a Smalltalk");
  5151. $ctx1.sendIdx["add:"]=1;
  5152. _st($2)._add_("nil");
  5153. $ctx1.sendIdx["add:"]=2;
  5154. _st($2)._add_("3@3");
  5155. $ctx1.sendIdx["add:"]=3;
  5156. _st($2)._add_("false");
  5157. $3=_st($2)._yourself();
  5158. $1=$3;
  5159. return $1;
  5160. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  5161. args: [],
  5162. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a Smalltalk';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5163. messageSends: ["add:", "new", "yourself"],
  5164. referencedClasses: ["Set"]
  5165. }),
  5166. smalltalk.SetTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "collectionSize",
  5170. protocol: 'fixture',
  5171. fn: function (){
  5172. var self=this;
  5173. return smalltalk.withContext(function($ctx1) {
  5174. return (4);
  5175. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  5176. args: [],
  5177. source: "collectionSize\x0a\x09^ 4",
  5178. messageSends: [],
  5179. referencedClasses: []
  5180. }),
  5181. smalltalk.SetTest);
  5182. smalltalk.addMethod(
  5183. smalltalk.method({
  5184. selector: "collectionWithDuplicates",
  5185. protocol: 'fixture',
  5186. fn: function (){
  5187. var self=this;
  5188. return smalltalk.withContext(function($ctx1) {
  5189. var $2,$3,$1;
  5190. $2=self._collection();
  5191. _st($2)._add_((0));
  5192. $3=_st($2)._yourself();
  5193. $1=$3;
  5194. return $1;
  5195. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  5196. args: [],
  5197. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5198. messageSends: ["add:", "collection", "yourself"],
  5199. referencedClasses: []
  5200. }),
  5201. smalltalk.SetTest);
  5202. smalltalk.addMethod(
  5203. smalltalk.method({
  5204. selector: "collectionWithNewValue",
  5205. protocol: 'fixture',
  5206. fn: function (){
  5207. var self=this;
  5208. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5209. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5210. return smalltalk.withContext(function($ctx1) {
  5211. var $2,$3,$1;
  5212. $2=_st($Set())._new();
  5213. _st($2)._add_(_st($Smalltalk())._current());
  5214. $ctx1.sendIdx["add:"]=1;
  5215. _st($2)._add_(nil);
  5216. $ctx1.sendIdx["add:"]=2;
  5217. _st($2)._add_((3).__at((3)));
  5218. $ctx1.sendIdx["add:"]=3;
  5219. _st($2)._add_("N");
  5220. $ctx1.sendIdx["add:"]=4;
  5221. _st($2)._add_(false);
  5222. $3=_st($2)._yourself();
  5223. $1=$3;
  5224. return $1;
  5225. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5226. args: [],
  5227. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5228. messageSends: ["add:", "new", "current", "@", "yourself"],
  5229. referencedClasses: ["Set", "Smalltalk"]
  5230. }),
  5231. smalltalk.SetTest);
  5232. smalltalk.addMethod(
  5233. smalltalk.method({
  5234. selector: "testAddAll",
  5235. protocol: 'tests',
  5236. fn: function (){
  5237. var self=this;
  5238. return smalltalk.withContext(function($ctx1) {
  5239. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5240. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5241. $2=self._collection();
  5242. $ctx1.sendIdx["collection"]=1;
  5243. $3=$2;
  5244. $4=self._collection();
  5245. $ctx1.sendIdx["collection"]=2;
  5246. _st($3)._addAll_($4);
  5247. $ctx1.sendIdx["addAll:"]=1;
  5248. $5=_st($2)._yourself();
  5249. $ctx1.sendIdx["yourself"]=1;
  5250. $1=$5;
  5251. $6=self._collection();
  5252. $ctx1.sendIdx["collection"]=3;
  5253. self._assert_equals_($1,$6);
  5254. $ctx1.sendIdx["assert:equals:"]=1;
  5255. $8=self._collection();
  5256. $ctx1.sendIdx["collection"]=4;
  5257. $9=$8;
  5258. $10=self._collectionWithNewValue();
  5259. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5260. _st($9)._addAll_($10);
  5261. $ctx1.sendIdx["addAll:"]=2;
  5262. $11=_st($8)._yourself();
  5263. $ctx1.sendIdx["yourself"]=2;
  5264. $7=$11;
  5265. $12=self._collectionWithNewValue();
  5266. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5267. self._assert_equals_($7,$12);
  5268. $ctx1.sendIdx["assert:equals:"]=2;
  5269. $14=self._collectionWithNewValue();
  5270. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5271. _st($14)._addAll_(self._collection());
  5272. $15=_st($14)._yourself();
  5273. $13=$15;
  5274. self._assert_equals_($13,self._collectionWithNewValue());
  5275. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5276. args: [],
  5277. 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",
  5278. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5279. referencedClasses: []
  5280. }),
  5281. smalltalk.SetTest);
  5282. smalltalk.addMethod(
  5283. smalltalk.method({
  5284. selector: "testAddRemove",
  5285. protocol: 'tests',
  5286. fn: function (){
  5287. var self=this;
  5288. var set;
  5289. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5290. return smalltalk.withContext(function($ctx1) {
  5291. var $1,$2;
  5292. set=_st($Set())._new();
  5293. self._assert_(_st(set)._isEmpty());
  5294. $ctx1.sendIdx["assert:"]=1;
  5295. _st(set)._add_((3));
  5296. $ctx1.sendIdx["add:"]=1;
  5297. $1=_st(set)._includes_((3));
  5298. $ctx1.sendIdx["includes:"]=1;
  5299. self._assert_($1);
  5300. $ctx1.sendIdx["assert:"]=2;
  5301. _st(set)._add_((5));
  5302. $2=_st(set)._includes_((5));
  5303. $ctx1.sendIdx["includes:"]=2;
  5304. self._assert_($2);
  5305. _st(set)._remove_((3));
  5306. self._deny_(_st(set)._includes_((3)));
  5307. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5308. args: [],
  5309. 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)",
  5310. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5311. referencedClasses: ["Set"]
  5312. }),
  5313. smalltalk.SetTest);
  5314. smalltalk.addMethod(
  5315. smalltalk.method({
  5316. selector: "testAt",
  5317. protocol: 'tests',
  5318. fn: function (){
  5319. var self=this;
  5320. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5321. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5322. return smalltalk.withContext(function($ctx1) {
  5323. self._should_raise_((function(){
  5324. return smalltalk.withContext(function($ctx2) {
  5325. return _st(_st($Set())._new())._at_put_((1),(2));
  5326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5327. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5328. args: [],
  5329. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5330. messageSends: ["should:raise:", "at:put:", "new"],
  5331. referencedClasses: ["Set", "Error"]
  5332. }),
  5333. smalltalk.SetTest);
  5334. smalltalk.addMethod(
  5335. smalltalk.method({
  5336. selector: "testCollect",
  5337. protocol: 'tests',
  5338. fn: function (){
  5339. var self=this;
  5340. return smalltalk.withContext(function($ctx1) {
  5341. var $2,$1;
  5342. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5343. $2=[(5), (6), (8)]._asSet();
  5344. $ctx1.sendIdx["asSet"]=1;
  5345. $1=_st($2)._collect_((function(x){
  5346. return smalltalk.withContext(function($ctx2) {
  5347. return _st(x).__backslash_backslash((3));
  5348. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5349. self._assert_equals_($1,[(0), (2)]._asSet());
  5350. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5351. args: [],
  5352. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5353. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5354. referencedClasses: []
  5355. }),
  5356. smalltalk.SetTest);
  5357. smalltalk.addMethod(
  5358. smalltalk.method({
  5359. selector: "testComma",
  5360. protocol: 'tests',
  5361. fn: function (){
  5362. var self=this;
  5363. return smalltalk.withContext(function($ctx1) {
  5364. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5365. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5366. $2=self._collection();
  5367. $ctx1.sendIdx["collection"]=1;
  5368. $3=self._collection();
  5369. $ctx1.sendIdx["collection"]=2;
  5370. $1=_st($2).__comma($3);
  5371. $ctx1.sendIdx[","]=1;
  5372. $4=self._collection();
  5373. $ctx1.sendIdx["collection"]=3;
  5374. self._assert_equals_($1,$4);
  5375. $ctx1.sendIdx["assert:equals:"]=1;
  5376. $6=self._collection();
  5377. $ctx1.sendIdx["collection"]=4;
  5378. $7=self._collectionWithNewValue();
  5379. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5380. $5=_st($6).__comma($7);
  5381. $ctx1.sendIdx[","]=2;
  5382. $8=self._collectionWithNewValue();
  5383. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5384. self._assert_equals_($5,$8);
  5385. $ctx1.sendIdx["assert:equals:"]=2;
  5386. $10=self._collectionWithNewValue();
  5387. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5388. $9=_st($10).__comma(self._collection());
  5389. self._assert_equals_($9,self._collectionWithNewValue());
  5390. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5391. args: [],
  5392. 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",
  5393. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5394. referencedClasses: []
  5395. }),
  5396. smalltalk.SetTest);
  5397. smalltalk.addMethod(
  5398. smalltalk.method({
  5399. selector: "testComparing",
  5400. protocol: 'tests',
  5401. fn: function (){
  5402. var self=this;
  5403. return smalltalk.withContext(function($ctx1) {
  5404. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5405. $1=[(0), (2)]._asSet();
  5406. $ctx1.sendIdx["asSet"]=1;
  5407. $2=[(0), (2)]._asSet();
  5408. $ctx1.sendIdx["asSet"]=2;
  5409. self._assert_equals_($1,$2);
  5410. $ctx1.sendIdx["assert:equals:"]=1;
  5411. $3=[(2), (0)]._asSet();
  5412. $ctx1.sendIdx["asSet"]=3;
  5413. $4=[(0), (2)]._asSet();
  5414. $ctx1.sendIdx["asSet"]=4;
  5415. self._assert_equals_($3,$4);
  5416. $6=[(0), (2), (3)]._asSet();
  5417. $ctx1.sendIdx["asSet"]=5;
  5418. $7=[(0), (2)]._asSet();
  5419. $ctx1.sendIdx["asSet"]=6;
  5420. $5=_st($6).__eq($7);
  5421. $ctx1.sendIdx["="]=1;
  5422. self._deny_($5);
  5423. $ctx1.sendIdx["deny:"]=1;
  5424. $9=[(1), (2)]._asSet();
  5425. $ctx1.sendIdx["asSet"]=7;
  5426. $8=_st($9).__eq([(0), (2)]._asSet());
  5427. self._deny_($8);
  5428. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5429. args: [],
  5430. 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",
  5431. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5432. referencedClasses: []
  5433. }),
  5434. smalltalk.SetTest);
  5435. smalltalk.addMethod(
  5436. smalltalk.method({
  5437. selector: "testPrintString",
  5438. protocol: 'tests',
  5439. fn: function (){
  5440. var self=this;
  5441. var set;
  5442. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5443. return smalltalk.withContext(function($ctx1) {
  5444. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5445. set=_st($Set())._new();
  5446. $1=_st(set)._printString();
  5447. $ctx1.sendIdx["printString"]=1;
  5448. self._assert_equals_($1,"a Set ()");
  5449. $ctx1.sendIdx["assert:equals:"]=1;
  5450. $2=set;
  5451. _st($2)._add_((1));
  5452. $ctx1.sendIdx["add:"]=1;
  5453. $3=_st($2)._add_((3));
  5454. $ctx1.sendIdx["add:"]=2;
  5455. $4=_st(set)._printString();
  5456. $ctx1.sendIdx["printString"]=2;
  5457. self._assert_equals_($4,"a Set (1 3)");
  5458. $ctx1.sendIdx["assert:equals:"]=2;
  5459. _st(set)._add_("foo");
  5460. $ctx1.sendIdx["add:"]=3;
  5461. $5=_st(set)._printString();
  5462. $ctx1.sendIdx["printString"]=3;
  5463. self._assert_equals_($5,"a Set (1 3 'foo')");
  5464. $ctx1.sendIdx["assert:equals:"]=3;
  5465. $6=set;
  5466. _st($6)._remove_((1));
  5467. $ctx1.sendIdx["remove:"]=1;
  5468. $7=_st($6)._remove_((3));
  5469. $8=_st(set)._printString();
  5470. $ctx1.sendIdx["printString"]=4;
  5471. self._assert_equals_($8,"a Set ('foo')");
  5472. $ctx1.sendIdx["assert:equals:"]=4;
  5473. _st(set)._add_((3));
  5474. $ctx1.sendIdx["add:"]=4;
  5475. $9=_st(set)._printString();
  5476. $ctx1.sendIdx["printString"]=5;
  5477. self._assert_equals_($9,"a Set (3 'foo')");
  5478. $ctx1.sendIdx["assert:equals:"]=5;
  5479. _st(set)._add_((3));
  5480. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5481. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5482. args: [],
  5483. 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'')'",
  5484. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5485. referencedClasses: ["Set"]
  5486. }),
  5487. smalltalk.SetTest);
  5488. smalltalk.addMethod(
  5489. smalltalk.method({
  5490. selector: "testUnboxedObjects",
  5491. protocol: 'tests',
  5492. fn: function (){
  5493. var self=this;
  5494. return smalltalk.withContext(function($ctx1) {
  5495. var $4,$3,$2,$1;
  5496. $4="foo"._yourself();
  5497. $ctx1.sendIdx["yourself"]=1;
  5498. $3=[$4,"foo"._yourself()];
  5499. $2=_st($3)._asSet();
  5500. $1=_st($2)._asArray();
  5501. self._assert_equals_($1,["foo"]);
  5502. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5503. args: [],
  5504. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5505. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5506. referencedClasses: []
  5507. }),
  5508. smalltalk.SetTest);
  5509. smalltalk.addMethod(
  5510. smalltalk.method({
  5511. selector: "testUnicity",
  5512. protocol: 'tests',
  5513. fn: function (){
  5514. var self=this;
  5515. var set;
  5516. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5517. return smalltalk.withContext(function($ctx1) {
  5518. var $1;
  5519. set=_st($Set())._new();
  5520. _st(set)._add_((21));
  5521. $ctx1.sendIdx["add:"]=1;
  5522. _st(set)._add_("hello");
  5523. $ctx1.sendIdx["add:"]=2;
  5524. _st(set)._add_((21));
  5525. $ctx1.sendIdx["add:"]=3;
  5526. $1=_st(set)._size();
  5527. $ctx1.sendIdx["size"]=1;
  5528. self._assert_equals_($1,(2));
  5529. $ctx1.sendIdx["assert:equals:"]=1;
  5530. _st(set)._add_("hello");
  5531. self._assert_equals_(_st(set)._size(),(2));
  5532. $ctx1.sendIdx["assert:equals:"]=2;
  5533. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5534. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5535. args: [],
  5536. 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')",
  5537. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5538. referencedClasses: ["Set"]
  5539. }),
  5540. smalltalk.SetTest);
  5541. smalltalk.addMethod(
  5542. smalltalk.method({
  5543. selector: "collectionClass",
  5544. protocol: 'fixture',
  5545. fn: function (){
  5546. var self=this;
  5547. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5548. return smalltalk.withContext(function($ctx1) {
  5549. return $Set();
  5550. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5551. args: [],
  5552. source: "collectionClass\x0a\x09^ Set",
  5553. messageSends: [],
  5554. referencedClasses: ["Set"]
  5555. }),
  5556. smalltalk.SetTest.klass);
  5557. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5558. smalltalk.addMethod(
  5559. smalltalk.method({
  5560. selector: "testShow",
  5561. protocol: 'tests',
  5562. fn: function (){
  5563. var self=this;
  5564. var originalTranscript;
  5565. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5566. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5567. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5568. return smalltalk.withContext(function($ctx1) {
  5569. originalTranscript=_st($Transcript())._current();
  5570. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5571. $ctx1.sendIdx["register:"]=1;
  5572. self._shouldnt_raise_((function(){
  5573. return smalltalk.withContext(function($ctx2) {
  5574. return _st($Transcript())._show_("Hello console!");
  5575. $ctx2.sendIdx["show:"]=1;
  5576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5577. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5578. self._shouldnt_raise_((function(){
  5579. return smalltalk.withContext(function($ctx2) {
  5580. return _st($Transcript())._show_(console);
  5581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5582. _st($Transcript())._register_(originalTranscript);
  5583. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5584. args: [],
  5585. 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.",
  5586. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5587. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5588. }),
  5589. smalltalk.ConsoleTranscriptTest);
  5590. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5591. smalltalk.addMethod(
  5592. smalltalk.method({
  5593. selector: "jsObject",
  5594. protocol: 'accessing',
  5595. fn: function (){
  5596. var self=this;
  5597. return smalltalk.withContext(function($ctx1) {
  5598. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5599. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5600. args: [],
  5601. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5602. messageSends: [],
  5603. referencedClasses: []
  5604. }),
  5605. smalltalk.JSObjectProxyTest);
  5606. smalltalk.addMethod(
  5607. smalltalk.method({
  5608. selector: "testAtIfAbsent",
  5609. protocol: 'tests',
  5610. fn: function (){
  5611. var self=this;
  5612. var testObject;
  5613. return smalltalk.withContext(function($ctx1) {
  5614. var $1,$2,$3;
  5615. testObject=self._jsObject();
  5616. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5617. return smalltalk.withContext(function($ctx2) {
  5618. return "Property does not exist";
  5619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5620. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5621. self._assert_equals_($1,"Property does not exist");
  5622. $ctx1.sendIdx["assert:equals:"]=1;
  5623. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5624. return smalltalk.withContext(function($ctx2) {
  5625. return "Property does not exist";
  5626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5627. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5628. self._assert_equals_($2,nil);
  5629. $ctx1.sendIdx["assert:equals:"]=2;
  5630. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5631. return smalltalk.withContext(function($ctx2) {
  5632. return "Property does not exist";
  5633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5634. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5635. self._assert_equals_($3,(1));
  5636. $ctx1.sendIdx["assert:equals:"]=3;
  5637. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5638. return smalltalk.withContext(function($ctx2) {
  5639. return "Property does not exist";
  5640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5641. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5642. args: [],
  5643. 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.",
  5644. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5645. referencedClasses: []
  5646. }),
  5647. smalltalk.JSObjectProxyTest);
  5648. smalltalk.addMethod(
  5649. smalltalk.method({
  5650. selector: "testAtIfPresent",
  5651. protocol: 'tests',
  5652. fn: function (){
  5653. var self=this;
  5654. var testObject;
  5655. return smalltalk.withContext(function($ctx1) {
  5656. var $2,$1,$4,$3,$6,$5;
  5657. testObject=self._jsObject();
  5658. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5659. return smalltalk.withContext(function($ctx2) {
  5660. $2=_st(x)._asString();
  5661. $ctx2.sendIdx["asString"]=1;
  5662. return "hello ".__comma($2);
  5663. $ctx2.sendIdx[","]=1;
  5664. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5665. $ctx1.sendIdx["at:ifPresent:"]=1;
  5666. self._assert_equals_($1,nil);
  5667. $ctx1.sendIdx["assert:equals:"]=1;
  5668. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5669. return smalltalk.withContext(function($ctx2) {
  5670. $4=_st(x)._asString();
  5671. $ctx2.sendIdx["asString"]=2;
  5672. return "hello ".__comma($4);
  5673. $ctx2.sendIdx[","]=2;
  5674. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5675. $ctx1.sendIdx["at:ifPresent:"]=2;
  5676. self._assert_equals_($3,"hello nil");
  5677. $ctx1.sendIdx["assert:equals:"]=2;
  5678. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5679. return smalltalk.withContext(function($ctx2) {
  5680. $6=_st(x)._asString();
  5681. $ctx2.sendIdx["asString"]=3;
  5682. return "hello ".__comma($6);
  5683. $ctx2.sendIdx[","]=3;
  5684. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5685. $ctx1.sendIdx["at:ifPresent:"]=3;
  5686. self._assert_equals_($5,"hello 1");
  5687. $ctx1.sendIdx["assert:equals:"]=3;
  5688. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5689. return smalltalk.withContext(function($ctx2) {
  5690. return "hello ".__comma(_st(x)._asString());
  5691. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5692. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5693. args: [],
  5694. 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'.",
  5695. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5696. referencedClasses: []
  5697. }),
  5698. smalltalk.JSObjectProxyTest);
  5699. smalltalk.addMethod(
  5700. smalltalk.method({
  5701. selector: "testAtIfPresentIfAbsent",
  5702. protocol: 'tests',
  5703. fn: function (){
  5704. var self=this;
  5705. var testObject;
  5706. return smalltalk.withContext(function($ctx1) {
  5707. var $2,$1,$4,$3,$6,$5;
  5708. testObject=self._jsObject();
  5709. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5710. return smalltalk.withContext(function($ctx2) {
  5711. $2=_st(x)._asString();
  5712. $ctx2.sendIdx["asString"]=1;
  5713. return "hello ".__comma($2);
  5714. $ctx2.sendIdx[","]=1;
  5715. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5716. return smalltalk.withContext(function($ctx2) {
  5717. return "not present";
  5718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5719. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5720. self._assert_equals_($1,"not present");
  5721. $ctx1.sendIdx["assert:equals:"]=1;
  5722. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5723. return smalltalk.withContext(function($ctx2) {
  5724. $4=_st(x)._asString();
  5725. $ctx2.sendIdx["asString"]=2;
  5726. return "hello ".__comma($4);
  5727. $ctx2.sendIdx[","]=2;
  5728. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5729. return smalltalk.withContext(function($ctx2) {
  5730. return "not present";
  5731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5732. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5733. self._assert_equals_($3,"hello nil");
  5734. $ctx1.sendIdx["assert:equals:"]=2;
  5735. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5736. return smalltalk.withContext(function($ctx2) {
  5737. $6=_st(x)._asString();
  5738. $ctx2.sendIdx["asString"]=3;
  5739. return "hello ".__comma($6);
  5740. $ctx2.sendIdx[","]=3;
  5741. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5742. return smalltalk.withContext(function($ctx2) {
  5743. return "not present";
  5744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5745. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5746. self._assert_equals_($5,"hello 1");
  5747. $ctx1.sendIdx["assert:equals:"]=3;
  5748. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5749. return smalltalk.withContext(function($ctx2) {
  5750. return "hello ".__comma(_st(x)._asString());
  5751. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5752. return smalltalk.withContext(function($ctx2) {
  5753. return "not present";
  5754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5755. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5756. args: [],
  5757. 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'.",
  5758. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5759. referencedClasses: []
  5760. }),
  5761. smalltalk.JSObjectProxyTest);
  5762. smalltalk.addMethod(
  5763. smalltalk.method({
  5764. selector: "testAtPut",
  5765. protocol: 'tests',
  5766. fn: function (){
  5767. var self=this;
  5768. var testObject;
  5769. return smalltalk.withContext(function($ctx1) {
  5770. var $2,$1;
  5771. testObject=self._jsObject();
  5772. $2=_st(testObject)._at_("abc");
  5773. $ctx1.sendIdx["at:"]=1;
  5774. $1=_st($2).__tild_eq("xyz");
  5775. self._assert_($1);
  5776. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5777. $ctx1.sendIdx["assert:equals:"]=1;
  5778. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5779. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5780. args: [],
  5781. 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'",
  5782. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5783. referencedClasses: []
  5784. }),
  5785. smalltalk.JSObjectProxyTest);
  5786. smalltalk.addMethod(
  5787. smalltalk.method({
  5788. selector: "testDNU",
  5789. protocol: 'tests',
  5790. fn: function (){
  5791. var self=this;
  5792. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5793. return smalltalk.withContext(function($ctx1) {
  5794. self._should_raise_((function(){
  5795. return smalltalk.withContext(function($ctx2) {
  5796. return _st(self._jsObject())._foo();
  5797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5798. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5799. args: [],
  5800. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5801. messageSends: ["should:raise:", "foo", "jsObject"],
  5802. referencedClasses: ["MessageNotUnderstood"]
  5803. }),
  5804. smalltalk.JSObjectProxyTest);
  5805. smalltalk.addMethod(
  5806. smalltalk.method({
  5807. selector: "testMessageSend",
  5808. protocol: 'tests',
  5809. fn: function (){
  5810. var self=this;
  5811. return smalltalk.withContext(function($ctx1) {
  5812. var $2,$1,$4,$3;
  5813. $2=self._jsObject();
  5814. $ctx1.sendIdx["jsObject"]=1;
  5815. $1=_st($2)._a();
  5816. self._assert_equals_($1,(1));
  5817. $ctx1.sendIdx["assert:equals:"]=1;
  5818. $4=self._jsObject();
  5819. $ctx1.sendIdx["jsObject"]=2;
  5820. $3=_st($4)._b();
  5821. self._assert_equals_($3,(2));
  5822. $ctx1.sendIdx["assert:equals:"]=2;
  5823. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5824. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5825. args: [],
  5826. 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",
  5827. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5828. referencedClasses: []
  5829. }),
  5830. smalltalk.JSObjectProxyTest);
  5831. smalltalk.addMethod(
  5832. smalltalk.method({
  5833. selector: "testMethodWithArguments",
  5834. protocol: 'tests',
  5835. fn: function (){
  5836. var self=this;
  5837. return smalltalk.withContext(function($ctx1) {
  5838. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5839. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5840. args: [],
  5841. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5842. messageSends: ["assert:equals:", "c:", "jsObject"],
  5843. referencedClasses: []
  5844. }),
  5845. smalltalk.JSObjectProxyTest);
  5846. smalltalk.addMethod(
  5847. smalltalk.method({
  5848. selector: "testPrinting",
  5849. protocol: 'tests',
  5850. fn: function (){
  5851. var self=this;
  5852. return smalltalk.withContext(function($ctx1) {
  5853. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5854. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5855. args: [],
  5856. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5857. messageSends: ["assert:equals:", "printString", "jsObject"],
  5858. referencedClasses: []
  5859. }),
  5860. smalltalk.JSObjectProxyTest);
  5861. smalltalk.addMethod(
  5862. smalltalk.method({
  5863. selector: "testPropertyThatReturnsEmptyString",
  5864. protocol: 'tests',
  5865. fn: function (){
  5866. var self=this;
  5867. var object;
  5868. return smalltalk.withContext(function($ctx1) {
  5869. var $1;
  5870. object=self._jsObject();
  5871. $1=_st(object)._d();
  5872. $ctx1.sendIdx["d"]=1;
  5873. self._assert_equals_($1,"");
  5874. $ctx1.sendIdx["assert:equals:"]=1;
  5875. _st(object)._d_("hello");
  5876. self._assert_equals_(_st(object)._d(),"hello");
  5877. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5878. args: [],
  5879. 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'",
  5880. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5881. referencedClasses: []
  5882. }),
  5883. smalltalk.JSObjectProxyTest);
  5884. smalltalk.addMethod(
  5885. smalltalk.method({
  5886. selector: "testPropertyThatReturnsUndefined",
  5887. protocol: 'tests',
  5888. fn: function (){
  5889. var self=this;
  5890. var object;
  5891. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5892. return smalltalk.withContext(function($ctx1) {
  5893. object=self._jsObject();
  5894. self._shouldnt_raise_((function(){
  5895. return smalltalk.withContext(function($ctx2) {
  5896. return _st(object)._e();
  5897. $ctx2.sendIdx["e"]=1;
  5898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5899. self._assert_(_st(_st(object)._e())._isNil());
  5900. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5901. args: [],
  5902. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5903. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5904. referencedClasses: ["MessageNotUnderstood"]
  5905. }),
  5906. smalltalk.JSObjectProxyTest);
  5907. smalltalk.addMethod(
  5908. smalltalk.method({
  5909. selector: "testValue",
  5910. protocol: 'tests',
  5911. fn: function (){
  5912. var self=this;
  5913. var testObject;
  5914. return smalltalk.withContext(function($ctx1) {
  5915. testObject=self._jsObject();
  5916. _st(testObject)._at_put_("value","aValue");
  5917. self._assert_equals_(_st(testObject)._value(),"aValue");
  5918. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5919. args: [],
  5920. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5921. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5922. referencedClasses: []
  5923. }),
  5924. smalltalk.JSObjectProxyTest);
  5925. smalltalk.addMethod(
  5926. smalltalk.method({
  5927. selector: "testYourself",
  5928. protocol: 'tests',
  5929. fn: function (){
  5930. var self=this;
  5931. var object;
  5932. return smalltalk.withContext(function($ctx1) {
  5933. var $1,$2;
  5934. $1=self._jsObject();
  5935. _st($1)._d_("test");
  5936. $2=_st($1)._yourself();
  5937. object=$2;
  5938. self._assert_equals_(_st(object)._d(),"test");
  5939. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5940. args: [],
  5941. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5942. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5943. referencedClasses: []
  5944. }),
  5945. smalltalk.JSObjectProxyTest);
  5946. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5947. smalltalk.addMethod(
  5948. smalltalk.method({
  5949. selector: "testCatchingException",
  5950. protocol: 'tests',
  5951. fn: function (){
  5952. var self=this;
  5953. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5954. return smalltalk.withContext(function($ctx1) {
  5955. _st((function(){
  5956. return smalltalk.withContext(function($ctx2) {
  5957. return self._throwException();
  5958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5959. return smalltalk.withContext(function($ctx2) {
  5960. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5961. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5962. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5963. args: [],
  5964. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5965. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5966. referencedClasses: ["Error"]
  5967. }),
  5968. smalltalk.JavaScriptExceptionTest);
  5969. smalltalk.addMethod(
  5970. smalltalk.method({
  5971. selector: "testRaisingException",
  5972. protocol: 'tests',
  5973. fn: function (){
  5974. var self=this;
  5975. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5976. return smalltalk.withContext(function($ctx1) {
  5977. self._should_raise_((function(){
  5978. return smalltalk.withContext(function($ctx2) {
  5979. return self._throwException();
  5980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5981. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5982. args: [],
  5983. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5984. messageSends: ["should:raise:", "throwException"],
  5985. referencedClasses: ["JavaScriptException"]
  5986. }),
  5987. smalltalk.JavaScriptExceptionTest);
  5988. smalltalk.addMethod(
  5989. smalltalk.method({
  5990. selector: "throwException",
  5991. protocol: 'helpers',
  5992. fn: function (){
  5993. var self=this;
  5994. return smalltalk.withContext(function($ctx1) {
  5995. throw 'test';
  5996. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5997. args: [],
  5998. source: "throwException\x0a\x09<throw 'test'>",
  5999. messageSends: [],
  6000. referencedClasses: []
  6001. }),
  6002. smalltalk.JavaScriptExceptionTest);
  6003. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6004. smalltalk.addMethod(
  6005. smalltalk.method({
  6006. selector: "testValue",
  6007. protocol: 'tests',
  6008. fn: function (){
  6009. var self=this;
  6010. var messageSend;
  6011. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6012. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6013. return smalltalk.withContext(function($ctx1) {
  6014. var $1,$2;
  6015. $1=_st($MessageSend())._new();
  6016. $ctx1.sendIdx["new"]=1;
  6017. _st($1)._receiver_(_st($Object())._new());
  6018. _st($1)._selector_("asString");
  6019. $2=_st($1)._yourself();
  6020. messageSend=$2;
  6021. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6022. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6023. args: [],
  6024. 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'",
  6025. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6026. referencedClasses: ["MessageSend", "Object"]
  6027. }),
  6028. smalltalk.MessageSendTest);
  6029. smalltalk.addMethod(
  6030. smalltalk.method({
  6031. selector: "testValueWithArguments",
  6032. protocol: 'tests',
  6033. fn: function (){
  6034. var self=this;
  6035. var messageSend;
  6036. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6037. return smalltalk.withContext(function($ctx1) {
  6038. var $1,$2;
  6039. $1=_st($MessageSend())._new();
  6040. _st($1)._receiver_((2));
  6041. _st($1)._selector_("+");
  6042. $2=_st($1)._yourself();
  6043. messageSend=$2;
  6044. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6045. $ctx1.sendIdx["assert:equals:"]=1;
  6046. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6047. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6048. args: [],
  6049. 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",
  6050. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6051. referencedClasses: ["MessageSend"]
  6052. }),
  6053. smalltalk.MessageSendTest);
  6054. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6055. smalltalk.addMethod(
  6056. smalltalk.method({
  6057. selector: "codeGeneratorClass",
  6058. protocol: 'accessing',
  6059. fn: function (){
  6060. var self=this;
  6061. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6062. return smalltalk.withContext(function($ctx1) {
  6063. return $CodeGenerator();
  6064. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  6065. args: [],
  6066. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6067. messageSends: [],
  6068. referencedClasses: ["CodeGenerator"]
  6069. }),
  6070. smalltalk.MethodInheritanceTest);
  6071. smalltalk.addMethod(
  6072. smalltalk.method({
  6073. selector: "compiler",
  6074. protocol: 'factory',
  6075. fn: function (){
  6076. var self=this;
  6077. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6078. return smalltalk.withContext(function($ctx1) {
  6079. var $2,$3,$1;
  6080. $2=_st($Compiler())._new();
  6081. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6082. $3=_st($2)._yourself();
  6083. $1=$3;
  6084. return $1;
  6085. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  6086. args: [],
  6087. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6088. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6089. referencedClasses: ["Compiler"]
  6090. }),
  6091. smalltalk.MethodInheritanceTest);
  6092. smalltalk.addMethod(
  6093. smalltalk.method({
  6094. selector: "deinstallBottom",
  6095. protocol: 'testing',
  6096. fn: function (){
  6097. var self=this;
  6098. return smalltalk.withContext(function($ctx1) {
  6099. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6100. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  6101. args: [],
  6102. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6103. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6104. referencedClasses: []
  6105. }),
  6106. smalltalk.MethodInheritanceTest);
  6107. smalltalk.addMethod(
  6108. smalltalk.method({
  6109. selector: "deinstallMiddle",
  6110. protocol: 'testing',
  6111. fn: function (){
  6112. var self=this;
  6113. return smalltalk.withContext(function($ctx1) {
  6114. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6115. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  6116. args: [],
  6117. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6118. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6119. referencedClasses: []
  6120. }),
  6121. smalltalk.MethodInheritanceTest);
  6122. smalltalk.addMethod(
  6123. smalltalk.method({
  6124. selector: "deinstallTop",
  6125. protocol: 'testing',
  6126. fn: function (){
  6127. var self=this;
  6128. return smalltalk.withContext(function($ctx1) {
  6129. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6130. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  6131. args: [],
  6132. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6133. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6134. referencedClasses: []
  6135. }),
  6136. smalltalk.MethodInheritanceTest);
  6137. smalltalk.addMethod(
  6138. smalltalk.method({
  6139. selector: "installBottom:",
  6140. protocol: 'testing',
  6141. fn: function (aString){
  6142. var self=this;
  6143. return smalltalk.withContext(function($ctx1) {
  6144. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6145. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6146. args: ["aString"],
  6147. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6148. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6149. referencedClasses: []
  6150. }),
  6151. smalltalk.MethodInheritanceTest);
  6152. smalltalk.addMethod(
  6153. smalltalk.method({
  6154. selector: "installMiddle:",
  6155. protocol: 'testing',
  6156. fn: function (aString){
  6157. var self=this;
  6158. return smalltalk.withContext(function($ctx1) {
  6159. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6160. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6161. args: ["aString"],
  6162. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6163. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6164. referencedClasses: []
  6165. }),
  6166. smalltalk.MethodInheritanceTest);
  6167. smalltalk.addMethod(
  6168. smalltalk.method({
  6169. selector: "installTop:",
  6170. protocol: 'testing',
  6171. fn: function (aString){
  6172. var self=this;
  6173. return smalltalk.withContext(function($ctx1) {
  6174. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6175. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6176. args: ["aString"],
  6177. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6178. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6179. referencedClasses: []
  6180. }),
  6181. smalltalk.MethodInheritanceTest);
  6182. smalltalk.addMethod(
  6183. smalltalk.method({
  6184. selector: "setUp",
  6185. protocol: 'initialization',
  6186. fn: function (){
  6187. var self=this;
  6188. return smalltalk.withContext(function($ctx1) {
  6189. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6190. $ctx1.sendIdx["new"]=1;
  6191. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6192. $ctx1.sendIdx["new"]=2;
  6193. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6194. self["@method"]=nil;
  6195. self["@performBlock"]=(function(){
  6196. return smalltalk.withContext(function($ctx2) {
  6197. return self._error_("performBlock not initialized");
  6198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6199. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  6200. args: [],
  6201. 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' ]",
  6202. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6203. referencedClasses: []
  6204. }),
  6205. smalltalk.MethodInheritanceTest);
  6206. smalltalk.addMethod(
  6207. smalltalk.method({
  6208. selector: "shouldMNU",
  6209. protocol: 'testing',
  6210. fn: function (){
  6211. var self=this;
  6212. return smalltalk.withContext(function($ctx1) {
  6213. self._shouldMNUTop();
  6214. self._shouldMNUMiddle();
  6215. self._shouldMNUBottom();
  6216. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6217. args: [],
  6218. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6219. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6220. referencedClasses: []
  6221. }),
  6222. smalltalk.MethodInheritanceTest);
  6223. smalltalk.addMethod(
  6224. smalltalk.method({
  6225. selector: "shouldMNUBottom",
  6226. protocol: 'testing',
  6227. fn: function (){
  6228. var self=this;
  6229. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6230. return smalltalk.withContext(function($ctx1) {
  6231. self._should_raise_((function(){
  6232. return smalltalk.withContext(function($ctx2) {
  6233. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6235. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6236. args: [],
  6237. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6238. messageSends: ["should:raise:", "value:"],
  6239. referencedClasses: ["MessageNotUnderstood"]
  6240. }),
  6241. smalltalk.MethodInheritanceTest);
  6242. smalltalk.addMethod(
  6243. smalltalk.method({
  6244. selector: "shouldMNUMiddle",
  6245. protocol: 'testing',
  6246. fn: function (){
  6247. var self=this;
  6248. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6249. return smalltalk.withContext(function($ctx1) {
  6250. self._should_raise_((function(){
  6251. return smalltalk.withContext(function($ctx2) {
  6252. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6254. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6255. args: [],
  6256. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6257. messageSends: ["should:raise:", "value:"],
  6258. referencedClasses: ["MessageNotUnderstood"]
  6259. }),
  6260. smalltalk.MethodInheritanceTest);
  6261. smalltalk.addMethod(
  6262. smalltalk.method({
  6263. selector: "shouldMNUTop",
  6264. protocol: 'testing',
  6265. fn: function (){
  6266. var self=this;
  6267. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6268. return smalltalk.withContext(function($ctx1) {
  6269. self._should_raise_((function(){
  6270. return smalltalk.withContext(function($ctx2) {
  6271. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6273. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6274. args: [],
  6275. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6276. messageSends: ["should:raise:", "value:"],
  6277. referencedClasses: ["MessageNotUnderstood"]
  6278. }),
  6279. smalltalk.MethodInheritanceTest);
  6280. smalltalk.addMethod(
  6281. smalltalk.method({
  6282. selector: "shouldReturn:",
  6283. protocol: 'testing',
  6284. fn: function (anObject){
  6285. var self=this;
  6286. var result;
  6287. return smalltalk.withContext(function($ctx1) {
  6288. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6289. $ctx1.sendIdx["value:"]=1;
  6290. self._assert_equals_(["top",anObject],["top",result]);
  6291. $ctx1.sendIdx["assert:equals:"]=1;
  6292. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6293. $ctx1.sendIdx["value:"]=2;
  6294. self._assert_equals_(["middle",anObject],["middle",result]);
  6295. $ctx1.sendIdx["assert:equals:"]=2;
  6296. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6297. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6298. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6299. args: ["anObject"],
  6300. 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 }",
  6301. messageSends: ["value:", "assert:equals:"],
  6302. referencedClasses: []
  6303. }),
  6304. smalltalk.MethodInheritanceTest);
  6305. smalltalk.addMethod(
  6306. smalltalk.method({
  6307. selector: "shouldReturn:and:and:",
  6308. protocol: 'testing',
  6309. fn: function (anObject,anObject2,anObject3){
  6310. var self=this;
  6311. var result;
  6312. return smalltalk.withContext(function($ctx1) {
  6313. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6314. $ctx1.sendIdx["value:"]=1;
  6315. self._assert_equals_(["top",anObject],["top",result]);
  6316. $ctx1.sendIdx["assert:equals:"]=1;
  6317. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6318. $ctx1.sendIdx["value:"]=2;
  6319. self._assert_equals_(["middle",anObject2],["middle",result]);
  6320. $ctx1.sendIdx["assert:equals:"]=2;
  6321. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6322. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6323. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6324. args: ["anObject", "anObject2", "anObject3"],
  6325. 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 }",
  6326. messageSends: ["value:", "assert:equals:"],
  6327. referencedClasses: []
  6328. }),
  6329. smalltalk.MethodInheritanceTest);
  6330. smalltalk.addMethod(
  6331. smalltalk.method({
  6332. selector: "targetClassBottom",
  6333. protocol: 'accessing',
  6334. fn: function (){
  6335. var self=this;
  6336. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6337. return smalltalk.withContext(function($ctx1) {
  6338. return $JavaScriptException();
  6339. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6340. args: [],
  6341. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6342. messageSends: [],
  6343. referencedClasses: ["JavaScriptException"]
  6344. }),
  6345. smalltalk.MethodInheritanceTest);
  6346. smalltalk.addMethod(
  6347. smalltalk.method({
  6348. selector: "targetClassMiddle",
  6349. protocol: 'accessing',
  6350. fn: function (){
  6351. var self=this;
  6352. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6353. return smalltalk.withContext(function($ctx1) {
  6354. return $Error();
  6355. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6356. args: [],
  6357. source: "targetClassMiddle\x0a\x09^ Error",
  6358. messageSends: [],
  6359. referencedClasses: ["Error"]
  6360. }),
  6361. smalltalk.MethodInheritanceTest);
  6362. smalltalk.addMethod(
  6363. smalltalk.method({
  6364. selector: "targetClassTop",
  6365. protocol: 'accessing',
  6366. fn: function (){
  6367. var self=this;
  6368. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6369. return smalltalk.withContext(function($ctx1) {
  6370. return $Object();
  6371. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6372. args: [],
  6373. source: "targetClassTop\x0a\x09^ Object",
  6374. messageSends: [],
  6375. referencedClasses: ["Object"]
  6376. }),
  6377. smalltalk.MethodInheritanceTest);
  6378. smalltalk.addMethod(
  6379. smalltalk.method({
  6380. selector: "tearDown",
  6381. protocol: 'initialization',
  6382. fn: function (){
  6383. var self=this;
  6384. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6385. return smalltalk.withContext(function($ctx1) {
  6386. _st((function(){
  6387. return smalltalk.withContext(function($ctx2) {
  6388. return self._deinstallTop();
  6389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6390. return smalltalk.withContext(function($ctx2) {
  6391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6392. $ctx1.sendIdx["on:do:"]=1;
  6393. _st((function(){
  6394. return smalltalk.withContext(function($ctx2) {
  6395. return self._deinstallMiddle();
  6396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6397. return smalltalk.withContext(function($ctx2) {
  6398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6399. $ctx1.sendIdx["on:do:"]=2;
  6400. _st((function(){
  6401. return smalltalk.withContext(function($ctx2) {
  6402. return self._deinstallBottom();
  6403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6404. return smalltalk.withContext(function($ctx2) {
  6405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6406. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6407. args: [],
  6408. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6409. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6410. referencedClasses: ["Error"]
  6411. }),
  6412. smalltalk.MethodInheritanceTest);
  6413. smalltalk.addMethod(
  6414. smalltalk.method({
  6415. selector: "testMNU11",
  6416. protocol: 'tests',
  6417. fn: function (){
  6418. var self=this;
  6419. return smalltalk.withContext(function($ctx1) {
  6420. self["@performBlock"]=(function(x){
  6421. return smalltalk.withContext(function($ctx2) {
  6422. return _st(x)._foo();
  6423. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6424. self._shouldMNU();
  6425. $ctx1.sendIdx["shouldMNU"]=1;
  6426. self._installTop_("foo ^ false");
  6427. $ctx1.sendIdx["installTop:"]=1;
  6428. self._installTop_("foo ^ true");
  6429. self._deinstallTop();
  6430. self._shouldMNU();
  6431. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6432. args: [],
  6433. 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",
  6434. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6435. referencedClasses: []
  6436. }),
  6437. smalltalk.MethodInheritanceTest);
  6438. smalltalk.addMethod(
  6439. smalltalk.method({
  6440. selector: "testMNU22",
  6441. protocol: 'tests',
  6442. fn: function (){
  6443. var self=this;
  6444. return smalltalk.withContext(function($ctx1) {
  6445. self["@performBlock"]=(function(x){
  6446. return smalltalk.withContext(function($ctx2) {
  6447. return _st(x)._foo();
  6448. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6449. self._shouldMNU();
  6450. $ctx1.sendIdx["shouldMNU"]=1;
  6451. self._installMiddle_("foo ^ false");
  6452. $ctx1.sendIdx["installMiddle:"]=1;
  6453. self._installMiddle_("foo ^ true");
  6454. self._deinstallMiddle();
  6455. self._shouldMNU();
  6456. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6457. args: [],
  6458. 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",
  6459. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6460. referencedClasses: []
  6461. }),
  6462. smalltalk.MethodInheritanceTest);
  6463. smalltalk.addMethod(
  6464. smalltalk.method({
  6465. selector: "testReturns1",
  6466. protocol: 'tests',
  6467. fn: function (){
  6468. var self=this;
  6469. return smalltalk.withContext(function($ctx1) {
  6470. self["@performBlock"]=(function(x){
  6471. return smalltalk.withContext(function($ctx2) {
  6472. return _st(x)._foo();
  6473. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6474. self._installTop_("foo ^ false");
  6475. $ctx1.sendIdx["installTop:"]=1;
  6476. self._shouldReturn_(false);
  6477. $ctx1.sendIdx["shouldReturn:"]=1;
  6478. self._installTop_("foo ^ true");
  6479. self._shouldReturn_(true);
  6480. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6481. args: [],
  6482. 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",
  6483. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6484. referencedClasses: []
  6485. }),
  6486. smalltalk.MethodInheritanceTest);
  6487. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6488. smalltalk.addMethod(
  6489. smalltalk.method({
  6490. selector: "testAbs",
  6491. protocol: 'tests',
  6492. fn: function (){
  6493. var self=this;
  6494. return smalltalk.withContext(function($ctx1) {
  6495. var $1;
  6496. $1=(4)._abs();
  6497. $ctx1.sendIdx["abs"]=1;
  6498. self._assert_equals_($1,(4));
  6499. $ctx1.sendIdx["assert:equals:"]=1;
  6500. self._assert_equals_((-4)._abs(),(4));
  6501. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6502. args: [],
  6503. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6504. messageSends: ["assert:equals:", "abs"],
  6505. referencedClasses: []
  6506. }),
  6507. smalltalk.NumberTest);
  6508. smalltalk.addMethod(
  6509. smalltalk.method({
  6510. selector: "testArithmetic",
  6511. protocol: 'tests',
  6512. fn: function (){
  6513. var self=this;
  6514. return smalltalk.withContext(function($ctx1) {
  6515. var $1,$2,$3,$5,$4;
  6516. $1=(1.5).__plus((1));
  6517. $ctx1.sendIdx["+"]=1;
  6518. self._assert_equals_($1,(2.5));
  6519. $ctx1.sendIdx["assert:equals:"]=1;
  6520. $2=(2).__minus((1));
  6521. $ctx1.sendIdx["-"]=1;
  6522. self._assert_equals_($2,(1));
  6523. $ctx1.sendIdx["assert:equals:"]=2;
  6524. self._assert_equals_((-2).__minus((1)),(-3));
  6525. $ctx1.sendIdx["assert:equals:"]=3;
  6526. self._assert_equals_((12).__slash((2)),(6));
  6527. $ctx1.sendIdx["assert:equals:"]=4;
  6528. $3=(3).__star((4));
  6529. $ctx1.sendIdx["*"]=1;
  6530. self._assert_equals_($3,(12));
  6531. $ctx1.sendIdx["assert:equals:"]=5;
  6532. self._assert_equals_((7).__slash_slash((2)),(3));
  6533. $ctx1.sendIdx["assert:equals:"]=6;
  6534. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6535. $ctx1.sendIdx["assert:equals:"]=7;
  6536. $5=(1).__plus((2));
  6537. $ctx1.sendIdx["+"]=2;
  6538. $4=_st($5).__star((3));
  6539. $ctx1.sendIdx["*"]=2;
  6540. self._assert_equals_($4,(9));
  6541. $ctx1.sendIdx["assert:equals:"]=8;
  6542. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6543. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6544. args: [],
  6545. 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",
  6546. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6547. referencedClasses: []
  6548. }),
  6549. smalltalk.NumberTest);
  6550. smalltalk.addMethod(
  6551. smalltalk.method({
  6552. selector: "testAsNumber",
  6553. protocol: 'tests',
  6554. fn: function (){
  6555. var self=this;
  6556. return smalltalk.withContext(function($ctx1) {
  6557. self._assert_equals_((3)._asNumber(),(3));
  6558. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6559. args: [],
  6560. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6561. messageSends: ["assert:equals:", "asNumber"],
  6562. referencedClasses: []
  6563. }),
  6564. smalltalk.NumberTest);
  6565. smalltalk.addMethod(
  6566. smalltalk.method({
  6567. selector: "testCeiling",
  6568. protocol: 'tests',
  6569. fn: function (){
  6570. var self=this;
  6571. return smalltalk.withContext(function($ctx1) {
  6572. var $1,$2;
  6573. $1=(1.2)._ceiling();
  6574. $ctx1.sendIdx["ceiling"]=1;
  6575. self._assert_equals_($1,(2));
  6576. $ctx1.sendIdx["assert:equals:"]=1;
  6577. $2=(-1.2)._ceiling();
  6578. $ctx1.sendIdx["ceiling"]=2;
  6579. self._assert_equals_($2,(-1));
  6580. $ctx1.sendIdx["assert:equals:"]=2;
  6581. self._assert_equals_((1)._ceiling(),(1));
  6582. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6583. args: [],
  6584. 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.",
  6585. messageSends: ["assert:equals:", "ceiling"],
  6586. referencedClasses: []
  6587. }),
  6588. smalltalk.NumberTest);
  6589. smalltalk.addMethod(
  6590. smalltalk.method({
  6591. selector: "testComparison",
  6592. protocol: 'tests',
  6593. fn: function (){
  6594. var self=this;
  6595. return smalltalk.withContext(function($ctx1) {
  6596. var $1,$2,$3,$4;
  6597. $1=(3).__gt((2));
  6598. $ctx1.sendIdx[">"]=1;
  6599. self._assert_($1);
  6600. $ctx1.sendIdx["assert:"]=1;
  6601. $2=(2).__lt((3));
  6602. $ctx1.sendIdx["<"]=1;
  6603. self._assert_($2);
  6604. $ctx1.sendIdx["assert:"]=2;
  6605. self._deny_((3).__lt((2)));
  6606. $ctx1.sendIdx["deny:"]=1;
  6607. self._deny_((2).__gt((3)));
  6608. $3=(3).__gt_eq((3));
  6609. $ctx1.sendIdx[">="]=1;
  6610. self._assert_($3);
  6611. $ctx1.sendIdx["assert:"]=3;
  6612. self._assert_((3.1).__gt_eq((3)));
  6613. $ctx1.sendIdx["assert:"]=4;
  6614. $4=(3).__lt_eq((3));
  6615. $ctx1.sendIdx["<="]=1;
  6616. self._assert_($4);
  6617. $ctx1.sendIdx["assert:"]=5;
  6618. self._assert_((3).__lt_eq((3.1)));
  6619. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6620. args: [],
  6621. 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",
  6622. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6623. referencedClasses: []
  6624. }),
  6625. smalltalk.NumberTest);
  6626. smalltalk.addMethod(
  6627. smalltalk.method({
  6628. selector: "testCopying",
  6629. protocol: 'tests',
  6630. fn: function (){
  6631. var self=this;
  6632. return smalltalk.withContext(function($ctx1) {
  6633. var $1;
  6634. $1=_st((1)._copy()).__eq_eq((1));
  6635. $ctx1.sendIdx["=="]=1;
  6636. self._assert_($1);
  6637. $ctx1.sendIdx["assert:"]=1;
  6638. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6639. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6640. args: [],
  6641. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6642. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6643. referencedClasses: []
  6644. }),
  6645. smalltalk.NumberTest);
  6646. smalltalk.addMethod(
  6647. smalltalk.method({
  6648. selector: "testEquality",
  6649. protocol: 'tests',
  6650. fn: function (){
  6651. var self=this;
  6652. return smalltalk.withContext(function($ctx1) {
  6653. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6654. $1=(1).__eq((1));
  6655. $ctx1.sendIdx["="]=1;
  6656. self._assert_($1);
  6657. $ctx1.sendIdx["assert:"]=1;
  6658. $2=(0).__eq((0));
  6659. $ctx1.sendIdx["="]=2;
  6660. self._assert_($2);
  6661. $ctx1.sendIdx["assert:"]=2;
  6662. $3=(1).__eq((0));
  6663. $ctx1.sendIdx["="]=3;
  6664. self._deny_($3);
  6665. $ctx1.sendIdx["deny:"]=1;
  6666. $5=(1)._yourself();
  6667. $ctx1.sendIdx["yourself"]=1;
  6668. $4=_st($5).__eq((1));
  6669. $ctx1.sendIdx["="]=4;
  6670. self._assert_($4);
  6671. $ctx1.sendIdx["assert:"]=3;
  6672. $7=(1)._yourself();
  6673. $ctx1.sendIdx["yourself"]=2;
  6674. $6=(1).__eq($7);
  6675. $ctx1.sendIdx["="]=5;
  6676. self._assert_($6);
  6677. $ctx1.sendIdx["assert:"]=4;
  6678. $9=(1)._yourself();
  6679. $ctx1.sendIdx["yourself"]=3;
  6680. $8=_st($9).__eq((1)._yourself());
  6681. $ctx1.sendIdx["="]=6;
  6682. self._assert_($8);
  6683. $10=(0).__eq(false);
  6684. $ctx1.sendIdx["="]=7;
  6685. self._deny_($10);
  6686. $ctx1.sendIdx["deny:"]=2;
  6687. $11=false.__eq((0));
  6688. $ctx1.sendIdx["="]=8;
  6689. self._deny_($11);
  6690. $ctx1.sendIdx["deny:"]=3;
  6691. $12="".__eq((0));
  6692. $ctx1.sendIdx["="]=9;
  6693. self._deny_($12);
  6694. $ctx1.sendIdx["deny:"]=4;
  6695. self._deny_((0).__eq(""));
  6696. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6697. args: [],
  6698. 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 = ''",
  6699. messageSends: ["assert:", "=", "deny:", "yourself"],
  6700. referencedClasses: []
  6701. }),
  6702. smalltalk.NumberTest);
  6703. smalltalk.addMethod(
  6704. smalltalk.method({
  6705. selector: "testFloor",
  6706. protocol: 'tests',
  6707. fn: function (){
  6708. var self=this;
  6709. return smalltalk.withContext(function($ctx1) {
  6710. var $1,$2;
  6711. $1=(1.2)._floor();
  6712. $ctx1.sendIdx["floor"]=1;
  6713. self._assert_equals_($1,(1));
  6714. $ctx1.sendIdx["assert:equals:"]=1;
  6715. $2=(-1.2)._floor();
  6716. $ctx1.sendIdx["floor"]=2;
  6717. self._assert_equals_($2,(-2));
  6718. $ctx1.sendIdx["assert:equals:"]=2;
  6719. self._assert_equals_((1)._floor(),(1));
  6720. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6721. args: [],
  6722. 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.",
  6723. messageSends: ["assert:equals:", "floor"],
  6724. referencedClasses: []
  6725. }),
  6726. smalltalk.NumberTest);
  6727. smalltalk.addMethod(
  6728. smalltalk.method({
  6729. selector: "testHexNumbers",
  6730. protocol: 'tests',
  6731. fn: function (){
  6732. var self=this;
  6733. return smalltalk.withContext(function($ctx1) {
  6734. var $1,$2,$3,$4,$5;
  6735. self._assert_equals_((9),(9));
  6736. $ctx1.sendIdx["assert:equals:"]=1;
  6737. $1=(10)._truncated();
  6738. $ctx1.sendIdx["truncated"]=1;
  6739. self._assert_equals_($1,(10));
  6740. $ctx1.sendIdx["assert:equals:"]=2;
  6741. $2=(11)._truncated();
  6742. $ctx1.sendIdx["truncated"]=2;
  6743. self._assert_equals_($2,(11));
  6744. $ctx1.sendIdx["assert:equals:"]=3;
  6745. $3=(12)._truncated();
  6746. $ctx1.sendIdx["truncated"]=3;
  6747. self._assert_equals_($3,(12));
  6748. $ctx1.sendIdx["assert:equals:"]=4;
  6749. $4=(13)._truncated();
  6750. $ctx1.sendIdx["truncated"]=4;
  6751. self._assert_equals_($4,(13));
  6752. $ctx1.sendIdx["assert:equals:"]=5;
  6753. $5=(14)._truncated();
  6754. $ctx1.sendIdx["truncated"]=5;
  6755. self._assert_equals_($5,(14));
  6756. $ctx1.sendIdx["assert:equals:"]=6;
  6757. self._assert_equals_((15)._truncated(),(15));
  6758. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6759. args: [],
  6760. 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",
  6761. messageSends: ["assert:equals:", "truncated"],
  6762. referencedClasses: []
  6763. }),
  6764. smalltalk.NumberTest);
  6765. smalltalk.addMethod(
  6766. smalltalk.method({
  6767. selector: "testIdentity",
  6768. protocol: 'tests',
  6769. fn: function (){
  6770. var self=this;
  6771. return smalltalk.withContext(function($ctx1) {
  6772. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6773. $1=(1).__eq_eq((1));
  6774. $ctx1.sendIdx["=="]=1;
  6775. self._assert_($1);
  6776. $ctx1.sendIdx["assert:"]=1;
  6777. $2=(0).__eq_eq((0));
  6778. $ctx1.sendIdx["=="]=2;
  6779. self._assert_($2);
  6780. $ctx1.sendIdx["assert:"]=2;
  6781. $3=(1).__eq_eq((0));
  6782. $ctx1.sendIdx["=="]=3;
  6783. self._deny_($3);
  6784. $ctx1.sendIdx["deny:"]=1;
  6785. $5=(1)._yourself();
  6786. $ctx1.sendIdx["yourself"]=1;
  6787. $4=_st($5).__eq_eq((1));
  6788. $ctx1.sendIdx["=="]=4;
  6789. self._assert_($4);
  6790. $ctx1.sendIdx["assert:"]=3;
  6791. $7=(1)._yourself();
  6792. $ctx1.sendIdx["yourself"]=2;
  6793. $6=(1).__eq_eq($7);
  6794. $ctx1.sendIdx["=="]=5;
  6795. self._assert_($6);
  6796. $ctx1.sendIdx["assert:"]=4;
  6797. $9=(1)._yourself();
  6798. $ctx1.sendIdx["yourself"]=3;
  6799. $8=_st($9).__eq_eq((1)._yourself());
  6800. $ctx1.sendIdx["=="]=6;
  6801. self._assert_($8);
  6802. self._deny_((1).__eq_eq((2)));
  6803. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6804. args: [],
  6805. 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",
  6806. messageSends: ["assert:", "==", "deny:", "yourself"],
  6807. referencedClasses: []
  6808. }),
  6809. smalltalk.NumberTest);
  6810. smalltalk.addMethod(
  6811. smalltalk.method({
  6812. selector: "testInvalidHexNumbers",
  6813. protocol: 'tests',
  6814. fn: function (){
  6815. var self=this;
  6816. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6817. return smalltalk.withContext(function($ctx1) {
  6818. self._should_raise_((function(){
  6819. return smalltalk.withContext(function($ctx2) {
  6820. return (16)._rG();
  6821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6822. $ctx1.sendIdx["should:raise:"]=1;
  6823. self._should_raise_((function(){
  6824. return smalltalk.withContext(function($ctx2) {
  6825. return (16)._rg();
  6826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6827. $ctx1.sendIdx["should:raise:"]=2;
  6828. self._should_raise_((function(){
  6829. return smalltalk.withContext(function($ctx2) {
  6830. return (16)._rH();
  6831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6832. $ctx1.sendIdx["should:raise:"]=3;
  6833. self._should_raise_((function(){
  6834. return smalltalk.withContext(function($ctx2) {
  6835. return (16)._rh();
  6836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6837. $ctx1.sendIdx["should:raise:"]=4;
  6838. self._should_raise_((function(){
  6839. return smalltalk.withContext(function($ctx2) {
  6840. return (16)._rI();
  6841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6842. $ctx1.sendIdx["should:raise:"]=5;
  6843. self._should_raise_((function(){
  6844. return smalltalk.withContext(function($ctx2) {
  6845. return (16)._ri();
  6846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6847. $ctx1.sendIdx["should:raise:"]=6;
  6848. self._should_raise_((function(){
  6849. return smalltalk.withContext(function($ctx2) {
  6850. return (16)._rJ();
  6851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6852. $ctx1.sendIdx["should:raise:"]=7;
  6853. self._should_raise_((function(){
  6854. return smalltalk.withContext(function($ctx2) {
  6855. return (16)._rj();
  6856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6857. $ctx1.sendIdx["should:raise:"]=8;
  6858. self._should_raise_((function(){
  6859. return smalltalk.withContext(function($ctx2) {
  6860. return (16)._rK();
  6861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6862. $ctx1.sendIdx["should:raise:"]=9;
  6863. self._should_raise_((function(){
  6864. return smalltalk.withContext(function($ctx2) {
  6865. return (16)._rk();
  6866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6867. $ctx1.sendIdx["should:raise:"]=10;
  6868. self._should_raise_((function(){
  6869. return smalltalk.withContext(function($ctx2) {
  6870. return (16)._rL();
  6871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6872. $ctx1.sendIdx["should:raise:"]=11;
  6873. self._should_raise_((function(){
  6874. return smalltalk.withContext(function($ctx2) {
  6875. return (16)._rl();
  6876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6877. $ctx1.sendIdx["should:raise:"]=12;
  6878. self._should_raise_((function(){
  6879. return smalltalk.withContext(function($ctx2) {
  6880. return (16)._rM();
  6881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6882. $ctx1.sendIdx["should:raise:"]=13;
  6883. self._should_raise_((function(){
  6884. return smalltalk.withContext(function($ctx2) {
  6885. return (16)._rm();
  6886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6887. $ctx1.sendIdx["should:raise:"]=14;
  6888. self._should_raise_((function(){
  6889. return smalltalk.withContext(function($ctx2) {
  6890. return (16)._rN();
  6891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6892. $ctx1.sendIdx["should:raise:"]=15;
  6893. self._should_raise_((function(){
  6894. return smalltalk.withContext(function($ctx2) {
  6895. return (16)._rn();
  6896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6897. $ctx1.sendIdx["should:raise:"]=16;
  6898. self._should_raise_((function(){
  6899. return smalltalk.withContext(function($ctx2) {
  6900. return (16)._rO();
  6901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6902. $ctx1.sendIdx["should:raise:"]=17;
  6903. self._should_raise_((function(){
  6904. return smalltalk.withContext(function($ctx2) {
  6905. return (16)._ro();
  6906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6907. $ctx1.sendIdx["should:raise:"]=18;
  6908. self._should_raise_((function(){
  6909. return smalltalk.withContext(function($ctx2) {
  6910. return (16)._rP();
  6911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6912. $ctx1.sendIdx["should:raise:"]=19;
  6913. self._should_raise_((function(){
  6914. return smalltalk.withContext(function($ctx2) {
  6915. return (16)._rp();
  6916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6917. $ctx1.sendIdx["should:raise:"]=20;
  6918. self._should_raise_((function(){
  6919. return smalltalk.withContext(function($ctx2) {
  6920. return (16)._rQ();
  6921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6922. $ctx1.sendIdx["should:raise:"]=21;
  6923. self._should_raise_((function(){
  6924. return smalltalk.withContext(function($ctx2) {
  6925. return (16)._rq();
  6926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6927. $ctx1.sendIdx["should:raise:"]=22;
  6928. self._should_raise_((function(){
  6929. return smalltalk.withContext(function($ctx2) {
  6930. return (16)._rR();
  6931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6932. $ctx1.sendIdx["should:raise:"]=23;
  6933. self._should_raise_((function(){
  6934. return smalltalk.withContext(function($ctx2) {
  6935. return (16)._rr();
  6936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6937. $ctx1.sendIdx["should:raise:"]=24;
  6938. self._should_raise_((function(){
  6939. return smalltalk.withContext(function($ctx2) {
  6940. return (16)._rS();
  6941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6942. $ctx1.sendIdx["should:raise:"]=25;
  6943. self._should_raise_((function(){
  6944. return smalltalk.withContext(function($ctx2) {
  6945. return (16)._rs();
  6946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6947. $ctx1.sendIdx["should:raise:"]=26;
  6948. self._should_raise_((function(){
  6949. return smalltalk.withContext(function($ctx2) {
  6950. return (16)._rT();
  6951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6952. $ctx1.sendIdx["should:raise:"]=27;
  6953. self._should_raise_((function(){
  6954. return smalltalk.withContext(function($ctx2) {
  6955. return (16)._rt();
  6956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6957. $ctx1.sendIdx["should:raise:"]=28;
  6958. self._should_raise_((function(){
  6959. return smalltalk.withContext(function($ctx2) {
  6960. return (16)._rU();
  6961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6962. $ctx1.sendIdx["should:raise:"]=29;
  6963. self._should_raise_((function(){
  6964. return smalltalk.withContext(function($ctx2) {
  6965. return (16)._ru();
  6966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6967. $ctx1.sendIdx["should:raise:"]=30;
  6968. self._should_raise_((function(){
  6969. return smalltalk.withContext(function($ctx2) {
  6970. return (16)._rV();
  6971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6972. $ctx1.sendIdx["should:raise:"]=31;
  6973. self._should_raise_((function(){
  6974. return smalltalk.withContext(function($ctx2) {
  6975. return (16)._rv();
  6976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6977. $ctx1.sendIdx["should:raise:"]=32;
  6978. self._should_raise_((function(){
  6979. return smalltalk.withContext(function($ctx2) {
  6980. return (16)._rW();
  6981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6982. $ctx1.sendIdx["should:raise:"]=33;
  6983. self._should_raise_((function(){
  6984. return smalltalk.withContext(function($ctx2) {
  6985. return (16)._rw();
  6986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6987. $ctx1.sendIdx["should:raise:"]=34;
  6988. self._should_raise_((function(){
  6989. return smalltalk.withContext(function($ctx2) {
  6990. return (16)._rX();
  6991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6992. $ctx1.sendIdx["should:raise:"]=35;
  6993. self._should_raise_((function(){
  6994. return smalltalk.withContext(function($ctx2) {
  6995. return (16)._rx();
  6996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6997. $ctx1.sendIdx["should:raise:"]=36;
  6998. self._should_raise_((function(){
  6999. return smalltalk.withContext(function($ctx2) {
  7000. return (16)._rY();
  7001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7002. $ctx1.sendIdx["should:raise:"]=37;
  7003. self._should_raise_((function(){
  7004. return smalltalk.withContext(function($ctx2) {
  7005. return (16)._ry();
  7006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7007. $ctx1.sendIdx["should:raise:"]=38;
  7008. self._should_raise_((function(){
  7009. return smalltalk.withContext(function($ctx2) {
  7010. return (16)._rZ();
  7011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7012. $ctx1.sendIdx["should:raise:"]=39;
  7013. self._should_raise_((function(){
  7014. return smalltalk.withContext(function($ctx2) {
  7015. return (16)._rz();
  7016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7017. $ctx1.sendIdx["should:raise:"]=40;
  7018. self._should_raise_((function(){
  7019. return smalltalk.withContext(function($ctx2) {
  7020. return (11259375)._Z();
  7021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7022. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  7023. args: [],
  7024. 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.",
  7025. 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"],
  7026. referencedClasses: ["MessageNotUnderstood"]
  7027. }),
  7028. smalltalk.NumberTest);
  7029. smalltalk.addMethod(
  7030. smalltalk.method({
  7031. selector: "testLog",
  7032. protocol: 'tests',
  7033. fn: function (){
  7034. var self=this;
  7035. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  7036. return smalltalk.withContext(function($ctx1) {
  7037. self._assert_equals_((10000)._log(),(4));
  7038. $ctx1.sendIdx["assert:equals:"]=1;
  7039. self._assert_equals_((512)._log_((2)),(9));
  7040. $ctx1.sendIdx["assert:equals:"]=2;
  7041. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7042. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  7043. args: [],
  7044. 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.",
  7045. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7046. referencedClasses: ["Number"]
  7047. }),
  7048. smalltalk.NumberTest);
  7049. smalltalk.addMethod(
  7050. smalltalk.method({
  7051. selector: "testMinMax",
  7052. protocol: 'tests',
  7053. fn: function (){
  7054. var self=this;
  7055. return smalltalk.withContext(function($ctx1) {
  7056. self._assert_equals_((2)._max_((5)),(5));
  7057. $ctx1.sendIdx["assert:equals:"]=1;
  7058. self._assert_equals_((2)._min_((5)),(2));
  7059. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  7060. args: [],
  7061. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7062. messageSends: ["assert:equals:", "max:", "min:"],
  7063. referencedClasses: []
  7064. }),
  7065. smalltalk.NumberTest);
  7066. smalltalk.addMethod(
  7067. smalltalk.method({
  7068. selector: "testNegated",
  7069. protocol: 'tests',
  7070. fn: function (){
  7071. var self=this;
  7072. return smalltalk.withContext(function($ctx1) {
  7073. var $1;
  7074. $1=(3)._negated();
  7075. $ctx1.sendIdx["negated"]=1;
  7076. self._assert_equals_($1,(-3));
  7077. $ctx1.sendIdx["assert:equals:"]=1;
  7078. self._assert_equals_((-3)._negated(),(3));
  7079. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  7080. args: [],
  7081. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7082. messageSends: ["assert:equals:", "negated"],
  7083. referencedClasses: []
  7084. }),
  7085. smalltalk.NumberTest);
  7086. smalltalk.addMethod(
  7087. smalltalk.method({
  7088. selector: "testPrintShowingDecimalPlaces",
  7089. protocol: 'tests',
  7090. fn: function (){
  7091. var self=this;
  7092. return smalltalk.withContext(function($ctx1) {
  7093. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7094. $1=(23)._printShowingDecimalPlaces_((2));
  7095. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7096. self._assert_equals_($1,"23.00");
  7097. $ctx1.sendIdx["assert:equals:"]=1;
  7098. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7099. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7100. self._assert_equals_($2,"23.57");
  7101. $ctx1.sendIdx["assert:equals:"]=2;
  7102. $4=(234.567)._negated();
  7103. $ctx1.sendIdx["negated"]=1;
  7104. $3=_st($4)._printShowingDecimalPlaces_((5));
  7105. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7106. self._assert_equals_($3,"-234.56700");
  7107. $ctx1.sendIdx["assert:equals:"]=3;
  7108. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7109. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7110. self._assert_equals_($5,"23");
  7111. $ctx1.sendIdx["assert:equals:"]=4;
  7112. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7113. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7114. self._assert_equals_($6,"24");
  7115. $ctx1.sendIdx["assert:equals:"]=5;
  7116. $8=(23.4567)._negated();
  7117. $ctx1.sendIdx["negated"]=2;
  7118. $7=_st($8)._printShowingDecimalPlaces_((0));
  7119. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7120. self._assert_equals_($7,"-23");
  7121. $ctx1.sendIdx["assert:equals:"]=6;
  7122. $10=(23.5567)._negated();
  7123. $ctx1.sendIdx["negated"]=3;
  7124. $9=_st($10)._printShowingDecimalPlaces_((0));
  7125. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7126. self._assert_equals_($9,"-24");
  7127. $ctx1.sendIdx["assert:equals:"]=7;
  7128. $11=(100000000)._printShowingDecimalPlaces_((1));
  7129. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7130. self._assert_equals_($11,"100000000.0");
  7131. $ctx1.sendIdx["assert:equals:"]=8;
  7132. $12=(0.98)._printShowingDecimalPlaces_((5));
  7133. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7134. self._assert_equals_($12,"0.98000");
  7135. $ctx1.sendIdx["assert:equals:"]=9;
  7136. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7137. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7138. self._assert_equals_($13,"-0.98");
  7139. $ctx1.sendIdx["assert:equals:"]=10;
  7140. $14=(2.567)._printShowingDecimalPlaces_((2));
  7141. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7142. self._assert_equals_($14,"2.57");
  7143. $ctx1.sendIdx["assert:equals:"]=11;
  7144. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7145. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7146. self._assert_equals_($15,"-2.57");
  7147. $ctx1.sendIdx["assert:equals:"]=12;
  7148. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7149. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  7150. args: [],
  7151. 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'.",
  7152. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7153. referencedClasses: []
  7154. }),
  7155. smalltalk.NumberTest);
  7156. smalltalk.addMethod(
  7157. smalltalk.method({
  7158. selector: "testRaisedTo",
  7159. protocol: 'tests',
  7160. fn: function (){
  7161. var self=this;
  7162. return smalltalk.withContext(function($ctx1) {
  7163. var $1,$2,$3;
  7164. $1=(2)._raisedTo_((4));
  7165. $ctx1.sendIdx["raisedTo:"]=1;
  7166. self._assert_equals_($1,(16));
  7167. $ctx1.sendIdx["assert:equals:"]=1;
  7168. $2=(2)._raisedTo_((0));
  7169. $ctx1.sendIdx["raisedTo:"]=2;
  7170. self._assert_equals_($2,(1));
  7171. $ctx1.sendIdx["assert:equals:"]=2;
  7172. $3=(2)._raisedTo_((-3));
  7173. $ctx1.sendIdx["raisedTo:"]=3;
  7174. self._assert_equals_($3,(0.125));
  7175. $ctx1.sendIdx["assert:equals:"]=3;
  7176. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7177. $ctx1.sendIdx["assert:equals:"]=4;
  7178. self._assert_equals_((2).__star_star((4)),(16));
  7179. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  7180. args: [],
  7181. 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.",
  7182. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7183. referencedClasses: []
  7184. }),
  7185. smalltalk.NumberTest);
  7186. smalltalk.addMethod(
  7187. smalltalk.method({
  7188. selector: "testRounded",
  7189. protocol: 'tests',
  7190. fn: function (){
  7191. var self=this;
  7192. return smalltalk.withContext(function($ctx1) {
  7193. var $1,$2;
  7194. $1=(3)._rounded();
  7195. $ctx1.sendIdx["rounded"]=1;
  7196. self._assert_equals_($1,(3));
  7197. $ctx1.sendIdx["assert:equals:"]=1;
  7198. $2=(3.212)._rounded();
  7199. $ctx1.sendIdx["rounded"]=2;
  7200. self._assert_equals_($2,(3));
  7201. $ctx1.sendIdx["assert:equals:"]=2;
  7202. self._assert_equals_((3.51)._rounded(),(4));
  7203. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  7204. args: [],
  7205. 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",
  7206. messageSends: ["assert:equals:", "rounded"],
  7207. referencedClasses: []
  7208. }),
  7209. smalltalk.NumberTest);
  7210. smalltalk.addMethod(
  7211. smalltalk.method({
  7212. selector: "testSign",
  7213. protocol: 'tests',
  7214. fn: function (){
  7215. var self=this;
  7216. return smalltalk.withContext(function($ctx1) {
  7217. var $1,$2;
  7218. $1=(5)._sign();
  7219. $ctx1.sendIdx["sign"]=1;
  7220. self._assert_equals_($1,(1));
  7221. $ctx1.sendIdx["assert:equals:"]=1;
  7222. $2=(0)._sign();
  7223. $ctx1.sendIdx["sign"]=2;
  7224. self._assert_equals_($2,(0));
  7225. $ctx1.sendIdx["assert:equals:"]=2;
  7226. self._assert_equals_((-1.4)._sign(),(-1));
  7227. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7228. args: [],
  7229. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7230. messageSends: ["assert:equals:", "sign"],
  7231. referencedClasses: []
  7232. }),
  7233. smalltalk.NumberTest);
  7234. smalltalk.addMethod(
  7235. smalltalk.method({
  7236. selector: "testSqrt",
  7237. protocol: 'tests',
  7238. fn: function (){
  7239. var self=this;
  7240. return smalltalk.withContext(function($ctx1) {
  7241. var $1;
  7242. $1=(4)._sqrt();
  7243. $ctx1.sendIdx["sqrt"]=1;
  7244. self._assert_equals_($1,(2));
  7245. $ctx1.sendIdx["assert:equals:"]=1;
  7246. self._assert_equals_((16)._sqrt(),(4));
  7247. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7248. args: [],
  7249. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7250. messageSends: ["assert:equals:", "sqrt"],
  7251. referencedClasses: []
  7252. }),
  7253. smalltalk.NumberTest);
  7254. smalltalk.addMethod(
  7255. smalltalk.method({
  7256. selector: "testSquared",
  7257. protocol: 'tests',
  7258. fn: function (){
  7259. var self=this;
  7260. return smalltalk.withContext(function($ctx1) {
  7261. self._assert_equals_((4)._squared(),(16));
  7262. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7263. args: [],
  7264. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7265. messageSends: ["assert:equals:", "squared"],
  7266. referencedClasses: []
  7267. }),
  7268. smalltalk.NumberTest);
  7269. smalltalk.addMethod(
  7270. smalltalk.method({
  7271. selector: "testTimesRepeat",
  7272. protocol: 'tests',
  7273. fn: function (){
  7274. var self=this;
  7275. var i;
  7276. return smalltalk.withContext(function($ctx1) {
  7277. i=(0);
  7278. (0)._timesRepeat_((function(){
  7279. return smalltalk.withContext(function($ctx2) {
  7280. i=_st(i).__plus((1));
  7281. $ctx2.sendIdx["+"]=1;
  7282. return i;
  7283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7284. $ctx1.sendIdx["timesRepeat:"]=1;
  7285. self._assert_equals_(i,(0));
  7286. $ctx1.sendIdx["assert:equals:"]=1;
  7287. (5)._timesRepeat_((function(){
  7288. return smalltalk.withContext(function($ctx2) {
  7289. i=_st(i).__plus((1));
  7290. return i;
  7291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7292. self._assert_equals_(i,(5));
  7293. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7294. args: [],
  7295. 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",
  7296. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7297. referencedClasses: []
  7298. }),
  7299. smalltalk.NumberTest);
  7300. smalltalk.addMethod(
  7301. smalltalk.method({
  7302. selector: "testTo",
  7303. protocol: 'tests',
  7304. fn: function (){
  7305. var self=this;
  7306. return smalltalk.withContext(function($ctx1) {
  7307. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7308. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7309. args: [],
  7310. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7311. messageSends: ["assert:equals:", "to:"],
  7312. referencedClasses: []
  7313. }),
  7314. smalltalk.NumberTest);
  7315. smalltalk.addMethod(
  7316. smalltalk.method({
  7317. selector: "testToBy",
  7318. protocol: 'tests',
  7319. fn: function (){
  7320. var self=this;
  7321. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7322. return smalltalk.withContext(function($ctx1) {
  7323. var $1;
  7324. $1=(0)._to_by_((6),(2));
  7325. $ctx1.sendIdx["to:by:"]=1;
  7326. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7327. self._should_raise_((function(){
  7328. return smalltalk.withContext(function($ctx2) {
  7329. return (1)._to_by_((4),(0));
  7330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7331. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7332. args: [],
  7333. 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",
  7334. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7335. referencedClasses: ["Error"]
  7336. }),
  7337. smalltalk.NumberTest);
  7338. smalltalk.addMethod(
  7339. smalltalk.method({
  7340. selector: "testTrigonometry",
  7341. protocol: 'tests',
  7342. fn: function (){
  7343. var self=this;
  7344. return smalltalk.withContext(function($ctx1) {
  7345. self._assert_equals_((0)._cos(),(1));
  7346. $ctx1.sendIdx["assert:equals:"]=1;
  7347. self._assert_equals_((0)._sin(),(0));
  7348. $ctx1.sendIdx["assert:equals:"]=2;
  7349. self._assert_equals_((0)._tan(),(0));
  7350. $ctx1.sendIdx["assert:equals:"]=3;
  7351. self._assert_equals_((1)._arcCos(),(0));
  7352. $ctx1.sendIdx["assert:equals:"]=4;
  7353. self._assert_equals_((0)._arcSin(),(0));
  7354. $ctx1.sendIdx["assert:equals:"]=5;
  7355. self._assert_equals_((0)._arcTan(),(0));
  7356. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7357. args: [],
  7358. 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.",
  7359. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7360. referencedClasses: []
  7361. }),
  7362. smalltalk.NumberTest);
  7363. smalltalk.addMethod(
  7364. smalltalk.method({
  7365. selector: "testTruncated",
  7366. protocol: 'tests',
  7367. fn: function (){
  7368. var self=this;
  7369. return smalltalk.withContext(function($ctx1) {
  7370. var $1,$2;
  7371. $1=(3)._truncated();
  7372. $ctx1.sendIdx["truncated"]=1;
  7373. self._assert_equals_($1,(3));
  7374. $ctx1.sendIdx["assert:equals:"]=1;
  7375. $2=(3.212)._truncated();
  7376. $ctx1.sendIdx["truncated"]=2;
  7377. self._assert_equals_($2,(3));
  7378. $ctx1.sendIdx["assert:equals:"]=2;
  7379. self._assert_equals_((3.51)._truncated(),(3));
  7380. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7381. args: [],
  7382. 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",
  7383. messageSends: ["assert:equals:", "truncated"],
  7384. referencedClasses: []
  7385. }),
  7386. smalltalk.NumberTest);
  7387. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7388. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7389. smalltalk.addMethod(
  7390. smalltalk.method({
  7391. selector: "foo",
  7392. protocol: 'not yet classified',
  7393. fn: function (){
  7394. var self=this;
  7395. return smalltalk.withContext(function($ctx1) {
  7396. var $1;
  7397. $1=self["@foo"];
  7398. return $1;
  7399. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7400. args: [],
  7401. source: "foo\x0a\x09^ foo",
  7402. messageSends: [],
  7403. referencedClasses: []
  7404. }),
  7405. smalltalk.ObjectMock);
  7406. smalltalk.addMethod(
  7407. smalltalk.method({
  7408. selector: "foo:",
  7409. protocol: 'not yet classified',
  7410. fn: function (anObject){
  7411. var self=this;
  7412. return smalltalk.withContext(function($ctx1) {
  7413. self["@foo"]=anObject;
  7414. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7415. args: ["anObject"],
  7416. source: "foo: anObject\x0a\x09foo := anObject",
  7417. messageSends: [],
  7418. referencedClasses: []
  7419. }),
  7420. smalltalk.ObjectMock);
  7421. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7422. smalltalk.addMethod(
  7423. smalltalk.method({
  7424. selector: "notDefined",
  7425. protocol: 'tests',
  7426. fn: function (){
  7427. var self=this;
  7428. return smalltalk.withContext(function($ctx1) {
  7429. return void 0;;
  7430. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7431. args: [],
  7432. source: "notDefined\x0a\x09<return void 0;>",
  7433. messageSends: [],
  7434. referencedClasses: []
  7435. }),
  7436. smalltalk.ObjectTest);
  7437. smalltalk.addMethod(
  7438. smalltalk.method({
  7439. selector: "testBasicAccess",
  7440. protocol: 'tests',
  7441. fn: function (){
  7442. var self=this;
  7443. var o;
  7444. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7445. return smalltalk.withContext(function($ctx1) {
  7446. var $1;
  7447. o=_st($Object())._new();
  7448. _st(o)._basicAt_put_("a",(1));
  7449. $1=_st(o)._basicAt_("a");
  7450. $ctx1.sendIdx["basicAt:"]=1;
  7451. self._assert_equals_($1,(1));
  7452. $ctx1.sendIdx["assert:equals:"]=1;
  7453. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7454. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7455. args: [],
  7456. 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",
  7457. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7458. referencedClasses: ["Object"]
  7459. }),
  7460. smalltalk.ObjectTest);
  7461. smalltalk.addMethod(
  7462. smalltalk.method({
  7463. selector: "testBasicPerform",
  7464. protocol: 'tests',
  7465. fn: function (){
  7466. var self=this;
  7467. var o;
  7468. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7469. return smalltalk.withContext(function($ctx1) {
  7470. o=_st($Object())._new();
  7471. _st(o)._basicAt_put_("func",(function(){
  7472. return smalltalk.withContext(function($ctx2) {
  7473. return "hello";
  7474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7475. $ctx1.sendIdx["basicAt:put:"]=1;
  7476. _st(o)._basicAt_put_("func2",(function(a){
  7477. return smalltalk.withContext(function($ctx2) {
  7478. return _st(a).__plus((1));
  7479. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7480. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7481. $ctx1.sendIdx["assert:equals:"]=1;
  7482. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7483. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7484. args: [],
  7485. 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",
  7486. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7487. referencedClasses: ["Object"]
  7488. }),
  7489. smalltalk.ObjectTest);
  7490. smalltalk.addMethod(
  7491. smalltalk.method({
  7492. selector: "testDNU",
  7493. protocol: 'tests',
  7494. fn: function (){
  7495. var self=this;
  7496. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7497. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7498. return smalltalk.withContext(function($ctx1) {
  7499. self._should_raise_((function(){
  7500. return smalltalk.withContext(function($ctx2) {
  7501. return _st(_st($Object())._new())._foo();
  7502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7503. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7504. args: [],
  7505. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7506. messageSends: ["should:raise:", "foo", "new"],
  7507. referencedClasses: ["Object", "MessageNotUnderstood"]
  7508. }),
  7509. smalltalk.ObjectTest);
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "testEquality",
  7513. protocol: 'tests',
  7514. fn: function (){
  7515. var self=this;
  7516. var o;
  7517. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7518. return smalltalk.withContext(function($ctx1) {
  7519. var $1,$2,$4,$3;
  7520. o=_st($Object())._new();
  7521. $ctx1.sendIdx["new"]=1;
  7522. $1=_st(o).__eq(_st($Object())._new());
  7523. $ctx1.sendIdx["="]=1;
  7524. self._deny_($1);
  7525. $2=_st(o).__eq(o);
  7526. $ctx1.sendIdx["="]=2;
  7527. self._assert_($2);
  7528. $ctx1.sendIdx["assert:"]=1;
  7529. $4=_st(o)._yourself();
  7530. $ctx1.sendIdx["yourself"]=1;
  7531. $3=_st($4).__eq(o);
  7532. $ctx1.sendIdx["="]=3;
  7533. self._assert_($3);
  7534. $ctx1.sendIdx["assert:"]=2;
  7535. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7536. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7537. args: [],
  7538. 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)",
  7539. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7540. referencedClasses: ["Object"]
  7541. }),
  7542. smalltalk.ObjectTest);
  7543. smalltalk.addMethod(
  7544. smalltalk.method({
  7545. selector: "testHalt",
  7546. protocol: 'tests',
  7547. fn: function (){
  7548. var self=this;
  7549. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7550. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7551. return smalltalk.withContext(function($ctx1) {
  7552. self._should_raise_((function(){
  7553. return smalltalk.withContext(function($ctx2) {
  7554. return _st(_st($Object())._new())._halt();
  7555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7556. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7557. args: [],
  7558. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7559. messageSends: ["should:raise:", "halt", "new"],
  7560. referencedClasses: ["Object", "Error"]
  7561. }),
  7562. smalltalk.ObjectTest);
  7563. smalltalk.addMethod(
  7564. smalltalk.method({
  7565. selector: "testIdentity",
  7566. protocol: 'tests',
  7567. fn: function (){
  7568. var self=this;
  7569. var o;
  7570. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7571. return smalltalk.withContext(function($ctx1) {
  7572. var $1,$2,$4,$3;
  7573. o=_st($Object())._new();
  7574. $ctx1.sendIdx["new"]=1;
  7575. $1=_st(o).__eq_eq(_st($Object())._new());
  7576. $ctx1.sendIdx["=="]=1;
  7577. self._deny_($1);
  7578. $2=_st(o).__eq_eq(o);
  7579. $ctx1.sendIdx["=="]=2;
  7580. self._assert_($2);
  7581. $ctx1.sendIdx["assert:"]=1;
  7582. $4=_st(o)._yourself();
  7583. $ctx1.sendIdx["yourself"]=1;
  7584. $3=_st($4).__eq_eq(o);
  7585. $ctx1.sendIdx["=="]=3;
  7586. self._assert_($3);
  7587. $ctx1.sendIdx["assert:"]=2;
  7588. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7589. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7590. args: [],
  7591. 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",
  7592. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7593. referencedClasses: ["Object"]
  7594. }),
  7595. smalltalk.ObjectTest);
  7596. smalltalk.addMethod(
  7597. smalltalk.method({
  7598. selector: "testIfNil",
  7599. protocol: 'tests',
  7600. fn: function (){
  7601. var self=this;
  7602. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7603. return smalltalk.withContext(function($ctx1) {
  7604. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7605. $2=_st($Object())._new();
  7606. $ctx1.sendIdx["new"]=1;
  7607. $1=_st($2)._isNil();
  7608. self._deny_($1);
  7609. $ctx1.sendIdx["deny:"]=1;
  7610. $5=_st($Object())._new();
  7611. $ctx1.sendIdx["new"]=2;
  7612. if(($receiver = $5) == nil || $receiver == null){
  7613. $4=true;
  7614. } else {
  7615. $4=$5;
  7616. };
  7617. $3=_st($4).__eq(true);
  7618. self._deny_($3);
  7619. $7=_st($Object())._new();
  7620. $ctx1.sendIdx["new"]=3;
  7621. if(($receiver = $7) == nil || $receiver == null){
  7622. $6=$7;
  7623. } else {
  7624. $6=true;
  7625. };
  7626. self._assert_equals_($6,true);
  7627. $ctx1.sendIdx["assert:equals:"]=1;
  7628. $9=_st($Object())._new();
  7629. $ctx1.sendIdx["new"]=4;
  7630. if(($receiver = $9) == nil || $receiver == null){
  7631. $8=false;
  7632. } else {
  7633. $8=true;
  7634. };
  7635. self._assert_equals_($8,true);
  7636. $ctx1.sendIdx["assert:equals:"]=2;
  7637. $11=_st($Object())._new();
  7638. if(($receiver = $11) == nil || $receiver == null){
  7639. $10=false;
  7640. } else {
  7641. $10=true;
  7642. };
  7643. self._assert_equals_($10,true);
  7644. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7645. args: [],
  7646. 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",
  7647. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7648. referencedClasses: ["Object"]
  7649. }),
  7650. smalltalk.ObjectTest);
  7651. smalltalk.addMethod(
  7652. smalltalk.method({
  7653. selector: "testInstVars",
  7654. protocol: 'tests',
  7655. fn: function (){
  7656. var self=this;
  7657. var o;
  7658. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7659. return smalltalk.withContext(function($ctx1) {
  7660. var $1,$2;
  7661. o=_st($ObjectMock())._new();
  7662. $1=_st(o)._instVarAt_("foo");
  7663. $ctx1.sendIdx["instVarAt:"]=1;
  7664. self._assert_equals_($1,nil);
  7665. $ctx1.sendIdx["assert:equals:"]=1;
  7666. _st(o)._instVarAt_put_("foo",(1));
  7667. $2=_st(o)._instVarAt_("foo");
  7668. $ctx1.sendIdx["instVarAt:"]=2;
  7669. self._assert_equals_($2,(1));
  7670. $ctx1.sendIdx["assert:equals:"]=2;
  7671. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7672. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7673. args: [],
  7674. 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",
  7675. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7676. referencedClasses: ["ObjectMock"]
  7677. }),
  7678. smalltalk.ObjectTest);
  7679. smalltalk.addMethod(
  7680. smalltalk.method({
  7681. selector: "testNilUndefined",
  7682. protocol: 'tests',
  7683. fn: function (){
  7684. var self=this;
  7685. return smalltalk.withContext(function($ctx1) {
  7686. self._assert_equals_(self._notDefined(),nil);
  7687. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7688. args: [],
  7689. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7690. messageSends: ["assert:equals:", "notDefined"],
  7691. referencedClasses: []
  7692. }),
  7693. smalltalk.ObjectTest);
  7694. smalltalk.addMethod(
  7695. smalltalk.method({
  7696. selector: "testYourself",
  7697. protocol: 'tests',
  7698. fn: function (){
  7699. var self=this;
  7700. var o;
  7701. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7702. return smalltalk.withContext(function($ctx1) {
  7703. o=_st($ObjectMock())._new();
  7704. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7705. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7706. args: [],
  7707. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7708. messageSends: ["new", "assert:", "==", "yourself"],
  7709. referencedClasses: ["ObjectMock"]
  7710. }),
  7711. smalltalk.ObjectTest);
  7712. smalltalk.addMethod(
  7713. smalltalk.method({
  7714. selector: "testidentityHash",
  7715. protocol: 'tests',
  7716. fn: function (){
  7717. var self=this;
  7718. var o1,o2;
  7719. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7720. return smalltalk.withContext(function($ctx1) {
  7721. var $2,$3,$1,$5,$4;
  7722. o1=_st($Object())._new();
  7723. $ctx1.sendIdx["new"]=1;
  7724. o2=_st($Object())._new();
  7725. $2=_st(o1)._identityHash();
  7726. $ctx1.sendIdx["identityHash"]=1;
  7727. $3=_st(o1)._identityHash();
  7728. $ctx1.sendIdx["identityHash"]=2;
  7729. $1=_st($2).__eq_eq($3);
  7730. $ctx1.sendIdx["=="]=1;
  7731. self._assert_($1);
  7732. $5=_st(o1)._identityHash();
  7733. $ctx1.sendIdx["identityHash"]=3;
  7734. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7735. self._deny_($4);
  7736. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7737. args: [],
  7738. 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",
  7739. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7740. referencedClasses: ["Object"]
  7741. }),
  7742. smalltalk.ObjectTest);
  7743. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7744. smalltalk.addMethod(
  7745. smalltalk.method({
  7746. selector: "testAccessing",
  7747. protocol: 'tests',
  7748. fn: function (){
  7749. var self=this;
  7750. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7751. return smalltalk.withContext(function($ctx1) {
  7752. var $2,$1,$3,$6,$5,$4;
  7753. $2=_st($Point())._x_y_((3),(4));
  7754. $ctx1.sendIdx["x:y:"]=1;
  7755. $1=_st($2)._x();
  7756. $ctx1.sendIdx["x"]=1;
  7757. self._assert_equals_($1,(3));
  7758. $ctx1.sendIdx["assert:equals:"]=1;
  7759. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7760. $ctx1.sendIdx["y"]=1;
  7761. self._assert_equals_($3,(4));
  7762. $ctx1.sendIdx["assert:equals:"]=2;
  7763. $6=_st($Point())._new();
  7764. $ctx1.sendIdx["new"]=1;
  7765. $5=_st($6)._x_((3));
  7766. $4=_st($5)._x();
  7767. self._assert_equals_($4,(3));
  7768. $ctx1.sendIdx["assert:equals:"]=3;
  7769. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7770. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7771. args: [],
  7772. 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",
  7773. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7774. referencedClasses: ["Point"]
  7775. }),
  7776. smalltalk.PointTest);
  7777. smalltalk.addMethod(
  7778. smalltalk.method({
  7779. selector: "testArithmetic",
  7780. protocol: 'tests',
  7781. fn: function (){
  7782. var self=this;
  7783. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7784. return smalltalk.withContext(function($ctx1) {
  7785. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7786. $2=(3).__at((4));
  7787. $ctx1.sendIdx["@"]=1;
  7788. $3=(3).__at((4));
  7789. $ctx1.sendIdx["@"]=2;
  7790. $1=_st($2).__star($3);
  7791. $4=_st($Point())._x_y_((9),(16));
  7792. $ctx1.sendIdx["x:y:"]=1;
  7793. self._assert_equals_($1,$4);
  7794. $ctx1.sendIdx["assert:equals:"]=1;
  7795. $6=(3).__at((4));
  7796. $ctx1.sendIdx["@"]=3;
  7797. $7=(3).__at((4));
  7798. $ctx1.sendIdx["@"]=4;
  7799. $5=_st($6).__plus($7);
  7800. $8=_st($Point())._x_y_((6),(8));
  7801. $ctx1.sendIdx["x:y:"]=2;
  7802. self._assert_equals_($5,$8);
  7803. $ctx1.sendIdx["assert:equals:"]=2;
  7804. $10=(3).__at((4));
  7805. $ctx1.sendIdx["@"]=5;
  7806. $11=(3).__at((4));
  7807. $ctx1.sendIdx["@"]=6;
  7808. $9=_st($10).__minus($11);
  7809. $12=_st($Point())._x_y_((0),(0));
  7810. $ctx1.sendIdx["x:y:"]=3;
  7811. self._assert_equals_($9,$12);
  7812. $ctx1.sendIdx["assert:equals:"]=3;
  7813. $14=(6).__at((8));
  7814. $ctx1.sendIdx["@"]=7;
  7815. $13=_st($14).__slash((3).__at((4)));
  7816. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7817. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7818. args: [],
  7819. 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)",
  7820. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7821. referencedClasses: ["Point"]
  7822. }),
  7823. smalltalk.PointTest);
  7824. smalltalk.addMethod(
  7825. smalltalk.method({
  7826. selector: "testAt",
  7827. protocol: 'tests',
  7828. fn: function (){
  7829. var self=this;
  7830. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7831. return smalltalk.withContext(function($ctx1) {
  7832. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7833. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7834. args: [],
  7835. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7836. messageSends: ["assert:equals:", "@", "x:y:"],
  7837. referencedClasses: ["Point"]
  7838. }),
  7839. smalltalk.PointTest);
  7840. smalltalk.addMethod(
  7841. smalltalk.method({
  7842. selector: "testEgality",
  7843. protocol: 'tests',
  7844. fn: function (){
  7845. var self=this;
  7846. return smalltalk.withContext(function($ctx1) {
  7847. var $2,$3,$1,$5,$4;
  7848. $2=(3).__at((4));
  7849. $ctx1.sendIdx["@"]=1;
  7850. $3=(3).__at((4));
  7851. $ctx1.sendIdx["@"]=2;
  7852. $1=_st($2).__eq($3);
  7853. $ctx1.sendIdx["="]=1;
  7854. self._assert_($1);
  7855. $5=(3).__at((5));
  7856. $ctx1.sendIdx["@"]=3;
  7857. $4=_st($5).__eq((3).__at((6)));
  7858. self._deny_($4);
  7859. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7860. args: [],
  7861. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7862. messageSends: ["assert:", "=", "@", "deny:"],
  7863. referencedClasses: []
  7864. }),
  7865. smalltalk.PointTest);
  7866. smalltalk.addMethod(
  7867. smalltalk.method({
  7868. selector: "testNew",
  7869. protocol: 'tests',
  7870. fn: function (){
  7871. var self=this;
  7872. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7873. return smalltalk.withContext(function($ctx1) {
  7874. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7875. $3=_st($Point())._new();
  7876. $ctx1.sendIdx["new"]=1;
  7877. $2=_st($3)._x_((3));
  7878. $ctx1.sendIdx["x:"]=1;
  7879. $1=_st($2)._y();
  7880. $ctx1.sendIdx["y"]=1;
  7881. self._assert_equals_($1,nil);
  7882. $ctx1.sendIdx["assert:equals:"]=1;
  7883. $7=_st($Point())._new();
  7884. $ctx1.sendIdx["new"]=2;
  7885. $6=_st($7)._x_((3));
  7886. $5=_st($6)._x();
  7887. $ctx1.sendIdx["x"]=1;
  7888. $4=_st($5).__eq((0));
  7889. $ctx1.sendIdx["="]=1;
  7890. self._deny_($4);
  7891. $ctx1.sendIdx["deny:"]=1;
  7892. $10=_st($Point())._new();
  7893. $ctx1.sendIdx["new"]=3;
  7894. $9=_st($10)._y_((4));
  7895. $ctx1.sendIdx["y:"]=1;
  7896. $8=_st($9)._x();
  7897. self._assert_equals_($8,nil);
  7898. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7899. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7900. args: [],
  7901. 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",
  7902. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7903. referencedClasses: ["Point"]
  7904. }),
  7905. smalltalk.PointTest);
  7906. smalltalk.addMethod(
  7907. smalltalk.method({
  7908. selector: "testTranslateBy",
  7909. protocol: 'tests',
  7910. fn: function (){
  7911. var self=this;
  7912. return smalltalk.withContext(function($ctx1) {
  7913. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7914. $2=(3).__at((3));
  7915. $ctx1.sendIdx["@"]=1;
  7916. $3=(0).__at((1));
  7917. $ctx1.sendIdx["@"]=2;
  7918. $1=_st($2)._translateBy_($3);
  7919. $ctx1.sendIdx["translateBy:"]=1;
  7920. $4=(3).__at((4));
  7921. $ctx1.sendIdx["@"]=3;
  7922. self._assert_equals_($1,$4);
  7923. $ctx1.sendIdx["assert:equals:"]=1;
  7924. $6=(3).__at((3));
  7925. $ctx1.sendIdx["@"]=4;
  7926. $8=(1)._negated();
  7927. $ctx1.sendIdx["negated"]=1;
  7928. $7=(0).__at($8);
  7929. $ctx1.sendIdx["@"]=5;
  7930. $5=_st($6)._translateBy_($7);
  7931. $ctx1.sendIdx["translateBy:"]=2;
  7932. $9=(3).__at((2));
  7933. $ctx1.sendIdx["@"]=6;
  7934. self._assert_equals_($5,$9);
  7935. $ctx1.sendIdx["assert:equals:"]=2;
  7936. $11=(3).__at((3));
  7937. $ctx1.sendIdx["@"]=7;
  7938. $12=(2).__at((3));
  7939. $ctx1.sendIdx["@"]=8;
  7940. $10=_st($11)._translateBy_($12);
  7941. $ctx1.sendIdx["translateBy:"]=3;
  7942. $13=(5).__at((6));
  7943. $ctx1.sendIdx["@"]=9;
  7944. self._assert_equals_($10,$13);
  7945. $ctx1.sendIdx["assert:equals:"]=3;
  7946. $15=(3).__at((3));
  7947. $ctx1.sendIdx["@"]=10;
  7948. $16=_st((3)._negated()).__at((0));
  7949. $ctx1.sendIdx["@"]=11;
  7950. $14=_st($15)._translateBy_($16);
  7951. self._assert_equals_($14,(0).__at((3)));
  7952. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7953. args: [],
  7954. 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.",
  7955. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7956. referencedClasses: []
  7957. }),
  7958. smalltalk.PointTest);
  7959. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7960. smalltalk.addMethod(
  7961. smalltalk.method({
  7962. selector: "testNextIfAbsent",
  7963. protocol: 'tests',
  7964. fn: function (){
  7965. var self=this;
  7966. var queue;
  7967. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7968. return smalltalk.withContext(function($ctx1) {
  7969. var $2,$1;
  7970. queue=_st($Queue())._new();
  7971. _st(queue)._nextPut_("index1");
  7972. $2=_st(queue)._nextIfAbsent_("empty");
  7973. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7974. $1=_st($2).__eq("index1");
  7975. $ctx1.sendIdx["="]=1;
  7976. self._assert_($1);
  7977. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7978. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7979. args: [],
  7980. 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'",
  7981. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7982. referencedClasses: ["Queue"]
  7983. }),
  7984. smalltalk.QueueTest);
  7985. smalltalk.addMethod(
  7986. smalltalk.method({
  7987. selector: "testQueueNext",
  7988. protocol: 'tests',
  7989. fn: function (){
  7990. var self=this;
  7991. var queue;
  7992. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7993. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7994. return smalltalk.withContext(function($ctx1) {
  7995. var $1,$2,$4,$3,$6,$5;
  7996. queue=_st($Queue())._new();
  7997. $1=queue;
  7998. _st($1)._nextPut_("index1");
  7999. $ctx1.sendIdx["nextPut:"]=1;
  8000. $2=_st($1)._nextPut_("index2");
  8001. $4=_st(queue)._next();
  8002. $ctx1.sendIdx["next"]=1;
  8003. $3=_st($4).__eq("index1");
  8004. $ctx1.sendIdx["="]=1;
  8005. self._assert_($3);
  8006. $6=_st(queue)._next();
  8007. $ctx1.sendIdx["next"]=2;
  8008. $5=_st($6).__eq("index");
  8009. self._deny_($5);
  8010. self._should_raise_((function(){
  8011. return smalltalk.withContext(function($ctx2) {
  8012. return _st(queue)._next();
  8013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8014. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  8015. args: [],
  8016. 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",
  8017. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8018. referencedClasses: ["Queue", "Error"]
  8019. }),
  8020. smalltalk.QueueTest);
  8021. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8022. smalltalk.addMethod(
  8023. smalltalk.method({
  8024. selector: "testAtRandomNumber",
  8025. protocol: 'tests',
  8026. fn: function (){
  8027. var self=this;
  8028. var val;
  8029. return smalltalk.withContext(function($ctx1) {
  8030. (100)._timesRepeat_((function(){
  8031. return smalltalk.withContext(function($ctx2) {
  8032. val=(10)._atRandom();
  8033. val;
  8034. self._assert_(_st(val).__gt((0)));
  8035. $ctx2.sendIdx["assert:"]=1;
  8036. return self._assert_(_st(val).__lt((11)));
  8037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8038. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  8039. args: [],
  8040. 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]",
  8041. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8042. referencedClasses: []
  8043. }),
  8044. smalltalk.RandomTest);
  8045. smalltalk.addMethod(
  8046. smalltalk.method({
  8047. selector: "testAtRandomSequenceableCollection",
  8048. protocol: 'tests',
  8049. fn: function (){
  8050. var self=this;
  8051. var val;
  8052. return smalltalk.withContext(function($ctx1) {
  8053. var $3,$4,$2,$1;
  8054. (100)._timesRepeat_((function(){
  8055. return smalltalk.withContext(function($ctx2) {
  8056. val="abc"._atRandom();
  8057. val;
  8058. $3=_st(val).__eq("a");
  8059. $ctx2.sendIdx["="]=1;
  8060. $4=_st(val).__eq("b");
  8061. $ctx2.sendIdx["="]=2;
  8062. $2=_st($3).__or($4);
  8063. $1=_st($2).__or(_st(val).__eq("c"));
  8064. $ctx2.sendIdx["|"]=1;
  8065. return self._assert_($1);
  8066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8067. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  8068. args: [],
  8069. 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].",
  8070. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8071. referencedClasses: []
  8072. }),
  8073. smalltalk.RandomTest);
  8074. smalltalk.addMethod(
  8075. smalltalk.method({
  8076. selector: "textNext",
  8077. protocol: 'tests',
  8078. fn: function (){
  8079. var self=this;
  8080. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  8081. return smalltalk.withContext(function($ctx1) {
  8082. var $1;
  8083. (10000)._timesRepeat_((function(){
  8084. var current,next;
  8085. return smalltalk.withContext(function($ctx2) {
  8086. next=_st(_st($Random())._new())._next();
  8087. next;
  8088. self._assert_(_st(next).__gt_eq((0)));
  8089. $ctx2.sendIdx["assert:"]=1;
  8090. self._assert_(_st(next).__lt((1)));
  8091. $1=_st(current).__eq(next);
  8092. $ctx2.sendIdx["="]=1;
  8093. self._deny_($1);
  8094. return _st(next).__eq(current);
  8095. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8096. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  8097. args: [],
  8098. 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 ]",
  8099. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8100. referencedClasses: ["Random"]
  8101. }),
  8102. smalltalk.RandomTest);
  8103. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8104. smalltalk.addMethod(
  8105. smalltalk.method({
  8106. selector: "collectionClass",
  8107. protocol: 'accessing',
  8108. fn: function (){
  8109. var self=this;
  8110. return smalltalk.withContext(function($ctx1) {
  8111. var $1;
  8112. $1=_st(self._class())._collectionClass();
  8113. return $1;
  8114. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  8115. args: [],
  8116. source: "collectionClass\x0a\x09^ self class collectionClass",
  8117. messageSends: ["collectionClass", "class"],
  8118. referencedClasses: []
  8119. }),
  8120. smalltalk.StreamTest);
  8121. smalltalk.addMethod(
  8122. smalltalk.method({
  8123. selector: "newCollection",
  8124. protocol: 'accessing',
  8125. fn: function (){
  8126. var self=this;
  8127. return smalltalk.withContext(function($ctx1) {
  8128. var $1;
  8129. $1=_st(self._collectionClass())._new();
  8130. return $1;
  8131. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  8132. args: [],
  8133. source: "newCollection\x0a\x09^ self collectionClass new",
  8134. messageSends: ["new", "collectionClass"],
  8135. referencedClasses: []
  8136. }),
  8137. smalltalk.StreamTest);
  8138. smalltalk.addMethod(
  8139. smalltalk.method({
  8140. selector: "newStream",
  8141. protocol: 'accessing',
  8142. fn: function (){
  8143. var self=this;
  8144. return smalltalk.withContext(function($ctx1) {
  8145. var $1;
  8146. $1=_st(_st(self._collectionClass())._new())._stream();
  8147. return $1;
  8148. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  8149. args: [],
  8150. source: "newStream\x0a\x09^ self collectionClass new stream",
  8151. messageSends: ["stream", "new", "collectionClass"],
  8152. referencedClasses: []
  8153. }),
  8154. smalltalk.StreamTest);
  8155. smalltalk.addMethod(
  8156. smalltalk.method({
  8157. selector: "testAtStartAtEnd",
  8158. protocol: 'tests',
  8159. fn: function (){
  8160. var self=this;
  8161. var stream;
  8162. return smalltalk.withContext(function($ctx1) {
  8163. var $1,$2,$3,$4;
  8164. stream=self._newStream();
  8165. $1=_st(stream)._atStart();
  8166. $ctx1.sendIdx["atStart"]=1;
  8167. self._assert_($1);
  8168. $ctx1.sendIdx["assert:"]=1;
  8169. $2=_st(stream)._atEnd();
  8170. $ctx1.sendIdx["atEnd"]=1;
  8171. self._assert_($2);
  8172. $ctx1.sendIdx["assert:"]=2;
  8173. _st(stream)._nextPutAll_(self._newCollection());
  8174. $3=_st(stream)._atEnd();
  8175. $ctx1.sendIdx["atEnd"]=2;
  8176. self._assert_($3);
  8177. $4=_st(stream)._atStart();
  8178. $ctx1.sendIdx["atStart"]=2;
  8179. self._deny_($4);
  8180. $ctx1.sendIdx["deny:"]=1;
  8181. _st(stream)._position_((1));
  8182. self._deny_(_st(stream)._atEnd());
  8183. $ctx1.sendIdx["deny:"]=2;
  8184. self._deny_(_st(stream)._atStart());
  8185. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  8186. args: [],
  8187. 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",
  8188. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8189. referencedClasses: []
  8190. }),
  8191. smalltalk.StreamTest);
  8192. smalltalk.addMethod(
  8193. smalltalk.method({
  8194. selector: "testContents",
  8195. protocol: 'tests',
  8196. fn: function (){
  8197. var self=this;
  8198. var stream;
  8199. return smalltalk.withContext(function($ctx1) {
  8200. var $1,$2;
  8201. stream=self._newStream();
  8202. $1=stream;
  8203. $2=self._newCollection();
  8204. $ctx1.sendIdx["newCollection"]=1;
  8205. _st($1)._nextPutAll_($2);
  8206. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8207. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  8208. args: [],
  8209. 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",
  8210. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8211. referencedClasses: []
  8212. }),
  8213. smalltalk.StreamTest);
  8214. smalltalk.addMethod(
  8215. smalltalk.method({
  8216. selector: "testIsEmpty",
  8217. protocol: 'tests',
  8218. fn: function (){
  8219. var self=this;
  8220. var stream;
  8221. return smalltalk.withContext(function($ctx1) {
  8222. var $1;
  8223. stream=self._newStream();
  8224. $1=_st(stream)._isEmpty();
  8225. $ctx1.sendIdx["isEmpty"]=1;
  8226. self._assert_($1);
  8227. _st(stream)._nextPutAll_(self._newCollection());
  8228. self._deny_(_st(stream)._isEmpty());
  8229. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8230. args: [],
  8231. 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",
  8232. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8233. referencedClasses: []
  8234. }),
  8235. smalltalk.StreamTest);
  8236. smalltalk.addMethod(
  8237. smalltalk.method({
  8238. selector: "testPosition",
  8239. protocol: 'tests',
  8240. fn: function (){
  8241. var self=this;
  8242. var collection,stream;
  8243. return smalltalk.withContext(function($ctx1) {
  8244. var $1,$2,$3;
  8245. collection=self._newCollection();
  8246. stream=self._newStream();
  8247. _st(stream)._nextPutAll_(collection);
  8248. $1=_st(stream)._position();
  8249. $ctx1.sendIdx["position"]=1;
  8250. self._assert_equals_($1,_st(collection)._size());
  8251. $ctx1.sendIdx["assert:equals:"]=1;
  8252. _st(stream)._position_((0));
  8253. $2=_st(stream)._position();
  8254. $ctx1.sendIdx["position"]=2;
  8255. self._assert_equals_($2,(0));
  8256. $ctx1.sendIdx["assert:equals:"]=2;
  8257. _st(stream)._next();
  8258. $ctx1.sendIdx["next"]=1;
  8259. $3=_st(stream)._position();
  8260. $ctx1.sendIdx["position"]=3;
  8261. self._assert_equals_($3,(1));
  8262. $ctx1.sendIdx["assert:equals:"]=3;
  8263. _st(stream)._next();
  8264. self._assert_equals_(_st(stream)._position(),(2));
  8265. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8266. args: [],
  8267. 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",
  8268. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8269. referencedClasses: []
  8270. }),
  8271. smalltalk.StreamTest);
  8272. smalltalk.addMethod(
  8273. smalltalk.method({
  8274. selector: "testReading",
  8275. protocol: 'tests',
  8276. fn: function (){
  8277. var self=this;
  8278. var stream,collection;
  8279. return smalltalk.withContext(function($ctx1) {
  8280. var $1,$2,$3;
  8281. collection=self._newCollection();
  8282. stream=self._newStream();
  8283. $1=stream;
  8284. _st($1)._nextPutAll_(collection);
  8285. $2=_st($1)._position_((0));
  8286. _st(collection)._do_((function(each){
  8287. return smalltalk.withContext(function($ctx2) {
  8288. $3=_st(stream)._next();
  8289. $ctx2.sendIdx["next"]=1;
  8290. return self._assert_equals_($3,each);
  8291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8292. self._assert_(_st(_st(stream)._next())._isNil());
  8293. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8294. args: [],
  8295. 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",
  8296. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8297. referencedClasses: []
  8298. }),
  8299. smalltalk.StreamTest);
  8300. smalltalk.addMethod(
  8301. smalltalk.method({
  8302. selector: "testStreamContents",
  8303. protocol: 'tests',
  8304. fn: function (){
  8305. var self=this;
  8306. return smalltalk.withContext(function($ctx1) {
  8307. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8308. args: [],
  8309. source: "testStreamContents",
  8310. messageSends: [],
  8311. referencedClasses: []
  8312. }),
  8313. smalltalk.StreamTest);
  8314. smalltalk.addMethod(
  8315. smalltalk.method({
  8316. selector: "testWrite",
  8317. protocol: 'tests',
  8318. fn: function (){
  8319. var self=this;
  8320. var stream,collection;
  8321. return smalltalk.withContext(function($ctx1) {
  8322. collection=self._newCollection();
  8323. stream=self._newStream();
  8324. _st(collection)._do_((function(each){
  8325. return smalltalk.withContext(function($ctx2) {
  8326. return _st(stream).__lt_lt(each);
  8327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8328. self._assert_equals_(_st(stream)._contents(),collection);
  8329. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8330. args: [],
  8331. 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",
  8332. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8333. referencedClasses: []
  8334. }),
  8335. smalltalk.StreamTest);
  8336. smalltalk.addMethod(
  8337. smalltalk.method({
  8338. selector: "testWriting",
  8339. protocol: 'tests',
  8340. fn: function (){
  8341. var self=this;
  8342. var stream,collection;
  8343. return smalltalk.withContext(function($ctx1) {
  8344. var $1;
  8345. collection=self._newCollection();
  8346. stream=self._newStream();
  8347. $ctx1.sendIdx["newStream"]=1;
  8348. _st(collection)._do_((function(each){
  8349. return smalltalk.withContext(function($ctx2) {
  8350. return _st(stream)._nextPut_(each);
  8351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8352. $1=_st(stream)._contents();
  8353. $ctx1.sendIdx["contents"]=1;
  8354. self._assert_equals_($1,collection);
  8355. $ctx1.sendIdx["assert:equals:"]=1;
  8356. stream=self._newStream();
  8357. _st(stream)._nextPutAll_(collection);
  8358. self._assert_equals_(_st(stream)._contents(),collection);
  8359. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8360. args: [],
  8361. 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",
  8362. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8363. referencedClasses: []
  8364. }),
  8365. smalltalk.StreamTest);
  8366. smalltalk.addMethod(
  8367. smalltalk.method({
  8368. selector: "collectionClass",
  8369. protocol: 'accessing',
  8370. fn: function (){
  8371. var self=this;
  8372. return smalltalk.withContext(function($ctx1) {
  8373. return nil;
  8374. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8375. args: [],
  8376. source: "collectionClass\x0a\x09^ nil",
  8377. messageSends: [],
  8378. referencedClasses: []
  8379. }),
  8380. smalltalk.StreamTest.klass);
  8381. smalltalk.addMethod(
  8382. smalltalk.method({
  8383. selector: "isAbstract",
  8384. protocol: 'testing',
  8385. fn: function (){
  8386. var self=this;
  8387. return smalltalk.withContext(function($ctx1) {
  8388. var $1;
  8389. $1=_st(self._collectionClass())._isNil();
  8390. return $1;
  8391. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8392. args: [],
  8393. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8394. messageSends: ["isNil", "collectionClass"],
  8395. referencedClasses: []
  8396. }),
  8397. smalltalk.StreamTest.klass);
  8398. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8399. smalltalk.addMethod(
  8400. smalltalk.method({
  8401. selector: "newCollection",
  8402. protocol: 'accessing',
  8403. fn: function (){
  8404. var self=this;
  8405. return smalltalk.withContext(function($ctx1) {
  8406. var $1;
  8407. $1=[true,(1),(3).__at((4)),"foo"];
  8408. return $1;
  8409. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8410. args: [],
  8411. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8412. messageSends: ["@"],
  8413. referencedClasses: []
  8414. }),
  8415. smalltalk.ArrayStreamTest);
  8416. smalltalk.addMethod(
  8417. smalltalk.method({
  8418. selector: "collectionClass",
  8419. protocol: 'accessing',
  8420. fn: function (){
  8421. var self=this;
  8422. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8423. return smalltalk.withContext(function($ctx1) {
  8424. return $Array();
  8425. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8426. args: [],
  8427. source: "collectionClass\x0a\x09^ Array",
  8428. messageSends: [],
  8429. referencedClasses: ["Array"]
  8430. }),
  8431. smalltalk.ArrayStreamTest.klass);
  8432. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8433. smalltalk.addMethod(
  8434. smalltalk.method({
  8435. selector: "newCollection",
  8436. protocol: 'accessing',
  8437. fn: function (){
  8438. var self=this;
  8439. return smalltalk.withContext(function($ctx1) {
  8440. return "hello world";
  8441. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8442. args: [],
  8443. source: "newCollection\x0a\x09^ 'hello world'",
  8444. messageSends: [],
  8445. referencedClasses: []
  8446. }),
  8447. smalltalk.StringStreamTest);
  8448. smalltalk.addMethod(
  8449. smalltalk.method({
  8450. selector: "collectionClass",
  8451. protocol: 'accessing',
  8452. fn: function (){
  8453. var self=this;
  8454. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8455. return smalltalk.withContext(function($ctx1) {
  8456. return $String();
  8457. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8458. args: [],
  8459. source: "collectionClass\x0a\x09^ String",
  8460. messageSends: [],
  8461. referencedClasses: ["String"]
  8462. }),
  8463. smalltalk.StringStreamTest.klass);
  8464. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8465. smalltalk.addMethod(
  8466. smalltalk.method({
  8467. selector: "testCopying",
  8468. protocol: 'tests',
  8469. fn: function (){
  8470. var self=this;
  8471. return smalltalk.withContext(function($ctx1) {
  8472. self._assert_equals_(nil._copy(),nil);
  8473. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8474. args: [],
  8475. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8476. messageSends: ["assert:equals:", "copy"],
  8477. referencedClasses: []
  8478. }),
  8479. smalltalk.UndefinedTest);
  8480. smalltalk.addMethod(
  8481. smalltalk.method({
  8482. selector: "testDeepCopy",
  8483. protocol: 'tests',
  8484. fn: function (){
  8485. var self=this;
  8486. return smalltalk.withContext(function($ctx1) {
  8487. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8488. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8489. args: [],
  8490. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8491. messageSends: ["assert:", "=", "deepCopy"],
  8492. referencedClasses: []
  8493. }),
  8494. smalltalk.UndefinedTest);
  8495. smalltalk.addMethod(
  8496. smalltalk.method({
  8497. selector: "testIfNil",
  8498. protocol: 'tests',
  8499. fn: function (){
  8500. var self=this;
  8501. return smalltalk.withContext(function($ctx1) {
  8502. var $1,$3,$2,$4,$6,$5;
  8503. if(($receiver = nil) == nil || $receiver == null){
  8504. $1=true;
  8505. } else {
  8506. $1=nil;
  8507. };
  8508. self._assert_equals_($1,true);
  8509. $ctx1.sendIdx["assert:equals:"]=1;
  8510. if(($receiver = nil) == nil || $receiver == null){
  8511. $3=nil;
  8512. } else {
  8513. $3=true;
  8514. };
  8515. $2=_st($3).__eq(true);
  8516. $ctx1.sendIdx["="]=1;
  8517. self._deny_($2);
  8518. $ctx1.sendIdx["deny:"]=1;
  8519. if(($receiver = nil) == nil || $receiver == null){
  8520. $4=true;
  8521. } else {
  8522. $4=false;
  8523. };
  8524. self._assert_equals_($4,true);
  8525. if(($receiver = nil) == nil || $receiver == null){
  8526. $6=false;
  8527. } else {
  8528. $6=true;
  8529. };
  8530. $5=_st($6).__eq(true);
  8531. self._deny_($5);
  8532. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8533. args: [],
  8534. 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",
  8535. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8536. referencedClasses: []
  8537. }),
  8538. smalltalk.UndefinedTest);
  8539. smalltalk.addMethod(
  8540. smalltalk.method({
  8541. selector: "testIsNil",
  8542. protocol: 'tests',
  8543. fn: function (){
  8544. var self=this;
  8545. return smalltalk.withContext(function($ctx1) {
  8546. self._assert_(nil._isNil());
  8547. self._deny_(nil._notNil());
  8548. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8549. args: [],
  8550. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8551. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8552. referencedClasses: []
  8553. }),
  8554. smalltalk.UndefinedTest);
  8555. });