2
0

Kernel-Tests.js 320 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfPresent",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var visited,sentinel;
  2334. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2335. return smalltalk.withContext(function($ctx1) {
  2336. var $2,$1,$4,$3;
  2337. sentinel=_st($Object())._new();
  2338. self._nonIndexesDo_((function(each){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. visited=nil;
  2341. visited;
  2342. $2=self._collection();
  2343. $ctx2.sendIdx["collection"]=1;
  2344. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2345. return smalltalk.withContext(function($ctx3) {
  2346. visited=value1;
  2347. visited;
  2348. return sentinel;
  2349. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2350. $ctx2.sendIdx["at:ifPresent:"]=1;
  2351. self._assert_equals_($1,nil);
  2352. $ctx2.sendIdx["assert:equals:"]=1;
  2353. return self._assert_(_st(visited)._isNil());
  2354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2355. self._samplesDo_((function(index,value){
  2356. return smalltalk.withContext(function($ctx2) {
  2357. visited=nil;
  2358. visited;
  2359. $4=self._collection();
  2360. $ctx2.sendIdx["collection"]=2;
  2361. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2362. return smalltalk.withContext(function($ctx3) {
  2363. visited=value2;
  2364. visited;
  2365. return sentinel;
  2366. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2367. self._assert_equals_($3,sentinel);
  2368. $ctx2.sendIdx["assert:equals:"]=2;
  2369. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2370. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2371. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2372. args: [],
  2373. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2374. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2375. referencedClasses: ["Object"]
  2376. }),
  2377. smalltalk.IndexableCollectionTest);
  2378. smalltalk.addMethod(
  2379. smalltalk.method({
  2380. selector: "testAtIfPresentIfAbsent",
  2381. protocol: 'tests',
  2382. fn: function (){
  2383. var self=this;
  2384. var visited,sentinel;
  2385. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2386. return smalltalk.withContext(function($ctx1) {
  2387. var $2,$1,$3,$5,$4;
  2388. sentinel=_st($Object())._new();
  2389. self._nonIndexesDo_((function(each){
  2390. return smalltalk.withContext(function($ctx2) {
  2391. visited=nil;
  2392. visited;
  2393. $2=self._collection();
  2394. $ctx2.sendIdx["collection"]=1;
  2395. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2396. return smalltalk.withContext(function($ctx3) {
  2397. visited=value1;
  2398. visited;
  2399. return sentinel;
  2400. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2401. return smalltalk.withContext(function($ctx3) {
  2402. return self._sampleNewValue();
  2403. $ctx3.sendIdx["sampleNewValue"]=1;
  2404. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2405. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2406. $3=self._sampleNewValue();
  2407. $ctx2.sendIdx["sampleNewValue"]=2;
  2408. self._assert_equals_($1,$3);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. return self._assert_(_st(visited)._isNil());
  2411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2412. self._samplesDo_((function(index,value){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. visited=nil;
  2415. visited;
  2416. $5=self._collection();
  2417. $ctx2.sendIdx["collection"]=2;
  2418. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2419. return smalltalk.withContext(function($ctx3) {
  2420. visited=value2;
  2421. visited;
  2422. return sentinel;
  2423. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2424. return smalltalk.withContext(function($ctx3) {
  2425. return self._sampleNewValue();
  2426. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2427. self._assert_equals_($4,sentinel);
  2428. $ctx2.sendIdx["assert:equals:"]=2;
  2429. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2430. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2431. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2432. args: [],
  2433. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2434. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2435. referencedClasses: ["Object"]
  2436. }),
  2437. smalltalk.IndexableCollectionTest);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "testAtPut",
  2441. protocol: 'tests',
  2442. fn: function (){
  2443. var self=this;
  2444. var newCollection;
  2445. return smalltalk.withContext(function($ctx1) {
  2446. newCollection=self._collection();
  2447. $ctx1.sendIdx["collection"]=1;
  2448. self._samplesDo_((function(index,value){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return _st(newCollection)._at_put_(index,value);
  2451. $ctx2.sendIdx["at:put:"]=1;
  2452. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2453. self._assert_equals_(newCollection,self._collection());
  2454. $ctx1.sendIdx["assert:equals:"]=1;
  2455. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2456. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2457. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2458. args: [],
  2459. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2460. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2461. referencedClasses: []
  2462. }),
  2463. smalltalk.IndexableCollectionTest);
  2464. smalltalk.addMethod(
  2465. smalltalk.method({
  2466. selector: "testIndexOf",
  2467. protocol: 'tests',
  2468. fn: function (){
  2469. var self=this;
  2470. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2471. return smalltalk.withContext(function($ctx1) {
  2472. var $1;
  2473. self._should_raise_((function(){
  2474. return smalltalk.withContext(function($ctx2) {
  2475. $1=self._collection();
  2476. $ctx2.sendIdx["collection"]=1;
  2477. return _st($1)._indexOf_(self._sampleNewValue());
  2478. $ctx2.sendIdx["indexOf:"]=1;
  2479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2480. self._samplesDo_((function(index,value){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2483. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2484. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2485. args: [],
  2486. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2487. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2488. referencedClasses: ["Error"]
  2489. }),
  2490. smalltalk.IndexableCollectionTest);
  2491. smalltalk.addMethod(
  2492. smalltalk.method({
  2493. selector: "testWithIndexDo",
  2494. protocol: 'tests',
  2495. fn: function (){
  2496. var self=this;
  2497. var collection;
  2498. return smalltalk.withContext(function($ctx1) {
  2499. collection=self._collection();
  2500. $ctx1.sendIdx["collection"]=1;
  2501. _st(self._collection())._withIndexDo_((function(each,index){
  2502. return smalltalk.withContext(function($ctx2) {
  2503. return self._assert_equals_(_st(collection)._at_(index),each);
  2504. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2505. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2506. args: [],
  2507. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  2508. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.IndexableCollectionTest);
  2512. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2513. smalltalk.addMethod(
  2514. smalltalk.method({
  2515. selector: "collection",
  2516. protocol: 'fixture',
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.withContext(function($ctx1) {
  2520. var $2,$3,$4,$1;
  2521. $2="b".__minus_gt((1));
  2522. $ctx1.sendIdx["->"]=1;
  2523. $3="a".__minus_gt((2));
  2524. $ctx1.sendIdx["->"]=2;
  2525. $4="c".__minus_gt((3));
  2526. $ctx1.sendIdx["->"]=3;
  2527. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2528. return $1;
  2529. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2530. args: [],
  2531. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2532. messageSends: ["->"],
  2533. referencedClasses: []
  2534. }),
  2535. smalltalk.HashedCollectionTest);
  2536. smalltalk.addMethod(
  2537. smalltalk.method({
  2538. selector: "collectionOfPrintStrings",
  2539. protocol: 'fixture',
  2540. fn: function (){
  2541. var self=this;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. var $2,$3,$4,$1;
  2544. $2="b".__minus_gt("1");
  2545. $ctx1.sendIdx["->"]=1;
  2546. $3="a".__minus_gt("2");
  2547. $ctx1.sendIdx["->"]=2;
  2548. $4="c".__minus_gt("3");
  2549. $ctx1.sendIdx["->"]=3;
  2550. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2551. return $1;
  2552. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2553. args: [],
  2554. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2555. messageSends: ["->"],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.HashedCollectionTest);
  2559. smalltalk.addMethod(
  2560. smalltalk.method({
  2561. selector: "collectionSize",
  2562. protocol: 'fixture',
  2563. fn: function (){
  2564. var self=this;
  2565. return smalltalk.withContext(function($ctx1) {
  2566. return (4);
  2567. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2568. args: [],
  2569. source: "collectionSize\x0a\x09^ 4",
  2570. messageSends: [],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.HashedCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "collectionWithDuplicates",
  2577. protocol: 'fixture',
  2578. fn: function (){
  2579. var self=this;
  2580. return smalltalk.withContext(function($ctx1) {
  2581. var $2,$3,$4,$5,$6,$7,$1;
  2582. $2="b".__minus_gt((1));
  2583. $ctx1.sendIdx["->"]=1;
  2584. $3="a".__minus_gt((2));
  2585. $ctx1.sendIdx["->"]=2;
  2586. $4="c".__minus_gt((3));
  2587. $ctx1.sendIdx["->"]=3;
  2588. $5="d".__minus_gt((-4));
  2589. $ctx1.sendIdx["->"]=4;
  2590. $6="e".__minus_gt((1));
  2591. $ctx1.sendIdx["->"]=5;
  2592. $7="f".__minus_gt((2));
  2593. $ctx1.sendIdx["->"]=6;
  2594. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2595. return $1;
  2596. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2597. args: [],
  2598. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2599. messageSends: ["->"],
  2600. referencedClasses: []
  2601. }),
  2602. smalltalk.HashedCollectionTest);
  2603. smalltalk.addMethod(
  2604. smalltalk.method({
  2605. selector: "collectionWithNewValue",
  2606. protocol: 'fixture',
  2607. fn: function (){
  2608. var self=this;
  2609. return smalltalk.withContext(function($ctx1) {
  2610. var $2,$3,$4,$5,$1;
  2611. $2="b".__minus_gt((1));
  2612. $ctx1.sendIdx["->"]=1;
  2613. $3="a".__minus_gt((2));
  2614. $ctx1.sendIdx["->"]=2;
  2615. $4="c".__minus_gt((3));
  2616. $ctx1.sendIdx["->"]=3;
  2617. $5="d".__minus_gt((-4));
  2618. $ctx1.sendIdx["->"]=4;
  2619. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2620. return $1;
  2621. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2622. args: [],
  2623. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2624. messageSends: ["->"],
  2625. referencedClasses: []
  2626. }),
  2627. smalltalk.HashedCollectionTest);
  2628. smalltalk.addMethod(
  2629. smalltalk.method({
  2630. selector: "nonIndexesDo:",
  2631. protocol: 'fixture',
  2632. fn: function (aBlock){
  2633. var self=this;
  2634. return smalltalk.withContext(function($ctx1) {
  2635. _st(aBlock)._value_((5));
  2636. $ctx1.sendIdx["value:"]=1;
  2637. _st(aBlock)._value_("z");
  2638. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2639. args: ["aBlock"],
  2640. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2641. messageSends: ["value:"],
  2642. referencedClasses: []
  2643. }),
  2644. smalltalk.HashedCollectionTest);
  2645. smalltalk.addMethod(
  2646. smalltalk.method({
  2647. selector: "sampleNewIndex",
  2648. protocol: 'fixture',
  2649. fn: function (){
  2650. var self=this;
  2651. return smalltalk.withContext(function($ctx1) {
  2652. return "new";
  2653. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2654. args: [],
  2655. source: "sampleNewIndex\x0a\x09^ 'new'",
  2656. messageSends: [],
  2657. referencedClasses: []
  2658. }),
  2659. smalltalk.HashedCollectionTest);
  2660. smalltalk.addMethod(
  2661. smalltalk.method({
  2662. selector: "sampleNewValueAsCollection",
  2663. protocol: 'fixture',
  2664. fn: function (){
  2665. var self=this;
  2666. return smalltalk.withContext(function($ctx1) {
  2667. var $1;
  2668. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2669. return $1;
  2670. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2671. args: [],
  2672. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2673. messageSends: ["->"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.HashedCollectionTest);
  2677. smalltalk.addMethod(
  2678. smalltalk.method({
  2679. selector: "samplesDo:",
  2680. protocol: 'fixture',
  2681. fn: function (aBlock){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) {
  2684. _st(aBlock)._value_value_("a",(2));
  2685. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2686. args: ["aBlock"],
  2687. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2688. messageSends: ["value:value:"],
  2689. referencedClasses: []
  2690. }),
  2691. smalltalk.HashedCollectionTest);
  2692. smalltalk.addMethod(
  2693. smalltalk.method({
  2694. selector: "testAddAll",
  2695. protocol: 'tests',
  2696. fn: function (){
  2697. var self=this;
  2698. return smalltalk.withContext(function($ctx1) {
  2699. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2700. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2701. $2=self._collection();
  2702. $ctx1.sendIdx["collection"]=1;
  2703. $3=$2;
  2704. $4=self._collection();
  2705. $ctx1.sendIdx["collection"]=2;
  2706. _st($3)._addAll_($4);
  2707. $ctx1.sendIdx["addAll:"]=1;
  2708. $5=_st($2)._yourself();
  2709. $ctx1.sendIdx["yourself"]=1;
  2710. $1=$5;
  2711. $6=self._collection();
  2712. $ctx1.sendIdx["collection"]=3;
  2713. self._assert_equals_($1,$6);
  2714. $ctx1.sendIdx["assert:equals:"]=1;
  2715. $8=self._collection();
  2716. $ctx1.sendIdx["collection"]=4;
  2717. $9=$8;
  2718. $10=self._collectionWithNewValue();
  2719. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2720. _st($9)._addAll_($10);
  2721. $ctx1.sendIdx["addAll:"]=2;
  2722. $11=_st($8)._yourself();
  2723. $ctx1.sendIdx["yourself"]=2;
  2724. $7=$11;
  2725. $12=self._collectionWithNewValue();
  2726. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2727. self._assert_equals_($7,$12);
  2728. $ctx1.sendIdx["assert:equals:"]=2;
  2729. $14=self._collectionWithNewValue();
  2730. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2731. _st($14)._addAll_(self._collection());
  2732. $15=_st($14)._yourself();
  2733. $13=$15;
  2734. self._assert_equals_($13,self._collectionWithNewValue());
  2735. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2736. args: [],
  2737. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2738. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2739. referencedClasses: []
  2740. }),
  2741. smalltalk.HashedCollectionTest);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "testAsDictionary",
  2745. protocol: 'tests',
  2746. fn: function (){
  2747. var self=this;
  2748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2749. return smalltalk.withContext(function($ctx1) {
  2750. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2751. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2752. args: [],
  2753. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2754. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2755. referencedClasses: ["Dictionary"]
  2756. }),
  2757. smalltalk.HashedCollectionTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testComma",
  2761. protocol: 'tests',
  2762. fn: function (){
  2763. var self=this;
  2764. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2765. return smalltalk.withContext(function($ctx1) {
  2766. var $1;
  2767. self._should_raise_((function(){
  2768. return smalltalk.withContext(function($ctx2) {
  2769. $1=self._collection();
  2770. $ctx2.sendIdx["collection"]=1;
  2771. return _st($1).__comma(self._collection());
  2772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2773. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2774. args: [],
  2775. source: "testComma\x0a\x09self should: [ self collection, self collection ] raise: Error",
  2776. messageSends: ["should:raise:", ",", "collection"],
  2777. referencedClasses: ["Error"]
  2778. }),
  2779. smalltalk.HashedCollectionTest);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "testFrom",
  2783. protocol: 'tests',
  2784. fn: function (){
  2785. var self=this;
  2786. var associations;
  2787. return smalltalk.withContext(function($ctx1) {
  2788. var $1,$2,$3,$5,$4;
  2789. $1="a".__minus_gt((1));
  2790. $ctx1.sendIdx["->"]=1;
  2791. $2="b".__minus_gt((2));
  2792. $ctx1.sendIdx["->"]=2;
  2793. associations=[$1,$2];
  2794. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2795. $5="a".__minus_gt((1));
  2796. $ctx1.sendIdx["->"]=3;
  2797. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2798. self._assertSameContents_as_($3,$4);
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2800. args: [],
  2801. 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 }.",
  2802. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2803. referencedClasses: []
  2804. }),
  2805. smalltalk.HashedCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testNewFromPairs",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. var flattenedAssociations;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. var $1,$3,$2;
  2815. flattenedAssociations=["a",(1),"b",(2)];
  2816. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2817. $3="a".__minus_gt((1));
  2818. $ctx1.sendIdx["->"]=1;
  2819. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2820. self._assertSameContents_as_($1,$2);
  2821. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2822. args: [],
  2823. 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 }.",
  2824. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2825. referencedClasses: []
  2826. }),
  2827. smalltalk.HashedCollectionTest);
  2828. smalltalk.addMethod(
  2829. smalltalk.method({
  2830. selector: "collectionClass",
  2831. protocol: 'fixture',
  2832. fn: function (){
  2833. var self=this;
  2834. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2835. return smalltalk.withContext(function($ctx1) {
  2836. return $HashedCollection();
  2837. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2838. args: [],
  2839. source: "collectionClass\x0a\x09^ HashedCollection",
  2840. messageSends: [],
  2841. referencedClasses: ["HashedCollection"]
  2842. }),
  2843. smalltalk.HashedCollectionTest.klass);
  2844. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2845. smalltalk.addMethod(
  2846. smalltalk.method({
  2847. selector: "collection",
  2848. protocol: 'fixture',
  2849. fn: function (){
  2850. var self=this;
  2851. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2852. return smalltalk.withContext(function($ctx1) {
  2853. var $2,$3,$1;
  2854. $2=_st($Dictionary())._new();
  2855. _st($2)._at_put_((1),(1));
  2856. $ctx1.sendIdx["at:put:"]=1;
  2857. _st($2)._at_put_("a",(2));
  2858. $ctx1.sendIdx["at:put:"]=2;
  2859. _st($2)._at_put_(true,(3));
  2860. $ctx1.sendIdx["at:put:"]=3;
  2861. _st($2)._at_put_((1).__at((3)),(-4));
  2862. $3=_st($2)._yourself();
  2863. $1=$3;
  2864. return $1;
  2865. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2866. args: [],
  2867. 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",
  2868. messageSends: ["at:put:", "new", "@", "yourself"],
  2869. referencedClasses: ["Dictionary"]
  2870. }),
  2871. smalltalk.DictionaryTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "collectionOfPrintStrings",
  2875. protocol: 'fixture',
  2876. fn: function (){
  2877. var self=this;
  2878. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2879. return smalltalk.withContext(function($ctx1) {
  2880. var $2,$3,$1;
  2881. $2=_st($Dictionary())._new();
  2882. _st($2)._at_put_((1),"1");
  2883. $ctx1.sendIdx["at:put:"]=1;
  2884. _st($2)._at_put_("a","2");
  2885. $ctx1.sendIdx["at:put:"]=2;
  2886. _st($2)._at_put_(true,"3");
  2887. $ctx1.sendIdx["at:put:"]=3;
  2888. _st($2)._at_put_((1).__at((3)),"-4");
  2889. $3=_st($2)._yourself();
  2890. $1=$3;
  2891. return $1;
  2892. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2893. args: [],
  2894. 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",
  2895. messageSends: ["at:put:", "new", "@", "yourself"],
  2896. referencedClasses: ["Dictionary"]
  2897. }),
  2898. smalltalk.DictionaryTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "collectionSize",
  2902. protocol: 'fixture',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. return (4);
  2907. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2908. args: [],
  2909. source: "collectionSize\x0a\x09^ 4",
  2910. messageSends: [],
  2911. referencedClasses: []
  2912. }),
  2913. smalltalk.DictionaryTest);
  2914. smalltalk.addMethod(
  2915. smalltalk.method({
  2916. selector: "collectionWithDuplicates",
  2917. protocol: 'fixture',
  2918. fn: function (){
  2919. var self=this;
  2920. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2921. return smalltalk.withContext(function($ctx1) {
  2922. var $2,$3,$1;
  2923. $2=_st($Dictionary())._new();
  2924. _st($2)._at_put_((1),(1));
  2925. $ctx1.sendIdx["at:put:"]=1;
  2926. _st($2)._at_put_("a",(2));
  2927. $ctx1.sendIdx["at:put:"]=2;
  2928. _st($2)._at_put_(true,(3));
  2929. $ctx1.sendIdx["at:put:"]=3;
  2930. _st($2)._at_put_((4),(-4));
  2931. $ctx1.sendIdx["at:put:"]=4;
  2932. _st($2)._at_put_("b",(1));
  2933. $ctx1.sendIdx["at:put:"]=5;
  2934. _st($2)._at_put_((3),(3));
  2935. $ctx1.sendIdx["at:put:"]=6;
  2936. _st($2)._at_put_(false,(12));
  2937. $3=_st($2)._yourself();
  2938. $1=$3;
  2939. return $1;
  2940. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2941. args: [],
  2942. 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",
  2943. messageSends: ["at:put:", "new", "yourself"],
  2944. referencedClasses: ["Dictionary"]
  2945. }),
  2946. smalltalk.DictionaryTest);
  2947. smalltalk.addMethod(
  2948. smalltalk.method({
  2949. selector: "collectionWithNewValue",
  2950. protocol: 'fixture',
  2951. fn: function (){
  2952. var self=this;
  2953. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2954. return smalltalk.withContext(function($ctx1) {
  2955. var $2,$3,$1;
  2956. $2=_st($Dictionary())._new();
  2957. _st($2)._at_put_((1),(1));
  2958. $ctx1.sendIdx["at:put:"]=1;
  2959. _st($2)._at_put_("a",(2));
  2960. $ctx1.sendIdx["at:put:"]=2;
  2961. _st($2)._at_put_(true,(3));
  2962. $ctx1.sendIdx["at:put:"]=3;
  2963. _st($2)._at_put_((1).__at((3)),(-4));
  2964. $ctx1.sendIdx["at:put:"]=4;
  2965. _st($2)._at_put_("new","N");
  2966. $3=_st($2)._yourself();
  2967. $1=$3;
  2968. return $1;
  2969. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2970. args: [],
  2971. 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",
  2972. messageSends: ["at:put:", "new", "@", "yourself"],
  2973. referencedClasses: ["Dictionary"]
  2974. }),
  2975. smalltalk.DictionaryTest);
  2976. smalltalk.addMethod(
  2977. smalltalk.method({
  2978. selector: "sampleNewValueAsCollection",
  2979. protocol: 'fixture',
  2980. fn: function (){
  2981. var self=this;
  2982. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2983. return smalltalk.withContext(function($ctx1) {
  2984. var $2,$3,$1;
  2985. $2=_st($Dictionary())._new();
  2986. _st($2)._at_put_("new","N");
  2987. $3=_st($2)._yourself();
  2988. $1=$3;
  2989. return $1;
  2990. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  2991. args: [],
  2992. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2993. messageSends: ["at:put:", "new", "yourself"],
  2994. referencedClasses: ["Dictionary"]
  2995. }),
  2996. smalltalk.DictionaryTest);
  2997. smalltalk.addMethod(
  2998. smalltalk.method({
  2999. selector: "samplesDo:",
  3000. protocol: 'fixture',
  3001. fn: function (aBlock){
  3002. var self=this;
  3003. return smalltalk.withContext(function($ctx1) {
  3004. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3005. _st(aBlock)._value_value_(true,(3));
  3006. $ctx1.sendIdx["value:value:"]=1;
  3007. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3008. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3009. args: ["aBlock"],
  3010. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3011. messageSends: ["samplesDo:", "value:value:", "@"],
  3012. referencedClasses: []
  3013. }),
  3014. smalltalk.DictionaryTest);
  3015. smalltalk.addMethod(
  3016. smalltalk.method({
  3017. selector: "testAccessing",
  3018. protocol: 'tests',
  3019. fn: function (){
  3020. var self=this;
  3021. var d;
  3022. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3023. return smalltalk.withContext(function($ctx1) {
  3024. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3025. d=_st($Dictionary())._new();
  3026. _st(d)._at_put_("hello","world");
  3027. $ctx1.sendIdx["at:put:"]=1;
  3028. $1=_st(d)._at_("hello");
  3029. $ctx1.sendIdx["at:"]=1;
  3030. self._assert_equals_($1,"world");
  3031. $ctx1.sendIdx["assert:equals:"]=1;
  3032. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3033. return smalltalk.withContext(function($ctx2) {
  3034. return nil;
  3035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3036. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3037. self._assert_equals_($2,"world");
  3038. $ctx1.sendIdx["assert:equals:"]=2;
  3039. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3040. return smalltalk.withContext(function($ctx2) {
  3041. return nil;
  3042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3043. $ctx1.sendIdx["deny:"]=1;
  3044. $3=_st(d)._includesKey_("hello");
  3045. $ctx1.sendIdx["includesKey:"]=1;
  3046. self._assert_($3);
  3047. $ctx1.sendIdx["assert:"]=1;
  3048. $4=_st(d)._includesKey_("foo");
  3049. $ctx1.sendIdx["includesKey:"]=2;
  3050. self._deny_($4);
  3051. $ctx1.sendIdx["deny:"]=2;
  3052. _st(d)._at_put_((1),(2));
  3053. $ctx1.sendIdx["at:put:"]=2;
  3054. $5=_st(d)._at_((1));
  3055. $ctx1.sendIdx["at:"]=2;
  3056. self._assert_equals_($5,(2));
  3057. $ctx1.sendIdx["assert:equals:"]=3;
  3058. $6=d;
  3059. $7=(1).__at((3));
  3060. $ctx1.sendIdx["@"]=1;
  3061. _st($6)._at_put_($7,(3));
  3062. $9=d;
  3063. $10=(1).__at((3));
  3064. $ctx1.sendIdx["@"]=2;
  3065. $8=_st($9)._at_($10);
  3066. self._assert_equals_($8,(3));
  3067. $12=d;
  3068. $13=(1).__at((3));
  3069. $ctx1.sendIdx["@"]=3;
  3070. $11=_st($12)._includesKey_($13);
  3071. $ctx1.sendIdx["includesKey:"]=3;
  3072. self._assert_($11);
  3073. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3074. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3075. args: [],
  3076. 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)",
  3077. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3078. referencedClasses: ["Dictionary"]
  3079. }),
  3080. smalltalk.DictionaryTest);
  3081. smalltalk.addMethod(
  3082. smalltalk.method({
  3083. selector: "testAsHashedCollection",
  3084. protocol: 'tests',
  3085. fn: function (){
  3086. var self=this;
  3087. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3088. return smalltalk.withContext(function($ctx1) {
  3089. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3090. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3091. args: [],
  3092. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3093. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3094. referencedClasses: ["HashedCollection"]
  3095. }),
  3096. smalltalk.DictionaryTest);
  3097. smalltalk.addMethod(
  3098. smalltalk.method({
  3099. selector: "testDynamicDictionaries",
  3100. protocol: 'tests',
  3101. fn: function (){
  3102. var self=this;
  3103. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3104. return smalltalk.withContext(function($ctx1) {
  3105. var $3,$2,$1;
  3106. $3="hello".__minus_gt((1));
  3107. $ctx1.sendIdx["->"]=1;
  3108. $2=smalltalk.HashedCollection._from_([$3]);
  3109. $1=_st($2)._asDictionary();
  3110. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3111. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3112. args: [],
  3113. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3114. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3115. referencedClasses: ["Dictionary"]
  3116. }),
  3117. smalltalk.DictionaryTest);
  3118. smalltalk.addMethod(
  3119. smalltalk.method({
  3120. selector: "testEquality",
  3121. protocol: 'tests',
  3122. fn: function (){
  3123. var self=this;
  3124. var d1,d2;
  3125. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3126. return smalltalk.withContext(function($ctx1) {
  3127. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3128. $2=_st($Dictionary())._new();
  3129. $ctx1.sendIdx["new"]=1;
  3130. $3=_st($Dictionary())._new();
  3131. $ctx1.sendIdx["new"]=2;
  3132. $1=_st($2).__eq($3);
  3133. $ctx1.sendIdx["="]=1;
  3134. self._assert_($1);
  3135. $ctx1.sendIdx["assert:"]=1;
  3136. $4=_st($Dictionary())._new();
  3137. $ctx1.sendIdx["new"]=3;
  3138. _st($4)._at_put_((1),(2));
  3139. $ctx1.sendIdx["at:put:"]=1;
  3140. $5=_st($4)._yourself();
  3141. $ctx1.sendIdx["yourself"]=1;
  3142. d1=$5;
  3143. $6=_st($Dictionary())._new();
  3144. $ctx1.sendIdx["new"]=4;
  3145. _st($6)._at_put_((1),(2));
  3146. $ctx1.sendIdx["at:put:"]=2;
  3147. $7=_st($6)._yourself();
  3148. $ctx1.sendIdx["yourself"]=2;
  3149. d2=$7;
  3150. $8=_st(d1).__eq(d2);
  3151. $ctx1.sendIdx["="]=2;
  3152. self._assert_($8);
  3153. $9=_st($Dictionary())._new();
  3154. $ctx1.sendIdx["new"]=5;
  3155. _st($9)._at_put_((1),(3));
  3156. $ctx1.sendIdx["at:put:"]=3;
  3157. $10=_st($9)._yourself();
  3158. $ctx1.sendIdx["yourself"]=3;
  3159. d2=$10;
  3160. $11=_st(d1).__eq(d2);
  3161. $ctx1.sendIdx["="]=3;
  3162. self._deny_($11);
  3163. $ctx1.sendIdx["deny:"]=1;
  3164. $12=_st($Dictionary())._new();
  3165. $ctx1.sendIdx["new"]=6;
  3166. _st($12)._at_put_((2),(2));
  3167. $ctx1.sendIdx["at:put:"]=4;
  3168. $13=_st($12)._yourself();
  3169. $ctx1.sendIdx["yourself"]=4;
  3170. d2=$13;
  3171. $14=_st(d1).__eq(d2);
  3172. $ctx1.sendIdx["="]=4;
  3173. self._deny_($14);
  3174. $ctx1.sendIdx["deny:"]=2;
  3175. $15=_st($Dictionary())._new();
  3176. _st($15)._at_put_((1),(2));
  3177. $ctx1.sendIdx["at:put:"]=5;
  3178. _st($15)._at_put_((3),(4));
  3179. $16=_st($15)._yourself();
  3180. d2=$16;
  3181. self._deny_(_st(d1).__eq(d2));
  3182. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3183. args: [],
  3184. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  3185. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3186. referencedClasses: ["Dictionary"]
  3187. }),
  3188. smalltalk.DictionaryTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "testKeys",
  3192. protocol: 'tests',
  3193. fn: function (){
  3194. var self=this;
  3195. var d;
  3196. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3197. return smalltalk.withContext(function($ctx1) {
  3198. d=_st($Dictionary())._new();
  3199. _st(d)._at_put_((1),(2));
  3200. $ctx1.sendIdx["at:put:"]=1;
  3201. _st(d)._at_put_((2),(3));
  3202. $ctx1.sendIdx["at:put:"]=2;
  3203. _st(d)._at_put_((3),(4));
  3204. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3205. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3206. args: [],
  3207. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  3208. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3209. referencedClasses: ["Dictionary"]
  3210. }),
  3211. smalltalk.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "testPointKey",
  3215. protocol: 'tests',
  3216. fn: function (){
  3217. var self=this;
  3218. var d;
  3219. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3220. return smalltalk.withContext(function($ctx1) {
  3221. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3222. d=_st($Dictionary())._new();
  3223. $1=d;
  3224. $2=(1).__at((1));
  3225. $ctx1.sendIdx["@"]=1;
  3226. _st($1)._at_put_($2,"foo");
  3227. $ctx1.sendIdx["at:put:"]=1;
  3228. $4=d;
  3229. $5=(1).__at((1));
  3230. $ctx1.sendIdx["@"]=2;
  3231. $3=_st($4)._at_($5);
  3232. $ctx1.sendIdx["at:"]=1;
  3233. self._assert_equals_($3,"foo");
  3234. $ctx1.sendIdx["assert:equals:"]=1;
  3235. $6=d;
  3236. $7=(1).__at((1));
  3237. $ctx1.sendIdx["@"]=3;
  3238. _st($6)._at_put_($7,"bar");
  3239. $9=d;
  3240. $10=(1).__at((1));
  3241. $ctx1.sendIdx["@"]=4;
  3242. $8=_st($9)._at_($10);
  3243. self._assert_equals_($8,"bar");
  3244. $ctx1.sendIdx["assert:equals:"]=2;
  3245. $11=d;
  3246. $12=(1).__at((1));
  3247. $ctx1.sendIdx["@"]=5;
  3248. _st($11)._removeKey_($12);
  3249. $14=d;
  3250. $15=(1).__at((1));
  3251. $ctx1.sendIdx["@"]=6;
  3252. $13=_st($14)._at_ifAbsent_($15,(function(){
  3253. return smalltalk.withContext(function($ctx2) {
  3254. return "baz";
  3255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3256. self._assert_equals_($13,"baz");
  3257. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3258. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3259. args: [],
  3260. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  3261. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3262. referencedClasses: ["Dictionary"]
  3263. }),
  3264. smalltalk.DictionaryTest);
  3265. smalltalk.addMethod(
  3266. smalltalk.method({
  3267. selector: "testPrintString",
  3268. protocol: 'tests',
  3269. fn: function (){
  3270. var self=this;
  3271. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3272. return smalltalk.withContext(function($ctx1) {
  3273. var $2,$3,$1;
  3274. $2=_st($Dictionary())._new();
  3275. _st($2)._at_put_("firstname","James");
  3276. $ctx1.sendIdx["at:put:"]=1;
  3277. _st($2)._at_put_("lastname","Bond");
  3278. $3=_st($2)._printString();
  3279. $1=$3;
  3280. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3281. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3282. args: [],
  3283. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3284. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3285. referencedClasses: ["Dictionary"]
  3286. }),
  3287. smalltalk.DictionaryTest);
  3288. smalltalk.addMethod(
  3289. smalltalk.method({
  3290. selector: "testRemoveKey",
  3291. protocol: 'tests',
  3292. fn: function (){
  3293. var self=this;
  3294. var d,key;
  3295. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3296. return smalltalk.withContext(function($ctx1) {
  3297. var $1;
  3298. d=_st($Dictionary())._new();
  3299. _st(d)._at_put_((1),(2));
  3300. $ctx1.sendIdx["at:put:"]=1;
  3301. _st(d)._at_put_((2),(3));
  3302. $ctx1.sendIdx["at:put:"]=2;
  3303. _st(d)._at_put_((3),(4));
  3304. key=(2);
  3305. $1=_st(d)._keys();
  3306. $ctx1.sendIdx["keys"]=1;
  3307. self._assert_equals_($1,[(1), (2), (3)]);
  3308. $ctx1.sendIdx["assert:equals:"]=1;
  3309. _st(d)._removeKey_(key);
  3310. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3311. $ctx1.sendIdx["assert:equals:"]=2;
  3312. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3313. self._deny_(_st(d)._includesKey_((2)));
  3314. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3315. args: [],
  3316. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3317. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3318. referencedClasses: ["Dictionary"]
  3319. }),
  3320. smalltalk.DictionaryTest);
  3321. smalltalk.addMethod(
  3322. smalltalk.method({
  3323. selector: "testRemoveKeyIfAbsent",
  3324. protocol: 'tests',
  3325. fn: function (){
  3326. var self=this;
  3327. var d,key;
  3328. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3329. return smalltalk.withContext(function($ctx1) {
  3330. var $1;
  3331. d=_st($Dictionary())._new();
  3332. _st(d)._at_put_((1),(2));
  3333. $ctx1.sendIdx["at:put:"]=1;
  3334. _st(d)._at_put_((2),(3));
  3335. $ctx1.sendIdx["at:put:"]=2;
  3336. _st(d)._at_put_((3),(4));
  3337. key=(2);
  3338. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3339. $ctx1.sendIdx["assert:equals:"]=1;
  3340. key=(3);
  3341. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3342. return smalltalk.withContext(function($ctx2) {
  3343. return (42);
  3344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3345. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3346. self._assert_equals_($1,(4));
  3347. $ctx1.sendIdx["assert:equals:"]=2;
  3348. key="why";
  3349. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3350. return smalltalk.withContext(function($ctx2) {
  3351. return (42);
  3352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3353. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3354. args: [],
  3355. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3356. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3357. referencedClasses: ["Dictionary"]
  3358. }),
  3359. smalltalk.DictionaryTest);
  3360. smalltalk.addMethod(
  3361. smalltalk.method({
  3362. selector: "testValues",
  3363. protocol: 'tests',
  3364. fn: function (){
  3365. var self=this;
  3366. var d;
  3367. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3368. return smalltalk.withContext(function($ctx1) {
  3369. d=_st($Dictionary())._new();
  3370. _st(d)._at_put_((1),(2));
  3371. $ctx1.sendIdx["at:put:"]=1;
  3372. _st(d)._at_put_((2),(3));
  3373. $ctx1.sendIdx["at:put:"]=2;
  3374. _st(d)._at_put_((3),(4));
  3375. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3376. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3377. args: [],
  3378. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3379. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3380. referencedClasses: ["Dictionary"]
  3381. }),
  3382. smalltalk.DictionaryTest);
  3383. smalltalk.addMethod(
  3384. smalltalk.method({
  3385. selector: "collectionClass",
  3386. protocol: 'fixture',
  3387. fn: function (){
  3388. var self=this;
  3389. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3390. return smalltalk.withContext(function($ctx1) {
  3391. return $Dictionary();
  3392. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3393. args: [],
  3394. source: "collectionClass\x0a\x09^ Dictionary",
  3395. messageSends: [],
  3396. referencedClasses: ["Dictionary"]
  3397. }),
  3398. smalltalk.DictionaryTest.klass);
  3399. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3400. smalltalk.addMethod(
  3401. smalltalk.method({
  3402. selector: "collectionFirst",
  3403. protocol: 'fixture',
  3404. fn: function (){
  3405. var self=this;
  3406. return smalltalk.withContext(function($ctx1) {
  3407. self._subclassResponsibility();
  3408. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3409. args: [],
  3410. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3411. messageSends: ["subclassResponsibility"],
  3412. referencedClasses: []
  3413. }),
  3414. smalltalk.SequenceableCollectionTest);
  3415. smalltalk.addMethod(
  3416. smalltalk.method({
  3417. selector: "collectionFirstTwo",
  3418. protocol: 'fixture',
  3419. fn: function (){
  3420. var self=this;
  3421. return smalltalk.withContext(function($ctx1) {
  3422. self._subclassResponsibility();
  3423. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3424. args: [],
  3425. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3426. messageSends: ["subclassResponsibility"],
  3427. referencedClasses: []
  3428. }),
  3429. smalltalk.SequenceableCollectionTest);
  3430. smalltalk.addMethod(
  3431. smalltalk.method({
  3432. selector: "collectionLast",
  3433. protocol: 'fixture',
  3434. fn: function (){
  3435. var self=this;
  3436. return smalltalk.withContext(function($ctx1) {
  3437. self._subclassResponsibility();
  3438. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3439. args: [],
  3440. source: "collectionLast\x0a\x09self subclassResponsibility",
  3441. messageSends: ["subclassResponsibility"],
  3442. referencedClasses: []
  3443. }),
  3444. smalltalk.SequenceableCollectionTest);
  3445. smalltalk.addMethod(
  3446. smalltalk.method({
  3447. selector: "collectionLastTwo",
  3448. protocol: 'fixture',
  3449. fn: function (){
  3450. var self=this;
  3451. return smalltalk.withContext(function($ctx1) {
  3452. self._subclassResponsibility();
  3453. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3454. args: [],
  3455. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3456. messageSends: ["subclassResponsibility"],
  3457. referencedClasses: []
  3458. }),
  3459. smalltalk.SequenceableCollectionTest);
  3460. smalltalk.addMethod(
  3461. smalltalk.method({
  3462. selector: "nonIndexesDo:",
  3463. protocol: 'fixture',
  3464. fn: function (aBlock){
  3465. var self=this;
  3466. return smalltalk.withContext(function($ctx1) {
  3467. _st(aBlock)._value_((0));
  3468. $ctx1.sendIdx["value:"]=1;
  3469. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3470. $ctx1.sendIdx["value:"]=2;
  3471. _st(aBlock)._value_("z");
  3472. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3473. args: ["aBlock"],
  3474. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3475. messageSends: ["value:", "+", "collectionSize"],
  3476. referencedClasses: []
  3477. }),
  3478. smalltalk.SequenceableCollectionTest);
  3479. smalltalk.addMethod(
  3480. smalltalk.method({
  3481. selector: "samplesDo:",
  3482. protocol: 'fixture',
  3483. fn: function (aBlock){
  3484. var self=this;
  3485. return smalltalk.withContext(function($ctx1) {
  3486. _st(aBlock)._value_value_((1),self._collectionFirst());
  3487. $ctx1.sendIdx["value:value:"]=1;
  3488. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3489. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3490. args: ["aBlock"],
  3491. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3492. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3493. referencedClasses: []
  3494. }),
  3495. smalltalk.SequenceableCollectionTest);
  3496. smalltalk.addMethod(
  3497. smalltalk.method({
  3498. selector: "testBeginsWith",
  3499. protocol: 'tests',
  3500. fn: function (){
  3501. var self=this;
  3502. return smalltalk.withContext(function($ctx1) {
  3503. var $2,$1,$4,$5,$3,$7,$6;
  3504. $2=self._collection();
  3505. $ctx1.sendIdx["collection"]=1;
  3506. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3507. $ctx1.sendIdx["beginsWith:"]=1;
  3508. self._assert_($1);
  3509. $ctx1.sendIdx["assert:"]=1;
  3510. $4=self._collection();
  3511. $ctx1.sendIdx["collection"]=2;
  3512. $5=self._collection();
  3513. $ctx1.sendIdx["collection"]=3;
  3514. $3=_st($4)._beginsWith_($5);
  3515. $ctx1.sendIdx["beginsWith:"]=2;
  3516. self._assert_($3);
  3517. $ctx1.sendIdx["assert:"]=2;
  3518. $7=self._collection();
  3519. $ctx1.sendIdx["collection"]=4;
  3520. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3521. $ctx1.sendIdx["beginsWith:"]=3;
  3522. self._assert_($6);
  3523. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3524. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3525. args: [],
  3526. 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)",
  3527. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3528. referencedClasses: []
  3529. }),
  3530. smalltalk.SequenceableCollectionTest);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "testEndsWith",
  3534. protocol: 'tests',
  3535. fn: function (){
  3536. var self=this;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. var $2,$1,$4,$5,$3,$7,$6;
  3539. $2=self._collection();
  3540. $ctx1.sendIdx["collection"]=1;
  3541. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3542. $ctx1.sendIdx["endsWith:"]=1;
  3543. self._assert_($1);
  3544. $ctx1.sendIdx["assert:"]=1;
  3545. $4=self._collection();
  3546. $ctx1.sendIdx["collection"]=2;
  3547. $5=self._collection();
  3548. $ctx1.sendIdx["collection"]=3;
  3549. $3=_st($4)._endsWith_($5);
  3550. $ctx1.sendIdx["endsWith:"]=2;
  3551. self._assert_($3);
  3552. $ctx1.sendIdx["assert:"]=2;
  3553. $7=self._collection();
  3554. $ctx1.sendIdx["collection"]=4;
  3555. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3556. $ctx1.sendIdx["endsWith:"]=3;
  3557. self._assert_($6);
  3558. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3559. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3560. args: [],
  3561. 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)",
  3562. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3563. referencedClasses: []
  3564. }),
  3565. smalltalk.SequenceableCollectionTest);
  3566. smalltalk.addMethod(
  3567. smalltalk.method({
  3568. selector: "testFirst",
  3569. protocol: 'tests',
  3570. fn: function (){
  3571. var self=this;
  3572. return smalltalk.withContext(function($ctx1) {
  3573. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3574. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3575. args: [],
  3576. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3577. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3578. referencedClasses: []
  3579. }),
  3580. smalltalk.SequenceableCollectionTest);
  3581. smalltalk.addMethod(
  3582. smalltalk.method({
  3583. selector: "testFirstN",
  3584. protocol: 'tests',
  3585. fn: function (){
  3586. var self=this;
  3587. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3588. return smalltalk.withContext(function($ctx1) {
  3589. var $2,$1,$4,$3,$6,$5,$7;
  3590. $2=self._collection();
  3591. $ctx1.sendIdx["collection"]=1;
  3592. $1=_st($2)._first_((2));
  3593. $ctx1.sendIdx["first:"]=1;
  3594. self._assert_equals_($1,self._collectionFirstTwo());
  3595. $ctx1.sendIdx["assert:equals:"]=1;
  3596. $4=self._collection();
  3597. $ctx1.sendIdx["collection"]=2;
  3598. $3=_st($4)._first_((0));
  3599. $ctx1.sendIdx["first:"]=2;
  3600. self._assert_equals_($3,_st(self._collectionClass())._new());
  3601. $ctx1.sendIdx["assert:equals:"]=2;
  3602. $6=self._collection();
  3603. $ctx1.sendIdx["collection"]=3;
  3604. $5=_st($6)._first_(self._collectionSize());
  3605. $ctx1.sendIdx["first:"]=3;
  3606. $7=self._collection();
  3607. $ctx1.sendIdx["collection"]=4;
  3608. self._assert_equals_($5,$7);
  3609. self._should_raise_((function(){
  3610. return smalltalk.withContext(function($ctx2) {
  3611. return _st(self._collection())._first_((33));
  3612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3613. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3614. args: [],
  3615. 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",
  3616. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3617. referencedClasses: ["Error"]
  3618. }),
  3619. smalltalk.SequenceableCollectionTest);
  3620. smalltalk.addMethod(
  3621. smalltalk.method({
  3622. selector: "testFourth",
  3623. protocol: 'tests',
  3624. fn: function (){
  3625. var self=this;
  3626. return smalltalk.withContext(function($ctx1) {
  3627. var $2,$1;
  3628. $2=self._collection();
  3629. $ctx1.sendIdx["collection"]=1;
  3630. $1=_st($2)._fourth();
  3631. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3632. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3633. args: [],
  3634. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3635. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3636. referencedClasses: []
  3637. }),
  3638. smalltalk.SequenceableCollectionTest);
  3639. smalltalk.addMethod(
  3640. smalltalk.method({
  3641. selector: "testLast",
  3642. protocol: 'tests',
  3643. fn: function (){
  3644. var self=this;
  3645. return smalltalk.withContext(function($ctx1) {
  3646. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3647. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3648. args: [],
  3649. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3650. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3651. referencedClasses: []
  3652. }),
  3653. smalltalk.SequenceableCollectionTest);
  3654. smalltalk.addMethod(
  3655. smalltalk.method({
  3656. selector: "testLastN",
  3657. protocol: 'tests',
  3658. fn: function (){
  3659. var self=this;
  3660. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3661. return smalltalk.withContext(function($ctx1) {
  3662. var $2,$1,$4,$3,$6,$5,$7;
  3663. $2=self._collection();
  3664. $ctx1.sendIdx["collection"]=1;
  3665. $1=_st($2)._last_((2));
  3666. $ctx1.sendIdx["last:"]=1;
  3667. self._assert_equals_($1,self._collectionLastTwo());
  3668. $ctx1.sendIdx["assert:equals:"]=1;
  3669. $4=self._collection();
  3670. $ctx1.sendIdx["collection"]=2;
  3671. $3=_st($4)._last_((0));
  3672. $ctx1.sendIdx["last:"]=2;
  3673. self._assert_equals_($3,_st(self._collectionClass())._new());
  3674. $ctx1.sendIdx["assert:equals:"]=2;
  3675. $6=self._collection();
  3676. $ctx1.sendIdx["collection"]=3;
  3677. $5=_st($6)._last_(self._collectionSize());
  3678. $ctx1.sendIdx["last:"]=3;
  3679. $7=self._collection();
  3680. $ctx1.sendIdx["collection"]=4;
  3681. self._assert_equals_($5,$7);
  3682. self._should_raise_((function(){
  3683. return smalltalk.withContext(function($ctx2) {
  3684. return _st(self._collection())._last_((33));
  3685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3686. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3687. args: [],
  3688. 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",
  3689. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3690. referencedClasses: ["Error"]
  3691. }),
  3692. smalltalk.SequenceableCollectionTest);
  3693. smalltalk.addMethod(
  3694. smalltalk.method({
  3695. selector: "testSecond",
  3696. protocol: 'tests',
  3697. fn: function (){
  3698. var self=this;
  3699. return smalltalk.withContext(function($ctx1) {
  3700. var $2,$1;
  3701. $2=self._collection();
  3702. $ctx1.sendIdx["collection"]=1;
  3703. $1=_st($2)._second();
  3704. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3705. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3706. args: [],
  3707. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3708. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3709. referencedClasses: []
  3710. }),
  3711. smalltalk.SequenceableCollectionTest);
  3712. smalltalk.addMethod(
  3713. smalltalk.method({
  3714. selector: "testThird",
  3715. protocol: 'tests',
  3716. fn: function (){
  3717. var self=this;
  3718. return smalltalk.withContext(function($ctx1) {
  3719. var $2,$1;
  3720. $2=self._collection();
  3721. $ctx1.sendIdx["collection"]=1;
  3722. $1=_st($2)._third();
  3723. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3724. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3725. args: [],
  3726. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3727. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3728. referencedClasses: []
  3729. }),
  3730. smalltalk.SequenceableCollectionTest);
  3731. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3732. smalltalk.addMethod(
  3733. smalltalk.method({
  3734. selector: "collection",
  3735. protocol: 'fixture',
  3736. fn: function (){
  3737. var self=this;
  3738. return smalltalk.withContext(function($ctx1) {
  3739. var $1;
  3740. $1=[(1), (2), (3), (-4)];
  3741. return $1;
  3742. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3743. args: [],
  3744. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3745. messageSends: [],
  3746. referencedClasses: []
  3747. }),
  3748. smalltalk.ArrayTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "collectionFirst",
  3752. protocol: 'fixture',
  3753. fn: function (){
  3754. var self=this;
  3755. return smalltalk.withContext(function($ctx1) {
  3756. return (1);
  3757. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3758. args: [],
  3759. source: "collectionFirst\x0a\x09^ 1",
  3760. messageSends: [],
  3761. referencedClasses: []
  3762. }),
  3763. smalltalk.ArrayTest);
  3764. smalltalk.addMethod(
  3765. smalltalk.method({
  3766. selector: "collectionFirstTwo",
  3767. protocol: 'fixture',
  3768. fn: function (){
  3769. var self=this;
  3770. return smalltalk.withContext(function($ctx1) {
  3771. var $1;
  3772. $1=[(1), (2)];
  3773. return $1;
  3774. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3775. args: [],
  3776. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3777. messageSends: [],
  3778. referencedClasses: []
  3779. }),
  3780. smalltalk.ArrayTest);
  3781. smalltalk.addMethod(
  3782. smalltalk.method({
  3783. selector: "collectionLast",
  3784. protocol: 'fixture',
  3785. fn: function (){
  3786. var self=this;
  3787. return smalltalk.withContext(function($ctx1) {
  3788. return (-4);
  3789. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3790. args: [],
  3791. source: "collectionLast\x0a\x09^ -4",
  3792. messageSends: [],
  3793. referencedClasses: []
  3794. }),
  3795. smalltalk.ArrayTest);
  3796. smalltalk.addMethod(
  3797. smalltalk.method({
  3798. selector: "collectionLastTwo",
  3799. protocol: 'fixture',
  3800. fn: function (){
  3801. var self=this;
  3802. return smalltalk.withContext(function($ctx1) {
  3803. var $1;
  3804. $1=[(3), (-4)];
  3805. return $1;
  3806. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3807. args: [],
  3808. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3809. messageSends: [],
  3810. referencedClasses: []
  3811. }),
  3812. smalltalk.ArrayTest);
  3813. smalltalk.addMethod(
  3814. smalltalk.method({
  3815. selector: "collectionOfPrintStrings",
  3816. protocol: 'fixture',
  3817. fn: function (){
  3818. var self=this;
  3819. return smalltalk.withContext(function($ctx1) {
  3820. var $1;
  3821. $1=["1", "2", "3", "-4"];
  3822. return $1;
  3823. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3824. args: [],
  3825. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3826. messageSends: [],
  3827. referencedClasses: []
  3828. }),
  3829. smalltalk.ArrayTest);
  3830. smalltalk.addMethod(
  3831. smalltalk.method({
  3832. selector: "collectionSize",
  3833. protocol: 'fixture',
  3834. fn: function (){
  3835. var self=this;
  3836. return smalltalk.withContext(function($ctx1) {
  3837. return (4);
  3838. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3839. args: [],
  3840. source: "collectionSize\x0a\x09^ 4",
  3841. messageSends: [],
  3842. referencedClasses: []
  3843. }),
  3844. smalltalk.ArrayTest);
  3845. smalltalk.addMethod(
  3846. smalltalk.method({
  3847. selector: "collectionWithDuplicates",
  3848. protocol: 'fixture',
  3849. fn: function (){
  3850. var self=this;
  3851. return smalltalk.withContext(function($ctx1) {
  3852. var $1;
  3853. $1=["a", "b", "c", (1), (2), (1), "a"];
  3854. return $1;
  3855. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3856. args: [],
  3857. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3858. messageSends: [],
  3859. referencedClasses: []
  3860. }),
  3861. smalltalk.ArrayTest);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "collectionWithNewValue",
  3865. protocol: 'fixture',
  3866. fn: function (){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. var $1;
  3870. $1=[(1), (2), (3), (-4), "N"];
  3871. return $1;
  3872. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3873. args: [],
  3874. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3875. messageSends: [],
  3876. referencedClasses: []
  3877. }),
  3878. smalltalk.ArrayTest);
  3879. smalltalk.addMethod(
  3880. smalltalk.method({
  3881. selector: "sampleNewIndex",
  3882. protocol: 'fixture',
  3883. fn: function (){
  3884. var self=this;
  3885. return smalltalk.withContext(function($ctx1) {
  3886. return (5);
  3887. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3888. args: [],
  3889. source: "sampleNewIndex\x0a\x09^ 5",
  3890. messageSends: [],
  3891. referencedClasses: []
  3892. }),
  3893. smalltalk.ArrayTest);
  3894. smalltalk.addMethod(
  3895. smalltalk.method({
  3896. selector: "samplesDo:",
  3897. protocol: 'fixture',
  3898. fn: function (aBlock){
  3899. var self=this;
  3900. return smalltalk.withContext(function($ctx1) {
  3901. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3902. _st(aBlock)._value_value_((3),(3));
  3903. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3904. args: ["aBlock"],
  3905. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3906. messageSends: ["samplesDo:", "value:value:"],
  3907. referencedClasses: []
  3908. }),
  3909. smalltalk.ArrayTest);
  3910. smalltalk.addMethod(
  3911. smalltalk.method({
  3912. selector: "testAdd",
  3913. protocol: 'tests',
  3914. fn: function (){
  3915. var self=this;
  3916. var array;
  3917. return smalltalk.withContext(function($ctx1) {
  3918. array=self._collection();
  3919. _st(array)._add_((6));
  3920. self._assert_equals_(_st(array)._last(),(6));
  3921. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3922. args: [],
  3923. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3924. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3925. referencedClasses: []
  3926. }),
  3927. smalltalk.ArrayTest);
  3928. smalltalk.addMethod(
  3929. smalltalk.method({
  3930. selector: "testAddFirst",
  3931. protocol: 'tests',
  3932. fn: function (){
  3933. var self=this;
  3934. return smalltalk.withContext(function($ctx1) {
  3935. var $1,$2;
  3936. $1=self._collection();
  3937. _st($1)._addFirst_((0));
  3938. $2=_st($1)._yourself();
  3939. self._assert_equals_(_st($2)._first(),(0));
  3940. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3941. args: [],
  3942. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3943. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3944. referencedClasses: []
  3945. }),
  3946. smalltalk.ArrayTest);
  3947. smalltalk.addMethod(
  3948. smalltalk.method({
  3949. selector: "testPrintString",
  3950. protocol: 'tests',
  3951. fn: function (){
  3952. var self=this;
  3953. var array;
  3954. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3955. return smalltalk.withContext(function($ctx1) {
  3956. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3957. array=_st($Array())._new();
  3958. $1=_st(array)._printString();
  3959. $ctx1.sendIdx["printString"]=1;
  3960. self._assert_equals_($1,"an Array ()");
  3961. $ctx1.sendIdx["assert:equals:"]=1;
  3962. $2=array;
  3963. _st($2)._add_((1));
  3964. $ctx1.sendIdx["add:"]=1;
  3965. $3=_st($2)._add_((3));
  3966. $ctx1.sendIdx["add:"]=2;
  3967. $4=_st(array)._printString();
  3968. $ctx1.sendIdx["printString"]=2;
  3969. self._assert_equals_($4,"an Array (1 3)");
  3970. $ctx1.sendIdx["assert:equals:"]=2;
  3971. _st(array)._add_("foo");
  3972. $5=_st(array)._printString();
  3973. $ctx1.sendIdx["printString"]=3;
  3974. self._assert_equals_($5,"an Array (1 3 'foo')");
  3975. $ctx1.sendIdx["assert:equals:"]=3;
  3976. $6=array;
  3977. _st($6)._remove_((1));
  3978. $ctx1.sendIdx["remove:"]=1;
  3979. $7=_st($6)._remove_((3));
  3980. $8=_st(array)._printString();
  3981. $ctx1.sendIdx["printString"]=4;
  3982. self._assert_equals_($8,"an Array ('foo')");
  3983. $ctx1.sendIdx["assert:equals:"]=4;
  3984. _st(array)._addLast_((3));
  3985. $ctx1.sendIdx["addLast:"]=1;
  3986. $9=_st(array)._printString();
  3987. $ctx1.sendIdx["printString"]=5;
  3988. self._assert_equals_($9,"an Array ('foo' 3)");
  3989. $ctx1.sendIdx["assert:equals:"]=5;
  3990. _st(array)._addLast_((3));
  3991. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3992. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3993. args: [],
  3994. 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)'.",
  3995. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3996. referencedClasses: ["Array"]
  3997. }),
  3998. smalltalk.ArrayTest);
  3999. smalltalk.addMethod(
  4000. smalltalk.method({
  4001. selector: "testRemove",
  4002. protocol: 'tests',
  4003. fn: function (){
  4004. var self=this;
  4005. var array;
  4006. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4007. return smalltalk.withContext(function($ctx1) {
  4008. array=[(1), (2), (3), (4), (5)];
  4009. _st(array)._remove_((3));
  4010. $ctx1.sendIdx["remove:"]=1;
  4011. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4012. self._should_raise_((function(){
  4013. return smalltalk.withContext(function($ctx2) {
  4014. return _st(array)._remove_((3));
  4015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4016. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4017. args: [],
  4018. 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",
  4019. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4020. referencedClasses: ["Error"]
  4021. }),
  4022. smalltalk.ArrayTest);
  4023. smalltalk.addMethod(
  4024. smalltalk.method({
  4025. selector: "testRemoveFromTo",
  4026. protocol: 'tests',
  4027. fn: function (){
  4028. var self=this;
  4029. return smalltalk.withContext(function($ctx1) {
  4030. var $1,$2;
  4031. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4032. $ctx1.sendIdx["removeFrom:to:"]=1;
  4033. self._assert_equals_($1,[(4)]);
  4034. $ctx1.sendIdx["assert:equals:"]=1;
  4035. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4036. $ctx1.sendIdx["removeFrom:to:"]=2;
  4037. self._assert_equals_($2,[(1), (4)]);
  4038. $ctx1.sendIdx["assert:equals:"]=2;
  4039. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4040. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4041. args: [],
  4042. 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)",
  4043. messageSends: ["assert:equals:", "removeFrom:to:"],
  4044. referencedClasses: []
  4045. }),
  4046. smalltalk.ArrayTest);
  4047. smalltalk.addMethod(
  4048. smalltalk.method({
  4049. selector: "testRemoveIndex",
  4050. protocol: 'tests',
  4051. fn: function (){
  4052. var self=this;
  4053. return smalltalk.withContext(function($ctx1) {
  4054. var $1,$2;
  4055. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4056. $ctx1.sendIdx["removeIndex:"]=1;
  4057. self._assert_equals_($1,[(1), (3), (4)]);
  4058. $ctx1.sendIdx["assert:equals:"]=1;
  4059. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4060. $ctx1.sendIdx["removeIndex:"]=2;
  4061. self._assert_equals_($2,[(2), (3), (4)]);
  4062. $ctx1.sendIdx["assert:equals:"]=2;
  4063. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4064. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4065. args: [],
  4066. 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: #()",
  4067. messageSends: ["assert:equals:", "removeIndex:"],
  4068. referencedClasses: []
  4069. }),
  4070. smalltalk.ArrayTest);
  4071. smalltalk.addMethod(
  4072. smalltalk.method({
  4073. selector: "testRemoveLast",
  4074. protocol: 'tests',
  4075. fn: function (){
  4076. var self=this;
  4077. var array;
  4078. return smalltalk.withContext(function($ctx1) {
  4079. array=[(1), (2)];
  4080. _st(array)._removeLast();
  4081. self._assert_equals_(_st(array)._last(),(1));
  4082. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4083. args: [],
  4084. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4085. messageSends: ["removeLast", "assert:equals:", "last"],
  4086. referencedClasses: []
  4087. }),
  4088. smalltalk.ArrayTest);
  4089. smalltalk.addMethod(
  4090. smalltalk.method({
  4091. selector: "testReversed",
  4092. protocol: 'tests',
  4093. fn: function (){
  4094. var self=this;
  4095. var array;
  4096. return smalltalk.withContext(function($ctx1) {
  4097. array=[(5), (4), (3), (2), (1)];
  4098. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4099. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4100. args: [],
  4101. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4102. messageSends: ["assert:equals:", "reversed"],
  4103. referencedClasses: []
  4104. }),
  4105. smalltalk.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "testSort",
  4109. protocol: 'tests',
  4110. fn: function (){
  4111. var self=this;
  4112. var array;
  4113. return smalltalk.withContext(function($ctx1) {
  4114. array=[(3), (1), (4), (5), (2)];
  4115. _st(array)._sort();
  4116. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4117. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4118. args: [],
  4119. 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)",
  4120. messageSends: ["sort", "assert:equals:"],
  4121. referencedClasses: []
  4122. }),
  4123. smalltalk.ArrayTest);
  4124. smalltalk.addMethod(
  4125. smalltalk.method({
  4126. selector: "collectionClass",
  4127. protocol: 'fixture',
  4128. fn: function (){
  4129. var self=this;
  4130. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4131. return smalltalk.withContext(function($ctx1) {
  4132. return $Array();
  4133. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4134. args: [],
  4135. source: "collectionClass\x0a\x09^ Array",
  4136. messageSends: [],
  4137. referencedClasses: ["Array"]
  4138. }),
  4139. smalltalk.ArrayTest.klass);
  4140. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4141. smalltalk.addMethod(
  4142. smalltalk.method({
  4143. selector: "collection",
  4144. protocol: 'fixture',
  4145. fn: function (){
  4146. var self=this;
  4147. return smalltalk.withContext(function($ctx1) {
  4148. return "hello";
  4149. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4150. args: [],
  4151. source: "collection\x0a\x09^ 'hello'",
  4152. messageSends: [],
  4153. referencedClasses: []
  4154. }),
  4155. smalltalk.StringTest);
  4156. smalltalk.addMethod(
  4157. smalltalk.method({
  4158. selector: "collectionFirst",
  4159. protocol: 'fixture',
  4160. fn: function (){
  4161. var self=this;
  4162. return smalltalk.withContext(function($ctx1) {
  4163. return "h";
  4164. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4165. args: [],
  4166. source: "collectionFirst\x0a\x09^ 'h'",
  4167. messageSends: [],
  4168. referencedClasses: []
  4169. }),
  4170. smalltalk.StringTest);
  4171. smalltalk.addMethod(
  4172. smalltalk.method({
  4173. selector: "collectionFirstTwo",
  4174. protocol: 'fixture',
  4175. fn: function (){
  4176. var self=this;
  4177. return smalltalk.withContext(function($ctx1) {
  4178. return "he";
  4179. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4180. args: [],
  4181. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4182. messageSends: [],
  4183. referencedClasses: []
  4184. }),
  4185. smalltalk.StringTest);
  4186. smalltalk.addMethod(
  4187. smalltalk.method({
  4188. selector: "collectionLast",
  4189. protocol: 'fixture',
  4190. fn: function (){
  4191. var self=this;
  4192. return smalltalk.withContext(function($ctx1) {
  4193. return "o";
  4194. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4195. args: [],
  4196. source: "collectionLast\x0a\x09^ 'o'",
  4197. messageSends: [],
  4198. referencedClasses: []
  4199. }),
  4200. smalltalk.StringTest);
  4201. smalltalk.addMethod(
  4202. smalltalk.method({
  4203. selector: "collectionLastTwo",
  4204. protocol: 'fixture',
  4205. fn: function (){
  4206. var self=this;
  4207. return smalltalk.withContext(function($ctx1) {
  4208. return "lo";
  4209. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4210. args: [],
  4211. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4212. messageSends: [],
  4213. referencedClasses: []
  4214. }),
  4215. smalltalk.StringTest);
  4216. smalltalk.addMethod(
  4217. smalltalk.method({
  4218. selector: "collectionOfPrintStrings",
  4219. protocol: 'fixture',
  4220. fn: function (){
  4221. var self=this;
  4222. return smalltalk.withContext(function($ctx1) {
  4223. return "'h''e''l''l''o'";
  4224. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4225. args: [],
  4226. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4227. messageSends: [],
  4228. referencedClasses: []
  4229. }),
  4230. smalltalk.StringTest);
  4231. smalltalk.addMethod(
  4232. smalltalk.method({
  4233. selector: "collectionSize",
  4234. protocol: 'fixture',
  4235. fn: function (){
  4236. var self=this;
  4237. return smalltalk.withContext(function($ctx1) {
  4238. return (5);
  4239. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4240. args: [],
  4241. source: "collectionSize\x0a\x09^ 5",
  4242. messageSends: [],
  4243. referencedClasses: []
  4244. }),
  4245. smalltalk.StringTest);
  4246. smalltalk.addMethod(
  4247. smalltalk.method({
  4248. selector: "collectionWithDuplicates",
  4249. protocol: 'fixture',
  4250. fn: function (){
  4251. var self=this;
  4252. return smalltalk.withContext(function($ctx1) {
  4253. return "abbaerte";
  4254. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4255. args: [],
  4256. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4257. messageSends: [],
  4258. referencedClasses: []
  4259. }),
  4260. smalltalk.StringTest);
  4261. smalltalk.addMethod(
  4262. smalltalk.method({
  4263. selector: "collectionWithNewValue",
  4264. protocol: 'fixture',
  4265. fn: function (){
  4266. var self=this;
  4267. return smalltalk.withContext(function($ctx1) {
  4268. return "helloN";
  4269. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4270. args: [],
  4271. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4272. messageSends: [],
  4273. referencedClasses: []
  4274. }),
  4275. smalltalk.StringTest);
  4276. smalltalk.addMethod(
  4277. smalltalk.method({
  4278. selector: "sampleNewValueAsCollection",
  4279. protocol: 'fixture',
  4280. fn: function (){
  4281. var self=this;
  4282. return smalltalk.withContext(function($ctx1) {
  4283. return "N";
  4284. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4285. args: [],
  4286. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4287. messageSends: [],
  4288. referencedClasses: []
  4289. }),
  4290. smalltalk.StringTest);
  4291. smalltalk.addMethod(
  4292. smalltalk.method({
  4293. selector: "samplesDo:",
  4294. protocol: 'fixture',
  4295. fn: function (aBlock){
  4296. var self=this;
  4297. return smalltalk.withContext(function($ctx1) {
  4298. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4299. _st(aBlock)._value_value_((3),"l");
  4300. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4301. args: ["aBlock"],
  4302. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4303. messageSends: ["samplesDo:", "value:value:"],
  4304. referencedClasses: []
  4305. }),
  4306. smalltalk.StringTest);
  4307. smalltalk.addMethod(
  4308. smalltalk.method({
  4309. selector: "testAddAll",
  4310. protocol: 'tests',
  4311. fn: function (){
  4312. var self=this;
  4313. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4314. return smalltalk.withContext(function($ctx1) {
  4315. var $1;
  4316. self._should_raise_((function(){
  4317. return smalltalk.withContext(function($ctx2) {
  4318. $1=self._collection();
  4319. $ctx2.sendIdx["collection"]=1;
  4320. return _st($1)._addAll_(self._collection());
  4321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4322. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4323. args: [],
  4324. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4325. messageSends: ["should:raise:", "addAll:", "collection"],
  4326. referencedClasses: ["Error"]
  4327. }),
  4328. smalltalk.StringTest);
  4329. smalltalk.addMethod(
  4330. smalltalk.method({
  4331. selector: "testAddRemove",
  4332. protocol: 'tests',
  4333. fn: function (){
  4334. var self=this;
  4335. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4336. return smalltalk.withContext(function($ctx1) {
  4337. self._should_raise_((function(){
  4338. return smalltalk.withContext(function($ctx2) {
  4339. return "hello"._add_("a");
  4340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4341. $ctx1.sendIdx["should:raise:"]=1;
  4342. self._should_raise_((function(){
  4343. return smalltalk.withContext(function($ctx2) {
  4344. return "hello"._remove_("h");
  4345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4346. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4347. args: [],
  4348. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4349. messageSends: ["should:raise:", "add:", "remove:"],
  4350. referencedClasses: ["Error"]
  4351. }),
  4352. smalltalk.StringTest);
  4353. smalltalk.addMethod(
  4354. smalltalk.method({
  4355. selector: "testAsArray",
  4356. protocol: 'tests',
  4357. fn: function (){
  4358. var self=this;
  4359. return smalltalk.withContext(function($ctx1) {
  4360. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4361. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4362. args: [],
  4363. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4364. messageSends: ["assert:equals:", "asArray"],
  4365. referencedClasses: []
  4366. }),
  4367. smalltalk.StringTest);
  4368. smalltalk.addMethod(
  4369. smalltalk.method({
  4370. selector: "testAsLowerCase",
  4371. protocol: 'tests',
  4372. fn: function (){
  4373. var self=this;
  4374. return smalltalk.withContext(function($ctx1) {
  4375. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4376. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4377. args: [],
  4378. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4379. messageSends: ["assert:equals:", "asLowercase"],
  4380. referencedClasses: []
  4381. }),
  4382. smalltalk.StringTest);
  4383. smalltalk.addMethod(
  4384. smalltalk.method({
  4385. selector: "testAsNumber",
  4386. protocol: 'tests',
  4387. fn: function (){
  4388. var self=this;
  4389. return smalltalk.withContext(function($ctx1) {
  4390. var $1,$2;
  4391. $1="3"._asNumber();
  4392. $ctx1.sendIdx["asNumber"]=1;
  4393. self._assert_equals_($1,(3));
  4394. $ctx1.sendIdx["assert:equals:"]=1;
  4395. $2="-3"._asNumber();
  4396. $ctx1.sendIdx["asNumber"]=2;
  4397. self._assert_equals_($2,(-3));
  4398. $ctx1.sendIdx["assert:equals:"]=2;
  4399. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4400. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4401. args: [],
  4402. 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.",
  4403. messageSends: ["assert:equals:", "asNumber"],
  4404. referencedClasses: []
  4405. }),
  4406. smalltalk.StringTest);
  4407. smalltalk.addMethod(
  4408. smalltalk.method({
  4409. selector: "testAsUpperCase",
  4410. protocol: 'tests',
  4411. fn: function (){
  4412. var self=this;
  4413. return smalltalk.withContext(function($ctx1) {
  4414. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4415. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4416. args: [],
  4417. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4418. messageSends: ["assert:equals:", "asUppercase"],
  4419. referencedClasses: []
  4420. }),
  4421. smalltalk.StringTest);
  4422. smalltalk.addMethod(
  4423. smalltalk.method({
  4424. selector: "testAsciiValue",
  4425. protocol: 'tests',
  4426. fn: function (){
  4427. var self=this;
  4428. var characterA,characterU;
  4429. return smalltalk.withContext(function($ctx1) {
  4430. var $1;
  4431. characterA="A";
  4432. characterU="U";
  4433. $1=_st(characterA)._asciiValue();
  4434. $ctx1.sendIdx["asciiValue"]=1;
  4435. self._assert_equals_($1,(65));
  4436. $ctx1.sendIdx["assert:equals:"]=1;
  4437. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4438. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4439. args: [],
  4440. 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",
  4441. messageSends: ["assert:equals:", "asciiValue"],
  4442. referencedClasses: []
  4443. }),
  4444. smalltalk.StringTest);
  4445. smalltalk.addMethod(
  4446. smalltalk.method({
  4447. selector: "testAtPut",
  4448. protocol: 'tests',
  4449. fn: function (){
  4450. var self=this;
  4451. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4452. return smalltalk.withContext(function($ctx1) {
  4453. self._should_raise_((function(){
  4454. return smalltalk.withContext(function($ctx2) {
  4455. return "hello"._at_put_((1),"a");
  4456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4457. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4458. args: [],
  4459. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4460. messageSends: ["should:raise:", "at:put:"],
  4461. referencedClasses: ["Error"]
  4462. }),
  4463. smalltalk.StringTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "testCapitalized",
  4467. protocol: 'tests',
  4468. fn: function (){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. var $1,$2,$3;
  4472. $1="test"._capitalized();
  4473. $ctx1.sendIdx["capitalized"]=1;
  4474. self._assert_equals_($1,"Test");
  4475. $ctx1.sendIdx["assert:equals:"]=1;
  4476. $2="Test"._capitalized();
  4477. $ctx1.sendIdx["capitalized"]=2;
  4478. self._assert_equals_($2,"Test");
  4479. $ctx1.sendIdx["assert:equals:"]=2;
  4480. self._assert_equals_(""._capitalized(),"");
  4481. $ctx1.sendIdx["assert:equals:"]=3;
  4482. $3="Test"._isCapitalized();
  4483. $ctx1.sendIdx["isCapitalized"]=1;
  4484. self._assert_equals_($3,true);
  4485. $ctx1.sendIdx["assert:equals:"]=4;
  4486. self._assert_equals_("test"._isCapitalized(),false);
  4487. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4488. args: [],
  4489. 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.",
  4490. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4491. referencedClasses: []
  4492. }),
  4493. smalltalk.StringTest);
  4494. smalltalk.addMethod(
  4495. smalltalk.method({
  4496. selector: "testCharCodeAt",
  4497. protocol: 'tests',
  4498. fn: function (){
  4499. var self=this;
  4500. return smalltalk.withContext(function($ctx1) {
  4501. var $1,$2,$3,$4,$5;
  4502. $1="jackie"._charCodeAt_((1));
  4503. $ctx1.sendIdx["charCodeAt:"]=1;
  4504. self._assert_equals_($1,(106));
  4505. $ctx1.sendIdx["assert:equals:"]=1;
  4506. $2="jackie"._charCodeAt_((2));
  4507. $ctx1.sendIdx["charCodeAt:"]=2;
  4508. self._assert_equals_($2,(97));
  4509. $ctx1.sendIdx["assert:equals:"]=2;
  4510. $3="jackie"._charCodeAt_((3));
  4511. $ctx1.sendIdx["charCodeAt:"]=3;
  4512. self._assert_equals_($3,(99));
  4513. $ctx1.sendIdx["assert:equals:"]=3;
  4514. $4="jackie"._charCodeAt_((4));
  4515. $ctx1.sendIdx["charCodeAt:"]=4;
  4516. self._assert_equals_($4,(107));
  4517. $ctx1.sendIdx["assert:equals:"]=4;
  4518. $5="jackie"._charCodeAt_((5));
  4519. $ctx1.sendIdx["charCodeAt:"]=5;
  4520. self._assert_equals_($5,(105));
  4521. $ctx1.sendIdx["assert:equals:"]=5;
  4522. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4523. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4524. args: [],
  4525. 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",
  4526. messageSends: ["assert:equals:", "charCodeAt:"],
  4527. referencedClasses: []
  4528. }),
  4529. smalltalk.StringTest);
  4530. smalltalk.addMethod(
  4531. smalltalk.method({
  4532. selector: "testCopyFromTo",
  4533. protocol: 'tests',
  4534. fn: function (){
  4535. var self=this;
  4536. return smalltalk.withContext(function($ctx1) {
  4537. var $1;
  4538. $1="jackie"._copyFrom_to_((1),(3));
  4539. $ctx1.sendIdx["copyFrom:to:"]=1;
  4540. self._assert_equals_($1,"jac");
  4541. $ctx1.sendIdx["assert:equals:"]=1;
  4542. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4543. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4544. args: [],
  4545. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4546. messageSends: ["assert:equals:", "copyFrom:to:"],
  4547. referencedClasses: []
  4548. }),
  4549. smalltalk.StringTest);
  4550. smalltalk.addMethod(
  4551. smalltalk.method({
  4552. selector: "testCopyWithoutAll",
  4553. protocol: 'tests',
  4554. fn: function (){
  4555. var self=this;
  4556. return smalltalk.withContext(function($ctx1) {
  4557. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4558. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4559. args: [],
  4560. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4561. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4562. referencedClasses: []
  4563. }),
  4564. smalltalk.StringTest);
  4565. smalltalk.addMethod(
  4566. smalltalk.method({
  4567. selector: "testEquality",
  4568. protocol: 'tests',
  4569. fn: function (){
  4570. var self=this;
  4571. return smalltalk.withContext(function($ctx1) {
  4572. var $1,$2,$3;
  4573. self._assert_equals_("hello","hello");
  4574. $ctx1.sendIdx["assert:equals:"]=1;
  4575. $1="hello".__eq("world");
  4576. $ctx1.sendIdx["="]=1;
  4577. self._deny_($1);
  4578. $ctx1.sendIdx["deny:"]=1;
  4579. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4580. return smalltalk.withContext(function($ctx2) {
  4581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4582. $ctx1.sendIdx["="]=2;
  4583. self._deny_($2);
  4584. $ctx1.sendIdx["deny:"]=2;
  4585. $3="hello"._yourself();
  4586. $ctx1.sendIdx["yourself"]=1;
  4587. self._assert_equals_("hello",$3);
  4588. $ctx1.sendIdx["assert:equals:"]=2;
  4589. self._assert_equals_("hello"._yourself(),"hello");
  4590. self._deny_("".__eq((0)));
  4591. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4592. args: [],
  4593. 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",
  4594. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4595. referencedClasses: []
  4596. }),
  4597. smalltalk.StringTest);
  4598. smalltalk.addMethod(
  4599. smalltalk.method({
  4600. selector: "testIdentity",
  4601. protocol: 'tests',
  4602. fn: function (){
  4603. var self=this;
  4604. return smalltalk.withContext(function($ctx1) {
  4605. var $1,$2,$4,$3,$5;
  4606. $1="hello".__eq_eq("hello");
  4607. $ctx1.sendIdx["=="]=1;
  4608. self._assert_($1);
  4609. $ctx1.sendIdx["assert:"]=1;
  4610. $2="hello".__eq_eq("world");
  4611. $ctx1.sendIdx["=="]=2;
  4612. self._deny_($2);
  4613. $ctx1.sendIdx["deny:"]=1;
  4614. $4="hello"._yourself();
  4615. $ctx1.sendIdx["yourself"]=1;
  4616. $3="hello".__eq_eq($4);
  4617. $ctx1.sendIdx["=="]=3;
  4618. self._assert_($3);
  4619. $ctx1.sendIdx["assert:"]=2;
  4620. $5=_st("hello"._yourself()).__eq_eq("hello");
  4621. $ctx1.sendIdx["=="]=4;
  4622. self._assert_($5);
  4623. self._deny_("".__eq_eq((0)));
  4624. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4625. args: [],
  4626. 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",
  4627. messageSends: ["assert:", "==", "deny:", "yourself"],
  4628. referencedClasses: []
  4629. }),
  4630. smalltalk.StringTest);
  4631. smalltalk.addMethod(
  4632. smalltalk.method({
  4633. selector: "testIdentityHash",
  4634. protocol: 'tests',
  4635. fn: function (){
  4636. var self=this;
  4637. return smalltalk.withContext(function($ctx1) {
  4638. var $1,$2,$4,$3;
  4639. $1="foo"._identityHash();
  4640. $ctx1.sendIdx["identityHash"]=1;
  4641. $2="foo"._identityHash();
  4642. $ctx1.sendIdx["identityHash"]=2;
  4643. self._assert_equals_($1,$2);
  4644. $4="foo"._identityHash();
  4645. $ctx1.sendIdx["identityHash"]=3;
  4646. $3=_st($4).__eq("bar"._identityHash());
  4647. self._deny_($3);
  4648. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4649. args: [],
  4650. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4651. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4652. referencedClasses: []
  4653. }),
  4654. smalltalk.StringTest);
  4655. smalltalk.addMethod(
  4656. smalltalk.method({
  4657. selector: "testIncludesSubString",
  4658. protocol: 'tests',
  4659. fn: function (){
  4660. var self=this;
  4661. return smalltalk.withContext(function($ctx1) {
  4662. var $1;
  4663. $1="amber"._includesSubString_("ber");
  4664. $ctx1.sendIdx["includesSubString:"]=1;
  4665. self._assert_($1);
  4666. self._deny_("amber"._includesSubString_("zork"));
  4667. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4668. args: [],
  4669. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4670. messageSends: ["assert:", "includesSubString:", "deny:"],
  4671. referencedClasses: []
  4672. }),
  4673. smalltalk.StringTest);
  4674. smalltalk.addMethod(
  4675. smalltalk.method({
  4676. selector: "testIsVowel",
  4677. protocol: 'tests',
  4678. fn: function (){
  4679. var self=this;
  4680. var vowel,consonant;
  4681. return smalltalk.withContext(function($ctx1) {
  4682. var $1;
  4683. vowel="u";
  4684. consonant="z";
  4685. $1=_st(vowel)._isVowel();
  4686. $ctx1.sendIdx["isVowel"]=1;
  4687. self._assert_equals_($1,true);
  4688. $ctx1.sendIdx["assert:equals:"]=1;
  4689. self._assert_equals_(_st(consonant)._isVowel(),false);
  4690. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4691. args: [],
  4692. 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",
  4693. messageSends: ["assert:equals:", "isVowel"],
  4694. referencedClasses: []
  4695. }),
  4696. smalltalk.StringTest);
  4697. smalltalk.addMethod(
  4698. smalltalk.method({
  4699. selector: "testJoin",
  4700. protocol: 'tests',
  4701. fn: function (){
  4702. var self=this;
  4703. return smalltalk.withContext(function($ctx1) {
  4704. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4705. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4706. args: [],
  4707. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4708. messageSends: ["assert:equals:", "join:"],
  4709. referencedClasses: []
  4710. }),
  4711. smalltalk.StringTest);
  4712. smalltalk.addMethod(
  4713. smalltalk.method({
  4714. selector: "testRemoveAll",
  4715. protocol: 'tests',
  4716. fn: function (){
  4717. var self=this;
  4718. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4719. return smalltalk.withContext(function($ctx1) {
  4720. self._should_raise_((function(){
  4721. return smalltalk.withContext(function($ctx2) {
  4722. return _st(self._collection())._removeAll();
  4723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4724. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4725. args: [],
  4726. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4727. messageSends: ["should:raise:", "removeAll", "collection"],
  4728. referencedClasses: ["Error"]
  4729. }),
  4730. smalltalk.StringTest);
  4731. smalltalk.addMethod(
  4732. smalltalk.method({
  4733. selector: "testReversed",
  4734. protocol: 'tests',
  4735. fn: function (){
  4736. var self=this;
  4737. return smalltalk.withContext(function($ctx1) {
  4738. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4739. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4740. args: [],
  4741. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4742. messageSends: ["assert:equals:", "reversed"],
  4743. referencedClasses: []
  4744. }),
  4745. smalltalk.StringTest);
  4746. smalltalk.addMethod(
  4747. smalltalk.method({
  4748. selector: "testStreamContents",
  4749. protocol: 'tests',
  4750. fn: function (){
  4751. var self=this;
  4752. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4753. return smalltalk.withContext(function($ctx1) {
  4754. var $1;
  4755. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4756. return smalltalk.withContext(function($ctx2) {
  4757. _st(aStream)._nextPutAll_("hello");
  4758. $ctx2.sendIdx["nextPutAll:"]=1;
  4759. _st(aStream)._space();
  4760. $1=_st(aStream)._nextPutAll_("world");
  4761. return $1;
  4762. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4763. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4764. args: [],
  4765. 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'",
  4766. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4767. referencedClasses: ["String"]
  4768. }),
  4769. smalltalk.StringTest);
  4770. smalltalk.addMethod(
  4771. smalltalk.method({
  4772. selector: "testSubStrings",
  4773. protocol: 'tests',
  4774. fn: function (){
  4775. var self=this;
  4776. return smalltalk.withContext(function($ctx1) {
  4777. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4778. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4779. args: [],
  4780. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4781. messageSends: ["assert:equals:", "subStrings:"],
  4782. referencedClasses: []
  4783. }),
  4784. smalltalk.StringTest);
  4785. smalltalk.addMethod(
  4786. smalltalk.method({
  4787. selector: "testTrim",
  4788. protocol: 'tests',
  4789. fn: function (){
  4790. var self=this;
  4791. return smalltalk.withContext(function($ctx1) {
  4792. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4793. $ctx1.sendIdx["assert:equals:"]=1;
  4794. self._assert_equals_("jackie "._trimRight(),"jackie");
  4795. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4796. args: [],
  4797. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4798. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4799. referencedClasses: []
  4800. }),
  4801. smalltalk.StringTest);
  4802. smalltalk.addMethod(
  4803. smalltalk.method({
  4804. selector: "collectionClass",
  4805. protocol: 'fixture',
  4806. fn: function (){
  4807. var self=this;
  4808. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4809. return smalltalk.withContext(function($ctx1) {
  4810. return $String();
  4811. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4812. args: [],
  4813. source: "collectionClass\x0a\x09^ String",
  4814. messageSends: [],
  4815. referencedClasses: ["String"]
  4816. }),
  4817. smalltalk.StringTest.klass);
  4818. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4819. smalltalk.addMethod(
  4820. smalltalk.method({
  4821. selector: "collection",
  4822. protocol: 'fixture',
  4823. fn: function (){
  4824. var self=this;
  4825. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4826. return smalltalk.withContext(function($ctx1) {
  4827. var $2,$3,$1;
  4828. $2=_st($Set())._new();
  4829. _st($2)._add_((1));
  4830. $ctx1.sendIdx["add:"]=1;
  4831. _st($2)._add_((2));
  4832. $ctx1.sendIdx["add:"]=2;
  4833. _st($2)._add_((3));
  4834. $ctx1.sendIdx["add:"]=3;
  4835. _st($2)._add_((-4));
  4836. $3=_st($2)._yourself();
  4837. $1=$3;
  4838. return $1;
  4839. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  4840. args: [],
  4841. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4842. messageSends: ["add:", "new", "yourself"],
  4843. referencedClasses: ["Set"]
  4844. }),
  4845. smalltalk.SetTest);
  4846. smalltalk.addMethod(
  4847. smalltalk.method({
  4848. selector: "collectionOfPrintStrings",
  4849. protocol: 'fixture',
  4850. fn: function (){
  4851. var self=this;
  4852. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4853. return smalltalk.withContext(function($ctx1) {
  4854. var $2,$3,$1;
  4855. $2=_st($Set())._new();
  4856. _st($2)._add_("1");
  4857. $ctx1.sendIdx["add:"]=1;
  4858. _st($2)._add_("2");
  4859. $ctx1.sendIdx["add:"]=2;
  4860. _st($2)._add_("3");
  4861. $ctx1.sendIdx["add:"]=3;
  4862. _st($2)._add_("-4");
  4863. $3=_st($2)._yourself();
  4864. $1=$3;
  4865. return $1;
  4866. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  4867. args: [],
  4868. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  4869. messageSends: ["add:", "new", "yourself"],
  4870. referencedClasses: ["Set"]
  4871. }),
  4872. smalltalk.SetTest);
  4873. smalltalk.addMethod(
  4874. smalltalk.method({
  4875. selector: "collectionSize",
  4876. protocol: 'fixture',
  4877. fn: function (){
  4878. var self=this;
  4879. return smalltalk.withContext(function($ctx1) {
  4880. return (4);
  4881. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  4882. args: [],
  4883. source: "collectionSize\x0a\x09^ 4",
  4884. messageSends: [],
  4885. referencedClasses: []
  4886. }),
  4887. smalltalk.SetTest);
  4888. smalltalk.addMethod(
  4889. smalltalk.method({
  4890. selector: "collectionWithDuplicates",
  4891. protocol: 'fixture',
  4892. fn: function (){
  4893. var self=this;
  4894. return smalltalk.withContext(function($ctx1) {
  4895. var $2,$3,$1;
  4896. $2=self._collection();
  4897. _st($2)._add_("yet another");
  4898. $3=_st($2)._yourself();
  4899. $1=$3;
  4900. return $1;
  4901. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  4902. args: [],
  4903. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  4904. messageSends: ["add:", "collection", "yourself"],
  4905. referencedClasses: []
  4906. }),
  4907. smalltalk.SetTest);
  4908. smalltalk.addMethod(
  4909. smalltalk.method({
  4910. selector: "collectionWithNewValue",
  4911. protocol: 'fixture',
  4912. fn: function (){
  4913. var self=this;
  4914. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4915. return smalltalk.withContext(function($ctx1) {
  4916. var $2,$3,$1;
  4917. $2=_st($Set())._new();
  4918. _st($2)._add_((1));
  4919. $ctx1.sendIdx["add:"]=1;
  4920. _st($2)._add_((2));
  4921. $ctx1.sendIdx["add:"]=2;
  4922. _st($2)._add_((3));
  4923. $ctx1.sendIdx["add:"]=3;
  4924. _st($2)._add_("N");
  4925. $ctx1.sendIdx["add:"]=4;
  4926. _st($2)._add_((-4));
  4927. $3=_st($2)._yourself();
  4928. $1=$3;
  4929. return $1;
  4930. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  4931. args: [],
  4932. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4933. messageSends: ["add:", "new", "yourself"],
  4934. referencedClasses: ["Set"]
  4935. }),
  4936. smalltalk.SetTest);
  4937. smalltalk.addMethod(
  4938. smalltalk.method({
  4939. selector: "testAddRemove",
  4940. protocol: 'tests',
  4941. fn: function (){
  4942. var self=this;
  4943. var set;
  4944. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4945. return smalltalk.withContext(function($ctx1) {
  4946. var $1,$2;
  4947. set=_st($Set())._new();
  4948. self._assert_(_st(set)._isEmpty());
  4949. $ctx1.sendIdx["assert:"]=1;
  4950. _st(set)._add_((3));
  4951. $ctx1.sendIdx["add:"]=1;
  4952. $1=_st(set)._includes_((3));
  4953. $ctx1.sendIdx["includes:"]=1;
  4954. self._assert_($1);
  4955. $ctx1.sendIdx["assert:"]=2;
  4956. _st(set)._add_((5));
  4957. $2=_st(set)._includes_((5));
  4958. $ctx1.sendIdx["includes:"]=2;
  4959. self._assert_($2);
  4960. _st(set)._remove_((3));
  4961. self._deny_(_st(set)._includes_((3)));
  4962. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4963. args: [],
  4964. 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)",
  4965. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4966. referencedClasses: ["Set"]
  4967. }),
  4968. smalltalk.SetTest);
  4969. smalltalk.addMethod(
  4970. smalltalk.method({
  4971. selector: "testAt",
  4972. protocol: 'tests',
  4973. fn: function (){
  4974. var self=this;
  4975. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4976. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4977. return smalltalk.withContext(function($ctx1) {
  4978. self._should_raise_((function(){
  4979. return smalltalk.withContext(function($ctx2) {
  4980. return _st(_st($Set())._new())._at_put_((1),(2));
  4981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4982. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  4983. args: [],
  4984. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  4985. messageSends: ["should:raise:", "at:put:", "new"],
  4986. referencedClasses: ["Set", "Error"]
  4987. }),
  4988. smalltalk.SetTest);
  4989. smalltalk.addMethod(
  4990. smalltalk.method({
  4991. selector: "testCollect",
  4992. protocol: 'tests',
  4993. fn: function (){
  4994. var self=this;
  4995. return smalltalk.withContext(function($ctx1) {
  4996. var $2,$1;
  4997. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  4998. $2=[(5), (6), (8)]._asSet();
  4999. $ctx1.sendIdx["asSet"]=1;
  5000. $1=_st($2)._collect_((function(x){
  5001. return smalltalk.withContext(function($ctx2) {
  5002. return _st(x).__backslash_backslash((3));
  5003. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5004. self._assert_equals_($1,[(0), (2)]._asSet());
  5005. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5006. args: [],
  5007. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5008. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5009. referencedClasses: []
  5010. }),
  5011. smalltalk.SetTest);
  5012. smalltalk.addMethod(
  5013. smalltalk.method({
  5014. selector: "testComparing",
  5015. protocol: 'tests',
  5016. fn: function (){
  5017. var self=this;
  5018. return smalltalk.withContext(function($ctx1) {
  5019. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5020. $1=[(0), (2)]._asSet();
  5021. $ctx1.sendIdx["asSet"]=1;
  5022. $2=[(0), (2)]._asSet();
  5023. $ctx1.sendIdx["asSet"]=2;
  5024. self._assert_equals_($1,$2);
  5025. $ctx1.sendIdx["assert:equals:"]=1;
  5026. $3=[(2), (0)]._asSet();
  5027. $ctx1.sendIdx["asSet"]=3;
  5028. $4=[(0), (2)]._asSet();
  5029. $ctx1.sendIdx["asSet"]=4;
  5030. self._assert_equals_($3,$4);
  5031. $6=[(0), (2), (3)]._asSet();
  5032. $ctx1.sendIdx["asSet"]=5;
  5033. $7=[(0), (2)]._asSet();
  5034. $ctx1.sendIdx["asSet"]=6;
  5035. $5=_st($6).__eq($7);
  5036. $ctx1.sendIdx["="]=1;
  5037. self._deny_($5);
  5038. $ctx1.sendIdx["deny:"]=1;
  5039. $9=[(1), (2)]._asSet();
  5040. $ctx1.sendIdx["asSet"]=7;
  5041. $8=_st($9).__eq([(0), (2)]._asSet());
  5042. self._deny_($8);
  5043. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5044. args: [],
  5045. 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",
  5046. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5047. referencedClasses: []
  5048. }),
  5049. smalltalk.SetTest);
  5050. smalltalk.addMethod(
  5051. smalltalk.method({
  5052. selector: "testPrintString",
  5053. protocol: 'tests',
  5054. fn: function (){
  5055. var self=this;
  5056. var set;
  5057. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5058. return smalltalk.withContext(function($ctx1) {
  5059. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5060. set=_st($Set())._new();
  5061. $1=_st(set)._printString();
  5062. $ctx1.sendIdx["printString"]=1;
  5063. self._assert_equals_($1,"a Set ()");
  5064. $ctx1.sendIdx["assert:equals:"]=1;
  5065. $2=set;
  5066. _st($2)._add_((1));
  5067. $ctx1.sendIdx["add:"]=1;
  5068. $3=_st($2)._add_((3));
  5069. $ctx1.sendIdx["add:"]=2;
  5070. $4=_st(set)._printString();
  5071. $ctx1.sendIdx["printString"]=2;
  5072. self._assert_equals_($4,"a Set (1 3)");
  5073. $ctx1.sendIdx["assert:equals:"]=2;
  5074. _st(set)._add_("foo");
  5075. $ctx1.sendIdx["add:"]=3;
  5076. $5=_st(set)._printString();
  5077. $ctx1.sendIdx["printString"]=3;
  5078. self._assert_equals_($5,"a Set (1 3 'foo')");
  5079. $ctx1.sendIdx["assert:equals:"]=3;
  5080. $6=set;
  5081. _st($6)._remove_((1));
  5082. $ctx1.sendIdx["remove:"]=1;
  5083. $7=_st($6)._remove_((3));
  5084. $8=_st(set)._printString();
  5085. $ctx1.sendIdx["printString"]=4;
  5086. self._assert_equals_($8,"a Set ('foo')");
  5087. $ctx1.sendIdx["assert:equals:"]=4;
  5088. _st(set)._add_((3));
  5089. $ctx1.sendIdx["add:"]=4;
  5090. $9=_st(set)._printString();
  5091. $ctx1.sendIdx["printString"]=5;
  5092. self._assert_equals_($9,"a Set ('foo' 3)");
  5093. $ctx1.sendIdx["assert:equals:"]=5;
  5094. _st(set)._add_((3));
  5095. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5096. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5097. args: [],
  5098. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  5099. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5100. referencedClasses: ["Set"]
  5101. }),
  5102. smalltalk.SetTest);
  5103. smalltalk.addMethod(
  5104. smalltalk.method({
  5105. selector: "testUnboxedObjects",
  5106. protocol: 'tests',
  5107. fn: function (){
  5108. var self=this;
  5109. return smalltalk.withContext(function($ctx1) {
  5110. var $4,$3,$2,$1;
  5111. $4="foo"._yourself();
  5112. $ctx1.sendIdx["yourself"]=1;
  5113. $3=[$4,"foo"._yourself()];
  5114. $2=_st($3)._asSet();
  5115. $1=_st($2)._asArray();
  5116. self._assert_equals_($1,["foo"]);
  5117. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5118. args: [],
  5119. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5120. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5121. referencedClasses: []
  5122. }),
  5123. smalltalk.SetTest);
  5124. smalltalk.addMethod(
  5125. smalltalk.method({
  5126. selector: "testUnicity",
  5127. protocol: 'tests',
  5128. fn: function (){
  5129. var self=this;
  5130. var set;
  5131. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5132. return smalltalk.withContext(function($ctx1) {
  5133. var $1;
  5134. set=_st($Set())._new();
  5135. _st(set)._add_((21));
  5136. $ctx1.sendIdx["add:"]=1;
  5137. _st(set)._add_("hello");
  5138. $ctx1.sendIdx["add:"]=2;
  5139. _st(set)._add_((21));
  5140. $ctx1.sendIdx["add:"]=3;
  5141. $1=_st(set)._size();
  5142. $ctx1.sendIdx["size"]=1;
  5143. self._assert_equals_($1,(2));
  5144. $ctx1.sendIdx["assert:equals:"]=1;
  5145. _st(set)._add_("hello");
  5146. self._assert_equals_(_st(set)._size(),(2));
  5147. $ctx1.sendIdx["assert:equals:"]=2;
  5148. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5149. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5150. args: [],
  5151. 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')",
  5152. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5153. referencedClasses: ["Set"]
  5154. }),
  5155. smalltalk.SetTest);
  5156. smalltalk.addMethod(
  5157. smalltalk.method({
  5158. selector: "collectionClass",
  5159. protocol: 'fixture',
  5160. fn: function (){
  5161. var self=this;
  5162. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5163. return smalltalk.withContext(function($ctx1) {
  5164. return $Set();
  5165. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5166. args: [],
  5167. source: "collectionClass\x0a\x09^ Set",
  5168. messageSends: [],
  5169. referencedClasses: ["Set"]
  5170. }),
  5171. smalltalk.SetTest.klass);
  5172. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5173. smalltalk.addMethod(
  5174. smalltalk.method({
  5175. selector: "testShow",
  5176. protocol: 'tests',
  5177. fn: function (){
  5178. var self=this;
  5179. var originalTranscript;
  5180. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5181. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5182. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5183. return smalltalk.withContext(function($ctx1) {
  5184. originalTranscript=_st($Transcript())._current();
  5185. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5186. $ctx1.sendIdx["register:"]=1;
  5187. self._shouldnt_raise_((function(){
  5188. return smalltalk.withContext(function($ctx2) {
  5189. return _st($Transcript())._show_("Hello console!");
  5190. $ctx2.sendIdx["show:"]=1;
  5191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5192. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5193. self._shouldnt_raise_((function(){
  5194. return smalltalk.withContext(function($ctx2) {
  5195. return _st($Transcript())._show_(console);
  5196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5197. _st($Transcript())._register_(originalTranscript);
  5198. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5199. args: [],
  5200. 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.",
  5201. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5202. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5203. }),
  5204. smalltalk.ConsoleTranscriptTest);
  5205. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5206. smalltalk.addMethod(
  5207. smalltalk.method({
  5208. selector: "jsObject",
  5209. protocol: 'accessing',
  5210. fn: function (){
  5211. var self=this;
  5212. return smalltalk.withContext(function($ctx1) {
  5213. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5214. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5215. args: [],
  5216. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5217. messageSends: [],
  5218. referencedClasses: []
  5219. }),
  5220. smalltalk.JSObjectProxyTest);
  5221. smalltalk.addMethod(
  5222. smalltalk.method({
  5223. selector: "testAtIfAbsent",
  5224. protocol: 'tests',
  5225. fn: function (){
  5226. var self=this;
  5227. var testObject;
  5228. return smalltalk.withContext(function($ctx1) {
  5229. var $1,$2,$3;
  5230. testObject=self._jsObject();
  5231. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5232. return smalltalk.withContext(function($ctx2) {
  5233. return "Property does not exist";
  5234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5235. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5236. self._assert_equals_($1,"Property does not exist");
  5237. $ctx1.sendIdx["assert:equals:"]=1;
  5238. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5239. return smalltalk.withContext(function($ctx2) {
  5240. return "Property does not exist";
  5241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5242. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5243. self._assert_equals_($2,nil);
  5244. $ctx1.sendIdx["assert:equals:"]=2;
  5245. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5246. return smalltalk.withContext(function($ctx2) {
  5247. return "Property does not exist";
  5248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5249. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5250. self._assert_equals_($3,(1));
  5251. $ctx1.sendIdx["assert:equals:"]=3;
  5252. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5253. return smalltalk.withContext(function($ctx2) {
  5254. return "Property does not exist";
  5255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5256. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5257. args: [],
  5258. 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.",
  5259. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5260. referencedClasses: []
  5261. }),
  5262. smalltalk.JSObjectProxyTest);
  5263. smalltalk.addMethod(
  5264. smalltalk.method({
  5265. selector: "testAtIfPresent",
  5266. protocol: 'tests',
  5267. fn: function (){
  5268. var self=this;
  5269. var testObject;
  5270. return smalltalk.withContext(function($ctx1) {
  5271. var $2,$1,$4,$3,$6,$5;
  5272. testObject=self._jsObject();
  5273. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5274. return smalltalk.withContext(function($ctx2) {
  5275. $2=_st(x)._asString();
  5276. $ctx2.sendIdx["asString"]=1;
  5277. return "hello ".__comma($2);
  5278. $ctx2.sendIdx[","]=1;
  5279. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5280. $ctx1.sendIdx["at:ifPresent:"]=1;
  5281. self._assert_equals_($1,nil);
  5282. $ctx1.sendIdx["assert:equals:"]=1;
  5283. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5284. return smalltalk.withContext(function($ctx2) {
  5285. $4=_st(x)._asString();
  5286. $ctx2.sendIdx["asString"]=2;
  5287. return "hello ".__comma($4);
  5288. $ctx2.sendIdx[","]=2;
  5289. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5290. $ctx1.sendIdx["at:ifPresent:"]=2;
  5291. self._assert_equals_($3,"hello nil");
  5292. $ctx1.sendIdx["assert:equals:"]=2;
  5293. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5294. return smalltalk.withContext(function($ctx2) {
  5295. $6=_st(x)._asString();
  5296. $ctx2.sendIdx["asString"]=3;
  5297. return "hello ".__comma($6);
  5298. $ctx2.sendIdx[","]=3;
  5299. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5300. $ctx1.sendIdx["at:ifPresent:"]=3;
  5301. self._assert_equals_($5,"hello 1");
  5302. $ctx1.sendIdx["assert:equals:"]=3;
  5303. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5304. return smalltalk.withContext(function($ctx2) {
  5305. return "hello ".__comma(_st(x)._asString());
  5306. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5307. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5308. args: [],
  5309. 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'.",
  5310. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5311. referencedClasses: []
  5312. }),
  5313. smalltalk.JSObjectProxyTest);
  5314. smalltalk.addMethod(
  5315. smalltalk.method({
  5316. selector: "testAtIfPresentIfAbsent",
  5317. protocol: 'tests',
  5318. fn: function (){
  5319. var self=this;
  5320. var testObject;
  5321. return smalltalk.withContext(function($ctx1) {
  5322. var $2,$1,$4,$3,$6,$5;
  5323. testObject=self._jsObject();
  5324. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5325. return smalltalk.withContext(function($ctx2) {
  5326. $2=_st(x)._asString();
  5327. $ctx2.sendIdx["asString"]=1;
  5328. return "hello ".__comma($2);
  5329. $ctx2.sendIdx[","]=1;
  5330. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5331. return smalltalk.withContext(function($ctx2) {
  5332. return "not present";
  5333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5334. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5335. self._assert_equals_($1,"not present");
  5336. $ctx1.sendIdx["assert:equals:"]=1;
  5337. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5338. return smalltalk.withContext(function($ctx2) {
  5339. $4=_st(x)._asString();
  5340. $ctx2.sendIdx["asString"]=2;
  5341. return "hello ".__comma($4);
  5342. $ctx2.sendIdx[","]=2;
  5343. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5344. return smalltalk.withContext(function($ctx2) {
  5345. return "not present";
  5346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5347. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5348. self._assert_equals_($3,"hello nil");
  5349. $ctx1.sendIdx["assert:equals:"]=2;
  5350. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5351. return smalltalk.withContext(function($ctx2) {
  5352. $6=_st(x)._asString();
  5353. $ctx2.sendIdx["asString"]=3;
  5354. return "hello ".__comma($6);
  5355. $ctx2.sendIdx[","]=3;
  5356. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5357. return smalltalk.withContext(function($ctx2) {
  5358. return "not present";
  5359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5360. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5361. self._assert_equals_($5,"hello 1");
  5362. $ctx1.sendIdx["assert:equals:"]=3;
  5363. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5364. return smalltalk.withContext(function($ctx2) {
  5365. return "hello ".__comma(_st(x)._asString());
  5366. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5367. return smalltalk.withContext(function($ctx2) {
  5368. return "not present";
  5369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5370. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5371. args: [],
  5372. 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'.",
  5373. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5374. referencedClasses: []
  5375. }),
  5376. smalltalk.JSObjectProxyTest);
  5377. smalltalk.addMethod(
  5378. smalltalk.method({
  5379. selector: "testAtPut",
  5380. protocol: 'tests',
  5381. fn: function (){
  5382. var self=this;
  5383. var testObject;
  5384. return smalltalk.withContext(function($ctx1) {
  5385. var $2,$1;
  5386. testObject=self._jsObject();
  5387. $2=_st(testObject)._at_("abc");
  5388. $ctx1.sendIdx["at:"]=1;
  5389. $1=_st($2).__tild_eq("xyz");
  5390. self._assert_($1);
  5391. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5392. $ctx1.sendIdx["assert:equals:"]=1;
  5393. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5394. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5395. args: [],
  5396. 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'",
  5397. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5398. referencedClasses: []
  5399. }),
  5400. smalltalk.JSObjectProxyTest);
  5401. smalltalk.addMethod(
  5402. smalltalk.method({
  5403. selector: "testDNU",
  5404. protocol: 'tests',
  5405. fn: function (){
  5406. var self=this;
  5407. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5408. return smalltalk.withContext(function($ctx1) {
  5409. self._should_raise_((function(){
  5410. return smalltalk.withContext(function($ctx2) {
  5411. return _st(self._jsObject())._foo();
  5412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5413. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5414. args: [],
  5415. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5416. messageSends: ["should:raise:", "foo", "jsObject"],
  5417. referencedClasses: ["MessageNotUnderstood"]
  5418. }),
  5419. smalltalk.JSObjectProxyTest);
  5420. smalltalk.addMethod(
  5421. smalltalk.method({
  5422. selector: "testMessageSend",
  5423. protocol: 'tests',
  5424. fn: function (){
  5425. var self=this;
  5426. return smalltalk.withContext(function($ctx1) {
  5427. var $2,$1,$4,$3;
  5428. $2=self._jsObject();
  5429. $ctx1.sendIdx["jsObject"]=1;
  5430. $1=_st($2)._a();
  5431. self._assert_equals_($1,(1));
  5432. $ctx1.sendIdx["assert:equals:"]=1;
  5433. $4=self._jsObject();
  5434. $ctx1.sendIdx["jsObject"]=2;
  5435. $3=_st($4)._b();
  5436. self._assert_equals_($3,(2));
  5437. $ctx1.sendIdx["assert:equals:"]=2;
  5438. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5439. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5440. args: [],
  5441. 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",
  5442. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5443. referencedClasses: []
  5444. }),
  5445. smalltalk.JSObjectProxyTest);
  5446. smalltalk.addMethod(
  5447. smalltalk.method({
  5448. selector: "testMethodWithArguments",
  5449. protocol: 'tests',
  5450. fn: function (){
  5451. var self=this;
  5452. return smalltalk.withContext(function($ctx1) {
  5453. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5454. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5455. args: [],
  5456. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5457. messageSends: ["assert:equals:", "c:", "jsObject"],
  5458. referencedClasses: []
  5459. }),
  5460. smalltalk.JSObjectProxyTest);
  5461. smalltalk.addMethod(
  5462. smalltalk.method({
  5463. selector: "testPrinting",
  5464. protocol: 'tests',
  5465. fn: function (){
  5466. var self=this;
  5467. return smalltalk.withContext(function($ctx1) {
  5468. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5469. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5470. args: [],
  5471. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5472. messageSends: ["assert:equals:", "printString", "jsObject"],
  5473. referencedClasses: []
  5474. }),
  5475. smalltalk.JSObjectProxyTest);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "testPropertyThatReturnsEmptyString",
  5479. protocol: 'tests',
  5480. fn: function (){
  5481. var self=this;
  5482. var object;
  5483. return smalltalk.withContext(function($ctx1) {
  5484. var $1;
  5485. object=self._jsObject();
  5486. $1=_st(object)._d();
  5487. $ctx1.sendIdx["d"]=1;
  5488. self._assert_equals_($1,"");
  5489. $ctx1.sendIdx["assert:equals:"]=1;
  5490. _st(object)._d_("hello");
  5491. self._assert_equals_(_st(object)._d(),"hello");
  5492. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5493. args: [],
  5494. 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'",
  5495. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5496. referencedClasses: []
  5497. }),
  5498. smalltalk.JSObjectProxyTest);
  5499. smalltalk.addMethod(
  5500. smalltalk.method({
  5501. selector: "testPropertyThatReturnsUndefined",
  5502. protocol: 'tests',
  5503. fn: function (){
  5504. var self=this;
  5505. var object;
  5506. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5507. return smalltalk.withContext(function($ctx1) {
  5508. object=self._jsObject();
  5509. self._shouldnt_raise_((function(){
  5510. return smalltalk.withContext(function($ctx2) {
  5511. return _st(object)._e();
  5512. $ctx2.sendIdx["e"]=1;
  5513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5514. self._assert_(_st(_st(object)._e())._isNil());
  5515. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5516. args: [],
  5517. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5518. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5519. referencedClasses: ["MessageNotUnderstood"]
  5520. }),
  5521. smalltalk.JSObjectProxyTest);
  5522. smalltalk.addMethod(
  5523. smalltalk.method({
  5524. selector: "testValue",
  5525. protocol: 'tests',
  5526. fn: function (){
  5527. var self=this;
  5528. var testObject;
  5529. return smalltalk.withContext(function($ctx1) {
  5530. testObject=self._jsObject();
  5531. _st(testObject)._at_put_("value","aValue");
  5532. self._assert_equals_(_st(testObject)._value(),"aValue");
  5533. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5534. args: [],
  5535. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5536. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5537. referencedClasses: []
  5538. }),
  5539. smalltalk.JSObjectProxyTest);
  5540. smalltalk.addMethod(
  5541. smalltalk.method({
  5542. selector: "testYourself",
  5543. protocol: 'tests',
  5544. fn: function (){
  5545. var self=this;
  5546. var object;
  5547. return smalltalk.withContext(function($ctx1) {
  5548. var $1,$2;
  5549. $1=self._jsObject();
  5550. _st($1)._d_("test");
  5551. $2=_st($1)._yourself();
  5552. object=$2;
  5553. self._assert_equals_(_st(object)._d(),"test");
  5554. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5555. args: [],
  5556. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5557. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5558. referencedClasses: []
  5559. }),
  5560. smalltalk.JSObjectProxyTest);
  5561. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5562. smalltalk.addMethod(
  5563. smalltalk.method({
  5564. selector: "testCatchingException",
  5565. protocol: 'tests',
  5566. fn: function (){
  5567. var self=this;
  5568. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5569. return smalltalk.withContext(function($ctx1) {
  5570. _st((function(){
  5571. return smalltalk.withContext(function($ctx2) {
  5572. return self._throwException();
  5573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5574. return smalltalk.withContext(function($ctx2) {
  5575. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5576. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5577. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5578. args: [],
  5579. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5580. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5581. referencedClasses: ["Error"]
  5582. }),
  5583. smalltalk.JavaScriptExceptionTest);
  5584. smalltalk.addMethod(
  5585. smalltalk.method({
  5586. selector: "testRaisingException",
  5587. protocol: 'tests',
  5588. fn: function (){
  5589. var self=this;
  5590. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5591. return smalltalk.withContext(function($ctx1) {
  5592. self._should_raise_((function(){
  5593. return smalltalk.withContext(function($ctx2) {
  5594. return self._throwException();
  5595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5596. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5597. args: [],
  5598. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5599. messageSends: ["should:raise:", "throwException"],
  5600. referencedClasses: ["JavaScriptException"]
  5601. }),
  5602. smalltalk.JavaScriptExceptionTest);
  5603. smalltalk.addMethod(
  5604. smalltalk.method({
  5605. selector: "throwException",
  5606. protocol: 'helpers',
  5607. fn: function (){
  5608. var self=this;
  5609. return smalltalk.withContext(function($ctx1) {
  5610. throw 'test';
  5611. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5612. args: [],
  5613. source: "throwException\x0a\x09<throw 'test'>",
  5614. messageSends: [],
  5615. referencedClasses: []
  5616. }),
  5617. smalltalk.JavaScriptExceptionTest);
  5618. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5619. smalltalk.addMethod(
  5620. smalltalk.method({
  5621. selector: "testValue",
  5622. protocol: 'tests',
  5623. fn: function (){
  5624. var self=this;
  5625. var messageSend;
  5626. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5627. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5628. return smalltalk.withContext(function($ctx1) {
  5629. var $1,$2;
  5630. $1=_st($MessageSend())._new();
  5631. $ctx1.sendIdx["new"]=1;
  5632. _st($1)._receiver_(_st($Object())._new());
  5633. _st($1)._selector_("asString");
  5634. $2=_st($1)._yourself();
  5635. messageSend=$2;
  5636. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5637. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5638. args: [],
  5639. 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'",
  5640. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5641. referencedClasses: ["MessageSend", "Object"]
  5642. }),
  5643. smalltalk.MessageSendTest);
  5644. smalltalk.addMethod(
  5645. smalltalk.method({
  5646. selector: "testValueWithArguments",
  5647. protocol: 'tests',
  5648. fn: function (){
  5649. var self=this;
  5650. var messageSend;
  5651. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5652. return smalltalk.withContext(function($ctx1) {
  5653. var $1,$2;
  5654. $1=_st($MessageSend())._new();
  5655. _st($1)._receiver_((2));
  5656. _st($1)._selector_("+");
  5657. $2=_st($1)._yourself();
  5658. messageSend=$2;
  5659. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5660. $ctx1.sendIdx["assert:equals:"]=1;
  5661. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5662. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5663. args: [],
  5664. 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",
  5665. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5666. referencedClasses: ["MessageSend"]
  5667. }),
  5668. smalltalk.MessageSendTest);
  5669. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5670. smalltalk.addMethod(
  5671. smalltalk.method({
  5672. selector: "codeGeneratorClass",
  5673. protocol: 'accessing',
  5674. fn: function (){
  5675. var self=this;
  5676. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5677. return smalltalk.withContext(function($ctx1) {
  5678. return $CodeGenerator();
  5679. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5680. args: [],
  5681. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5682. messageSends: [],
  5683. referencedClasses: ["CodeGenerator"]
  5684. }),
  5685. smalltalk.MethodInheritanceTest);
  5686. smalltalk.addMethod(
  5687. smalltalk.method({
  5688. selector: "compiler",
  5689. protocol: 'factory',
  5690. fn: function (){
  5691. var self=this;
  5692. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5693. return smalltalk.withContext(function($ctx1) {
  5694. var $2,$3,$1;
  5695. $2=_st($Compiler())._new();
  5696. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5697. $3=_st($2)._yourself();
  5698. $1=$3;
  5699. return $1;
  5700. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5701. args: [],
  5702. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5703. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5704. referencedClasses: ["Compiler"]
  5705. }),
  5706. smalltalk.MethodInheritanceTest);
  5707. smalltalk.addMethod(
  5708. smalltalk.method({
  5709. selector: "deinstallBottom",
  5710. protocol: 'testing',
  5711. fn: function (){
  5712. var self=this;
  5713. return smalltalk.withContext(function($ctx1) {
  5714. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5715. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5716. args: [],
  5717. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5718. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5719. referencedClasses: []
  5720. }),
  5721. smalltalk.MethodInheritanceTest);
  5722. smalltalk.addMethod(
  5723. smalltalk.method({
  5724. selector: "deinstallMiddle",
  5725. protocol: 'testing',
  5726. fn: function (){
  5727. var self=this;
  5728. return smalltalk.withContext(function($ctx1) {
  5729. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5730. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5731. args: [],
  5732. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5733. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5734. referencedClasses: []
  5735. }),
  5736. smalltalk.MethodInheritanceTest);
  5737. smalltalk.addMethod(
  5738. smalltalk.method({
  5739. selector: "deinstallTop",
  5740. protocol: 'testing',
  5741. fn: function (){
  5742. var self=this;
  5743. return smalltalk.withContext(function($ctx1) {
  5744. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5745. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5746. args: [],
  5747. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5748. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5749. referencedClasses: []
  5750. }),
  5751. smalltalk.MethodInheritanceTest);
  5752. smalltalk.addMethod(
  5753. smalltalk.method({
  5754. selector: "installBottom:",
  5755. protocol: 'testing',
  5756. fn: function (aString){
  5757. var self=this;
  5758. return smalltalk.withContext(function($ctx1) {
  5759. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5760. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5761. args: ["aString"],
  5762. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5763. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5764. referencedClasses: []
  5765. }),
  5766. smalltalk.MethodInheritanceTest);
  5767. smalltalk.addMethod(
  5768. smalltalk.method({
  5769. selector: "installMiddle:",
  5770. protocol: 'testing',
  5771. fn: function (aString){
  5772. var self=this;
  5773. return smalltalk.withContext(function($ctx1) {
  5774. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5775. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5776. args: ["aString"],
  5777. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5778. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5779. referencedClasses: []
  5780. }),
  5781. smalltalk.MethodInheritanceTest);
  5782. smalltalk.addMethod(
  5783. smalltalk.method({
  5784. selector: "installTop:",
  5785. protocol: 'testing',
  5786. fn: function (aString){
  5787. var self=this;
  5788. return smalltalk.withContext(function($ctx1) {
  5789. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5790. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5791. args: ["aString"],
  5792. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5793. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5794. referencedClasses: []
  5795. }),
  5796. smalltalk.MethodInheritanceTest);
  5797. smalltalk.addMethod(
  5798. smalltalk.method({
  5799. selector: "setUp",
  5800. protocol: 'initialization',
  5801. fn: function (){
  5802. var self=this;
  5803. return smalltalk.withContext(function($ctx1) {
  5804. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5805. $ctx1.sendIdx["new"]=1;
  5806. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5807. $ctx1.sendIdx["new"]=2;
  5808. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5809. self["@method"]=nil;
  5810. self["@performBlock"]=(function(){
  5811. return smalltalk.withContext(function($ctx2) {
  5812. return self._error_("performBlock not initialized");
  5813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5814. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5815. args: [],
  5816. 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' ]",
  5817. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5818. referencedClasses: []
  5819. }),
  5820. smalltalk.MethodInheritanceTest);
  5821. smalltalk.addMethod(
  5822. smalltalk.method({
  5823. selector: "shouldMNU",
  5824. protocol: 'testing',
  5825. fn: function (){
  5826. var self=this;
  5827. return smalltalk.withContext(function($ctx1) {
  5828. self._shouldMNUTop();
  5829. self._shouldMNUMiddle();
  5830. self._shouldMNUBottom();
  5831. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5832. args: [],
  5833. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5834. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5835. referencedClasses: []
  5836. }),
  5837. smalltalk.MethodInheritanceTest);
  5838. smalltalk.addMethod(
  5839. smalltalk.method({
  5840. selector: "shouldMNUBottom",
  5841. protocol: 'testing',
  5842. fn: function (){
  5843. var self=this;
  5844. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5845. return smalltalk.withContext(function($ctx1) {
  5846. self._should_raise_((function(){
  5847. return smalltalk.withContext(function($ctx2) {
  5848. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5850. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5851. args: [],
  5852. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5853. messageSends: ["should:raise:", "value:"],
  5854. referencedClasses: ["MessageNotUnderstood"]
  5855. }),
  5856. smalltalk.MethodInheritanceTest);
  5857. smalltalk.addMethod(
  5858. smalltalk.method({
  5859. selector: "shouldMNUMiddle",
  5860. protocol: 'testing',
  5861. fn: function (){
  5862. var self=this;
  5863. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5864. return smalltalk.withContext(function($ctx1) {
  5865. self._should_raise_((function(){
  5866. return smalltalk.withContext(function($ctx2) {
  5867. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5869. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5870. args: [],
  5871. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5872. messageSends: ["should:raise:", "value:"],
  5873. referencedClasses: ["MessageNotUnderstood"]
  5874. }),
  5875. smalltalk.MethodInheritanceTest);
  5876. smalltalk.addMethod(
  5877. smalltalk.method({
  5878. selector: "shouldMNUTop",
  5879. protocol: 'testing',
  5880. fn: function (){
  5881. var self=this;
  5882. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5883. return smalltalk.withContext(function($ctx1) {
  5884. self._should_raise_((function(){
  5885. return smalltalk.withContext(function($ctx2) {
  5886. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5888. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5889. args: [],
  5890. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5891. messageSends: ["should:raise:", "value:"],
  5892. referencedClasses: ["MessageNotUnderstood"]
  5893. }),
  5894. smalltalk.MethodInheritanceTest);
  5895. smalltalk.addMethod(
  5896. smalltalk.method({
  5897. selector: "shouldReturn:",
  5898. protocol: 'testing',
  5899. fn: function (anObject){
  5900. var self=this;
  5901. var result;
  5902. return smalltalk.withContext(function($ctx1) {
  5903. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5904. $ctx1.sendIdx["value:"]=1;
  5905. self._assert_equals_(["top",anObject],["top",result]);
  5906. $ctx1.sendIdx["assert:equals:"]=1;
  5907. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5908. $ctx1.sendIdx["value:"]=2;
  5909. self._assert_equals_(["middle",anObject],["middle",result]);
  5910. $ctx1.sendIdx["assert:equals:"]=2;
  5911. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5912. self._assert_equals_(["bottom",anObject],["bottom",result]);
  5913. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  5914. args: ["anObject"],
  5915. 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 }",
  5916. messageSends: ["value:", "assert:equals:"],
  5917. referencedClasses: []
  5918. }),
  5919. smalltalk.MethodInheritanceTest);
  5920. smalltalk.addMethod(
  5921. smalltalk.method({
  5922. selector: "shouldReturn:and:and:",
  5923. protocol: 'testing',
  5924. fn: function (anObject,anObject2,anObject3){
  5925. var self=this;
  5926. var result;
  5927. return smalltalk.withContext(function($ctx1) {
  5928. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5929. $ctx1.sendIdx["value:"]=1;
  5930. self._assert_equals_(["top",anObject],["top",result]);
  5931. $ctx1.sendIdx["assert:equals:"]=1;
  5932. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5933. $ctx1.sendIdx["value:"]=2;
  5934. self._assert_equals_(["middle",anObject2],["middle",result]);
  5935. $ctx1.sendIdx["assert:equals:"]=2;
  5936. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5937. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5938. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5939. args: ["anObject", "anObject2", "anObject3"],
  5940. 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 }",
  5941. messageSends: ["value:", "assert:equals:"],
  5942. referencedClasses: []
  5943. }),
  5944. smalltalk.MethodInheritanceTest);
  5945. smalltalk.addMethod(
  5946. smalltalk.method({
  5947. selector: "targetClassBottom",
  5948. protocol: 'accessing',
  5949. fn: function (){
  5950. var self=this;
  5951. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5952. return smalltalk.withContext(function($ctx1) {
  5953. return $JavaScriptException();
  5954. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5955. args: [],
  5956. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5957. messageSends: [],
  5958. referencedClasses: ["JavaScriptException"]
  5959. }),
  5960. smalltalk.MethodInheritanceTest);
  5961. smalltalk.addMethod(
  5962. smalltalk.method({
  5963. selector: "targetClassMiddle",
  5964. protocol: 'accessing',
  5965. fn: function (){
  5966. var self=this;
  5967. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5968. return smalltalk.withContext(function($ctx1) {
  5969. return $Error();
  5970. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5971. args: [],
  5972. source: "targetClassMiddle\x0a\x09^ Error",
  5973. messageSends: [],
  5974. referencedClasses: ["Error"]
  5975. }),
  5976. smalltalk.MethodInheritanceTest);
  5977. smalltalk.addMethod(
  5978. smalltalk.method({
  5979. selector: "targetClassTop",
  5980. protocol: 'accessing',
  5981. fn: function (){
  5982. var self=this;
  5983. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5984. return smalltalk.withContext(function($ctx1) {
  5985. return $Object();
  5986. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  5987. args: [],
  5988. source: "targetClassTop\x0a\x09^ Object",
  5989. messageSends: [],
  5990. referencedClasses: ["Object"]
  5991. }),
  5992. smalltalk.MethodInheritanceTest);
  5993. smalltalk.addMethod(
  5994. smalltalk.method({
  5995. selector: "tearDown",
  5996. protocol: 'initialization',
  5997. fn: function (){
  5998. var self=this;
  5999. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6000. return smalltalk.withContext(function($ctx1) {
  6001. _st((function(){
  6002. return smalltalk.withContext(function($ctx2) {
  6003. return self._deinstallTop();
  6004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6005. return smalltalk.withContext(function($ctx2) {
  6006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6007. $ctx1.sendIdx["on:do:"]=1;
  6008. _st((function(){
  6009. return smalltalk.withContext(function($ctx2) {
  6010. return self._deinstallMiddle();
  6011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6012. return smalltalk.withContext(function($ctx2) {
  6013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6014. $ctx1.sendIdx["on:do:"]=2;
  6015. _st((function(){
  6016. return smalltalk.withContext(function($ctx2) {
  6017. return self._deinstallBottom();
  6018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6019. return smalltalk.withContext(function($ctx2) {
  6020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6021. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6022. args: [],
  6023. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6024. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6025. referencedClasses: ["Error"]
  6026. }),
  6027. smalltalk.MethodInheritanceTest);
  6028. smalltalk.addMethod(
  6029. smalltalk.method({
  6030. selector: "testMNU11",
  6031. protocol: 'tests',
  6032. fn: function (){
  6033. var self=this;
  6034. return smalltalk.withContext(function($ctx1) {
  6035. self["@performBlock"]=(function(x){
  6036. return smalltalk.withContext(function($ctx2) {
  6037. return _st(x)._foo();
  6038. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6039. self._shouldMNU();
  6040. $ctx1.sendIdx["shouldMNU"]=1;
  6041. self._installTop_("foo ^ false");
  6042. $ctx1.sendIdx["installTop:"]=1;
  6043. self._installTop_("foo ^ true");
  6044. self._deinstallTop();
  6045. self._shouldMNU();
  6046. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6047. args: [],
  6048. 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",
  6049. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6050. referencedClasses: []
  6051. }),
  6052. smalltalk.MethodInheritanceTest);
  6053. smalltalk.addMethod(
  6054. smalltalk.method({
  6055. selector: "testMNU22",
  6056. protocol: 'tests',
  6057. fn: function (){
  6058. var self=this;
  6059. return smalltalk.withContext(function($ctx1) {
  6060. self["@performBlock"]=(function(x){
  6061. return smalltalk.withContext(function($ctx2) {
  6062. return _st(x)._foo();
  6063. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6064. self._shouldMNU();
  6065. $ctx1.sendIdx["shouldMNU"]=1;
  6066. self._installMiddle_("foo ^ false");
  6067. $ctx1.sendIdx["installMiddle:"]=1;
  6068. self._installMiddle_("foo ^ true");
  6069. self._deinstallMiddle();
  6070. self._shouldMNU();
  6071. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6072. args: [],
  6073. 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",
  6074. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6075. referencedClasses: []
  6076. }),
  6077. smalltalk.MethodInheritanceTest);
  6078. smalltalk.addMethod(
  6079. smalltalk.method({
  6080. selector: "testReturns1",
  6081. protocol: 'tests',
  6082. fn: function (){
  6083. var self=this;
  6084. return smalltalk.withContext(function($ctx1) {
  6085. self["@performBlock"]=(function(x){
  6086. return smalltalk.withContext(function($ctx2) {
  6087. return _st(x)._foo();
  6088. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6089. self._installTop_("foo ^ false");
  6090. $ctx1.sendIdx["installTop:"]=1;
  6091. self._shouldReturn_(false);
  6092. $ctx1.sendIdx["shouldReturn:"]=1;
  6093. self._installTop_("foo ^ true");
  6094. self._shouldReturn_(true);
  6095. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6096. args: [],
  6097. 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",
  6098. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6099. referencedClasses: []
  6100. }),
  6101. smalltalk.MethodInheritanceTest);
  6102. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6103. smalltalk.addMethod(
  6104. smalltalk.method({
  6105. selector: "testAbs",
  6106. protocol: 'tests',
  6107. fn: function (){
  6108. var self=this;
  6109. return smalltalk.withContext(function($ctx1) {
  6110. var $1;
  6111. $1=(4)._abs();
  6112. $ctx1.sendIdx["abs"]=1;
  6113. self._assert_equals_($1,(4));
  6114. $ctx1.sendIdx["assert:equals:"]=1;
  6115. self._assert_equals_((-4)._abs(),(4));
  6116. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6117. args: [],
  6118. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6119. messageSends: ["assert:equals:", "abs"],
  6120. referencedClasses: []
  6121. }),
  6122. smalltalk.NumberTest);
  6123. smalltalk.addMethod(
  6124. smalltalk.method({
  6125. selector: "testArithmetic",
  6126. protocol: 'tests',
  6127. fn: function (){
  6128. var self=this;
  6129. return smalltalk.withContext(function($ctx1) {
  6130. var $1,$2,$3,$5,$4;
  6131. $1=(1.5).__plus((1));
  6132. $ctx1.sendIdx["+"]=1;
  6133. self._assert_equals_($1,(2.5));
  6134. $ctx1.sendIdx["assert:equals:"]=1;
  6135. $2=(2).__minus((1));
  6136. $ctx1.sendIdx["-"]=1;
  6137. self._assert_equals_($2,(1));
  6138. $ctx1.sendIdx["assert:equals:"]=2;
  6139. self._assert_equals_((-2).__minus((1)),(-3));
  6140. $ctx1.sendIdx["assert:equals:"]=3;
  6141. self._assert_equals_((12).__slash((2)),(6));
  6142. $ctx1.sendIdx["assert:equals:"]=4;
  6143. $3=(3).__star((4));
  6144. $ctx1.sendIdx["*"]=1;
  6145. self._assert_equals_($3,(12));
  6146. $ctx1.sendIdx["assert:equals:"]=5;
  6147. self._assert_equals_((7).__slash_slash((2)),(3));
  6148. $ctx1.sendIdx["assert:equals:"]=6;
  6149. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6150. $ctx1.sendIdx["assert:equals:"]=7;
  6151. $5=(1).__plus((2));
  6152. $ctx1.sendIdx["+"]=2;
  6153. $4=_st($5).__star((3));
  6154. $ctx1.sendIdx["*"]=2;
  6155. self._assert_equals_($4,(9));
  6156. $ctx1.sendIdx["assert:equals:"]=8;
  6157. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6158. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6159. args: [],
  6160. 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",
  6161. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6162. referencedClasses: []
  6163. }),
  6164. smalltalk.NumberTest);
  6165. smalltalk.addMethod(
  6166. smalltalk.method({
  6167. selector: "testAsNumber",
  6168. protocol: 'tests',
  6169. fn: function (){
  6170. var self=this;
  6171. return smalltalk.withContext(function($ctx1) {
  6172. self._assert_equals_((3)._asNumber(),(3));
  6173. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6174. args: [],
  6175. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6176. messageSends: ["assert:equals:", "asNumber"],
  6177. referencedClasses: []
  6178. }),
  6179. smalltalk.NumberTest);
  6180. smalltalk.addMethod(
  6181. smalltalk.method({
  6182. selector: "testCeiling",
  6183. protocol: 'tests',
  6184. fn: function (){
  6185. var self=this;
  6186. return smalltalk.withContext(function($ctx1) {
  6187. var $1,$2;
  6188. $1=(1.2)._ceiling();
  6189. $ctx1.sendIdx["ceiling"]=1;
  6190. self._assert_equals_($1,(2));
  6191. $ctx1.sendIdx["assert:equals:"]=1;
  6192. $2=(-1.2)._ceiling();
  6193. $ctx1.sendIdx["ceiling"]=2;
  6194. self._assert_equals_($2,(-1));
  6195. $ctx1.sendIdx["assert:equals:"]=2;
  6196. self._assert_equals_((1)._ceiling(),(1));
  6197. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6198. args: [],
  6199. 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.",
  6200. messageSends: ["assert:equals:", "ceiling"],
  6201. referencedClasses: []
  6202. }),
  6203. smalltalk.NumberTest);
  6204. smalltalk.addMethod(
  6205. smalltalk.method({
  6206. selector: "testComparison",
  6207. protocol: 'tests',
  6208. fn: function (){
  6209. var self=this;
  6210. return smalltalk.withContext(function($ctx1) {
  6211. var $1,$2,$3,$4;
  6212. $1=(3).__gt((2));
  6213. $ctx1.sendIdx[">"]=1;
  6214. self._assert_($1);
  6215. $ctx1.sendIdx["assert:"]=1;
  6216. $2=(2).__lt((3));
  6217. $ctx1.sendIdx["<"]=1;
  6218. self._assert_($2);
  6219. $ctx1.sendIdx["assert:"]=2;
  6220. self._deny_((3).__lt((2)));
  6221. $ctx1.sendIdx["deny:"]=1;
  6222. self._deny_((2).__gt((3)));
  6223. $3=(3).__gt_eq((3));
  6224. $ctx1.sendIdx[">="]=1;
  6225. self._assert_($3);
  6226. $ctx1.sendIdx["assert:"]=3;
  6227. self._assert_((3.1).__gt_eq((3)));
  6228. $ctx1.sendIdx["assert:"]=4;
  6229. $4=(3).__lt_eq((3));
  6230. $ctx1.sendIdx["<="]=1;
  6231. self._assert_($4);
  6232. $ctx1.sendIdx["assert:"]=5;
  6233. self._assert_((3).__lt_eq((3.1)));
  6234. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6235. args: [],
  6236. 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",
  6237. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6238. referencedClasses: []
  6239. }),
  6240. smalltalk.NumberTest);
  6241. smalltalk.addMethod(
  6242. smalltalk.method({
  6243. selector: "testCopying",
  6244. protocol: 'tests',
  6245. fn: function (){
  6246. var self=this;
  6247. return smalltalk.withContext(function($ctx1) {
  6248. var $1;
  6249. $1=_st((1)._copy()).__eq_eq((1));
  6250. $ctx1.sendIdx["=="]=1;
  6251. self._assert_($1);
  6252. $ctx1.sendIdx["assert:"]=1;
  6253. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6254. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6255. args: [],
  6256. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6257. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6258. referencedClasses: []
  6259. }),
  6260. smalltalk.NumberTest);
  6261. smalltalk.addMethod(
  6262. smalltalk.method({
  6263. selector: "testEquality",
  6264. protocol: 'tests',
  6265. fn: function (){
  6266. var self=this;
  6267. return smalltalk.withContext(function($ctx1) {
  6268. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6269. $1=(1).__eq((1));
  6270. $ctx1.sendIdx["="]=1;
  6271. self._assert_($1);
  6272. $ctx1.sendIdx["assert:"]=1;
  6273. $2=(0).__eq((0));
  6274. $ctx1.sendIdx["="]=2;
  6275. self._assert_($2);
  6276. $ctx1.sendIdx["assert:"]=2;
  6277. $3=(1).__eq((0));
  6278. $ctx1.sendIdx["="]=3;
  6279. self._deny_($3);
  6280. $ctx1.sendIdx["deny:"]=1;
  6281. $5=(1)._yourself();
  6282. $ctx1.sendIdx["yourself"]=1;
  6283. $4=_st($5).__eq((1));
  6284. $ctx1.sendIdx["="]=4;
  6285. self._assert_($4);
  6286. $ctx1.sendIdx["assert:"]=3;
  6287. $7=(1)._yourself();
  6288. $ctx1.sendIdx["yourself"]=2;
  6289. $6=(1).__eq($7);
  6290. $ctx1.sendIdx["="]=5;
  6291. self._assert_($6);
  6292. $ctx1.sendIdx["assert:"]=4;
  6293. $9=(1)._yourself();
  6294. $ctx1.sendIdx["yourself"]=3;
  6295. $8=_st($9).__eq((1)._yourself());
  6296. $ctx1.sendIdx["="]=6;
  6297. self._assert_($8);
  6298. $10=(0).__eq(false);
  6299. $ctx1.sendIdx["="]=7;
  6300. self._deny_($10);
  6301. $ctx1.sendIdx["deny:"]=2;
  6302. $11=false.__eq((0));
  6303. $ctx1.sendIdx["="]=8;
  6304. self._deny_($11);
  6305. $ctx1.sendIdx["deny:"]=3;
  6306. $12="".__eq((0));
  6307. $ctx1.sendIdx["="]=9;
  6308. self._deny_($12);
  6309. $ctx1.sendIdx["deny:"]=4;
  6310. self._deny_((0).__eq(""));
  6311. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6312. args: [],
  6313. 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 = ''",
  6314. messageSends: ["assert:", "=", "deny:", "yourself"],
  6315. referencedClasses: []
  6316. }),
  6317. smalltalk.NumberTest);
  6318. smalltalk.addMethod(
  6319. smalltalk.method({
  6320. selector: "testFloor",
  6321. protocol: 'tests',
  6322. fn: function (){
  6323. var self=this;
  6324. return smalltalk.withContext(function($ctx1) {
  6325. var $1,$2;
  6326. $1=(1.2)._floor();
  6327. $ctx1.sendIdx["floor"]=1;
  6328. self._assert_equals_($1,(1));
  6329. $ctx1.sendIdx["assert:equals:"]=1;
  6330. $2=(-1.2)._floor();
  6331. $ctx1.sendIdx["floor"]=2;
  6332. self._assert_equals_($2,(-2));
  6333. $ctx1.sendIdx["assert:equals:"]=2;
  6334. self._assert_equals_((1)._floor(),(1));
  6335. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6336. args: [],
  6337. 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.",
  6338. messageSends: ["assert:equals:", "floor"],
  6339. referencedClasses: []
  6340. }),
  6341. smalltalk.NumberTest);
  6342. smalltalk.addMethod(
  6343. smalltalk.method({
  6344. selector: "testHexNumbers",
  6345. protocol: 'tests',
  6346. fn: function (){
  6347. var self=this;
  6348. return smalltalk.withContext(function($ctx1) {
  6349. var $1,$2,$3,$4,$5;
  6350. self._assert_equals_((9),(9));
  6351. $ctx1.sendIdx["assert:equals:"]=1;
  6352. $1=(10)._truncated();
  6353. $ctx1.sendIdx["truncated"]=1;
  6354. self._assert_equals_($1,(10));
  6355. $ctx1.sendIdx["assert:equals:"]=2;
  6356. $2=(11)._truncated();
  6357. $ctx1.sendIdx["truncated"]=2;
  6358. self._assert_equals_($2,(11));
  6359. $ctx1.sendIdx["assert:equals:"]=3;
  6360. $3=(12)._truncated();
  6361. $ctx1.sendIdx["truncated"]=3;
  6362. self._assert_equals_($3,(12));
  6363. $ctx1.sendIdx["assert:equals:"]=4;
  6364. $4=(13)._truncated();
  6365. $ctx1.sendIdx["truncated"]=4;
  6366. self._assert_equals_($4,(13));
  6367. $ctx1.sendIdx["assert:equals:"]=5;
  6368. $5=(14)._truncated();
  6369. $ctx1.sendIdx["truncated"]=5;
  6370. self._assert_equals_($5,(14));
  6371. $ctx1.sendIdx["assert:equals:"]=6;
  6372. self._assert_equals_((15)._truncated(),(15));
  6373. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6374. args: [],
  6375. 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",
  6376. messageSends: ["assert:equals:", "truncated"],
  6377. referencedClasses: []
  6378. }),
  6379. smalltalk.NumberTest);
  6380. smalltalk.addMethod(
  6381. smalltalk.method({
  6382. selector: "testIdentity",
  6383. protocol: 'tests',
  6384. fn: function (){
  6385. var self=this;
  6386. return smalltalk.withContext(function($ctx1) {
  6387. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6388. $1=(1).__eq_eq((1));
  6389. $ctx1.sendIdx["=="]=1;
  6390. self._assert_($1);
  6391. $ctx1.sendIdx["assert:"]=1;
  6392. $2=(0).__eq_eq((0));
  6393. $ctx1.sendIdx["=="]=2;
  6394. self._assert_($2);
  6395. $ctx1.sendIdx["assert:"]=2;
  6396. $3=(1).__eq_eq((0));
  6397. $ctx1.sendIdx["=="]=3;
  6398. self._deny_($3);
  6399. $ctx1.sendIdx["deny:"]=1;
  6400. $5=(1)._yourself();
  6401. $ctx1.sendIdx["yourself"]=1;
  6402. $4=_st($5).__eq_eq((1));
  6403. $ctx1.sendIdx["=="]=4;
  6404. self._assert_($4);
  6405. $ctx1.sendIdx["assert:"]=3;
  6406. $7=(1)._yourself();
  6407. $ctx1.sendIdx["yourself"]=2;
  6408. $6=(1).__eq_eq($7);
  6409. $ctx1.sendIdx["=="]=5;
  6410. self._assert_($6);
  6411. $ctx1.sendIdx["assert:"]=4;
  6412. $9=(1)._yourself();
  6413. $ctx1.sendIdx["yourself"]=3;
  6414. $8=_st($9).__eq_eq((1)._yourself());
  6415. $ctx1.sendIdx["=="]=6;
  6416. self._assert_($8);
  6417. self._deny_((1).__eq_eq((2)));
  6418. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6419. args: [],
  6420. 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",
  6421. messageSends: ["assert:", "==", "deny:", "yourself"],
  6422. referencedClasses: []
  6423. }),
  6424. smalltalk.NumberTest);
  6425. smalltalk.addMethod(
  6426. smalltalk.method({
  6427. selector: "testInvalidHexNumbers",
  6428. protocol: 'tests',
  6429. fn: function (){
  6430. var self=this;
  6431. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6432. return smalltalk.withContext(function($ctx1) {
  6433. self._should_raise_((function(){
  6434. return smalltalk.withContext(function($ctx2) {
  6435. return (16)._rG();
  6436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6437. $ctx1.sendIdx["should:raise:"]=1;
  6438. self._should_raise_((function(){
  6439. return smalltalk.withContext(function($ctx2) {
  6440. return (16)._rg();
  6441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6442. $ctx1.sendIdx["should:raise:"]=2;
  6443. self._should_raise_((function(){
  6444. return smalltalk.withContext(function($ctx2) {
  6445. return (16)._rH();
  6446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6447. $ctx1.sendIdx["should:raise:"]=3;
  6448. self._should_raise_((function(){
  6449. return smalltalk.withContext(function($ctx2) {
  6450. return (16)._rh();
  6451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6452. $ctx1.sendIdx["should:raise:"]=4;
  6453. self._should_raise_((function(){
  6454. return smalltalk.withContext(function($ctx2) {
  6455. return (16)._rI();
  6456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6457. $ctx1.sendIdx["should:raise:"]=5;
  6458. self._should_raise_((function(){
  6459. return smalltalk.withContext(function($ctx2) {
  6460. return (16)._ri();
  6461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6462. $ctx1.sendIdx["should:raise:"]=6;
  6463. self._should_raise_((function(){
  6464. return smalltalk.withContext(function($ctx2) {
  6465. return (16)._rJ();
  6466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6467. $ctx1.sendIdx["should:raise:"]=7;
  6468. self._should_raise_((function(){
  6469. return smalltalk.withContext(function($ctx2) {
  6470. return (16)._rj();
  6471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6472. $ctx1.sendIdx["should:raise:"]=8;
  6473. self._should_raise_((function(){
  6474. return smalltalk.withContext(function($ctx2) {
  6475. return (16)._rK();
  6476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6477. $ctx1.sendIdx["should:raise:"]=9;
  6478. self._should_raise_((function(){
  6479. return smalltalk.withContext(function($ctx2) {
  6480. return (16)._rk();
  6481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6482. $ctx1.sendIdx["should:raise:"]=10;
  6483. self._should_raise_((function(){
  6484. return smalltalk.withContext(function($ctx2) {
  6485. return (16)._rL();
  6486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6487. $ctx1.sendIdx["should:raise:"]=11;
  6488. self._should_raise_((function(){
  6489. return smalltalk.withContext(function($ctx2) {
  6490. return (16)._rl();
  6491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6492. $ctx1.sendIdx["should:raise:"]=12;
  6493. self._should_raise_((function(){
  6494. return smalltalk.withContext(function($ctx2) {
  6495. return (16)._rM();
  6496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6497. $ctx1.sendIdx["should:raise:"]=13;
  6498. self._should_raise_((function(){
  6499. return smalltalk.withContext(function($ctx2) {
  6500. return (16)._rm();
  6501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6502. $ctx1.sendIdx["should:raise:"]=14;
  6503. self._should_raise_((function(){
  6504. return smalltalk.withContext(function($ctx2) {
  6505. return (16)._rN();
  6506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6507. $ctx1.sendIdx["should:raise:"]=15;
  6508. self._should_raise_((function(){
  6509. return smalltalk.withContext(function($ctx2) {
  6510. return (16)._rn();
  6511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6512. $ctx1.sendIdx["should:raise:"]=16;
  6513. self._should_raise_((function(){
  6514. return smalltalk.withContext(function($ctx2) {
  6515. return (16)._rO();
  6516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6517. $ctx1.sendIdx["should:raise:"]=17;
  6518. self._should_raise_((function(){
  6519. return smalltalk.withContext(function($ctx2) {
  6520. return (16)._ro();
  6521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6522. $ctx1.sendIdx["should:raise:"]=18;
  6523. self._should_raise_((function(){
  6524. return smalltalk.withContext(function($ctx2) {
  6525. return (16)._rP();
  6526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6527. $ctx1.sendIdx["should:raise:"]=19;
  6528. self._should_raise_((function(){
  6529. return smalltalk.withContext(function($ctx2) {
  6530. return (16)._rp();
  6531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6532. $ctx1.sendIdx["should:raise:"]=20;
  6533. self._should_raise_((function(){
  6534. return smalltalk.withContext(function($ctx2) {
  6535. return (16)._rQ();
  6536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6537. $ctx1.sendIdx["should:raise:"]=21;
  6538. self._should_raise_((function(){
  6539. return smalltalk.withContext(function($ctx2) {
  6540. return (16)._rq();
  6541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6542. $ctx1.sendIdx["should:raise:"]=22;
  6543. self._should_raise_((function(){
  6544. return smalltalk.withContext(function($ctx2) {
  6545. return (16)._rR();
  6546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6547. $ctx1.sendIdx["should:raise:"]=23;
  6548. self._should_raise_((function(){
  6549. return smalltalk.withContext(function($ctx2) {
  6550. return (16)._rr();
  6551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6552. $ctx1.sendIdx["should:raise:"]=24;
  6553. self._should_raise_((function(){
  6554. return smalltalk.withContext(function($ctx2) {
  6555. return (16)._rS();
  6556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6557. $ctx1.sendIdx["should:raise:"]=25;
  6558. self._should_raise_((function(){
  6559. return smalltalk.withContext(function($ctx2) {
  6560. return (16)._rs();
  6561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6562. $ctx1.sendIdx["should:raise:"]=26;
  6563. self._should_raise_((function(){
  6564. return smalltalk.withContext(function($ctx2) {
  6565. return (16)._rT();
  6566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6567. $ctx1.sendIdx["should:raise:"]=27;
  6568. self._should_raise_((function(){
  6569. return smalltalk.withContext(function($ctx2) {
  6570. return (16)._rt();
  6571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6572. $ctx1.sendIdx["should:raise:"]=28;
  6573. self._should_raise_((function(){
  6574. return smalltalk.withContext(function($ctx2) {
  6575. return (16)._rU();
  6576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6577. $ctx1.sendIdx["should:raise:"]=29;
  6578. self._should_raise_((function(){
  6579. return smalltalk.withContext(function($ctx2) {
  6580. return (16)._ru();
  6581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6582. $ctx1.sendIdx["should:raise:"]=30;
  6583. self._should_raise_((function(){
  6584. return smalltalk.withContext(function($ctx2) {
  6585. return (16)._rV();
  6586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6587. $ctx1.sendIdx["should:raise:"]=31;
  6588. self._should_raise_((function(){
  6589. return smalltalk.withContext(function($ctx2) {
  6590. return (16)._rv();
  6591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6592. $ctx1.sendIdx["should:raise:"]=32;
  6593. self._should_raise_((function(){
  6594. return smalltalk.withContext(function($ctx2) {
  6595. return (16)._rW();
  6596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6597. $ctx1.sendIdx["should:raise:"]=33;
  6598. self._should_raise_((function(){
  6599. return smalltalk.withContext(function($ctx2) {
  6600. return (16)._rw();
  6601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6602. $ctx1.sendIdx["should:raise:"]=34;
  6603. self._should_raise_((function(){
  6604. return smalltalk.withContext(function($ctx2) {
  6605. return (16)._rX();
  6606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6607. $ctx1.sendIdx["should:raise:"]=35;
  6608. self._should_raise_((function(){
  6609. return smalltalk.withContext(function($ctx2) {
  6610. return (16)._rx();
  6611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6612. $ctx1.sendIdx["should:raise:"]=36;
  6613. self._should_raise_((function(){
  6614. return smalltalk.withContext(function($ctx2) {
  6615. return (16)._rY();
  6616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6617. $ctx1.sendIdx["should:raise:"]=37;
  6618. self._should_raise_((function(){
  6619. return smalltalk.withContext(function($ctx2) {
  6620. return (16)._ry();
  6621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6622. $ctx1.sendIdx["should:raise:"]=38;
  6623. self._should_raise_((function(){
  6624. return smalltalk.withContext(function($ctx2) {
  6625. return (16)._rZ();
  6626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6627. $ctx1.sendIdx["should:raise:"]=39;
  6628. self._should_raise_((function(){
  6629. return smalltalk.withContext(function($ctx2) {
  6630. return (16)._rz();
  6631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6632. $ctx1.sendIdx["should:raise:"]=40;
  6633. self._should_raise_((function(){
  6634. return smalltalk.withContext(function($ctx2) {
  6635. return (11259375)._Z();
  6636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6637. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6638. args: [],
  6639. 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.",
  6640. 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"],
  6641. referencedClasses: ["MessageNotUnderstood"]
  6642. }),
  6643. smalltalk.NumberTest);
  6644. smalltalk.addMethod(
  6645. smalltalk.method({
  6646. selector: "testLog",
  6647. protocol: 'tests',
  6648. fn: function (){
  6649. var self=this;
  6650. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6651. return smalltalk.withContext(function($ctx1) {
  6652. self._assert_equals_((10000)._log(),(4));
  6653. $ctx1.sendIdx["assert:equals:"]=1;
  6654. self._assert_equals_((512)._log_((2)),(9));
  6655. $ctx1.sendIdx["assert:equals:"]=2;
  6656. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6657. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6658. args: [],
  6659. 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.",
  6660. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6661. referencedClasses: ["Number"]
  6662. }),
  6663. smalltalk.NumberTest);
  6664. smalltalk.addMethod(
  6665. smalltalk.method({
  6666. selector: "testMinMax",
  6667. protocol: 'tests',
  6668. fn: function (){
  6669. var self=this;
  6670. return smalltalk.withContext(function($ctx1) {
  6671. self._assert_equals_((2)._max_((5)),(5));
  6672. $ctx1.sendIdx["assert:equals:"]=1;
  6673. self._assert_equals_((2)._min_((5)),(2));
  6674. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6675. args: [],
  6676. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6677. messageSends: ["assert:equals:", "max:", "min:"],
  6678. referencedClasses: []
  6679. }),
  6680. smalltalk.NumberTest);
  6681. smalltalk.addMethod(
  6682. smalltalk.method({
  6683. selector: "testNegated",
  6684. protocol: 'tests',
  6685. fn: function (){
  6686. var self=this;
  6687. return smalltalk.withContext(function($ctx1) {
  6688. var $1;
  6689. $1=(3)._negated();
  6690. $ctx1.sendIdx["negated"]=1;
  6691. self._assert_equals_($1,(-3));
  6692. $ctx1.sendIdx["assert:equals:"]=1;
  6693. self._assert_equals_((-3)._negated(),(3));
  6694. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6695. args: [],
  6696. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6697. messageSends: ["assert:equals:", "negated"],
  6698. referencedClasses: []
  6699. }),
  6700. smalltalk.NumberTest);
  6701. smalltalk.addMethod(
  6702. smalltalk.method({
  6703. selector: "testPrintShowingDecimalPlaces",
  6704. protocol: 'tests',
  6705. fn: function (){
  6706. var self=this;
  6707. return smalltalk.withContext(function($ctx1) {
  6708. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6709. $1=(23)._printShowingDecimalPlaces_((2));
  6710. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6711. self._assert_equals_($1,"23.00");
  6712. $ctx1.sendIdx["assert:equals:"]=1;
  6713. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6714. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6715. self._assert_equals_($2,"23.57");
  6716. $ctx1.sendIdx["assert:equals:"]=2;
  6717. $4=(234.567)._negated();
  6718. $ctx1.sendIdx["negated"]=1;
  6719. $3=_st($4)._printShowingDecimalPlaces_((5));
  6720. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6721. self._assert_equals_($3,"-234.56700");
  6722. $ctx1.sendIdx["assert:equals:"]=3;
  6723. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6724. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6725. self._assert_equals_($5,"23");
  6726. $ctx1.sendIdx["assert:equals:"]=4;
  6727. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6728. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6729. self._assert_equals_($6,"24");
  6730. $ctx1.sendIdx["assert:equals:"]=5;
  6731. $8=(23.4567)._negated();
  6732. $ctx1.sendIdx["negated"]=2;
  6733. $7=_st($8)._printShowingDecimalPlaces_((0));
  6734. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6735. self._assert_equals_($7,"-23");
  6736. $ctx1.sendIdx["assert:equals:"]=6;
  6737. $10=(23.5567)._negated();
  6738. $ctx1.sendIdx["negated"]=3;
  6739. $9=_st($10)._printShowingDecimalPlaces_((0));
  6740. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6741. self._assert_equals_($9,"-24");
  6742. $ctx1.sendIdx["assert:equals:"]=7;
  6743. $11=(100000000)._printShowingDecimalPlaces_((1));
  6744. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6745. self._assert_equals_($11,"100000000.0");
  6746. $ctx1.sendIdx["assert:equals:"]=8;
  6747. $12=(0.98)._printShowingDecimalPlaces_((5));
  6748. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6749. self._assert_equals_($12,"0.98000");
  6750. $ctx1.sendIdx["assert:equals:"]=9;
  6751. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6752. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6753. self._assert_equals_($13,"-0.98");
  6754. $ctx1.sendIdx["assert:equals:"]=10;
  6755. $14=(2.567)._printShowingDecimalPlaces_((2));
  6756. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6757. self._assert_equals_($14,"2.57");
  6758. $ctx1.sendIdx["assert:equals:"]=11;
  6759. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6760. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6761. self._assert_equals_($15,"-2.57");
  6762. $ctx1.sendIdx["assert:equals:"]=12;
  6763. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6764. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6765. args: [],
  6766. 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'.",
  6767. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6768. referencedClasses: []
  6769. }),
  6770. smalltalk.NumberTest);
  6771. smalltalk.addMethod(
  6772. smalltalk.method({
  6773. selector: "testRaisedTo",
  6774. protocol: 'tests',
  6775. fn: function (){
  6776. var self=this;
  6777. return smalltalk.withContext(function($ctx1) {
  6778. var $1,$2,$3;
  6779. $1=(2)._raisedTo_((4));
  6780. $ctx1.sendIdx["raisedTo:"]=1;
  6781. self._assert_equals_($1,(16));
  6782. $ctx1.sendIdx["assert:equals:"]=1;
  6783. $2=(2)._raisedTo_((0));
  6784. $ctx1.sendIdx["raisedTo:"]=2;
  6785. self._assert_equals_($2,(1));
  6786. $ctx1.sendIdx["assert:equals:"]=2;
  6787. $3=(2)._raisedTo_((-3));
  6788. $ctx1.sendIdx["raisedTo:"]=3;
  6789. self._assert_equals_($3,(0.125));
  6790. $ctx1.sendIdx["assert:equals:"]=3;
  6791. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6792. $ctx1.sendIdx["assert:equals:"]=4;
  6793. self._assert_equals_((2).__star_star((4)),(16));
  6794. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6795. args: [],
  6796. 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.",
  6797. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6798. referencedClasses: []
  6799. }),
  6800. smalltalk.NumberTest);
  6801. smalltalk.addMethod(
  6802. smalltalk.method({
  6803. selector: "testRounded",
  6804. protocol: 'tests',
  6805. fn: function (){
  6806. var self=this;
  6807. return smalltalk.withContext(function($ctx1) {
  6808. var $1,$2;
  6809. $1=(3)._rounded();
  6810. $ctx1.sendIdx["rounded"]=1;
  6811. self._assert_equals_($1,(3));
  6812. $ctx1.sendIdx["assert:equals:"]=1;
  6813. $2=(3.212)._rounded();
  6814. $ctx1.sendIdx["rounded"]=2;
  6815. self._assert_equals_($2,(3));
  6816. $ctx1.sendIdx["assert:equals:"]=2;
  6817. self._assert_equals_((3.51)._rounded(),(4));
  6818. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6819. args: [],
  6820. 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",
  6821. messageSends: ["assert:equals:", "rounded"],
  6822. referencedClasses: []
  6823. }),
  6824. smalltalk.NumberTest);
  6825. smalltalk.addMethod(
  6826. smalltalk.method({
  6827. selector: "testSign",
  6828. protocol: 'tests',
  6829. fn: function (){
  6830. var self=this;
  6831. return smalltalk.withContext(function($ctx1) {
  6832. var $1,$2;
  6833. $1=(5)._sign();
  6834. $ctx1.sendIdx["sign"]=1;
  6835. self._assert_equals_($1,(1));
  6836. $ctx1.sendIdx["assert:equals:"]=1;
  6837. $2=(0)._sign();
  6838. $ctx1.sendIdx["sign"]=2;
  6839. self._assert_equals_($2,(0));
  6840. $ctx1.sendIdx["assert:equals:"]=2;
  6841. self._assert_equals_((-1.4)._sign(),(-1));
  6842. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6843. args: [],
  6844. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6845. messageSends: ["assert:equals:", "sign"],
  6846. referencedClasses: []
  6847. }),
  6848. smalltalk.NumberTest);
  6849. smalltalk.addMethod(
  6850. smalltalk.method({
  6851. selector: "testSqrt",
  6852. protocol: 'tests',
  6853. fn: function (){
  6854. var self=this;
  6855. return smalltalk.withContext(function($ctx1) {
  6856. var $1;
  6857. $1=(4)._sqrt();
  6858. $ctx1.sendIdx["sqrt"]=1;
  6859. self._assert_equals_($1,(2));
  6860. $ctx1.sendIdx["assert:equals:"]=1;
  6861. self._assert_equals_((16)._sqrt(),(4));
  6862. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6863. args: [],
  6864. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6865. messageSends: ["assert:equals:", "sqrt"],
  6866. referencedClasses: []
  6867. }),
  6868. smalltalk.NumberTest);
  6869. smalltalk.addMethod(
  6870. smalltalk.method({
  6871. selector: "testSquared",
  6872. protocol: 'tests',
  6873. fn: function (){
  6874. var self=this;
  6875. return smalltalk.withContext(function($ctx1) {
  6876. self._assert_equals_((4)._squared(),(16));
  6877. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6878. args: [],
  6879. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6880. messageSends: ["assert:equals:", "squared"],
  6881. referencedClasses: []
  6882. }),
  6883. smalltalk.NumberTest);
  6884. smalltalk.addMethod(
  6885. smalltalk.method({
  6886. selector: "testTimesRepeat",
  6887. protocol: 'tests',
  6888. fn: function (){
  6889. var self=this;
  6890. var i;
  6891. return smalltalk.withContext(function($ctx1) {
  6892. i=(0);
  6893. (0)._timesRepeat_((function(){
  6894. return smalltalk.withContext(function($ctx2) {
  6895. i=_st(i).__plus((1));
  6896. $ctx2.sendIdx["+"]=1;
  6897. return i;
  6898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6899. $ctx1.sendIdx["timesRepeat:"]=1;
  6900. self._assert_equals_(i,(0));
  6901. $ctx1.sendIdx["assert:equals:"]=1;
  6902. (5)._timesRepeat_((function(){
  6903. return smalltalk.withContext(function($ctx2) {
  6904. i=_st(i).__plus((1));
  6905. return i;
  6906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6907. self._assert_equals_(i,(5));
  6908. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6909. args: [],
  6910. 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",
  6911. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  6912. referencedClasses: []
  6913. }),
  6914. smalltalk.NumberTest);
  6915. smalltalk.addMethod(
  6916. smalltalk.method({
  6917. selector: "testTo",
  6918. protocol: 'tests',
  6919. fn: function (){
  6920. var self=this;
  6921. return smalltalk.withContext(function($ctx1) {
  6922. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  6923. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  6924. args: [],
  6925. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  6926. messageSends: ["assert:equals:", "to:"],
  6927. referencedClasses: []
  6928. }),
  6929. smalltalk.NumberTest);
  6930. smalltalk.addMethod(
  6931. smalltalk.method({
  6932. selector: "testToBy",
  6933. protocol: 'tests',
  6934. fn: function (){
  6935. var self=this;
  6936. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6937. return smalltalk.withContext(function($ctx1) {
  6938. var $1;
  6939. $1=(0)._to_by_((6),(2));
  6940. $ctx1.sendIdx["to:by:"]=1;
  6941. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6942. self._should_raise_((function(){
  6943. return smalltalk.withContext(function($ctx2) {
  6944. return (1)._to_by_((4),(0));
  6945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6946. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6947. args: [],
  6948. 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",
  6949. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6950. referencedClasses: ["Error"]
  6951. }),
  6952. smalltalk.NumberTest);
  6953. smalltalk.addMethod(
  6954. smalltalk.method({
  6955. selector: "testTrigonometry",
  6956. protocol: 'tests',
  6957. fn: function (){
  6958. var self=this;
  6959. return smalltalk.withContext(function($ctx1) {
  6960. self._assert_equals_((0)._cos(),(1));
  6961. $ctx1.sendIdx["assert:equals:"]=1;
  6962. self._assert_equals_((0)._sin(),(0));
  6963. $ctx1.sendIdx["assert:equals:"]=2;
  6964. self._assert_equals_((0)._tan(),(0));
  6965. $ctx1.sendIdx["assert:equals:"]=3;
  6966. self._assert_equals_((1)._arcCos(),(0));
  6967. $ctx1.sendIdx["assert:equals:"]=4;
  6968. self._assert_equals_((0)._arcSin(),(0));
  6969. $ctx1.sendIdx["assert:equals:"]=5;
  6970. self._assert_equals_((0)._arcTan(),(0));
  6971. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6972. args: [],
  6973. 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.",
  6974. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6975. referencedClasses: []
  6976. }),
  6977. smalltalk.NumberTest);
  6978. smalltalk.addMethod(
  6979. smalltalk.method({
  6980. selector: "testTruncated",
  6981. protocol: 'tests',
  6982. fn: function (){
  6983. var self=this;
  6984. return smalltalk.withContext(function($ctx1) {
  6985. var $1,$2;
  6986. $1=(3)._truncated();
  6987. $ctx1.sendIdx["truncated"]=1;
  6988. self._assert_equals_($1,(3));
  6989. $ctx1.sendIdx["assert:equals:"]=1;
  6990. $2=(3.212)._truncated();
  6991. $ctx1.sendIdx["truncated"]=2;
  6992. self._assert_equals_($2,(3));
  6993. $ctx1.sendIdx["assert:equals:"]=2;
  6994. self._assert_equals_((3.51)._truncated(),(3));
  6995. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  6996. args: [],
  6997. 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",
  6998. messageSends: ["assert:equals:", "truncated"],
  6999. referencedClasses: []
  7000. }),
  7001. smalltalk.NumberTest);
  7002. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7003. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7004. smalltalk.addMethod(
  7005. smalltalk.method({
  7006. selector: "foo",
  7007. protocol: 'not yet classified',
  7008. fn: function (){
  7009. var self=this;
  7010. return smalltalk.withContext(function($ctx1) {
  7011. var $1;
  7012. $1=self["@foo"];
  7013. return $1;
  7014. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7015. args: [],
  7016. source: "foo\x0a\x09^ foo",
  7017. messageSends: [],
  7018. referencedClasses: []
  7019. }),
  7020. smalltalk.ObjectMock);
  7021. smalltalk.addMethod(
  7022. smalltalk.method({
  7023. selector: "foo:",
  7024. protocol: 'not yet classified',
  7025. fn: function (anObject){
  7026. var self=this;
  7027. return smalltalk.withContext(function($ctx1) {
  7028. self["@foo"]=anObject;
  7029. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7030. args: ["anObject"],
  7031. source: "foo: anObject\x0a\x09foo := anObject",
  7032. messageSends: [],
  7033. referencedClasses: []
  7034. }),
  7035. smalltalk.ObjectMock);
  7036. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7037. smalltalk.addMethod(
  7038. smalltalk.method({
  7039. selector: "notDefined",
  7040. protocol: 'tests',
  7041. fn: function (){
  7042. var self=this;
  7043. return smalltalk.withContext(function($ctx1) {
  7044. return void 0;;
  7045. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7046. args: [],
  7047. source: "notDefined\x0a\x09<return void 0;>",
  7048. messageSends: [],
  7049. referencedClasses: []
  7050. }),
  7051. smalltalk.ObjectTest);
  7052. smalltalk.addMethod(
  7053. smalltalk.method({
  7054. selector: "testBasicAccess",
  7055. protocol: 'tests',
  7056. fn: function (){
  7057. var self=this;
  7058. var o;
  7059. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7060. return smalltalk.withContext(function($ctx1) {
  7061. var $1;
  7062. o=_st($Object())._new();
  7063. _st(o)._basicAt_put_("a",(1));
  7064. $1=_st(o)._basicAt_("a");
  7065. $ctx1.sendIdx["basicAt:"]=1;
  7066. self._assert_equals_($1,(1));
  7067. $ctx1.sendIdx["assert:equals:"]=1;
  7068. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7069. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7070. args: [],
  7071. 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",
  7072. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7073. referencedClasses: ["Object"]
  7074. }),
  7075. smalltalk.ObjectTest);
  7076. smalltalk.addMethod(
  7077. smalltalk.method({
  7078. selector: "testBasicPerform",
  7079. protocol: 'tests',
  7080. fn: function (){
  7081. var self=this;
  7082. var o;
  7083. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7084. return smalltalk.withContext(function($ctx1) {
  7085. o=_st($Object())._new();
  7086. _st(o)._basicAt_put_("func",(function(){
  7087. return smalltalk.withContext(function($ctx2) {
  7088. return "hello";
  7089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7090. $ctx1.sendIdx["basicAt:put:"]=1;
  7091. _st(o)._basicAt_put_("func2",(function(a){
  7092. return smalltalk.withContext(function($ctx2) {
  7093. return _st(a).__plus((1));
  7094. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7095. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7096. $ctx1.sendIdx["assert:equals:"]=1;
  7097. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7098. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7099. args: [],
  7100. 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",
  7101. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7102. referencedClasses: ["Object"]
  7103. }),
  7104. smalltalk.ObjectTest);
  7105. smalltalk.addMethod(
  7106. smalltalk.method({
  7107. selector: "testDNU",
  7108. protocol: 'tests',
  7109. fn: function (){
  7110. var self=this;
  7111. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7112. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7113. return smalltalk.withContext(function($ctx1) {
  7114. self._should_raise_((function(){
  7115. return smalltalk.withContext(function($ctx2) {
  7116. return _st(_st($Object())._new())._foo();
  7117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7118. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7119. args: [],
  7120. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7121. messageSends: ["should:raise:", "foo", "new"],
  7122. referencedClasses: ["Object", "MessageNotUnderstood"]
  7123. }),
  7124. smalltalk.ObjectTest);
  7125. smalltalk.addMethod(
  7126. smalltalk.method({
  7127. selector: "testEquality",
  7128. protocol: 'tests',
  7129. fn: function (){
  7130. var self=this;
  7131. var o;
  7132. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7133. return smalltalk.withContext(function($ctx1) {
  7134. var $1,$2,$4,$3;
  7135. o=_st($Object())._new();
  7136. $ctx1.sendIdx["new"]=1;
  7137. $1=_st(o).__eq(_st($Object())._new());
  7138. $ctx1.sendIdx["="]=1;
  7139. self._deny_($1);
  7140. $2=_st(o).__eq(o);
  7141. $ctx1.sendIdx["="]=2;
  7142. self._assert_($2);
  7143. $ctx1.sendIdx["assert:"]=1;
  7144. $4=_st(o)._yourself();
  7145. $ctx1.sendIdx["yourself"]=1;
  7146. $3=_st($4).__eq(o);
  7147. $ctx1.sendIdx["="]=3;
  7148. self._assert_($3);
  7149. $ctx1.sendIdx["assert:"]=2;
  7150. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7151. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7152. args: [],
  7153. 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)",
  7154. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7155. referencedClasses: ["Object"]
  7156. }),
  7157. smalltalk.ObjectTest);
  7158. smalltalk.addMethod(
  7159. smalltalk.method({
  7160. selector: "testHalt",
  7161. protocol: 'tests',
  7162. fn: function (){
  7163. var self=this;
  7164. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7165. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7166. return smalltalk.withContext(function($ctx1) {
  7167. self._should_raise_((function(){
  7168. return smalltalk.withContext(function($ctx2) {
  7169. return _st(_st($Object())._new())._halt();
  7170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7171. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7172. args: [],
  7173. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7174. messageSends: ["should:raise:", "halt", "new"],
  7175. referencedClasses: ["Object", "Error"]
  7176. }),
  7177. smalltalk.ObjectTest);
  7178. smalltalk.addMethod(
  7179. smalltalk.method({
  7180. selector: "testIdentity",
  7181. protocol: 'tests',
  7182. fn: function (){
  7183. var self=this;
  7184. var o;
  7185. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7186. return smalltalk.withContext(function($ctx1) {
  7187. var $1,$2,$4,$3;
  7188. o=_st($Object())._new();
  7189. $ctx1.sendIdx["new"]=1;
  7190. $1=_st(o).__eq_eq(_st($Object())._new());
  7191. $ctx1.sendIdx["=="]=1;
  7192. self._deny_($1);
  7193. $2=_st(o).__eq_eq(o);
  7194. $ctx1.sendIdx["=="]=2;
  7195. self._assert_($2);
  7196. $ctx1.sendIdx["assert:"]=1;
  7197. $4=_st(o)._yourself();
  7198. $ctx1.sendIdx["yourself"]=1;
  7199. $3=_st($4).__eq_eq(o);
  7200. $ctx1.sendIdx["=="]=3;
  7201. self._assert_($3);
  7202. $ctx1.sendIdx["assert:"]=2;
  7203. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7204. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7205. args: [],
  7206. 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",
  7207. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7208. referencedClasses: ["Object"]
  7209. }),
  7210. smalltalk.ObjectTest);
  7211. smalltalk.addMethod(
  7212. smalltalk.method({
  7213. selector: "testIfNil",
  7214. protocol: 'tests',
  7215. fn: function (){
  7216. var self=this;
  7217. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7218. return smalltalk.withContext(function($ctx1) {
  7219. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7220. $2=_st($Object())._new();
  7221. $ctx1.sendIdx["new"]=1;
  7222. $1=_st($2)._isNil();
  7223. self._deny_($1);
  7224. $ctx1.sendIdx["deny:"]=1;
  7225. $5=_st($Object())._new();
  7226. $ctx1.sendIdx["new"]=2;
  7227. if(($receiver = $5) == nil || $receiver == null){
  7228. $4=true;
  7229. } else {
  7230. $4=$5;
  7231. };
  7232. $3=_st($4).__eq(true);
  7233. self._deny_($3);
  7234. $7=_st($Object())._new();
  7235. $ctx1.sendIdx["new"]=3;
  7236. if(($receiver = $7) == nil || $receiver == null){
  7237. $6=$7;
  7238. } else {
  7239. $6=true;
  7240. };
  7241. self._assert_equals_($6,true);
  7242. $ctx1.sendIdx["assert:equals:"]=1;
  7243. $9=_st($Object())._new();
  7244. $ctx1.sendIdx["new"]=4;
  7245. if(($receiver = $9) == nil || $receiver == null){
  7246. $8=false;
  7247. } else {
  7248. $8=true;
  7249. };
  7250. self._assert_equals_($8,true);
  7251. $ctx1.sendIdx["assert:equals:"]=2;
  7252. $11=_st($Object())._new();
  7253. if(($receiver = $11) == nil || $receiver == null){
  7254. $10=false;
  7255. } else {
  7256. $10=true;
  7257. };
  7258. self._assert_equals_($10,true);
  7259. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7260. args: [],
  7261. 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",
  7262. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7263. referencedClasses: ["Object"]
  7264. }),
  7265. smalltalk.ObjectTest);
  7266. smalltalk.addMethod(
  7267. smalltalk.method({
  7268. selector: "testInstVars",
  7269. protocol: 'tests',
  7270. fn: function (){
  7271. var self=this;
  7272. var o;
  7273. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7274. return smalltalk.withContext(function($ctx1) {
  7275. var $1,$2;
  7276. o=_st($ObjectMock())._new();
  7277. $1=_st(o)._instVarAt_("foo");
  7278. $ctx1.sendIdx["instVarAt:"]=1;
  7279. self._assert_equals_($1,nil);
  7280. $ctx1.sendIdx["assert:equals:"]=1;
  7281. _st(o)._instVarAt_put_("foo",(1));
  7282. $2=_st(o)._instVarAt_("foo");
  7283. $ctx1.sendIdx["instVarAt:"]=2;
  7284. self._assert_equals_($2,(1));
  7285. $ctx1.sendIdx["assert:equals:"]=2;
  7286. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7287. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7288. args: [],
  7289. 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",
  7290. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7291. referencedClasses: ["ObjectMock"]
  7292. }),
  7293. smalltalk.ObjectTest);
  7294. smalltalk.addMethod(
  7295. smalltalk.method({
  7296. selector: "testNilUndefined",
  7297. protocol: 'tests',
  7298. fn: function (){
  7299. var self=this;
  7300. return smalltalk.withContext(function($ctx1) {
  7301. self._assert_equals_(self._notDefined(),nil);
  7302. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7303. args: [],
  7304. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7305. messageSends: ["assert:equals:", "notDefined"],
  7306. referencedClasses: []
  7307. }),
  7308. smalltalk.ObjectTest);
  7309. smalltalk.addMethod(
  7310. smalltalk.method({
  7311. selector: "testYourself",
  7312. protocol: 'tests',
  7313. fn: function (){
  7314. var self=this;
  7315. var o;
  7316. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7317. return smalltalk.withContext(function($ctx1) {
  7318. o=_st($ObjectMock())._new();
  7319. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7320. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7321. args: [],
  7322. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7323. messageSends: ["new", "assert:", "==", "yourself"],
  7324. referencedClasses: ["ObjectMock"]
  7325. }),
  7326. smalltalk.ObjectTest);
  7327. smalltalk.addMethod(
  7328. smalltalk.method({
  7329. selector: "testidentityHash",
  7330. protocol: 'tests',
  7331. fn: function (){
  7332. var self=this;
  7333. var o1,o2;
  7334. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7335. return smalltalk.withContext(function($ctx1) {
  7336. var $2,$3,$1,$5,$4;
  7337. o1=_st($Object())._new();
  7338. $ctx1.sendIdx["new"]=1;
  7339. o2=_st($Object())._new();
  7340. $2=_st(o1)._identityHash();
  7341. $ctx1.sendIdx["identityHash"]=1;
  7342. $3=_st(o1)._identityHash();
  7343. $ctx1.sendIdx["identityHash"]=2;
  7344. $1=_st($2).__eq_eq($3);
  7345. $ctx1.sendIdx["=="]=1;
  7346. self._assert_($1);
  7347. $5=_st(o1)._identityHash();
  7348. $ctx1.sendIdx["identityHash"]=3;
  7349. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7350. self._deny_($4);
  7351. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7352. args: [],
  7353. 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",
  7354. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7355. referencedClasses: ["Object"]
  7356. }),
  7357. smalltalk.ObjectTest);
  7358. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7359. smalltalk.addMethod(
  7360. smalltalk.method({
  7361. selector: "testAccessing",
  7362. protocol: 'tests',
  7363. fn: function (){
  7364. var self=this;
  7365. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7366. return smalltalk.withContext(function($ctx1) {
  7367. var $2,$1,$3,$6,$5,$4;
  7368. $2=_st($Point())._x_y_((3),(4));
  7369. $ctx1.sendIdx["x:y:"]=1;
  7370. $1=_st($2)._x();
  7371. $ctx1.sendIdx["x"]=1;
  7372. self._assert_equals_($1,(3));
  7373. $ctx1.sendIdx["assert:equals:"]=1;
  7374. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7375. $ctx1.sendIdx["y"]=1;
  7376. self._assert_equals_($3,(4));
  7377. $ctx1.sendIdx["assert:equals:"]=2;
  7378. $6=_st($Point())._new();
  7379. $ctx1.sendIdx["new"]=1;
  7380. $5=_st($6)._x_((3));
  7381. $4=_st($5)._x();
  7382. self._assert_equals_($4,(3));
  7383. $ctx1.sendIdx["assert:equals:"]=3;
  7384. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7385. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7386. args: [],
  7387. 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",
  7388. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7389. referencedClasses: ["Point"]
  7390. }),
  7391. smalltalk.PointTest);
  7392. smalltalk.addMethod(
  7393. smalltalk.method({
  7394. selector: "testArithmetic",
  7395. protocol: 'tests',
  7396. fn: function (){
  7397. var self=this;
  7398. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7399. return smalltalk.withContext(function($ctx1) {
  7400. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7401. $2=(3).__at((4));
  7402. $ctx1.sendIdx["@"]=1;
  7403. $3=(3).__at((4));
  7404. $ctx1.sendIdx["@"]=2;
  7405. $1=_st($2).__star($3);
  7406. $4=_st($Point())._x_y_((9),(16));
  7407. $ctx1.sendIdx["x:y:"]=1;
  7408. self._assert_equals_($1,$4);
  7409. $ctx1.sendIdx["assert:equals:"]=1;
  7410. $6=(3).__at((4));
  7411. $ctx1.sendIdx["@"]=3;
  7412. $7=(3).__at((4));
  7413. $ctx1.sendIdx["@"]=4;
  7414. $5=_st($6).__plus($7);
  7415. $8=_st($Point())._x_y_((6),(8));
  7416. $ctx1.sendIdx["x:y:"]=2;
  7417. self._assert_equals_($5,$8);
  7418. $ctx1.sendIdx["assert:equals:"]=2;
  7419. $10=(3).__at((4));
  7420. $ctx1.sendIdx["@"]=5;
  7421. $11=(3).__at((4));
  7422. $ctx1.sendIdx["@"]=6;
  7423. $9=_st($10).__minus($11);
  7424. $12=_st($Point())._x_y_((0),(0));
  7425. $ctx1.sendIdx["x:y:"]=3;
  7426. self._assert_equals_($9,$12);
  7427. $ctx1.sendIdx["assert:equals:"]=3;
  7428. $14=(6).__at((8));
  7429. $ctx1.sendIdx["@"]=7;
  7430. $13=_st($14).__slash((3).__at((4)));
  7431. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7432. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7433. args: [],
  7434. 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)",
  7435. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7436. referencedClasses: ["Point"]
  7437. }),
  7438. smalltalk.PointTest);
  7439. smalltalk.addMethod(
  7440. smalltalk.method({
  7441. selector: "testAt",
  7442. protocol: 'tests',
  7443. fn: function (){
  7444. var self=this;
  7445. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7446. return smalltalk.withContext(function($ctx1) {
  7447. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7448. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7449. args: [],
  7450. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7451. messageSends: ["assert:equals:", "@", "x:y:"],
  7452. referencedClasses: ["Point"]
  7453. }),
  7454. smalltalk.PointTest);
  7455. smalltalk.addMethod(
  7456. smalltalk.method({
  7457. selector: "testEgality",
  7458. protocol: 'tests',
  7459. fn: function (){
  7460. var self=this;
  7461. return smalltalk.withContext(function($ctx1) {
  7462. var $2,$3,$1,$5,$4;
  7463. $2=(3).__at((4));
  7464. $ctx1.sendIdx["@"]=1;
  7465. $3=(3).__at((4));
  7466. $ctx1.sendIdx["@"]=2;
  7467. $1=_st($2).__eq($3);
  7468. $ctx1.sendIdx["="]=1;
  7469. self._assert_($1);
  7470. $5=(3).__at((5));
  7471. $ctx1.sendIdx["@"]=3;
  7472. $4=_st($5).__eq((3).__at((6)));
  7473. self._deny_($4);
  7474. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7475. args: [],
  7476. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7477. messageSends: ["assert:", "=", "@", "deny:"],
  7478. referencedClasses: []
  7479. }),
  7480. smalltalk.PointTest);
  7481. smalltalk.addMethod(
  7482. smalltalk.method({
  7483. selector: "testNew",
  7484. protocol: 'tests',
  7485. fn: function (){
  7486. var self=this;
  7487. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7488. return smalltalk.withContext(function($ctx1) {
  7489. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7490. $3=_st($Point())._new();
  7491. $ctx1.sendIdx["new"]=1;
  7492. $2=_st($3)._x_((3));
  7493. $ctx1.sendIdx["x:"]=1;
  7494. $1=_st($2)._y();
  7495. $ctx1.sendIdx["y"]=1;
  7496. self._assert_equals_($1,nil);
  7497. $ctx1.sendIdx["assert:equals:"]=1;
  7498. $7=_st($Point())._new();
  7499. $ctx1.sendIdx["new"]=2;
  7500. $6=_st($7)._x_((3));
  7501. $5=_st($6)._x();
  7502. $ctx1.sendIdx["x"]=1;
  7503. $4=_st($5).__eq((0));
  7504. $ctx1.sendIdx["="]=1;
  7505. self._deny_($4);
  7506. $ctx1.sendIdx["deny:"]=1;
  7507. $10=_st($Point())._new();
  7508. $ctx1.sendIdx["new"]=3;
  7509. $9=_st($10)._y_((4));
  7510. $ctx1.sendIdx["y:"]=1;
  7511. $8=_st($9)._x();
  7512. self._assert_equals_($8,nil);
  7513. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7514. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7515. args: [],
  7516. 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",
  7517. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7518. referencedClasses: ["Point"]
  7519. }),
  7520. smalltalk.PointTest);
  7521. smalltalk.addMethod(
  7522. smalltalk.method({
  7523. selector: "testTranslateBy",
  7524. protocol: 'tests',
  7525. fn: function (){
  7526. var self=this;
  7527. return smalltalk.withContext(function($ctx1) {
  7528. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7529. $2=(3).__at((3));
  7530. $ctx1.sendIdx["@"]=1;
  7531. $3=(0).__at((1));
  7532. $ctx1.sendIdx["@"]=2;
  7533. $1=_st($2)._translateBy_($3);
  7534. $ctx1.sendIdx["translateBy:"]=1;
  7535. $4=(3).__at((4));
  7536. $ctx1.sendIdx["@"]=3;
  7537. self._assert_equals_($1,$4);
  7538. $ctx1.sendIdx["assert:equals:"]=1;
  7539. $6=(3).__at((3));
  7540. $ctx1.sendIdx["@"]=4;
  7541. $8=(1)._negated();
  7542. $ctx1.sendIdx["negated"]=1;
  7543. $7=(0).__at($8);
  7544. $ctx1.sendIdx["@"]=5;
  7545. $5=_st($6)._translateBy_($7);
  7546. $ctx1.sendIdx["translateBy:"]=2;
  7547. $9=(3).__at((2));
  7548. $ctx1.sendIdx["@"]=6;
  7549. self._assert_equals_($5,$9);
  7550. $ctx1.sendIdx["assert:equals:"]=2;
  7551. $11=(3).__at((3));
  7552. $ctx1.sendIdx["@"]=7;
  7553. $12=(2).__at((3));
  7554. $ctx1.sendIdx["@"]=8;
  7555. $10=_st($11)._translateBy_($12);
  7556. $ctx1.sendIdx["translateBy:"]=3;
  7557. $13=(5).__at((6));
  7558. $ctx1.sendIdx["@"]=9;
  7559. self._assert_equals_($10,$13);
  7560. $ctx1.sendIdx["assert:equals:"]=3;
  7561. $15=(3).__at((3));
  7562. $ctx1.sendIdx["@"]=10;
  7563. $16=_st((3)._negated()).__at((0));
  7564. $ctx1.sendIdx["@"]=11;
  7565. $14=_st($15)._translateBy_($16);
  7566. self._assert_equals_($14,(0).__at((3)));
  7567. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7568. args: [],
  7569. 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.",
  7570. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7571. referencedClasses: []
  7572. }),
  7573. smalltalk.PointTest);
  7574. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7575. smalltalk.addMethod(
  7576. smalltalk.method({
  7577. selector: "testNextIfAbsent",
  7578. protocol: 'tests',
  7579. fn: function (){
  7580. var self=this;
  7581. var queue;
  7582. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7583. return smalltalk.withContext(function($ctx1) {
  7584. var $2,$1;
  7585. queue=_st($Queue())._new();
  7586. _st(queue)._nextPut_("index1");
  7587. $2=_st(queue)._nextIfAbsent_("empty");
  7588. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7589. $1=_st($2).__eq("index1");
  7590. $ctx1.sendIdx["="]=1;
  7591. self._assert_($1);
  7592. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7593. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7594. args: [],
  7595. 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'",
  7596. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7597. referencedClasses: ["Queue"]
  7598. }),
  7599. smalltalk.QueueTest);
  7600. smalltalk.addMethod(
  7601. smalltalk.method({
  7602. selector: "testQueueNext",
  7603. protocol: 'tests',
  7604. fn: function (){
  7605. var self=this;
  7606. var queue;
  7607. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7608. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7609. return smalltalk.withContext(function($ctx1) {
  7610. var $1,$2,$4,$3,$6,$5;
  7611. queue=_st($Queue())._new();
  7612. $1=queue;
  7613. _st($1)._nextPut_("index1");
  7614. $ctx1.sendIdx["nextPut:"]=1;
  7615. $2=_st($1)._nextPut_("index2");
  7616. $4=_st(queue)._next();
  7617. $ctx1.sendIdx["next"]=1;
  7618. $3=_st($4).__eq("index1");
  7619. $ctx1.sendIdx["="]=1;
  7620. self._assert_($3);
  7621. $6=_st(queue)._next();
  7622. $ctx1.sendIdx["next"]=2;
  7623. $5=_st($6).__eq("index");
  7624. self._deny_($5);
  7625. self._should_raise_((function(){
  7626. return smalltalk.withContext(function($ctx2) {
  7627. return _st(queue)._next();
  7628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7629. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7630. args: [],
  7631. 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",
  7632. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7633. referencedClasses: ["Queue", "Error"]
  7634. }),
  7635. smalltalk.QueueTest);
  7636. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7637. smalltalk.addMethod(
  7638. smalltalk.method({
  7639. selector: "testAtRandomNumber",
  7640. protocol: 'tests',
  7641. fn: function (){
  7642. var self=this;
  7643. var val;
  7644. return smalltalk.withContext(function($ctx1) {
  7645. (100)._timesRepeat_((function(){
  7646. return smalltalk.withContext(function($ctx2) {
  7647. val=(10)._atRandom();
  7648. val;
  7649. self._assert_(_st(val).__gt((0)));
  7650. $ctx2.sendIdx["assert:"]=1;
  7651. return self._assert_(_st(val).__lt((11)));
  7652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7653. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7654. args: [],
  7655. 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]",
  7656. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7657. referencedClasses: []
  7658. }),
  7659. smalltalk.RandomTest);
  7660. smalltalk.addMethod(
  7661. smalltalk.method({
  7662. selector: "testAtRandomSequenceableCollection",
  7663. protocol: 'tests',
  7664. fn: function (){
  7665. var self=this;
  7666. var val;
  7667. return smalltalk.withContext(function($ctx1) {
  7668. var $3,$4,$2,$1;
  7669. (100)._timesRepeat_((function(){
  7670. return smalltalk.withContext(function($ctx2) {
  7671. val="abc"._atRandom();
  7672. val;
  7673. $3=_st(val).__eq("a");
  7674. $ctx2.sendIdx["="]=1;
  7675. $4=_st(val).__eq("b");
  7676. $ctx2.sendIdx["="]=2;
  7677. $2=_st($3).__or($4);
  7678. $1=_st($2).__or(_st(val).__eq("c"));
  7679. $ctx2.sendIdx["|"]=1;
  7680. return self._assert_($1);
  7681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7682. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7683. args: [],
  7684. 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].",
  7685. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7686. referencedClasses: []
  7687. }),
  7688. smalltalk.RandomTest);
  7689. smalltalk.addMethod(
  7690. smalltalk.method({
  7691. selector: "textNext",
  7692. protocol: 'tests',
  7693. fn: function (){
  7694. var self=this;
  7695. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7696. return smalltalk.withContext(function($ctx1) {
  7697. var $1;
  7698. (10000)._timesRepeat_((function(){
  7699. var current,next;
  7700. return smalltalk.withContext(function($ctx2) {
  7701. next=_st(_st($Random())._new())._next();
  7702. next;
  7703. self._assert_(_st(next).__gt_eq((0)));
  7704. $ctx2.sendIdx["assert:"]=1;
  7705. self._assert_(_st(next).__lt((1)));
  7706. $1=_st(current).__eq(next);
  7707. $ctx2.sendIdx["="]=1;
  7708. self._deny_($1);
  7709. return _st(next).__eq(current);
  7710. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7711. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7712. args: [],
  7713. 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 ]",
  7714. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7715. referencedClasses: ["Random"]
  7716. }),
  7717. smalltalk.RandomTest);
  7718. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7719. smalltalk.addMethod(
  7720. smalltalk.method({
  7721. selector: "collectionClass",
  7722. protocol: 'accessing',
  7723. fn: function (){
  7724. var self=this;
  7725. return smalltalk.withContext(function($ctx1) {
  7726. var $1;
  7727. $1=_st(self._class())._collectionClass();
  7728. return $1;
  7729. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7730. args: [],
  7731. source: "collectionClass\x0a\x09^ self class collectionClass",
  7732. messageSends: ["collectionClass", "class"],
  7733. referencedClasses: []
  7734. }),
  7735. smalltalk.StreamTest);
  7736. smalltalk.addMethod(
  7737. smalltalk.method({
  7738. selector: "newCollection",
  7739. protocol: 'accessing',
  7740. fn: function (){
  7741. var self=this;
  7742. return smalltalk.withContext(function($ctx1) {
  7743. var $1;
  7744. $1=_st(self._collectionClass())._new();
  7745. return $1;
  7746. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7747. args: [],
  7748. source: "newCollection\x0a\x09^ self collectionClass new",
  7749. messageSends: ["new", "collectionClass"],
  7750. referencedClasses: []
  7751. }),
  7752. smalltalk.StreamTest);
  7753. smalltalk.addMethod(
  7754. smalltalk.method({
  7755. selector: "newStream",
  7756. protocol: 'accessing',
  7757. fn: function (){
  7758. var self=this;
  7759. return smalltalk.withContext(function($ctx1) {
  7760. var $1;
  7761. $1=_st(_st(self._collectionClass())._new())._stream();
  7762. return $1;
  7763. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7764. args: [],
  7765. source: "newStream\x0a\x09^ self collectionClass new stream",
  7766. messageSends: ["stream", "new", "collectionClass"],
  7767. referencedClasses: []
  7768. }),
  7769. smalltalk.StreamTest);
  7770. smalltalk.addMethod(
  7771. smalltalk.method({
  7772. selector: "testAtStartAtEnd",
  7773. protocol: 'tests',
  7774. fn: function (){
  7775. var self=this;
  7776. var stream;
  7777. return smalltalk.withContext(function($ctx1) {
  7778. var $1,$2,$3,$4;
  7779. stream=self._newStream();
  7780. $1=_st(stream)._atStart();
  7781. $ctx1.sendIdx["atStart"]=1;
  7782. self._assert_($1);
  7783. $ctx1.sendIdx["assert:"]=1;
  7784. $2=_st(stream)._atEnd();
  7785. $ctx1.sendIdx["atEnd"]=1;
  7786. self._assert_($2);
  7787. $ctx1.sendIdx["assert:"]=2;
  7788. _st(stream)._nextPutAll_(self._newCollection());
  7789. $3=_st(stream)._atEnd();
  7790. $ctx1.sendIdx["atEnd"]=2;
  7791. self._assert_($3);
  7792. $4=_st(stream)._atStart();
  7793. $ctx1.sendIdx["atStart"]=2;
  7794. self._deny_($4);
  7795. $ctx1.sendIdx["deny:"]=1;
  7796. _st(stream)._position_((1));
  7797. self._deny_(_st(stream)._atEnd());
  7798. $ctx1.sendIdx["deny:"]=2;
  7799. self._deny_(_st(stream)._atStart());
  7800. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7801. args: [],
  7802. 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",
  7803. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7804. referencedClasses: []
  7805. }),
  7806. smalltalk.StreamTest);
  7807. smalltalk.addMethod(
  7808. smalltalk.method({
  7809. selector: "testContents",
  7810. protocol: 'tests',
  7811. fn: function (){
  7812. var self=this;
  7813. var stream;
  7814. return smalltalk.withContext(function($ctx1) {
  7815. var $1,$2;
  7816. stream=self._newStream();
  7817. $1=stream;
  7818. $2=self._newCollection();
  7819. $ctx1.sendIdx["newCollection"]=1;
  7820. _st($1)._nextPutAll_($2);
  7821. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7822. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7823. args: [],
  7824. 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",
  7825. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7826. referencedClasses: []
  7827. }),
  7828. smalltalk.StreamTest);
  7829. smalltalk.addMethod(
  7830. smalltalk.method({
  7831. selector: "testIsEmpty",
  7832. protocol: 'tests',
  7833. fn: function (){
  7834. var self=this;
  7835. var stream;
  7836. return smalltalk.withContext(function($ctx1) {
  7837. var $1;
  7838. stream=self._newStream();
  7839. $1=_st(stream)._isEmpty();
  7840. $ctx1.sendIdx["isEmpty"]=1;
  7841. self._assert_($1);
  7842. _st(stream)._nextPutAll_(self._newCollection());
  7843. self._deny_(_st(stream)._isEmpty());
  7844. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7845. args: [],
  7846. 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",
  7847. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7848. referencedClasses: []
  7849. }),
  7850. smalltalk.StreamTest);
  7851. smalltalk.addMethod(
  7852. smalltalk.method({
  7853. selector: "testPosition",
  7854. protocol: 'tests',
  7855. fn: function (){
  7856. var self=this;
  7857. var collection,stream;
  7858. return smalltalk.withContext(function($ctx1) {
  7859. var $1,$2,$3;
  7860. collection=self._newCollection();
  7861. stream=self._newStream();
  7862. _st(stream)._nextPutAll_(collection);
  7863. $1=_st(stream)._position();
  7864. $ctx1.sendIdx["position"]=1;
  7865. self._assert_equals_($1,_st(collection)._size());
  7866. $ctx1.sendIdx["assert:equals:"]=1;
  7867. _st(stream)._position_((0));
  7868. $2=_st(stream)._position();
  7869. $ctx1.sendIdx["position"]=2;
  7870. self._assert_equals_($2,(0));
  7871. $ctx1.sendIdx["assert:equals:"]=2;
  7872. _st(stream)._next();
  7873. $ctx1.sendIdx["next"]=1;
  7874. $3=_st(stream)._position();
  7875. $ctx1.sendIdx["position"]=3;
  7876. self._assert_equals_($3,(1));
  7877. $ctx1.sendIdx["assert:equals:"]=3;
  7878. _st(stream)._next();
  7879. self._assert_equals_(_st(stream)._position(),(2));
  7880. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7881. args: [],
  7882. 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",
  7883. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7884. referencedClasses: []
  7885. }),
  7886. smalltalk.StreamTest);
  7887. smalltalk.addMethod(
  7888. smalltalk.method({
  7889. selector: "testReading",
  7890. protocol: 'tests',
  7891. fn: function (){
  7892. var self=this;
  7893. var stream,collection;
  7894. return smalltalk.withContext(function($ctx1) {
  7895. var $1,$2,$3;
  7896. collection=self._newCollection();
  7897. stream=self._newStream();
  7898. $1=stream;
  7899. _st($1)._nextPutAll_(collection);
  7900. $2=_st($1)._position_((0));
  7901. _st(collection)._do_((function(each){
  7902. return smalltalk.withContext(function($ctx2) {
  7903. $3=_st(stream)._next();
  7904. $ctx2.sendIdx["next"]=1;
  7905. return self._assert_equals_($3,each);
  7906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7907. self._assert_(_st(_st(stream)._next())._isNil());
  7908. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7909. args: [],
  7910. 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",
  7911. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7912. referencedClasses: []
  7913. }),
  7914. smalltalk.StreamTest);
  7915. smalltalk.addMethod(
  7916. smalltalk.method({
  7917. selector: "testStreamContents",
  7918. protocol: 'tests',
  7919. fn: function (){
  7920. var self=this;
  7921. return smalltalk.withContext(function($ctx1) {
  7922. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7923. args: [],
  7924. source: "testStreamContents",
  7925. messageSends: [],
  7926. referencedClasses: []
  7927. }),
  7928. smalltalk.StreamTest);
  7929. smalltalk.addMethod(
  7930. smalltalk.method({
  7931. selector: "testWrite",
  7932. protocol: 'tests',
  7933. fn: function (){
  7934. var self=this;
  7935. var stream,collection;
  7936. return smalltalk.withContext(function($ctx1) {
  7937. collection=self._newCollection();
  7938. stream=self._newStream();
  7939. _st(collection)._do_((function(each){
  7940. return smalltalk.withContext(function($ctx2) {
  7941. return _st(stream).__lt_lt(each);
  7942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7943. self._assert_equals_(_st(stream)._contents(),collection);
  7944. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7945. args: [],
  7946. 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",
  7947. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7948. referencedClasses: []
  7949. }),
  7950. smalltalk.StreamTest);
  7951. smalltalk.addMethod(
  7952. smalltalk.method({
  7953. selector: "testWriting",
  7954. protocol: 'tests',
  7955. fn: function (){
  7956. var self=this;
  7957. var stream,collection;
  7958. return smalltalk.withContext(function($ctx1) {
  7959. var $1;
  7960. collection=self._newCollection();
  7961. stream=self._newStream();
  7962. $ctx1.sendIdx["newStream"]=1;
  7963. _st(collection)._do_((function(each){
  7964. return smalltalk.withContext(function($ctx2) {
  7965. return _st(stream)._nextPut_(each);
  7966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7967. $1=_st(stream)._contents();
  7968. $ctx1.sendIdx["contents"]=1;
  7969. self._assert_equals_($1,collection);
  7970. $ctx1.sendIdx["assert:equals:"]=1;
  7971. stream=self._newStream();
  7972. _st(stream)._nextPutAll_(collection);
  7973. self._assert_equals_(_st(stream)._contents(),collection);
  7974. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7975. args: [],
  7976. 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",
  7977. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7978. referencedClasses: []
  7979. }),
  7980. smalltalk.StreamTest);
  7981. smalltalk.addMethod(
  7982. smalltalk.method({
  7983. selector: "collectionClass",
  7984. protocol: 'accessing',
  7985. fn: function (){
  7986. var self=this;
  7987. return smalltalk.withContext(function($ctx1) {
  7988. return nil;
  7989. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7990. args: [],
  7991. source: "collectionClass\x0a\x09^ nil",
  7992. messageSends: [],
  7993. referencedClasses: []
  7994. }),
  7995. smalltalk.StreamTest.klass);
  7996. smalltalk.addMethod(
  7997. smalltalk.method({
  7998. selector: "isAbstract",
  7999. protocol: 'testing',
  8000. fn: function (){
  8001. var self=this;
  8002. return smalltalk.withContext(function($ctx1) {
  8003. var $1;
  8004. $1=_st(self._collectionClass())._isNil();
  8005. return $1;
  8006. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8007. args: [],
  8008. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8009. messageSends: ["isNil", "collectionClass"],
  8010. referencedClasses: []
  8011. }),
  8012. smalltalk.StreamTest.klass);
  8013. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8014. smalltalk.addMethod(
  8015. smalltalk.method({
  8016. selector: "newCollection",
  8017. protocol: 'accessing',
  8018. fn: function (){
  8019. var self=this;
  8020. return smalltalk.withContext(function($ctx1) {
  8021. var $1;
  8022. $1=[true,(1),(3).__at((4)),"foo"];
  8023. return $1;
  8024. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8025. args: [],
  8026. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8027. messageSends: ["@"],
  8028. referencedClasses: []
  8029. }),
  8030. smalltalk.ArrayStreamTest);
  8031. smalltalk.addMethod(
  8032. smalltalk.method({
  8033. selector: "collectionClass",
  8034. protocol: 'accessing',
  8035. fn: function (){
  8036. var self=this;
  8037. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8038. return smalltalk.withContext(function($ctx1) {
  8039. return $Array();
  8040. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8041. args: [],
  8042. source: "collectionClass\x0a\x09^ Array",
  8043. messageSends: [],
  8044. referencedClasses: ["Array"]
  8045. }),
  8046. smalltalk.ArrayStreamTest.klass);
  8047. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8048. smalltalk.addMethod(
  8049. smalltalk.method({
  8050. selector: "newCollection",
  8051. protocol: 'accessing',
  8052. fn: function (){
  8053. var self=this;
  8054. return smalltalk.withContext(function($ctx1) {
  8055. return "hello world";
  8056. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8057. args: [],
  8058. source: "newCollection\x0a\x09^ 'hello world'",
  8059. messageSends: [],
  8060. referencedClasses: []
  8061. }),
  8062. smalltalk.StringStreamTest);
  8063. smalltalk.addMethod(
  8064. smalltalk.method({
  8065. selector: "collectionClass",
  8066. protocol: 'accessing',
  8067. fn: function (){
  8068. var self=this;
  8069. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8070. return smalltalk.withContext(function($ctx1) {
  8071. return $String();
  8072. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8073. args: [],
  8074. source: "collectionClass\x0a\x09^ String",
  8075. messageSends: [],
  8076. referencedClasses: ["String"]
  8077. }),
  8078. smalltalk.StringStreamTest.klass);
  8079. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8080. smalltalk.addMethod(
  8081. smalltalk.method({
  8082. selector: "testCopying",
  8083. protocol: 'tests',
  8084. fn: function (){
  8085. var self=this;
  8086. return smalltalk.withContext(function($ctx1) {
  8087. self._assert_equals_(nil._copy(),nil);
  8088. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8089. args: [],
  8090. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8091. messageSends: ["assert:equals:", "copy"],
  8092. referencedClasses: []
  8093. }),
  8094. smalltalk.UndefinedTest);
  8095. smalltalk.addMethod(
  8096. smalltalk.method({
  8097. selector: "testDeepCopy",
  8098. protocol: 'tests',
  8099. fn: function (){
  8100. var self=this;
  8101. return smalltalk.withContext(function($ctx1) {
  8102. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8103. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8104. args: [],
  8105. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8106. messageSends: ["assert:", "=", "deepCopy"],
  8107. referencedClasses: []
  8108. }),
  8109. smalltalk.UndefinedTest);
  8110. smalltalk.addMethod(
  8111. smalltalk.method({
  8112. selector: "testIfNil",
  8113. protocol: 'tests',
  8114. fn: function (){
  8115. var self=this;
  8116. return smalltalk.withContext(function($ctx1) {
  8117. var $1,$3,$2,$4,$6,$5;
  8118. if(($receiver = nil) == nil || $receiver == null){
  8119. $1=true;
  8120. } else {
  8121. $1=nil;
  8122. };
  8123. self._assert_equals_($1,true);
  8124. $ctx1.sendIdx["assert:equals:"]=1;
  8125. if(($receiver = nil) == nil || $receiver == null){
  8126. $3=nil;
  8127. } else {
  8128. $3=true;
  8129. };
  8130. $2=_st($3).__eq(true);
  8131. $ctx1.sendIdx["="]=1;
  8132. self._deny_($2);
  8133. $ctx1.sendIdx["deny:"]=1;
  8134. if(($receiver = nil) == nil || $receiver == null){
  8135. $4=true;
  8136. } else {
  8137. $4=false;
  8138. };
  8139. self._assert_equals_($4,true);
  8140. if(($receiver = nil) == nil || $receiver == null){
  8141. $6=false;
  8142. } else {
  8143. $6=true;
  8144. };
  8145. $5=_st($6).__eq(true);
  8146. self._deny_($5);
  8147. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8148. args: [],
  8149. 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",
  8150. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8151. referencedClasses: []
  8152. }),
  8153. smalltalk.UndefinedTest);
  8154. smalltalk.addMethod(
  8155. smalltalk.method({
  8156. selector: "testIsNil",
  8157. protocol: 'tests',
  8158. fn: function (){
  8159. var self=this;
  8160. return smalltalk.withContext(function($ctx1) {
  8161. self._assert_(nil._isNil());
  8162. self._deny_(nil._notNil());
  8163. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8164. args: [],
  8165. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8166. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8167. referencedClasses: []
  8168. }),
  8169. smalltalk.UndefinedTest);
  8170. });