Kernel-Tests.js 294 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819
  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: "collectionWithDuplicates",
  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,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times.\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "isCollectionReadOnly",
  1275. protocol: 'testing',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. return false;
  1280. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "isCollectionReadOnly\x0a\x09^ false",
  1283. messageSends: [],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "sampleNonValue",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. return (999);
  1295. }, function($ctx1) {$ctx1.fill(self,"sampleNonValue",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "sampleNonValue\x0a\x09\x22Answer value that is guaranteed\x0a\x09not to be contained by self collection\x22\x0a\x09\x0a\x09^ 999",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "testAllSatisfy",
  1305. protocol: 'tests',
  1306. fn: function (){
  1307. var self=this;
  1308. var collection,anyOne;
  1309. return smalltalk.withContext(function($ctx1) {
  1310. var $1;
  1311. collection=self._collection();
  1312. anyOne=_st(collection)._anyOne();
  1313. $1=_st(collection)._allSatisfy_((function(each){
  1314. return smalltalk.withContext(function($ctx2) {
  1315. return _st(collection)._includes_(each);
  1316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1317. $ctx1.sendIdx["allSatisfy:"]=1;
  1318. self._assert_($1);
  1319. self._deny_(_st(collection)._allSatisfy_((function(each){
  1320. return smalltalk.withContext(function($ctx2) {
  1321. return _st(each).__tild_eq(anyOne);
  1322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1323. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1324. args: [],
  1325. 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 ])",
  1326. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1327. referencedClasses: []
  1328. }),
  1329. smalltalk.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "testAnyOne",
  1333. protocol: 'tests',
  1334. fn: function (){
  1335. var self=this;
  1336. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1337. return smalltalk.withContext(function($ctx1) {
  1338. var $2,$1;
  1339. self._should_raise_((function(){
  1340. return smalltalk.withContext(function($ctx2) {
  1341. return _st(_st(self._collectionClass())._new())._anyOne();
  1342. $ctx2.sendIdx["anyOne"]=1;
  1343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1344. $2=self._collection();
  1345. $ctx1.sendIdx["collection"]=1;
  1346. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1347. self._assert_($1);
  1348. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1349. args: [],
  1350. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1351. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1352. referencedClasses: ["Error"]
  1353. }),
  1354. smalltalk.CollectionTest);
  1355. smalltalk.addMethod(
  1356. smalltalk.method({
  1357. selector: "testAnySatisfy",
  1358. protocol: 'tests',
  1359. fn: function (){
  1360. var self=this;
  1361. var anyOne;
  1362. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1363. return smalltalk.withContext(function($ctx1) {
  1364. var $1,$3,$2;
  1365. $1=self._collection();
  1366. $ctx1.sendIdx["collection"]=1;
  1367. anyOne=_st($1)._anyOne();
  1368. $3=self._collection();
  1369. $ctx1.sendIdx["collection"]=2;
  1370. $2=_st($3)._anySatisfy_((function(each){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. return _st(each).__eq(anyOne);
  1373. $ctx2.sendIdx["="]=1;
  1374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1375. $ctx1.sendIdx["anySatisfy:"]=1;
  1376. self._assert_($2);
  1377. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1378. return smalltalk.withContext(function($ctx2) {
  1379. return _st(each).__eq(_st($Object())._new());
  1380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1381. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1382. args: [],
  1383. 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 ])",
  1384. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1385. referencedClasses: ["Object"]
  1386. }),
  1387. smalltalk.CollectionTest);
  1388. smalltalk.addMethod(
  1389. smalltalk.method({
  1390. selector: "testAsArray",
  1391. protocol: 'tests',
  1392. fn: function (){
  1393. var self=this;
  1394. return smalltalk.withContext(function($ctx1) {
  1395. var $1;
  1396. $1=self._collection();
  1397. $ctx1.sendIdx["collection"]=1;
  1398. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1399. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1400. args: [],
  1401. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1402. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1403. referencedClasses: []
  1404. }),
  1405. smalltalk.CollectionTest);
  1406. smalltalk.addMethod(
  1407. smalltalk.method({
  1408. selector: "testAsOrderedCollection",
  1409. protocol: 'tests',
  1410. fn: function (){
  1411. var self=this;
  1412. return smalltalk.withContext(function($ctx1) {
  1413. var $1;
  1414. $1=self._collection();
  1415. $ctx1.sendIdx["collection"]=1;
  1416. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1417. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1418. args: [],
  1419. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1420. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1421. referencedClasses: []
  1422. }),
  1423. smalltalk.CollectionTest);
  1424. smalltalk.addMethod(
  1425. smalltalk.method({
  1426. selector: "testAsSet",
  1427. protocol: 'tests',
  1428. fn: function (){
  1429. var self=this;
  1430. var c,set;
  1431. return smalltalk.withContext(function($ctx1) {
  1432. c=self._collectionWithDuplicates();
  1433. set=_st(c)._asSet();
  1434. self._assert_equals_(_st(set)._size(),(5));
  1435. _st(c)._do_((function(each){
  1436. return smalltalk.withContext(function($ctx2) {
  1437. return self._assert_(_st(set)._includes_(each));
  1438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1439. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1440. args: [],
  1441. 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) ]",
  1442. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1443. referencedClasses: []
  1444. }),
  1445. smalltalk.CollectionTest);
  1446. smalltalk.addMethod(
  1447. smalltalk.method({
  1448. selector: "testCollect",
  1449. protocol: 'tests',
  1450. fn: function (){
  1451. var self=this;
  1452. var newCollection;
  1453. return smalltalk.withContext(function($ctx1) {
  1454. newCollection=[(1), (2), (3), (4)];
  1455. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(each)._abs();
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1459. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1460. args: [],
  1461. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
  1462. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1463. referencedClasses: []
  1464. }),
  1465. smalltalk.CollectionTest);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "testDetect",
  1469. protocol: 'tests',
  1470. fn: function (){
  1471. var self=this;
  1472. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1473. return smalltalk.withContext(function($ctx1) {
  1474. var $2,$1;
  1475. $2=self._collection();
  1476. $ctx1.sendIdx["collection"]=1;
  1477. $1=_st($2)._detect_((function(each){
  1478. return smalltalk.withContext(function($ctx2) {
  1479. return _st(each).__lt((0));
  1480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1481. $ctx1.sendIdx["detect:"]=1;
  1482. self._assert_equals_($1,(-4));
  1483. self._should_raise_((function(){
  1484. return smalltalk.withContext(function($ctx2) {
  1485. return _st(self._collection())._detect_((function(each){
  1486. return smalltalk.withContext(function($ctx3) {
  1487. return _st(each).__eq((6));
  1488. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1493. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testDo",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var newCollection;
  1504. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$2;
  1507. newCollection=_st($OrderedCollection())._new();
  1508. $ctx1.sendIdx["new"]=1;
  1509. $1=self._collection();
  1510. $ctx1.sendIdx["collection"]=1;
  1511. _st($1)._do_((function(each){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return _st(newCollection)._add_(each);
  1514. $ctx2.sendIdx["add:"]=1;
  1515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1516. $ctx1.sendIdx["do:"]=1;
  1517. self._assertSameContents_as_(self._collection(),newCollection);
  1518. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1519. newCollection=_st($OrderedCollection())._new();
  1520. $2=self._collectionWithDuplicates();
  1521. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1522. _st($2)._do_((function(each){
  1523. return smalltalk.withContext(function($ctx2) {
  1524. return _st(newCollection)._add_(each);
  1525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1526. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1527. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1528. args: [],
  1529. 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",
  1530. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1531. referencedClasses: ["OrderedCollection"]
  1532. }),
  1533. smalltalk.CollectionTest);
  1534. smalltalk.addMethod(
  1535. smalltalk.method({
  1536. selector: "testIfEmptyFamily",
  1537. protocol: 'tests',
  1538. fn: function (){
  1539. var self=this;
  1540. return smalltalk.withContext(function($ctx1) {
  1541. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1542. $3=self._collectionClass();
  1543. $ctx1.sendIdx["collectionClass"]=1;
  1544. $2=_st($3)._new();
  1545. $ctx1.sendIdx["new"]=1;
  1546. $1=_st($2)._ifEmpty_((function(){
  1547. return smalltalk.withContext(function($ctx2) {
  1548. return (42);
  1549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1550. $ctx1.sendIdx["ifEmpty:"]=1;
  1551. self._assert_equals_($1,(42));
  1552. $ctx1.sendIdx["assert:equals:"]=1;
  1553. $5=self._collection();
  1554. $ctx1.sendIdx["collection"]=1;
  1555. $4=_st($5)._ifEmpty_((function(){
  1556. return smalltalk.withContext(function($ctx2) {
  1557. return (42);
  1558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1559. $6=self._collection();
  1560. $ctx1.sendIdx["collection"]=2;
  1561. self._assert_equals_($4,$6);
  1562. $ctx1.sendIdx["assert:equals:"]=2;
  1563. $9=self._collectionClass();
  1564. $ctx1.sendIdx["collectionClass"]=2;
  1565. $8=_st($9)._new();
  1566. $ctx1.sendIdx["new"]=2;
  1567. $7=_st($8)._ifNotEmpty_((function(){
  1568. return smalltalk.withContext(function($ctx2) {
  1569. return (42);
  1570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1571. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1572. $11=self._collectionClass();
  1573. $ctx1.sendIdx["collectionClass"]=3;
  1574. $10=_st($11)._new();
  1575. $ctx1.sendIdx["new"]=3;
  1576. self._assert_equals_($7,$10);
  1577. $ctx1.sendIdx["assert:equals:"]=3;
  1578. $13=self._collection();
  1579. $ctx1.sendIdx["collection"]=3;
  1580. $12=_st($13)._ifNotEmpty_((function(){
  1581. return smalltalk.withContext(function($ctx2) {
  1582. return (42);
  1583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1584. self._assert_equals_($12,(42));
  1585. $ctx1.sendIdx["assert:equals:"]=4;
  1586. $16=self._collectionClass();
  1587. $ctx1.sendIdx["collectionClass"]=4;
  1588. $15=_st($16)._new();
  1589. $ctx1.sendIdx["new"]=4;
  1590. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1591. return smalltalk.withContext(function($ctx2) {
  1592. return (42);
  1593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1594. return smalltalk.withContext(function($ctx2) {
  1595. return (999);
  1596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1597. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1598. self._assert_equals_($14,(42));
  1599. $ctx1.sendIdx["assert:equals:"]=5;
  1600. $18=self._collection();
  1601. $ctx1.sendIdx["collection"]=4;
  1602. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1603. return smalltalk.withContext(function($ctx2) {
  1604. return (42);
  1605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1606. return smalltalk.withContext(function($ctx2) {
  1607. return (999);
  1608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1609. self._assert_equals_($17,(999));
  1610. $ctx1.sendIdx["assert:equals:"]=6;
  1611. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1612. return smalltalk.withContext(function($ctx2) {
  1613. return (42);
  1614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1615. return smalltalk.withContext(function($ctx2) {
  1616. return (999);
  1617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1618. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1619. self._assert_equals_($19,(999));
  1620. $ctx1.sendIdx["assert:equals:"]=7;
  1621. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1622. return smalltalk.withContext(function($ctx2) {
  1623. return (42);
  1624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1625. return smalltalk.withContext(function($ctx2) {
  1626. return (999);
  1627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1628. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1629. args: [],
  1630. 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",
  1631. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1632. referencedClasses: []
  1633. }),
  1634. smalltalk.CollectionTest);
  1635. smalltalk.addMethod(
  1636. smalltalk.method({
  1637. selector: "testIsEmpty",
  1638. protocol: 'tests',
  1639. fn: function (){
  1640. var self=this;
  1641. return smalltalk.withContext(function($ctx1) {
  1642. var $1;
  1643. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1644. $ctx1.sendIdx["isEmpty"]=1;
  1645. self._assert_($1);
  1646. self._deny_(_st(self._collection())._isEmpty());
  1647. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1648. args: [],
  1649. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1650. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1651. referencedClasses: []
  1652. }),
  1653. smalltalk.CollectionTest);
  1654. smalltalk.addMethod(
  1655. smalltalk.method({
  1656. selector: "testNoneSatisfy",
  1657. protocol: 'tests',
  1658. fn: function (){
  1659. var self=this;
  1660. var anyOne;
  1661. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1662. return smalltalk.withContext(function($ctx1) {
  1663. var $1,$3,$2;
  1664. $1=self._collection();
  1665. $ctx1.sendIdx["collection"]=1;
  1666. anyOne=_st($1)._anyOne();
  1667. $3=self._collection();
  1668. $ctx1.sendIdx["collection"]=2;
  1669. $2=_st($3)._noneSatisfy_((function(each){
  1670. return smalltalk.withContext(function($ctx2) {
  1671. return _st(each).__eq(anyOne);
  1672. $ctx2.sendIdx["="]=1;
  1673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1674. $ctx1.sendIdx["noneSatisfy:"]=1;
  1675. self._deny_($2);
  1676. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1677. return smalltalk.withContext(function($ctx2) {
  1678. return _st(each).__eq(_st($Object())._new());
  1679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1680. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1681. args: [],
  1682. 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 ])",
  1683. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1684. referencedClasses: ["Object"]
  1685. }),
  1686. smalltalk.CollectionTest);
  1687. smalltalk.addMethod(
  1688. smalltalk.method({
  1689. selector: "testRemoveAll",
  1690. protocol: 'tests',
  1691. fn: function (){
  1692. var self=this;
  1693. return smalltalk.withContext(function($ctx1) {
  1694. var $1,$2;
  1695. $1=self._collection();
  1696. _st($1)._removeAll();
  1697. $2=_st($1)._yourself();
  1698. self._assert_equals_($2,_st(self._collectionClass())._new());
  1699. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1700. args: [],
  1701. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1702. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1703. referencedClasses: []
  1704. }),
  1705. smalltalk.CollectionTest);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "testSelect",
  1709. protocol: 'tests',
  1710. fn: function (){
  1711. var self=this;
  1712. var newCollection;
  1713. return smalltalk.withContext(function($ctx1) {
  1714. newCollection=[(2), (-4)];
  1715. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1716. return smalltalk.withContext(function($ctx2) {
  1717. return _st(each)._even();
  1718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1719. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1720. args: [],
  1721. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
  1722. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.CollectionTest);
  1726. smalltalk.addMethod(
  1727. smalltalk.method({
  1728. selector: "testSize",
  1729. protocol: 'tests',
  1730. fn: function (){
  1731. var self=this;
  1732. return smalltalk.withContext(function($ctx1) {
  1733. var $1;
  1734. $1=_st(_st(self._collectionClass())._new())._size();
  1735. $ctx1.sendIdx["size"]=1;
  1736. self._assert_equals_($1,(0));
  1737. $ctx1.sendIdx["assert:equals:"]=1;
  1738. self._assert_equals_(_st(self._collection())._size(),(4));
  1739. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1740. args: [],
  1741. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1742. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1743. referencedClasses: []
  1744. }),
  1745. smalltalk.CollectionTest);
  1746. smalltalk.addMethod(
  1747. smalltalk.method({
  1748. selector: "collectionClass",
  1749. protocol: 'fixture',
  1750. fn: function (){
  1751. var self=this;
  1752. return smalltalk.withContext(function($ctx1) {
  1753. self._subclassResponsibility();
  1754. return self}, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1755. args: [],
  1756. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09self subclassResponsibility",
  1757. messageSends: ["subclassResponsibility"],
  1758. referencedClasses: []
  1759. }),
  1760. smalltalk.CollectionTest.klass);
  1761. smalltalk.addMethod(
  1762. smalltalk.method({
  1763. selector: "isAbstract",
  1764. protocol: 'testing',
  1765. fn: function (){
  1766. var self=this;
  1767. return smalltalk.withContext(function($ctx1) {
  1768. var $1;
  1769. $1=_st(self._collectionClass())._isNil();
  1770. return $1;
  1771. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1772. args: [],
  1773. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1774. messageSends: ["isNil", "collectionClass"],
  1775. referencedClasses: []
  1776. }),
  1777. smalltalk.CollectionTest.klass);
  1778. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1779. smalltalk.addMethod(
  1780. smalltalk.method({
  1781. selector: "collectionWithNewValue",
  1782. protocol: 'fixture',
  1783. fn: function (){
  1784. var self=this;
  1785. return smalltalk.withContext(function($ctx1) {
  1786. self._subclassResponsibility();
  1787. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  1788. args: [],
  1789. 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",
  1790. messageSends: ["subclassResponsibility"],
  1791. referencedClasses: []
  1792. }),
  1793. smalltalk.IndexableCollectionTest);
  1794. smalltalk.addMethod(
  1795. smalltalk.method({
  1796. selector: "sampleNewIndex",
  1797. protocol: 'fixture',
  1798. fn: function (){
  1799. var self=this;
  1800. return smalltalk.withContext(function($ctx1) {
  1801. self._subclassResponsibility();
  1802. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  1803. args: [],
  1804. 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",
  1805. messageSends: ["subclassResponsibility"],
  1806. referencedClasses: []
  1807. }),
  1808. smalltalk.IndexableCollectionTest);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "sampleNewValue",
  1812. protocol: 'fixture',
  1813. fn: function (){
  1814. var self=this;
  1815. return smalltalk.withContext(function($ctx1) {
  1816. return "N";
  1817. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.IndexableCollectionTest)})},
  1818. args: [],
  1819. 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'",
  1820. messageSends: [],
  1821. referencedClasses: []
  1822. }),
  1823. smalltalk.IndexableCollectionTest);
  1824. smalltalk.addMethod(
  1825. smalltalk.method({
  1826. selector: "sampleNonIndexesDo:",
  1827. protocol: 'fixture',
  1828. fn: function (aBlock){
  1829. var self=this;
  1830. return smalltalk.withContext(function($ctx1) {
  1831. self._subclassResponsibility();
  1832. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  1833. args: ["aBlock"],
  1834. 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",
  1835. messageSends: ["subclassResponsibility"],
  1836. referencedClasses: []
  1837. }),
  1838. smalltalk.IndexableCollectionTest);
  1839. smalltalk.addMethod(
  1840. smalltalk.method({
  1841. selector: "samplesDo:",
  1842. protocol: 'fixture',
  1843. fn: function (aBlock){
  1844. var self=this;
  1845. return smalltalk.withContext(function($ctx1) {
  1846. self._subclassResponsibility();
  1847. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  1848. args: ["aBlock"],
  1849. 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",
  1850. messageSends: ["subclassResponsibility"],
  1851. referencedClasses: []
  1852. }),
  1853. smalltalk.IndexableCollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testAt",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1861. return smalltalk.withContext(function($ctx1) {
  1862. var $1;
  1863. self._nonIndexesDo_((function(each){
  1864. return smalltalk.withContext(function($ctx2) {
  1865. return self._should_raise_((function(){
  1866. return smalltalk.withContext(function($ctx3) {
  1867. $1=self._collection();
  1868. $ctx3.sendIdx["collection"]=1;
  1869. return _st($1)._at_(each);
  1870. $ctx3.sendIdx["at:"]=1;
  1871. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. self._samplesDo_((function(index,value){
  1874. return smalltalk.withContext(function($ctx2) {
  1875. return self._assert_equals_(_st(self._collection())._at_(index),value);
  1876. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  1877. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1878. args: [],
  1879. 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 ]",
  1880. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  1881. referencedClasses: ["Error"]
  1882. }),
  1883. smalltalk.IndexableCollectionTest);
  1884. smalltalk.addMethod(
  1885. smalltalk.method({
  1886. selector: "testAtIfAbsent",
  1887. protocol: 'tests',
  1888. fn: function (){
  1889. var self=this;
  1890. return smalltalk.withContext(function($ctx1) {
  1891. var $2,$1,$3;
  1892. self._nonIndexesDo_((function(each){
  1893. return smalltalk.withContext(function($ctx2) {
  1894. $2=self._collection();
  1895. $ctx2.sendIdx["collection"]=1;
  1896. $1=_st($2)._at_ifAbsent_(each,(function(){
  1897. return smalltalk.withContext(function($ctx3) {
  1898. return self._sampleNonValue();
  1899. $ctx3.sendIdx["sampleNonValue"]=1;
  1900. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1901. $ctx2.sendIdx["at:ifAbsent:"]=1;
  1902. $3=self._sampleNonValue();
  1903. $ctx2.sendIdx["sampleNonValue"]=2;
  1904. return self._assert_equals_($1,$3);
  1905. $ctx2.sendIdx["assert:equals:"]=1;
  1906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1907. self._samplesDo_((function(index,value){
  1908. return smalltalk.withContext(function($ctx2) {
  1909. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  1910. return smalltalk.withContext(function($ctx3) {
  1911. return self._sampleNonValue();
  1912. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  1913. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  1914. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1915. args: [],
  1916. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNonValue ]) equals: self sampleNonValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNonValue ]) equals: value ].",
  1917. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNonValue", "samplesDo:"],
  1918. referencedClasses: []
  1919. }),
  1920. smalltalk.IndexableCollectionTest);
  1921. smalltalk.addMethod(
  1922. smalltalk.method({
  1923. selector: "testAtIfPresent",
  1924. protocol: 'tests',
  1925. fn: function (){
  1926. var self=this;
  1927. var visited,sentinel;
  1928. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1929. return smalltalk.withContext(function($ctx1) {
  1930. var $2,$1,$4,$3;
  1931. sentinel=_st($Object())._new();
  1932. self._nonIndexesDo_((function(each){
  1933. return smalltalk.withContext(function($ctx2) {
  1934. visited=nil;
  1935. visited;
  1936. $2=self._collection();
  1937. $ctx2.sendIdx["collection"]=1;
  1938. $1=_st($2)._at_ifPresent_(each,(function(value1){
  1939. return smalltalk.withContext(function($ctx3) {
  1940. visited=value1;
  1941. visited;
  1942. return sentinel;
  1943. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  1944. $ctx2.sendIdx["at:ifPresent:"]=1;
  1945. self._assert_equals_($1,nil);
  1946. $ctx2.sendIdx["assert:equals:"]=1;
  1947. return self._assert_(_st(visited)._isNil());
  1948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1949. self._samplesDo_((function(index,value){
  1950. return smalltalk.withContext(function($ctx2) {
  1951. visited=nil;
  1952. visited;
  1953. $4=self._collection();
  1954. $ctx2.sendIdx["collection"]=2;
  1955. $3=_st($4)._at_ifPresent_(index,(function(value2){
  1956. return smalltalk.withContext(function($ctx3) {
  1957. visited=value2;
  1958. visited;
  1959. return sentinel;
  1960. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  1961. self._assert_equals_($3,sentinel);
  1962. $ctx2.sendIdx["assert:equals:"]=2;
  1963. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  1964. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  1965. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  1966. args: [],
  1967. 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) ]",
  1968. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  1969. referencedClasses: ["Object"]
  1970. }),
  1971. smalltalk.IndexableCollectionTest);
  1972. smalltalk.addMethod(
  1973. smalltalk.method({
  1974. selector: "testAtIfPresentIfAbsent",
  1975. protocol: 'tests',
  1976. fn: function (){
  1977. var self=this;
  1978. var visited,sentinel;
  1979. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1980. return smalltalk.withContext(function($ctx1) {
  1981. var $2,$1,$3,$5,$4;
  1982. sentinel=_st($Object())._new();
  1983. self._nonIndexesDo_((function(each){
  1984. return smalltalk.withContext(function($ctx2) {
  1985. visited=nil;
  1986. visited;
  1987. $2=self._collection();
  1988. $ctx2.sendIdx["collection"]=1;
  1989. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  1990. return smalltalk.withContext(function($ctx3) {
  1991. visited=value1;
  1992. visited;
  1993. return sentinel;
  1994. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  1995. return smalltalk.withContext(function($ctx3) {
  1996. return self._sampleNonValue();
  1997. $ctx3.sendIdx["sampleNonValue"]=1;
  1998. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1999. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2000. $3=self._sampleNonValue();
  2001. $ctx2.sendIdx["sampleNonValue"]=2;
  2002. self._assert_equals_($1,$3);
  2003. $ctx2.sendIdx["assert:equals:"]=1;
  2004. return self._assert_(_st(visited)._isNil());
  2005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2006. self._samplesDo_((function(index,value){
  2007. return smalltalk.withContext(function($ctx2) {
  2008. visited=nil;
  2009. visited;
  2010. $5=self._collection();
  2011. $ctx2.sendIdx["collection"]=2;
  2012. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2013. return smalltalk.withContext(function($ctx3) {
  2014. visited=value2;
  2015. visited;
  2016. return sentinel;
  2017. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2018. return smalltalk.withContext(function($ctx3) {
  2019. return self._sampleNonValue();
  2020. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2021. self._assert_equals_($4,sentinel);
  2022. $ctx2.sendIdx["assert:equals:"]=2;
  2023. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2024. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2025. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2026. args: [],
  2027. 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 sampleNonValue ] ) equals: self sampleNonValue.\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 sampleNonValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2028. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNonValue", "assert:", "isNil", "samplesDo:", "at:"],
  2029. referencedClasses: ["Object"]
  2030. }),
  2031. smalltalk.IndexableCollectionTest);
  2032. smalltalk.addMethod(
  2033. smalltalk.method({
  2034. selector: "testAtPut",
  2035. protocol: 'tests',
  2036. fn: function (){
  2037. var self=this;
  2038. var newCollection;
  2039. return smalltalk.withContext(function($ctx1) {
  2040. newCollection=self._collection();
  2041. $ctx1.sendIdx["collection"]=1;
  2042. self._samplesDo_((function(index,value){
  2043. return smalltalk.withContext(function($ctx2) {
  2044. return _st(newCollection)._at_put_(index,value);
  2045. $ctx2.sendIdx["at:put:"]=1;
  2046. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2047. self._assert_equals_(newCollection,self._collection());
  2048. $ctx1.sendIdx["assert:equals:"]=1;
  2049. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2050. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2051. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2052. args: [],
  2053. 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",
  2054. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2055. referencedClasses: []
  2056. }),
  2057. smalltalk.IndexableCollectionTest);
  2058. smalltalk.addMethod(
  2059. smalltalk.method({
  2060. selector: "testIndexOf",
  2061. protocol: 'tests',
  2062. fn: function (){
  2063. var self=this;
  2064. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2065. return smalltalk.withContext(function($ctx1) {
  2066. var $1;
  2067. self._should_raise_((function(){
  2068. return smalltalk.withContext(function($ctx2) {
  2069. $1=self._collection();
  2070. $ctx2.sendIdx["collection"]=1;
  2071. return _st($1)._indexOf_(self._sampleNonValue());
  2072. $ctx2.sendIdx["indexOf:"]=1;
  2073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2074. self._samplesDo_((function(index,value){
  2075. return smalltalk.withContext(function($ctx2) {
  2076. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2077. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2078. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2079. args: [],
  2080. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNonValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2081. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNonValue", "samplesDo:", "assert:equals:"],
  2082. referencedClasses: ["Error"]
  2083. }),
  2084. smalltalk.IndexableCollectionTest);
  2085. smalltalk.addMethod(
  2086. smalltalk.method({
  2087. selector: "testWithIndexDo",
  2088. protocol: 'tests',
  2089. fn: function (){
  2090. var self=this;
  2091. var collection;
  2092. return smalltalk.withContext(function($ctx1) {
  2093. collection=self._collection();
  2094. $ctx1.sendIdx["collection"]=1;
  2095. _st(self._collection())._withIndexDo_((function(each,index){
  2096. return smalltalk.withContext(function($ctx2) {
  2097. return self._assert_equals_(_st(collection)._at_(index),each);
  2098. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2099. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2100. args: [],
  2101. 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 ]",
  2102. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2103. referencedClasses: []
  2104. }),
  2105. smalltalk.IndexableCollectionTest);
  2106. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2107. smalltalk.addMethod(
  2108. smalltalk.method({
  2109. selector: "collection",
  2110. protocol: 'fixture',
  2111. fn: function (){
  2112. var self=this;
  2113. return smalltalk.withContext(function($ctx1) {
  2114. var $2,$3,$4,$1;
  2115. $2="b".__minus_gt((1));
  2116. $ctx1.sendIdx["->"]=1;
  2117. $3="a".__minus_gt((2));
  2118. $ctx1.sendIdx["->"]=2;
  2119. $4="c".__minus_gt((3));
  2120. $ctx1.sendIdx["->"]=3;
  2121. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2122. return $1;
  2123. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2124. args: [],
  2125. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2126. messageSends: ["->"],
  2127. referencedClasses: []
  2128. }),
  2129. smalltalk.HashedCollectionTest);
  2130. smalltalk.addMethod(
  2131. smalltalk.method({
  2132. selector: "collectionWithDuplicates",
  2133. protocol: 'fixture',
  2134. fn: function (){
  2135. var self=this;
  2136. return smalltalk.withContext(function($ctx1) {
  2137. var $2,$3,$4,$5,$6,$7,$1;
  2138. $2="b".__minus_gt((1));
  2139. $ctx1.sendIdx["->"]=1;
  2140. $3="a".__minus_gt((2));
  2141. $ctx1.sendIdx["->"]=2;
  2142. $4="c".__minus_gt((3));
  2143. $ctx1.sendIdx["->"]=3;
  2144. $5="d".__minus_gt((-4));
  2145. $ctx1.sendIdx["->"]=4;
  2146. $6="e".__minus_gt((1));
  2147. $ctx1.sendIdx["->"]=5;
  2148. $7="f".__minus_gt((2));
  2149. $ctx1.sendIdx["->"]=6;
  2150. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2151. return $1;
  2152. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2153. args: [],
  2154. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2155. messageSends: ["->"],
  2156. referencedClasses: []
  2157. }),
  2158. smalltalk.HashedCollectionTest);
  2159. smalltalk.addMethod(
  2160. smalltalk.method({
  2161. selector: "collectionWithNewValue",
  2162. protocol: 'fixture',
  2163. fn: function (){
  2164. var self=this;
  2165. return smalltalk.withContext(function($ctx1) {
  2166. var $2,$3,$4,$5,$1;
  2167. $2="b".__minus_gt((1));
  2168. $ctx1.sendIdx["->"]=1;
  2169. $3="a".__minus_gt((2));
  2170. $ctx1.sendIdx["->"]=2;
  2171. $4="c".__minus_gt((3));
  2172. $ctx1.sendIdx["->"]=3;
  2173. $5="d".__minus_gt((-4));
  2174. $ctx1.sendIdx["->"]=4;
  2175. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2176. return $1;
  2177. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2178. args: [],
  2179. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2180. messageSends: ["->"],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.HashedCollectionTest);
  2184. smalltalk.addMethod(
  2185. smalltalk.method({
  2186. selector: "nonIndexesDo:",
  2187. protocol: 'fixture',
  2188. fn: function (aBlock){
  2189. var self=this;
  2190. return smalltalk.withContext(function($ctx1) {
  2191. _st(aBlock)._value_((5));
  2192. $ctx1.sendIdx["value:"]=1;
  2193. _st(aBlock)._value_("z");
  2194. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2195. args: ["aBlock"],
  2196. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2197. messageSends: ["value:"],
  2198. referencedClasses: []
  2199. }),
  2200. smalltalk.HashedCollectionTest);
  2201. smalltalk.addMethod(
  2202. smalltalk.method({
  2203. selector: "sampleNewIndex",
  2204. protocol: 'fixture',
  2205. fn: function (){
  2206. var self=this;
  2207. return smalltalk.withContext(function($ctx1) {
  2208. return "new";
  2209. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2210. args: [],
  2211. source: "sampleNewIndex\x0a\x09^ 'new'",
  2212. messageSends: [],
  2213. referencedClasses: []
  2214. }),
  2215. smalltalk.HashedCollectionTest);
  2216. smalltalk.addMethod(
  2217. smalltalk.method({
  2218. selector: "samplesDo:",
  2219. protocol: 'fixture',
  2220. fn: function (aBlock){
  2221. var self=this;
  2222. return smalltalk.withContext(function($ctx1) {
  2223. _st(aBlock)._value_value_("a",(2));
  2224. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2225. args: ["aBlock"],
  2226. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2227. messageSends: ["value:value:"],
  2228. referencedClasses: []
  2229. }),
  2230. smalltalk.HashedCollectionTest);
  2231. smalltalk.addMethod(
  2232. smalltalk.method({
  2233. selector: "testAsDictionary",
  2234. protocol: 'tests',
  2235. fn: function (){
  2236. var self=this;
  2237. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2238. return smalltalk.withContext(function($ctx1) {
  2239. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2240. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2241. args: [],
  2242. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2243. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2244. referencedClasses: ["Dictionary"]
  2245. }),
  2246. smalltalk.HashedCollectionTest);
  2247. smalltalk.addMethod(
  2248. smalltalk.method({
  2249. selector: "testFrom",
  2250. protocol: 'tests',
  2251. fn: function (){
  2252. var self=this;
  2253. var associations;
  2254. return smalltalk.withContext(function($ctx1) {
  2255. var $1,$2,$3,$5,$4;
  2256. $1="a".__minus_gt((1));
  2257. $ctx1.sendIdx["->"]=1;
  2258. $2="b".__minus_gt((2));
  2259. $ctx1.sendIdx["->"]=2;
  2260. associations=[$1,$2];
  2261. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2262. $5="a".__minus_gt((1));
  2263. $ctx1.sendIdx["->"]=3;
  2264. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2265. self._assertSameContents_as_($3,$4);
  2266. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2267. args: [],
  2268. 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 }.",
  2269. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2270. referencedClasses: []
  2271. }),
  2272. smalltalk.HashedCollectionTest);
  2273. smalltalk.addMethod(
  2274. smalltalk.method({
  2275. selector: "testNewFromPairs",
  2276. protocol: 'tests',
  2277. fn: function (){
  2278. var self=this;
  2279. var flattenedAssociations;
  2280. return smalltalk.withContext(function($ctx1) {
  2281. var $1,$3,$2;
  2282. flattenedAssociations=["a",(1),"b",(2)];
  2283. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2284. $3="a".__minus_gt((1));
  2285. $ctx1.sendIdx["->"]=1;
  2286. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2287. self._assertSameContents_as_($1,$2);
  2288. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2289. args: [],
  2290. 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 }.",
  2291. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2292. referencedClasses: []
  2293. }),
  2294. smalltalk.HashedCollectionTest);
  2295. smalltalk.addMethod(
  2296. smalltalk.method({
  2297. selector: "collectionClass",
  2298. protocol: 'fixture',
  2299. fn: function (){
  2300. var self=this;
  2301. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2302. return smalltalk.withContext(function($ctx1) {
  2303. return $HashedCollection();
  2304. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2305. args: [],
  2306. source: "collectionClass\x0a\x09^ HashedCollection",
  2307. messageSends: [],
  2308. referencedClasses: ["HashedCollection"]
  2309. }),
  2310. smalltalk.HashedCollectionTest.klass);
  2311. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2312. smalltalk.addMethod(
  2313. smalltalk.method({
  2314. selector: "collection",
  2315. protocol: 'fixture',
  2316. fn: function (){
  2317. var self=this;
  2318. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2319. return smalltalk.withContext(function($ctx1) {
  2320. var $2,$3,$1;
  2321. $2=_st($Dictionary())._new();
  2322. _st($2)._at_put_((1),(1));
  2323. $ctx1.sendIdx["at:put:"]=1;
  2324. _st($2)._at_put_("a",(2));
  2325. $ctx1.sendIdx["at:put:"]=2;
  2326. _st($2)._at_put_(true,(3));
  2327. $ctx1.sendIdx["at:put:"]=3;
  2328. _st($2)._at_put_((1).__at((3)),(-4));
  2329. $3=_st($2)._yourself();
  2330. $1=$3;
  2331. return $1;
  2332. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2333. args: [],
  2334. 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",
  2335. messageSends: ["at:put:", "new", "@", "yourself"],
  2336. referencedClasses: ["Dictionary"]
  2337. }),
  2338. smalltalk.DictionaryTest);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "collectionWithDuplicates",
  2342. protocol: 'fixture',
  2343. fn: function (){
  2344. var self=this;
  2345. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2346. return smalltalk.withContext(function($ctx1) {
  2347. var $2,$3,$1;
  2348. $2=_st($Dictionary())._new();
  2349. _st($2)._at_put_((1),(1));
  2350. $ctx1.sendIdx["at:put:"]=1;
  2351. _st($2)._at_put_("a",(2));
  2352. $ctx1.sendIdx["at:put:"]=2;
  2353. _st($2)._at_put_(true,(3));
  2354. $ctx1.sendIdx["at:put:"]=3;
  2355. _st($2)._at_put_((4),(-4));
  2356. $ctx1.sendIdx["at:put:"]=4;
  2357. _st($2)._at_put_("b",(1));
  2358. $ctx1.sendIdx["at:put:"]=5;
  2359. _st($2)._at_put_((3),(3));
  2360. $ctx1.sendIdx["at:put:"]=6;
  2361. _st($2)._at_put_(false,(12));
  2362. $3=_st($2)._yourself();
  2363. $1=$3;
  2364. return $1;
  2365. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2366. args: [],
  2367. 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",
  2368. messageSends: ["at:put:", "new", "yourself"],
  2369. referencedClasses: ["Dictionary"]
  2370. }),
  2371. smalltalk.DictionaryTest);
  2372. smalltalk.addMethod(
  2373. smalltalk.method({
  2374. selector: "collectionWithNewValue",
  2375. protocol: 'fixture',
  2376. fn: function (){
  2377. var self=this;
  2378. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2379. return smalltalk.withContext(function($ctx1) {
  2380. var $2,$3,$1;
  2381. $2=_st($Dictionary())._new();
  2382. _st($2)._at_put_((1),(1));
  2383. $ctx1.sendIdx["at:put:"]=1;
  2384. _st($2)._at_put_("a",(2));
  2385. $ctx1.sendIdx["at:put:"]=2;
  2386. _st($2)._at_put_(true,(3));
  2387. $ctx1.sendIdx["at:put:"]=3;
  2388. _st($2)._at_put_((1).__at((3)),(-4));
  2389. $ctx1.sendIdx["at:put:"]=4;
  2390. _st($2)._at_put_("new","N");
  2391. $3=_st($2)._yourself();
  2392. $1=$3;
  2393. return $1;
  2394. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2395. args: [],
  2396. 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",
  2397. messageSends: ["at:put:", "new", "@", "yourself"],
  2398. referencedClasses: ["Dictionary"]
  2399. }),
  2400. smalltalk.DictionaryTest);
  2401. smalltalk.addMethod(
  2402. smalltalk.method({
  2403. selector: "samplesDo:",
  2404. protocol: 'fixture',
  2405. fn: function (aBlock){
  2406. var self=this;
  2407. return smalltalk.withContext(function($ctx1) {
  2408. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  2409. _st(aBlock)._value_value_(true,(3));
  2410. $ctx1.sendIdx["value:value:"]=1;
  2411. _st(aBlock)._value_value_((1).__at((3)),(-4));
  2412. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  2413. args: ["aBlock"],
  2414. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  2415. messageSends: ["samplesDo:", "value:value:", "@"],
  2416. referencedClasses: []
  2417. }),
  2418. smalltalk.DictionaryTest);
  2419. smalltalk.addMethod(
  2420. smalltalk.method({
  2421. selector: "testAccessing",
  2422. protocol: 'tests',
  2423. fn: function (){
  2424. var self=this;
  2425. var d;
  2426. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2427. return smalltalk.withContext(function($ctx1) {
  2428. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2429. d=_st($Dictionary())._new();
  2430. _st(d)._at_put_("hello","world");
  2431. $ctx1.sendIdx["at:put:"]=1;
  2432. $1=_st(d)._at_("hello");
  2433. $ctx1.sendIdx["at:"]=1;
  2434. self._assert_equals_($1,"world");
  2435. $ctx1.sendIdx["assert:equals:"]=1;
  2436. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2437. return smalltalk.withContext(function($ctx2) {
  2438. return nil;
  2439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2440. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2441. self._assert_equals_($2,"world");
  2442. $ctx1.sendIdx["assert:equals:"]=2;
  2443. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2444. return smalltalk.withContext(function($ctx2) {
  2445. return nil;
  2446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2447. $ctx1.sendIdx["deny:"]=1;
  2448. $3=_st(d)._includesKey_("hello");
  2449. $ctx1.sendIdx["includesKey:"]=1;
  2450. self._assert_($3);
  2451. $ctx1.sendIdx["assert:"]=1;
  2452. $4=_st(d)._includesKey_("foo");
  2453. $ctx1.sendIdx["includesKey:"]=2;
  2454. self._deny_($4);
  2455. $ctx1.sendIdx["deny:"]=2;
  2456. _st(d)._at_put_((1),(2));
  2457. $ctx1.sendIdx["at:put:"]=2;
  2458. $5=_st(d)._at_((1));
  2459. $ctx1.sendIdx["at:"]=2;
  2460. self._assert_equals_($5,(2));
  2461. $ctx1.sendIdx["assert:equals:"]=3;
  2462. $6=d;
  2463. $7=(1).__at((3));
  2464. $ctx1.sendIdx["@"]=1;
  2465. _st($6)._at_put_($7,(3));
  2466. $9=d;
  2467. $10=(1).__at((3));
  2468. $ctx1.sendIdx["@"]=2;
  2469. $8=_st($9)._at_($10);
  2470. self._assert_equals_($8,(3));
  2471. $12=d;
  2472. $13=(1).__at((3));
  2473. $ctx1.sendIdx["@"]=3;
  2474. $11=_st($12)._includesKey_($13);
  2475. $ctx1.sendIdx["includesKey:"]=3;
  2476. self._assert_($11);
  2477. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2478. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2479. args: [],
  2480. 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)",
  2481. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2482. referencedClasses: ["Dictionary"]
  2483. }),
  2484. smalltalk.DictionaryTest);
  2485. smalltalk.addMethod(
  2486. smalltalk.method({
  2487. selector: "testAsHashedCollection",
  2488. protocol: 'tests',
  2489. fn: function (){
  2490. var self=this;
  2491. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2492. return smalltalk.withContext(function($ctx1) {
  2493. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2494. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2495. args: [],
  2496. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2497. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2498. referencedClasses: ["HashedCollection"]
  2499. }),
  2500. smalltalk.DictionaryTest);
  2501. smalltalk.addMethod(
  2502. smalltalk.method({
  2503. selector: "testDynamicDictionaries",
  2504. protocol: 'tests',
  2505. fn: function (){
  2506. var self=this;
  2507. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2508. return smalltalk.withContext(function($ctx1) {
  2509. var $3,$2,$1;
  2510. $3="hello".__minus_gt((1));
  2511. $ctx1.sendIdx["->"]=1;
  2512. $2=smalltalk.HashedCollection._from_([$3]);
  2513. $1=_st($2)._asDictionary();
  2514. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  2515. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2516. args: [],
  2517. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2518. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2519. referencedClasses: ["Dictionary"]
  2520. }),
  2521. smalltalk.DictionaryTest);
  2522. smalltalk.addMethod(
  2523. smalltalk.method({
  2524. selector: "testEquality",
  2525. protocol: 'tests',
  2526. fn: function (){
  2527. var self=this;
  2528. var d1,d2;
  2529. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2530. return smalltalk.withContext(function($ctx1) {
  2531. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  2532. $2=_st($Dictionary())._new();
  2533. $ctx1.sendIdx["new"]=1;
  2534. $3=_st($Dictionary())._new();
  2535. $ctx1.sendIdx["new"]=2;
  2536. $1=_st($2).__eq($3);
  2537. $ctx1.sendIdx["="]=1;
  2538. self._assert_($1);
  2539. $ctx1.sendIdx["assert:"]=1;
  2540. $4=_st($Dictionary())._new();
  2541. $ctx1.sendIdx["new"]=3;
  2542. _st($4)._at_put_((1),(2));
  2543. $ctx1.sendIdx["at:put:"]=1;
  2544. $5=_st($4)._yourself();
  2545. $ctx1.sendIdx["yourself"]=1;
  2546. d1=$5;
  2547. $6=_st($Dictionary())._new();
  2548. $ctx1.sendIdx["new"]=4;
  2549. _st($6)._at_put_((1),(2));
  2550. $ctx1.sendIdx["at:put:"]=2;
  2551. $7=_st($6)._yourself();
  2552. $ctx1.sendIdx["yourself"]=2;
  2553. d2=$7;
  2554. $8=_st(d1).__eq(d2);
  2555. $ctx1.sendIdx["="]=2;
  2556. self._assert_($8);
  2557. $9=_st($Dictionary())._new();
  2558. $ctx1.sendIdx["new"]=5;
  2559. _st($9)._at_put_((1),(3));
  2560. $ctx1.sendIdx["at:put:"]=3;
  2561. $10=_st($9)._yourself();
  2562. $ctx1.sendIdx["yourself"]=3;
  2563. d2=$10;
  2564. $11=_st(d1).__eq(d2);
  2565. $ctx1.sendIdx["="]=3;
  2566. self._deny_($11);
  2567. $ctx1.sendIdx["deny:"]=1;
  2568. $12=_st($Dictionary())._new();
  2569. $ctx1.sendIdx["new"]=6;
  2570. _st($12)._at_put_((2),(2));
  2571. $ctx1.sendIdx["at:put:"]=4;
  2572. $13=_st($12)._yourself();
  2573. $ctx1.sendIdx["yourself"]=4;
  2574. d2=$13;
  2575. $14=_st(d1).__eq(d2);
  2576. $ctx1.sendIdx["="]=4;
  2577. self._deny_($14);
  2578. $ctx1.sendIdx["deny:"]=2;
  2579. $15=_st($Dictionary())._new();
  2580. _st($15)._at_put_((1),(2));
  2581. $ctx1.sendIdx["at:put:"]=5;
  2582. _st($15)._at_put_((3),(4));
  2583. $16=_st($15)._yourself();
  2584. d2=$16;
  2585. self._deny_(_st(d1).__eq(d2));
  2586. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2587. args: [],
  2588. 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.",
  2589. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2590. referencedClasses: ["Dictionary"]
  2591. }),
  2592. smalltalk.DictionaryTest);
  2593. smalltalk.addMethod(
  2594. smalltalk.method({
  2595. selector: "testKeys",
  2596. protocol: 'tests',
  2597. fn: function (){
  2598. var self=this;
  2599. var d;
  2600. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2601. return smalltalk.withContext(function($ctx1) {
  2602. d=_st($Dictionary())._new();
  2603. _st(d)._at_put_((1),(2));
  2604. $ctx1.sendIdx["at:put:"]=1;
  2605. _st(d)._at_put_((2),(3));
  2606. $ctx1.sendIdx["at:put:"]=2;
  2607. _st(d)._at_put_((3),(4));
  2608. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2609. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2610. args: [],
  2611. 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)",
  2612. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2613. referencedClasses: ["Dictionary"]
  2614. }),
  2615. smalltalk.DictionaryTest);
  2616. smalltalk.addMethod(
  2617. smalltalk.method({
  2618. selector: "testPointKey",
  2619. protocol: 'tests',
  2620. fn: function (){
  2621. var self=this;
  2622. var d;
  2623. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2624. return smalltalk.withContext(function($ctx1) {
  2625. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2626. d=_st($Dictionary())._new();
  2627. $1=d;
  2628. $2=(1).__at((1));
  2629. $ctx1.sendIdx["@"]=1;
  2630. _st($1)._at_put_($2,"foo");
  2631. $ctx1.sendIdx["at:put:"]=1;
  2632. $4=d;
  2633. $5=(1).__at((1));
  2634. $ctx1.sendIdx["@"]=2;
  2635. $3=_st($4)._at_($5);
  2636. $ctx1.sendIdx["at:"]=1;
  2637. self._assert_equals_($3,"foo");
  2638. $ctx1.sendIdx["assert:equals:"]=1;
  2639. $6=d;
  2640. $7=(1).__at((1));
  2641. $ctx1.sendIdx["@"]=3;
  2642. _st($6)._at_put_($7,"bar");
  2643. $9=d;
  2644. $10=(1).__at((1));
  2645. $ctx1.sendIdx["@"]=4;
  2646. $8=_st($9)._at_($10);
  2647. self._assert_equals_($8,"bar");
  2648. $ctx1.sendIdx["assert:equals:"]=2;
  2649. $11=d;
  2650. $12=(1).__at((1));
  2651. $ctx1.sendIdx["@"]=5;
  2652. _st($11)._removeKey_($12);
  2653. $14=d;
  2654. $15=(1).__at((1));
  2655. $ctx1.sendIdx["@"]=6;
  2656. $13=_st($14)._at_ifAbsent_($15,(function(){
  2657. return smalltalk.withContext(function($ctx2) {
  2658. return "baz";
  2659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2660. self._assert_equals_($13,"baz");
  2661. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2662. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2663. args: [],
  2664. 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)",
  2665. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2666. referencedClasses: ["Dictionary"]
  2667. }),
  2668. smalltalk.DictionaryTest);
  2669. smalltalk.addMethod(
  2670. smalltalk.method({
  2671. selector: "testPrintString",
  2672. protocol: 'tests',
  2673. fn: function (){
  2674. var self=this;
  2675. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2676. return smalltalk.withContext(function($ctx1) {
  2677. var $2,$3,$1;
  2678. $2=_st($Dictionary())._new();
  2679. _st($2)._at_put_("firstname","James");
  2680. $ctx1.sendIdx["at:put:"]=1;
  2681. _st($2)._at_put_("lastname","Bond");
  2682. $3=_st($2)._printString();
  2683. $1=$3;
  2684. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2685. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2686. args: [],
  2687. 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'')'",
  2688. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2689. referencedClasses: ["Dictionary"]
  2690. }),
  2691. smalltalk.DictionaryTest);
  2692. smalltalk.addMethod(
  2693. smalltalk.method({
  2694. selector: "testRemoveKey",
  2695. protocol: 'tests',
  2696. fn: function (){
  2697. var self=this;
  2698. var d,key;
  2699. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2700. return smalltalk.withContext(function($ctx1) {
  2701. var $1;
  2702. d=_st($Dictionary())._new();
  2703. _st(d)._at_put_((1),(2));
  2704. $ctx1.sendIdx["at:put:"]=1;
  2705. _st(d)._at_put_((2),(3));
  2706. $ctx1.sendIdx["at:put:"]=2;
  2707. _st(d)._at_put_((3),(4));
  2708. key=(2);
  2709. $1=_st(d)._keys();
  2710. $ctx1.sendIdx["keys"]=1;
  2711. self._assert_equals_($1,[(1), (2), (3)]);
  2712. $ctx1.sendIdx["assert:equals:"]=1;
  2713. _st(d)._removeKey_(key);
  2714. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  2715. $ctx1.sendIdx["assert:equals:"]=2;
  2716. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2717. self._deny_(_st(d)._includesKey_((2)));
  2718. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2719. args: [],
  2720. 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)",
  2721. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2722. referencedClasses: ["Dictionary"]
  2723. }),
  2724. smalltalk.DictionaryTest);
  2725. smalltalk.addMethod(
  2726. smalltalk.method({
  2727. selector: "testRemoveKeyIfAbsent",
  2728. protocol: 'tests',
  2729. fn: function (){
  2730. var self=this;
  2731. var d,key;
  2732. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2733. return smalltalk.withContext(function($ctx1) {
  2734. var $1;
  2735. d=_st($Dictionary())._new();
  2736. _st(d)._at_put_((1),(2));
  2737. $ctx1.sendIdx["at:put:"]=1;
  2738. _st(d)._at_put_((2),(3));
  2739. $ctx1.sendIdx["at:put:"]=2;
  2740. _st(d)._at_put_((3),(4));
  2741. key=(2);
  2742. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2743. $ctx1.sendIdx["assert:equals:"]=1;
  2744. key=(3);
  2745. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2746. return smalltalk.withContext(function($ctx2) {
  2747. return (42);
  2748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2749. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2750. self._assert_equals_($1,(4));
  2751. $ctx1.sendIdx["assert:equals:"]=2;
  2752. key="why";
  2753. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  2754. return smalltalk.withContext(function($ctx2) {
  2755. return (42);
  2756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  2757. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2758. args: [],
  2759. 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.",
  2760. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2761. referencedClasses: ["Dictionary"]
  2762. }),
  2763. smalltalk.DictionaryTest);
  2764. smalltalk.addMethod(
  2765. smalltalk.method({
  2766. selector: "testSize",
  2767. protocol: 'tests',
  2768. fn: function (){
  2769. var self=this;
  2770. var d;
  2771. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2772. return smalltalk.withContext(function($ctx1) {
  2773. var $1,$2;
  2774. d=_st($Dictionary())._new();
  2775. $1=_st(d)._size();
  2776. $ctx1.sendIdx["size"]=1;
  2777. self._assert_equals_($1,(0));
  2778. $ctx1.sendIdx["assert:equals:"]=1;
  2779. _st(d)._at_put_((1),(2));
  2780. $ctx1.sendIdx["at:put:"]=1;
  2781. $2=_st(d)._size();
  2782. $ctx1.sendIdx["size"]=2;
  2783. self._assert_equals_($2,(1));
  2784. $ctx1.sendIdx["assert:equals:"]=2;
  2785. _st(d)._at_put_((2),(3));
  2786. self._assert_equals_(_st(d)._size(),(2));
  2787. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2788. args: [],
  2789. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size equals: 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size equals: 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size equals: 2.",
  2790. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2791. referencedClasses: ["Dictionary"]
  2792. }),
  2793. smalltalk.DictionaryTest);
  2794. smalltalk.addMethod(
  2795. smalltalk.method({
  2796. selector: "testValues",
  2797. protocol: 'tests',
  2798. fn: function (){
  2799. var self=this;
  2800. var d;
  2801. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2802. return smalltalk.withContext(function($ctx1) {
  2803. d=_st($Dictionary())._new();
  2804. _st(d)._at_put_((1),(2));
  2805. $ctx1.sendIdx["at:put:"]=1;
  2806. _st(d)._at_put_((2),(3));
  2807. $ctx1.sendIdx["at:put:"]=2;
  2808. _st(d)._at_put_((3),(4));
  2809. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2810. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2811. args: [],
  2812. 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)",
  2813. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2814. referencedClasses: ["Dictionary"]
  2815. }),
  2816. smalltalk.DictionaryTest);
  2817. smalltalk.addMethod(
  2818. smalltalk.method({
  2819. selector: "collectionClass",
  2820. protocol: 'fixture',
  2821. fn: function (){
  2822. var self=this;
  2823. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2824. return smalltalk.withContext(function($ctx1) {
  2825. return $Dictionary();
  2826. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2827. args: [],
  2828. source: "collectionClass\x0a\x09^ Dictionary",
  2829. messageSends: [],
  2830. referencedClasses: ["Dictionary"]
  2831. }),
  2832. smalltalk.DictionaryTest.klass);
  2833. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2834. smalltalk.addMethod(
  2835. smalltalk.method({
  2836. selector: "collectionFirst",
  2837. protocol: 'fixture',
  2838. fn: function (){
  2839. var self=this;
  2840. return smalltalk.withContext(function($ctx1) {
  2841. self._subclassResponsibility();
  2842. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  2843. args: [],
  2844. source: "collectionFirst\x0a\x09self subclassResponsibility",
  2845. messageSends: ["subclassResponsibility"],
  2846. referencedClasses: []
  2847. }),
  2848. smalltalk.SequenceableCollectionTest);
  2849. smalltalk.addMethod(
  2850. smalltalk.method({
  2851. selector: "collectionFirstTwo",
  2852. protocol: 'fixture',
  2853. fn: function (){
  2854. var self=this;
  2855. return smalltalk.withContext(function($ctx1) {
  2856. self._subclassResponsibility();
  2857. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  2858. args: [],
  2859. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  2860. messageSends: ["subclassResponsibility"],
  2861. referencedClasses: []
  2862. }),
  2863. smalltalk.SequenceableCollectionTest);
  2864. smalltalk.addMethod(
  2865. smalltalk.method({
  2866. selector: "collectionLast",
  2867. protocol: 'fixture',
  2868. fn: function (){
  2869. var self=this;
  2870. return smalltalk.withContext(function($ctx1) {
  2871. self._subclassResponsibility();
  2872. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  2873. args: [],
  2874. source: "collectionLast\x0a\x09self subclassResponsibility",
  2875. messageSends: ["subclassResponsibility"],
  2876. referencedClasses: []
  2877. }),
  2878. smalltalk.SequenceableCollectionTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "collectionLastTwo",
  2882. protocol: 'fixture',
  2883. fn: function (){
  2884. var self=this;
  2885. return smalltalk.withContext(function($ctx1) {
  2886. self._subclassResponsibility();
  2887. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  2888. args: [],
  2889. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  2890. messageSends: ["subclassResponsibility"],
  2891. referencedClasses: []
  2892. }),
  2893. smalltalk.SequenceableCollectionTest);
  2894. smalltalk.addMethod(
  2895. smalltalk.method({
  2896. selector: "nonIndexesDo:",
  2897. protocol: 'fixture',
  2898. fn: function (aBlock){
  2899. var self=this;
  2900. return smalltalk.withContext(function($ctx1) {
  2901. _st(aBlock)._value_((0));
  2902. $ctx1.sendIdx["value:"]=1;
  2903. _st(aBlock)._value_(_st(_st(self._collection())._size()).__plus((1)));
  2904. $ctx1.sendIdx["value:"]=2;
  2905. _st(aBlock)._value_("z");
  2906. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  2907. args: ["aBlock"],
  2908. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collection size + 1.\x0a\x09aBlock value: 'z'",
  2909. messageSends: ["value:", "+", "size", "collection"],
  2910. referencedClasses: []
  2911. }),
  2912. smalltalk.SequenceableCollectionTest);
  2913. smalltalk.addMethod(
  2914. smalltalk.method({
  2915. selector: "samplesDo:",
  2916. protocol: 'fixture',
  2917. fn: function (aBlock){
  2918. var self=this;
  2919. return smalltalk.withContext(function($ctx1) {
  2920. _st(aBlock)._value_value_((1),self._collectionFirst());
  2921. $ctx1.sendIdx["value:value:"]=1;
  2922. _st(aBlock)._value_value_(_st(self._collection())._size(),self._collectionLast());
  2923. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  2924. args: ["aBlock"],
  2925. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collection size value: self collectionLast",
  2926. messageSends: ["value:value:", "collectionFirst", "size", "collection", "collectionLast"],
  2927. referencedClasses: []
  2928. }),
  2929. smalltalk.SequenceableCollectionTest);
  2930. smalltalk.addMethod(
  2931. smalltalk.method({
  2932. selector: "testBeginsWith",
  2933. protocol: 'tests',
  2934. fn: function (){
  2935. var self=this;
  2936. return smalltalk.withContext(function($ctx1) {
  2937. var $2,$1,$4,$5,$3,$7,$6;
  2938. $2=self._collection();
  2939. $ctx1.sendIdx["collection"]=1;
  2940. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  2941. $ctx1.sendIdx["beginsWith:"]=1;
  2942. self._assert_($1);
  2943. $ctx1.sendIdx["assert:"]=1;
  2944. $4=self._collection();
  2945. $ctx1.sendIdx["collection"]=2;
  2946. $5=self._collection();
  2947. $ctx1.sendIdx["collection"]=3;
  2948. $3=_st($4)._beginsWith_($5);
  2949. $ctx1.sendIdx["beginsWith:"]=2;
  2950. self._assert_($3);
  2951. $ctx1.sendIdx["assert:"]=2;
  2952. $7=self._collection();
  2953. $ctx1.sendIdx["collection"]=4;
  2954. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  2955. $ctx1.sendIdx["beginsWith:"]=3;
  2956. self._assert_($6);
  2957. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  2958. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  2959. args: [],
  2960. 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)",
  2961. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  2962. referencedClasses: []
  2963. }),
  2964. smalltalk.SequenceableCollectionTest);
  2965. smalltalk.addMethod(
  2966. smalltalk.method({
  2967. selector: "testEndsWith",
  2968. protocol: 'tests',
  2969. fn: function (){
  2970. var self=this;
  2971. return smalltalk.withContext(function($ctx1) {
  2972. var $2,$1,$4,$5,$3,$7,$6;
  2973. $2=self._collection();
  2974. $ctx1.sendIdx["collection"]=1;
  2975. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  2976. $ctx1.sendIdx["endsWith:"]=1;
  2977. self._assert_($1);
  2978. $ctx1.sendIdx["assert:"]=1;
  2979. $4=self._collection();
  2980. $ctx1.sendIdx["collection"]=2;
  2981. $5=self._collection();
  2982. $ctx1.sendIdx["collection"]=3;
  2983. $3=_st($4)._endsWith_($5);
  2984. $ctx1.sendIdx["endsWith:"]=2;
  2985. self._assert_($3);
  2986. $ctx1.sendIdx["assert:"]=2;
  2987. $7=self._collection();
  2988. $ctx1.sendIdx["collection"]=4;
  2989. $6=_st($7)._endsWith_(self._collectionLastTwo());
  2990. $ctx1.sendIdx["endsWith:"]=3;
  2991. self._assert_($6);
  2992. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  2993. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  2994. args: [],
  2995. 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)",
  2996. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  2997. referencedClasses: []
  2998. }),
  2999. smalltalk.SequenceableCollectionTest);
  3000. smalltalk.addMethod(
  3001. smalltalk.method({
  3002. selector: "testFirst",
  3003. protocol: 'tests',
  3004. fn: function (){
  3005. var self=this;
  3006. return smalltalk.withContext(function($ctx1) {
  3007. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3008. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3009. args: [],
  3010. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3011. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3012. referencedClasses: []
  3013. }),
  3014. smalltalk.SequenceableCollectionTest);
  3015. smalltalk.addMethod(
  3016. smalltalk.method({
  3017. selector: "testFirstN",
  3018. protocol: 'tests',
  3019. fn: function (){
  3020. var self=this;
  3021. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3022. return smalltalk.withContext(function($ctx1) {
  3023. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3024. $2=self._collection();
  3025. $ctx1.sendIdx["collection"]=1;
  3026. $1=_st($2)._first_((2));
  3027. $ctx1.sendIdx["first:"]=1;
  3028. self._assert_equals_($1,self._collectionFirstTwo());
  3029. $ctx1.sendIdx["assert:equals:"]=1;
  3030. $4=self._collection();
  3031. $ctx1.sendIdx["collection"]=2;
  3032. $3=_st($4)._first_((0));
  3033. $ctx1.sendIdx["first:"]=2;
  3034. self._assert_equals_($3,_st(self._collectionClass())._new());
  3035. $ctx1.sendIdx["assert:equals:"]=2;
  3036. $6=self._collection();
  3037. $ctx1.sendIdx["collection"]=3;
  3038. $8=self._collection();
  3039. $ctx1.sendIdx["collection"]=4;
  3040. $7=_st($8)._size();
  3041. $5=_st($6)._first_($7);
  3042. $ctx1.sendIdx["first:"]=3;
  3043. $9=self._collection();
  3044. $ctx1.sendIdx["collection"]=5;
  3045. self._assert_equals_($5,$9);
  3046. self._should_raise_((function(){
  3047. return smalltalk.withContext(function($ctx2) {
  3048. return _st(self._collection())._first_((33));
  3049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3050. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3051. args: [],
  3052. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3053. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "size", "should:raise:"],
  3054. referencedClasses: ["Error"]
  3055. }),
  3056. smalltalk.SequenceableCollectionTest);
  3057. smalltalk.addMethod(
  3058. smalltalk.method({
  3059. selector: "testFourth",
  3060. protocol: 'tests',
  3061. fn: function (){
  3062. var self=this;
  3063. return smalltalk.withContext(function($ctx1) {
  3064. var $2,$1;
  3065. $2=self._collection();
  3066. $ctx1.sendIdx["collection"]=1;
  3067. $1=_st($2)._fourth();
  3068. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3069. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3070. args: [],
  3071. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3072. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3073. referencedClasses: []
  3074. }),
  3075. smalltalk.SequenceableCollectionTest);
  3076. smalltalk.addMethod(
  3077. smalltalk.method({
  3078. selector: "testLast",
  3079. protocol: 'tests',
  3080. fn: function (){
  3081. var self=this;
  3082. return smalltalk.withContext(function($ctx1) {
  3083. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3084. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3085. args: [],
  3086. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3087. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3088. referencedClasses: []
  3089. }),
  3090. smalltalk.SequenceableCollectionTest);
  3091. smalltalk.addMethod(
  3092. smalltalk.method({
  3093. selector: "testLastN",
  3094. protocol: 'tests',
  3095. fn: function (){
  3096. var self=this;
  3097. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3098. return smalltalk.withContext(function($ctx1) {
  3099. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3100. $2=self._collection();
  3101. $ctx1.sendIdx["collection"]=1;
  3102. $1=_st($2)._last_((2));
  3103. $ctx1.sendIdx["last:"]=1;
  3104. self._assert_equals_($1,self._collectionLastTwo());
  3105. $ctx1.sendIdx["assert:equals:"]=1;
  3106. $4=self._collection();
  3107. $ctx1.sendIdx["collection"]=2;
  3108. $3=_st($4)._last_((0));
  3109. $ctx1.sendIdx["last:"]=2;
  3110. self._assert_equals_($3,_st(self._collectionClass())._new());
  3111. $ctx1.sendIdx["assert:equals:"]=2;
  3112. $6=self._collection();
  3113. $ctx1.sendIdx["collection"]=3;
  3114. $8=self._collection();
  3115. $ctx1.sendIdx["collection"]=4;
  3116. $7=_st($8)._size();
  3117. $5=_st($6)._last_($7);
  3118. $ctx1.sendIdx["last:"]=3;
  3119. $9=self._collection();
  3120. $ctx1.sendIdx["collection"]=5;
  3121. self._assert_equals_($5,$9);
  3122. self._should_raise_((function(){
  3123. return smalltalk.withContext(function($ctx2) {
  3124. return _st(self._collection())._last_((33));
  3125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3126. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3127. args: [],
  3128. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3129. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "size", "should:raise:"],
  3130. referencedClasses: ["Error"]
  3131. }),
  3132. smalltalk.SequenceableCollectionTest);
  3133. smalltalk.addMethod(
  3134. smalltalk.method({
  3135. selector: "testSecond",
  3136. protocol: 'tests',
  3137. fn: function (){
  3138. var self=this;
  3139. return smalltalk.withContext(function($ctx1) {
  3140. var $2,$1;
  3141. $2=self._collection();
  3142. $ctx1.sendIdx["collection"]=1;
  3143. $1=_st($2)._second();
  3144. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3145. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3146. args: [],
  3147. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3148. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3149. referencedClasses: []
  3150. }),
  3151. smalltalk.SequenceableCollectionTest);
  3152. smalltalk.addMethod(
  3153. smalltalk.method({
  3154. selector: "testThird",
  3155. protocol: 'tests',
  3156. fn: function (){
  3157. var self=this;
  3158. return smalltalk.withContext(function($ctx1) {
  3159. var $2,$1;
  3160. $2=self._collection();
  3161. $ctx1.sendIdx["collection"]=1;
  3162. $1=_st($2)._third();
  3163. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3164. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3165. args: [],
  3166. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3167. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3168. referencedClasses: []
  3169. }),
  3170. smalltalk.SequenceableCollectionTest);
  3171. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3172. smalltalk.addMethod(
  3173. smalltalk.method({
  3174. selector: "collection",
  3175. protocol: 'fixture',
  3176. fn: function (){
  3177. var self=this;
  3178. return smalltalk.withContext(function($ctx1) {
  3179. var $1;
  3180. $1=[(1), (2), (3), (-4)];
  3181. return $1;
  3182. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3183. args: [],
  3184. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3185. messageSends: [],
  3186. referencedClasses: []
  3187. }),
  3188. smalltalk.ArrayTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "collectionFirst",
  3192. protocol: 'fixture',
  3193. fn: function (){
  3194. var self=this;
  3195. return smalltalk.withContext(function($ctx1) {
  3196. return (1);
  3197. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3198. args: [],
  3199. source: "collectionFirst\x0a\x09^ 1",
  3200. messageSends: [],
  3201. referencedClasses: []
  3202. }),
  3203. smalltalk.ArrayTest);
  3204. smalltalk.addMethod(
  3205. smalltalk.method({
  3206. selector: "collectionFirstTwo",
  3207. protocol: 'fixture',
  3208. fn: function (){
  3209. var self=this;
  3210. return smalltalk.withContext(function($ctx1) {
  3211. var $1;
  3212. $1=[(1), (2)];
  3213. return $1;
  3214. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3215. args: [],
  3216. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3217. messageSends: [],
  3218. referencedClasses: []
  3219. }),
  3220. smalltalk.ArrayTest);
  3221. smalltalk.addMethod(
  3222. smalltalk.method({
  3223. selector: "collectionLast",
  3224. protocol: 'fixture',
  3225. fn: function (){
  3226. var self=this;
  3227. return smalltalk.withContext(function($ctx1) {
  3228. return (-4);
  3229. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3230. args: [],
  3231. source: "collectionLast\x0a\x09^ -4",
  3232. messageSends: [],
  3233. referencedClasses: []
  3234. }),
  3235. smalltalk.ArrayTest);
  3236. smalltalk.addMethod(
  3237. smalltalk.method({
  3238. selector: "collectionLastTwo",
  3239. protocol: 'fixture',
  3240. fn: function (){
  3241. var self=this;
  3242. return smalltalk.withContext(function($ctx1) {
  3243. var $1;
  3244. $1=[(3), (-4)];
  3245. return $1;
  3246. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3247. args: [],
  3248. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3249. messageSends: [],
  3250. referencedClasses: []
  3251. }),
  3252. smalltalk.ArrayTest);
  3253. smalltalk.addMethod(
  3254. smalltalk.method({
  3255. selector: "collectionWithDuplicates",
  3256. protocol: 'fixture',
  3257. fn: function (){
  3258. var self=this;
  3259. return smalltalk.withContext(function($ctx1) {
  3260. var $1;
  3261. $1=["a", "b", "c", (1), (2), (1), "a"];
  3262. return $1;
  3263. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3264. args: [],
  3265. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3266. messageSends: [],
  3267. referencedClasses: []
  3268. }),
  3269. smalltalk.ArrayTest);
  3270. smalltalk.addMethod(
  3271. smalltalk.method({
  3272. selector: "collectionWithNewValue",
  3273. protocol: 'fixture',
  3274. fn: function (){
  3275. var self=this;
  3276. return smalltalk.withContext(function($ctx1) {
  3277. var $1;
  3278. $1=[(1), (2), (3), (-4), "N"];
  3279. return $1;
  3280. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3281. args: [],
  3282. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3283. messageSends: [],
  3284. referencedClasses: []
  3285. }),
  3286. smalltalk.ArrayTest);
  3287. smalltalk.addMethod(
  3288. smalltalk.method({
  3289. selector: "sampleNewIndex",
  3290. protocol: 'fixture',
  3291. fn: function (){
  3292. var self=this;
  3293. return smalltalk.withContext(function($ctx1) {
  3294. return (5);
  3295. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3296. args: [],
  3297. source: "sampleNewIndex\x0a\x09^ 5",
  3298. messageSends: [],
  3299. referencedClasses: []
  3300. }),
  3301. smalltalk.ArrayTest);
  3302. smalltalk.addMethod(
  3303. smalltalk.method({
  3304. selector: "samplesDo:",
  3305. protocol: 'fixture',
  3306. fn: function (aBlock){
  3307. var self=this;
  3308. return smalltalk.withContext(function($ctx1) {
  3309. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3310. _st(aBlock)._value_value_((3),(3));
  3311. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3312. args: ["aBlock"],
  3313. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3314. messageSends: ["samplesDo:", "value:value:"],
  3315. referencedClasses: []
  3316. }),
  3317. smalltalk.ArrayTest);
  3318. smalltalk.addMethod(
  3319. smalltalk.method({
  3320. selector: "testAdd",
  3321. protocol: 'tests',
  3322. fn: function (){
  3323. var self=this;
  3324. var array;
  3325. return smalltalk.withContext(function($ctx1) {
  3326. array=self._collection();
  3327. _st(array)._add_((6));
  3328. self._assert_equals_(_st(array)._last(),(6));
  3329. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3330. args: [],
  3331. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3332. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3333. referencedClasses: []
  3334. }),
  3335. smalltalk.ArrayTest);
  3336. smalltalk.addMethod(
  3337. smalltalk.method({
  3338. selector: "testAddFirst",
  3339. protocol: 'tests',
  3340. fn: function (){
  3341. var self=this;
  3342. return smalltalk.withContext(function($ctx1) {
  3343. var $1,$2;
  3344. $1=self._collection();
  3345. _st($1)._addFirst_((0));
  3346. $2=_st($1)._yourself();
  3347. self._assert_equals_(_st($2)._first(),(0));
  3348. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3349. args: [],
  3350. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3351. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3352. referencedClasses: []
  3353. }),
  3354. smalltalk.ArrayTest);
  3355. smalltalk.addMethod(
  3356. smalltalk.method({
  3357. selector: "testPrintString",
  3358. protocol: 'tests',
  3359. fn: function (){
  3360. var self=this;
  3361. var array;
  3362. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3363. return smalltalk.withContext(function($ctx1) {
  3364. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3365. array=_st($Array())._new();
  3366. $1=_st(array)._printString();
  3367. $ctx1.sendIdx["printString"]=1;
  3368. self._assert_equals_($1,"an Array ()");
  3369. $ctx1.sendIdx["assert:equals:"]=1;
  3370. $2=array;
  3371. _st($2)._add_((1));
  3372. $ctx1.sendIdx["add:"]=1;
  3373. $3=_st($2)._add_((3));
  3374. $ctx1.sendIdx["add:"]=2;
  3375. $4=_st(array)._printString();
  3376. $ctx1.sendIdx["printString"]=2;
  3377. self._assert_equals_($4,"an Array (1 3)");
  3378. $ctx1.sendIdx["assert:equals:"]=2;
  3379. _st(array)._add_("foo");
  3380. $5=_st(array)._printString();
  3381. $ctx1.sendIdx["printString"]=3;
  3382. self._assert_equals_($5,"an Array (1 3 'foo')");
  3383. $ctx1.sendIdx["assert:equals:"]=3;
  3384. $6=array;
  3385. _st($6)._remove_((1));
  3386. $ctx1.sendIdx["remove:"]=1;
  3387. $7=_st($6)._remove_((3));
  3388. $8=_st(array)._printString();
  3389. $ctx1.sendIdx["printString"]=4;
  3390. self._assert_equals_($8,"an Array ('foo')");
  3391. $ctx1.sendIdx["assert:equals:"]=4;
  3392. _st(array)._addLast_((3));
  3393. $ctx1.sendIdx["addLast:"]=1;
  3394. $9=_st(array)._printString();
  3395. $ctx1.sendIdx["printString"]=5;
  3396. self._assert_equals_($9,"an Array ('foo' 3)");
  3397. $ctx1.sendIdx["assert:equals:"]=5;
  3398. _st(array)._addLast_((3));
  3399. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3400. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3401. args: [],
  3402. 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)'.",
  3403. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3404. referencedClasses: ["Array"]
  3405. }),
  3406. smalltalk.ArrayTest);
  3407. smalltalk.addMethod(
  3408. smalltalk.method({
  3409. selector: "testRemove",
  3410. protocol: 'tests',
  3411. fn: function (){
  3412. var self=this;
  3413. var array;
  3414. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3415. return smalltalk.withContext(function($ctx1) {
  3416. array=[(1), (2), (3), (4), (5)];
  3417. _st(array)._remove_((3));
  3418. $ctx1.sendIdx["remove:"]=1;
  3419. self._assert_equals_(array,[(1), (2), (4), (5)]);
  3420. self._should_raise_((function(){
  3421. return smalltalk.withContext(function($ctx2) {
  3422. return _st(array)._remove_((3));
  3423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3424. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  3425. args: [],
  3426. 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",
  3427. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  3428. referencedClasses: ["Error"]
  3429. }),
  3430. smalltalk.ArrayTest);
  3431. smalltalk.addMethod(
  3432. smalltalk.method({
  3433. selector: "testRemoveFromTo",
  3434. protocol: 'tests',
  3435. fn: function (){
  3436. var self=this;
  3437. return smalltalk.withContext(function($ctx1) {
  3438. var $1,$2;
  3439. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  3440. $ctx1.sendIdx["removeFrom:to:"]=1;
  3441. self._assert_equals_($1,[(4)]);
  3442. $ctx1.sendIdx["assert:equals:"]=1;
  3443. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  3444. $ctx1.sendIdx["removeFrom:to:"]=2;
  3445. self._assert_equals_($2,[(1), (4)]);
  3446. $ctx1.sendIdx["assert:equals:"]=2;
  3447. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  3448. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  3449. args: [],
  3450. 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)",
  3451. messageSends: ["assert:equals:", "removeFrom:to:"],
  3452. referencedClasses: []
  3453. }),
  3454. smalltalk.ArrayTest);
  3455. smalltalk.addMethod(
  3456. smalltalk.method({
  3457. selector: "testRemoveIndex",
  3458. protocol: 'tests',
  3459. fn: function (){
  3460. var self=this;
  3461. return smalltalk.withContext(function($ctx1) {
  3462. var $1,$2;
  3463. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  3464. $ctx1.sendIdx["removeIndex:"]=1;
  3465. self._assert_equals_($1,[(1), (3), (4)]);
  3466. $ctx1.sendIdx["assert:equals:"]=1;
  3467. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  3468. $ctx1.sendIdx["removeIndex:"]=2;
  3469. self._assert_equals_($2,[(2), (3), (4)]);
  3470. $ctx1.sendIdx["assert:equals:"]=2;
  3471. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  3472. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  3473. args: [],
  3474. 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: #()",
  3475. messageSends: ["assert:equals:", "removeIndex:"],
  3476. referencedClasses: []
  3477. }),
  3478. smalltalk.ArrayTest);
  3479. smalltalk.addMethod(
  3480. smalltalk.method({
  3481. selector: "testRemoveLast",
  3482. protocol: 'tests',
  3483. fn: function (){
  3484. var self=this;
  3485. var array;
  3486. return smalltalk.withContext(function($ctx1) {
  3487. array=[(1), (2)];
  3488. _st(array)._removeLast();
  3489. self._assert_equals_(_st(array)._last(),(1));
  3490. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  3491. args: [],
  3492. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  3493. messageSends: ["removeLast", "assert:equals:", "last"],
  3494. referencedClasses: []
  3495. }),
  3496. smalltalk.ArrayTest);
  3497. smalltalk.addMethod(
  3498. smalltalk.method({
  3499. selector: "testReversed",
  3500. protocol: 'tests',
  3501. fn: function (){
  3502. var self=this;
  3503. var array;
  3504. return smalltalk.withContext(function($ctx1) {
  3505. array=[(5), (4), (3), (2), (1)];
  3506. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  3507. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  3508. args: [],
  3509. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  3510. messageSends: ["assert:equals:", "reversed"],
  3511. referencedClasses: []
  3512. }),
  3513. smalltalk.ArrayTest);
  3514. smalltalk.addMethod(
  3515. smalltalk.method({
  3516. selector: "testSort",
  3517. protocol: 'tests',
  3518. fn: function (){
  3519. var self=this;
  3520. var array;
  3521. return smalltalk.withContext(function($ctx1) {
  3522. array=[(3), (1), (4), (5), (2)];
  3523. _st(array)._sort();
  3524. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  3525. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  3526. args: [],
  3527. 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)",
  3528. messageSends: ["sort", "assert:equals:"],
  3529. referencedClasses: []
  3530. }),
  3531. smalltalk.ArrayTest);
  3532. smalltalk.addMethod(
  3533. smalltalk.method({
  3534. selector: "collectionClass",
  3535. protocol: 'fixture',
  3536. fn: function (){
  3537. var self=this;
  3538. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3539. return smalltalk.withContext(function($ctx1) {
  3540. return $Array();
  3541. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  3542. args: [],
  3543. source: "collectionClass\x0a\x09^ Array",
  3544. messageSends: [],
  3545. referencedClasses: ["Array"]
  3546. }),
  3547. smalltalk.ArrayTest.klass);
  3548. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3549. smalltalk.addMethod(
  3550. smalltalk.method({
  3551. selector: "collection",
  3552. protocol: 'fixture',
  3553. fn: function (){
  3554. var self=this;
  3555. return smalltalk.withContext(function($ctx1) {
  3556. return "hello";
  3557. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  3558. args: [],
  3559. source: "collection\x0a\x09^ 'hello'",
  3560. messageSends: [],
  3561. referencedClasses: []
  3562. }),
  3563. smalltalk.StringTest);
  3564. smalltalk.addMethod(
  3565. smalltalk.method({
  3566. selector: "collectionFirst",
  3567. protocol: 'fixture',
  3568. fn: function (){
  3569. var self=this;
  3570. return smalltalk.withContext(function($ctx1) {
  3571. return "h";
  3572. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  3573. args: [],
  3574. source: "collectionFirst\x0a\x09^ 'h'",
  3575. messageSends: [],
  3576. referencedClasses: []
  3577. }),
  3578. smalltalk.StringTest);
  3579. smalltalk.addMethod(
  3580. smalltalk.method({
  3581. selector: "collectionFirstTwo",
  3582. protocol: 'fixture',
  3583. fn: function (){
  3584. var self=this;
  3585. return smalltalk.withContext(function($ctx1) {
  3586. return "he";
  3587. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  3588. args: [],
  3589. source: "collectionFirstTwo\x0a\x09^ 'he'",
  3590. messageSends: [],
  3591. referencedClasses: []
  3592. }),
  3593. smalltalk.StringTest);
  3594. smalltalk.addMethod(
  3595. smalltalk.method({
  3596. selector: "collectionLast",
  3597. protocol: 'fixture',
  3598. fn: function (){
  3599. var self=this;
  3600. return smalltalk.withContext(function($ctx1) {
  3601. return "o";
  3602. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  3603. args: [],
  3604. source: "collectionLast\x0a\x09^ 'o'",
  3605. messageSends: [],
  3606. referencedClasses: []
  3607. }),
  3608. smalltalk.StringTest);
  3609. smalltalk.addMethod(
  3610. smalltalk.method({
  3611. selector: "collectionLastTwo",
  3612. protocol: 'fixture',
  3613. fn: function (){
  3614. var self=this;
  3615. return smalltalk.withContext(function($ctx1) {
  3616. return "lo";
  3617. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  3618. args: [],
  3619. source: "collectionLastTwo\x0a\x09^ 'lo'",
  3620. messageSends: [],
  3621. referencedClasses: []
  3622. }),
  3623. smalltalk.StringTest);
  3624. smalltalk.addMethod(
  3625. smalltalk.method({
  3626. selector: "collectionWithDuplicates",
  3627. protocol: 'fixture',
  3628. fn: function (){
  3629. var self=this;
  3630. return smalltalk.withContext(function($ctx1) {
  3631. return "abbaerte";
  3632. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  3633. args: [],
  3634. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  3635. messageSends: [],
  3636. referencedClasses: []
  3637. }),
  3638. smalltalk.StringTest);
  3639. smalltalk.addMethod(
  3640. smalltalk.method({
  3641. selector: "samplesDo:",
  3642. protocol: 'fixture',
  3643. fn: function (aBlock){
  3644. var self=this;
  3645. return smalltalk.withContext(function($ctx1) {
  3646. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3647. _st(aBlock)._value_value_((3),"l");
  3648. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  3649. args: ["aBlock"],
  3650. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  3651. messageSends: ["samplesDo:", "value:value:"],
  3652. referencedClasses: []
  3653. }),
  3654. smalltalk.StringTest);
  3655. smalltalk.addMethod(
  3656. smalltalk.method({
  3657. selector: "testAddRemove",
  3658. protocol: 'tests',
  3659. fn: function (){
  3660. var self=this;
  3661. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3662. return smalltalk.withContext(function($ctx1) {
  3663. self._should_raise_((function(){
  3664. return smalltalk.withContext(function($ctx2) {
  3665. return "hello"._add_("a");
  3666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3667. $ctx1.sendIdx["should:raise:"]=1;
  3668. self._should_raise_((function(){
  3669. return smalltalk.withContext(function($ctx2) {
  3670. return "hello"._remove_("h");
  3671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3672. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  3673. args: [],
  3674. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  3675. messageSends: ["should:raise:", "add:", "remove:"],
  3676. referencedClasses: ["Error"]
  3677. }),
  3678. smalltalk.StringTest);
  3679. smalltalk.addMethod(
  3680. smalltalk.method({
  3681. selector: "testAsArray",
  3682. protocol: 'tests',
  3683. fn: function (){
  3684. var self=this;
  3685. return smalltalk.withContext(function($ctx1) {
  3686. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  3687. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  3688. args: [],
  3689. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  3690. messageSends: ["assert:equals:", "asArray"],
  3691. referencedClasses: []
  3692. }),
  3693. smalltalk.StringTest);
  3694. smalltalk.addMethod(
  3695. smalltalk.method({
  3696. selector: "testAsLowerCase",
  3697. protocol: 'tests',
  3698. fn: function (){
  3699. var self=this;
  3700. return smalltalk.withContext(function($ctx1) {
  3701. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  3702. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  3703. args: [],
  3704. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  3705. messageSends: ["assert:equals:", "asLowercase"],
  3706. referencedClasses: []
  3707. }),
  3708. smalltalk.StringTest);
  3709. smalltalk.addMethod(
  3710. smalltalk.method({
  3711. selector: "testAsNumber",
  3712. protocol: 'tests',
  3713. fn: function (){
  3714. var self=this;
  3715. return smalltalk.withContext(function($ctx1) {
  3716. var $1,$2;
  3717. $1="3"._asNumber();
  3718. $ctx1.sendIdx["asNumber"]=1;
  3719. self._assert_equals_($1,(3));
  3720. $ctx1.sendIdx["assert:equals:"]=1;
  3721. $2="-3"._asNumber();
  3722. $ctx1.sendIdx["asNumber"]=2;
  3723. self._assert_equals_($2,(-3));
  3724. $ctx1.sendIdx["assert:equals:"]=2;
  3725. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  3726. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  3727. args: [],
  3728. 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.",
  3729. messageSends: ["assert:equals:", "asNumber"],
  3730. referencedClasses: []
  3731. }),
  3732. smalltalk.StringTest);
  3733. smalltalk.addMethod(
  3734. smalltalk.method({
  3735. selector: "testAsUpperCase",
  3736. protocol: 'tests',
  3737. fn: function (){
  3738. var self=this;
  3739. return smalltalk.withContext(function($ctx1) {
  3740. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3741. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3742. args: [],
  3743. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3744. messageSends: ["assert:equals:", "asUppercase"],
  3745. referencedClasses: []
  3746. }),
  3747. smalltalk.StringTest);
  3748. smalltalk.addMethod(
  3749. smalltalk.method({
  3750. selector: "testAsciiValue",
  3751. protocol: 'tests',
  3752. fn: function (){
  3753. var self=this;
  3754. var characterA,characterU;
  3755. return smalltalk.withContext(function($ctx1) {
  3756. var $1;
  3757. characterA="A";
  3758. characterU="U";
  3759. $1=_st(characterA)._asciiValue();
  3760. $ctx1.sendIdx["asciiValue"]=1;
  3761. self._assert_equals_($1,(65));
  3762. $ctx1.sendIdx["assert:equals:"]=1;
  3763. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  3764. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3765. args: [],
  3766. 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",
  3767. messageSends: ["assert:equals:", "asciiValue"],
  3768. referencedClasses: []
  3769. }),
  3770. smalltalk.StringTest);
  3771. smalltalk.addMethod(
  3772. smalltalk.method({
  3773. selector: "testAtPut",
  3774. protocol: 'tests',
  3775. fn: function (){
  3776. var self=this;
  3777. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3778. return smalltalk.withContext(function($ctx1) {
  3779. self._should_raise_((function(){
  3780. return smalltalk.withContext(function($ctx2) {
  3781. return "hello"._at_put_((1),"a");
  3782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3783. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3784. args: [],
  3785. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  3786. messageSends: ["should:raise:", "at:put:"],
  3787. referencedClasses: ["Error"]
  3788. }),
  3789. smalltalk.StringTest);
  3790. smalltalk.addMethod(
  3791. smalltalk.method({
  3792. selector: "testCapitalized",
  3793. protocol: 'tests',
  3794. fn: function (){
  3795. var self=this;
  3796. return smalltalk.withContext(function($ctx1) {
  3797. var $1,$2,$3;
  3798. $1="test"._capitalized();
  3799. $ctx1.sendIdx["capitalized"]=1;
  3800. self._assert_equals_($1,"Test");
  3801. $ctx1.sendIdx["assert:equals:"]=1;
  3802. $2="Test"._capitalized();
  3803. $ctx1.sendIdx["capitalized"]=2;
  3804. self._assert_equals_($2,"Test");
  3805. $ctx1.sendIdx["assert:equals:"]=2;
  3806. self._assert_equals_(""._capitalized(),"");
  3807. $ctx1.sendIdx["assert:equals:"]=3;
  3808. $3="Test"._isCapitalized();
  3809. $ctx1.sendIdx["isCapitalized"]=1;
  3810. self._assert_equals_($3,true);
  3811. $ctx1.sendIdx["assert:equals:"]=4;
  3812. self._assert_equals_("test"._isCapitalized(),false);
  3813. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3814. args: [],
  3815. 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.",
  3816. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3817. referencedClasses: []
  3818. }),
  3819. smalltalk.StringTest);
  3820. smalltalk.addMethod(
  3821. smalltalk.method({
  3822. selector: "testCharCodeAt",
  3823. protocol: 'tests',
  3824. fn: function (){
  3825. var self=this;
  3826. return smalltalk.withContext(function($ctx1) {
  3827. var $1,$2,$3,$4,$5;
  3828. $1="jackie"._charCodeAt_((1));
  3829. $ctx1.sendIdx["charCodeAt:"]=1;
  3830. self._assert_equals_($1,(106));
  3831. $ctx1.sendIdx["assert:equals:"]=1;
  3832. $2="jackie"._charCodeAt_((2));
  3833. $ctx1.sendIdx["charCodeAt:"]=2;
  3834. self._assert_equals_($2,(97));
  3835. $ctx1.sendIdx["assert:equals:"]=2;
  3836. $3="jackie"._charCodeAt_((3));
  3837. $ctx1.sendIdx["charCodeAt:"]=3;
  3838. self._assert_equals_($3,(99));
  3839. $ctx1.sendIdx["assert:equals:"]=3;
  3840. $4="jackie"._charCodeAt_((4));
  3841. $ctx1.sendIdx["charCodeAt:"]=4;
  3842. self._assert_equals_($4,(107));
  3843. $ctx1.sendIdx["assert:equals:"]=4;
  3844. $5="jackie"._charCodeAt_((5));
  3845. $ctx1.sendIdx["charCodeAt:"]=5;
  3846. self._assert_equals_($5,(105));
  3847. $ctx1.sendIdx["assert:equals:"]=5;
  3848. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3849. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3850. args: [],
  3851. 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",
  3852. messageSends: ["assert:equals:", "charCodeAt:"],
  3853. referencedClasses: []
  3854. }),
  3855. smalltalk.StringTest);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: "testCollect",
  3859. protocol: 'tests',
  3860. fn: function (){
  3861. var self=this;
  3862. var newCollection;
  3863. return smalltalk.withContext(function($ctx1) {
  3864. newCollection="hheelllloo";
  3865. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3866. return smalltalk.withContext(function($ctx2) {
  3867. return _st(each).__comma(each);
  3868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3869. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3870. args: [],
  3871. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  3872. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3873. referencedClasses: []
  3874. }),
  3875. smalltalk.StringTest);
  3876. smalltalk.addMethod(
  3877. smalltalk.method({
  3878. selector: "testCopyFromTo",
  3879. protocol: 'tests',
  3880. fn: function (){
  3881. var self=this;
  3882. return smalltalk.withContext(function($ctx1) {
  3883. var $1;
  3884. $1="jackie"._copyFrom_to_((1),(3));
  3885. $ctx1.sendIdx["copyFrom:to:"]=1;
  3886. self._assert_equals_($1,"jac");
  3887. $ctx1.sendIdx["assert:equals:"]=1;
  3888. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3889. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3890. args: [],
  3891. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3892. messageSends: ["assert:equals:", "copyFrom:to:"],
  3893. referencedClasses: []
  3894. }),
  3895. smalltalk.StringTest);
  3896. smalltalk.addMethod(
  3897. smalltalk.method({
  3898. selector: "testCopyWithoutAll",
  3899. protocol: 'tests',
  3900. fn: function (){
  3901. var self=this;
  3902. return smalltalk.withContext(function($ctx1) {
  3903. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3904. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3905. args: [],
  3906. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3907. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3908. referencedClasses: []
  3909. }),
  3910. smalltalk.StringTest);
  3911. smalltalk.addMethod(
  3912. smalltalk.method({
  3913. selector: "testDetect",
  3914. protocol: 'tests',
  3915. fn: function (){
  3916. var self=this;
  3917. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3918. return smalltalk.withContext(function($ctx1) {
  3919. var $2,$1;
  3920. $2=self._collection();
  3921. $ctx1.sendIdx["collection"]=1;
  3922. $1=_st($2)._detect_((function(each){
  3923. return smalltalk.withContext(function($ctx2) {
  3924. return _st(each).__eq("h");
  3925. $ctx2.sendIdx["="]=1;
  3926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3927. $ctx1.sendIdx["detect:"]=1;
  3928. self._assert_equals_($1,"h");
  3929. self._should_raise_((function(){
  3930. return smalltalk.withContext(function($ctx2) {
  3931. return _st(self._collection())._detect_((function(each){
  3932. return smalltalk.withContext(function($ctx3) {
  3933. return _st(each).__eq((6));
  3934. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3936. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3937. args: [],
  3938. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  3939. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3940. referencedClasses: ["Error"]
  3941. }),
  3942. smalltalk.StringTest);
  3943. smalltalk.addMethod(
  3944. smalltalk.method({
  3945. selector: "testEquality",
  3946. protocol: 'tests',
  3947. fn: function (){
  3948. var self=this;
  3949. return smalltalk.withContext(function($ctx1) {
  3950. var $1,$2,$3;
  3951. self._assert_equals_("hello","hello");
  3952. $ctx1.sendIdx["assert:equals:"]=1;
  3953. $1="hello".__eq("world");
  3954. $ctx1.sendIdx["="]=1;
  3955. self._deny_($1);
  3956. $ctx1.sendIdx["deny:"]=1;
  3957. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3958. return smalltalk.withContext(function($ctx2) {
  3959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3960. $ctx1.sendIdx["="]=2;
  3961. self._deny_($2);
  3962. $ctx1.sendIdx["deny:"]=2;
  3963. $3="hello"._yourself();
  3964. $ctx1.sendIdx["yourself"]=1;
  3965. self._assert_equals_("hello",$3);
  3966. $ctx1.sendIdx["assert:equals:"]=2;
  3967. self._assert_equals_("hello"._yourself(),"hello");
  3968. self._deny_("".__eq((0)));
  3969. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3970. args: [],
  3971. 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",
  3972. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3973. referencedClasses: []
  3974. }),
  3975. smalltalk.StringTest);
  3976. smalltalk.addMethod(
  3977. smalltalk.method({
  3978. selector: "testIdentity",
  3979. protocol: 'tests',
  3980. fn: function (){
  3981. var self=this;
  3982. return smalltalk.withContext(function($ctx1) {
  3983. var $1,$2,$4,$3,$5;
  3984. $1="hello".__eq_eq("hello");
  3985. $ctx1.sendIdx["=="]=1;
  3986. self._assert_($1);
  3987. $ctx1.sendIdx["assert:"]=1;
  3988. $2="hello".__eq_eq("world");
  3989. $ctx1.sendIdx["=="]=2;
  3990. self._deny_($2);
  3991. $ctx1.sendIdx["deny:"]=1;
  3992. $4="hello"._yourself();
  3993. $ctx1.sendIdx["yourself"]=1;
  3994. $3="hello".__eq_eq($4);
  3995. $ctx1.sendIdx["=="]=3;
  3996. self._assert_($3);
  3997. $ctx1.sendIdx["assert:"]=2;
  3998. $5=_st("hello"._yourself()).__eq_eq("hello");
  3999. $ctx1.sendIdx["=="]=4;
  4000. self._assert_($5);
  4001. self._deny_("".__eq_eq((0)));
  4002. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4003. args: [],
  4004. 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",
  4005. messageSends: ["assert:", "==", "deny:", "yourself"],
  4006. referencedClasses: []
  4007. }),
  4008. smalltalk.StringTest);
  4009. smalltalk.addMethod(
  4010. smalltalk.method({
  4011. selector: "testIdentityHash",
  4012. protocol: 'tests',
  4013. fn: function (){
  4014. var self=this;
  4015. return smalltalk.withContext(function($ctx1) {
  4016. var $1,$2,$4,$3;
  4017. $1="foo"._identityHash();
  4018. $ctx1.sendIdx["identityHash"]=1;
  4019. $2="foo"._identityHash();
  4020. $ctx1.sendIdx["identityHash"]=2;
  4021. self._assert_equals_($1,$2);
  4022. $4="foo"._identityHash();
  4023. $ctx1.sendIdx["identityHash"]=3;
  4024. $3=_st($4).__eq("bar"._identityHash());
  4025. self._deny_($3);
  4026. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4027. args: [],
  4028. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4029. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4030. referencedClasses: []
  4031. }),
  4032. smalltalk.StringTest);
  4033. smalltalk.addMethod(
  4034. smalltalk.method({
  4035. selector: "testIncludesSubString",
  4036. protocol: 'tests',
  4037. fn: function (){
  4038. var self=this;
  4039. return smalltalk.withContext(function($ctx1) {
  4040. var $1;
  4041. $1="amber"._includesSubString_("ber");
  4042. $ctx1.sendIdx["includesSubString:"]=1;
  4043. self._assert_($1);
  4044. self._deny_("amber"._includesSubString_("zork"));
  4045. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4046. args: [],
  4047. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4048. messageSends: ["assert:", "includesSubString:", "deny:"],
  4049. referencedClasses: []
  4050. }),
  4051. smalltalk.StringTest);
  4052. smalltalk.addMethod(
  4053. smalltalk.method({
  4054. selector: "testIsVowel",
  4055. protocol: 'tests',
  4056. fn: function (){
  4057. var self=this;
  4058. var vowel,consonant;
  4059. return smalltalk.withContext(function($ctx1) {
  4060. var $1;
  4061. vowel="u";
  4062. consonant="z";
  4063. $1=_st(vowel)._isVowel();
  4064. $ctx1.sendIdx["isVowel"]=1;
  4065. self._assert_equals_($1,true);
  4066. $ctx1.sendIdx["assert:equals:"]=1;
  4067. self._assert_equals_(_st(consonant)._isVowel(),false);
  4068. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4069. args: [],
  4070. 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",
  4071. messageSends: ["assert:equals:", "isVowel"],
  4072. referencedClasses: []
  4073. }),
  4074. smalltalk.StringTest);
  4075. smalltalk.addMethod(
  4076. smalltalk.method({
  4077. selector: "testJoin",
  4078. protocol: 'tests',
  4079. fn: function (){
  4080. var self=this;
  4081. return smalltalk.withContext(function($ctx1) {
  4082. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4083. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4084. args: [],
  4085. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4086. messageSends: ["assert:equals:", "join:"],
  4087. referencedClasses: []
  4088. }),
  4089. smalltalk.StringTest);
  4090. smalltalk.addMethod(
  4091. smalltalk.method({
  4092. selector: "testRemoveAll",
  4093. protocol: 'tests',
  4094. fn: function (){
  4095. var self=this;
  4096. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4097. return smalltalk.withContext(function($ctx1) {
  4098. self._should_raise_((function(){
  4099. return smalltalk.withContext(function($ctx2) {
  4100. return _st(self._collection())._removeAll();
  4101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4102. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4103. args: [],
  4104. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4105. messageSends: ["should:raise:", "removeAll", "collection"],
  4106. referencedClasses: ["Error"]
  4107. }),
  4108. smalltalk.StringTest);
  4109. smalltalk.addMethod(
  4110. smalltalk.method({
  4111. selector: "testReversed",
  4112. protocol: 'tests',
  4113. fn: function (){
  4114. var self=this;
  4115. return smalltalk.withContext(function($ctx1) {
  4116. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4117. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4118. args: [],
  4119. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4120. messageSends: ["assert:equals:", "reversed"],
  4121. referencedClasses: []
  4122. }),
  4123. smalltalk.StringTest);
  4124. smalltalk.addMethod(
  4125. smalltalk.method({
  4126. selector: "testSelect",
  4127. protocol: 'tests',
  4128. fn: function (){
  4129. var self=this;
  4130. var newCollection;
  4131. return smalltalk.withContext(function($ctx1) {
  4132. newCollection="o";
  4133. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  4134. return smalltalk.withContext(function($ctx2) {
  4135. return _st(each).__eq("o");
  4136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  4137. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  4138. args: [],
  4139. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  4140. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  4141. referencedClasses: []
  4142. }),
  4143. smalltalk.StringTest);
  4144. smalltalk.addMethod(
  4145. smalltalk.method({
  4146. selector: "testSize",
  4147. protocol: 'tests',
  4148. fn: function (){
  4149. var self=this;
  4150. return smalltalk.withContext(function($ctx1) {
  4151. var $1;
  4152. $1="smalltalk"._size();
  4153. $ctx1.sendIdx["size"]=1;
  4154. self._assert_equals_($1,(9));
  4155. $ctx1.sendIdx["assert:equals:"]=1;
  4156. self._assert_equals_(""._size(),(0));
  4157. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  4158. args: [],
  4159. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  4160. messageSends: ["assert:equals:", "size"],
  4161. referencedClasses: []
  4162. }),
  4163. smalltalk.StringTest);
  4164. smalltalk.addMethod(
  4165. smalltalk.method({
  4166. selector: "testStreamContents",
  4167. protocol: 'tests',
  4168. fn: function (){
  4169. var self=this;
  4170. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4171. return smalltalk.withContext(function($ctx1) {
  4172. var $1;
  4173. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4174. return smalltalk.withContext(function($ctx2) {
  4175. _st(aStream)._nextPutAll_("hello");
  4176. $ctx2.sendIdx["nextPutAll:"]=1;
  4177. _st(aStream)._space();
  4178. $1=_st(aStream)._nextPutAll_("world");
  4179. return $1;
  4180. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4181. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4182. args: [],
  4183. 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'",
  4184. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4185. referencedClasses: ["String"]
  4186. }),
  4187. smalltalk.StringTest);
  4188. smalltalk.addMethod(
  4189. smalltalk.method({
  4190. selector: "testSubStrings",
  4191. protocol: 'tests',
  4192. fn: function (){
  4193. var self=this;
  4194. return smalltalk.withContext(function($ctx1) {
  4195. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4196. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4197. args: [],
  4198. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4199. messageSends: ["assert:equals:", "subStrings:"],
  4200. referencedClasses: []
  4201. }),
  4202. smalltalk.StringTest);
  4203. smalltalk.addMethod(
  4204. smalltalk.method({
  4205. selector: "testTrim",
  4206. protocol: 'tests',
  4207. fn: function (){
  4208. var self=this;
  4209. return smalltalk.withContext(function($ctx1) {
  4210. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4211. $ctx1.sendIdx["assert:equals:"]=1;
  4212. self._assert_equals_("jackie "._trimRight(),"jackie");
  4213. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4214. args: [],
  4215. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4216. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4217. referencedClasses: []
  4218. }),
  4219. smalltalk.StringTest);
  4220. smalltalk.addMethod(
  4221. smalltalk.method({
  4222. selector: "collectionClass",
  4223. protocol: 'fixture',
  4224. fn: function (){
  4225. var self=this;
  4226. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4227. return smalltalk.withContext(function($ctx1) {
  4228. return $String();
  4229. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4230. args: [],
  4231. source: "collectionClass\x0a\x09^ String",
  4232. messageSends: [],
  4233. referencedClasses: ["String"]
  4234. }),
  4235. smalltalk.StringTest.klass);
  4236. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4237. smalltalk.addMethod(
  4238. smalltalk.method({
  4239. selector: "testShow",
  4240. protocol: 'tests',
  4241. fn: function (){
  4242. var self=this;
  4243. var originalTranscript;
  4244. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  4245. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  4246. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4247. return smalltalk.withContext(function($ctx1) {
  4248. originalTranscript=_st($Transcript())._current();
  4249. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  4250. $ctx1.sendIdx["register:"]=1;
  4251. self._shouldnt_raise_((function(){
  4252. return smalltalk.withContext(function($ctx2) {
  4253. return _st($Transcript())._show_("Hello console!");
  4254. $ctx2.sendIdx["show:"]=1;
  4255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4256. $ctx1.sendIdx["shouldnt:raise:"]=1;
  4257. self._shouldnt_raise_((function(){
  4258. return smalltalk.withContext(function($ctx2) {
  4259. return _st($Transcript())._show_(console);
  4260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4261. _st($Transcript())._register_(originalTranscript);
  4262. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  4263. args: [],
  4264. 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.",
  4265. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  4266. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  4267. }),
  4268. smalltalk.ConsoleTranscriptTest);
  4269. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4270. smalltalk.addMethod(
  4271. smalltalk.method({
  4272. selector: "jsObject",
  4273. protocol: 'accessing',
  4274. fn: function (){
  4275. var self=this;
  4276. return smalltalk.withContext(function($ctx1) {
  4277. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  4278. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  4279. args: [],
  4280. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  4281. messageSends: [],
  4282. referencedClasses: []
  4283. }),
  4284. smalltalk.JSObjectProxyTest);
  4285. smalltalk.addMethod(
  4286. smalltalk.method({
  4287. selector: "testAtIfAbsent",
  4288. protocol: 'tests',
  4289. fn: function (){
  4290. var self=this;
  4291. var testObject;
  4292. return smalltalk.withContext(function($ctx1) {
  4293. var $1,$2,$3;
  4294. testObject=self._jsObject();
  4295. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  4296. return smalltalk.withContext(function($ctx2) {
  4297. return "Property does not exist";
  4298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4299. $ctx1.sendIdx["at:ifAbsent:"]=1;
  4300. self._assert_equals_($1,"Property does not exist");
  4301. $ctx1.sendIdx["assert:equals:"]=1;
  4302. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  4303. return smalltalk.withContext(function($ctx2) {
  4304. return "Property does not exist";
  4305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4306. $ctx1.sendIdx["at:ifAbsent:"]=2;
  4307. self._assert_equals_($2,nil);
  4308. $ctx1.sendIdx["assert:equals:"]=2;
  4309. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  4310. return smalltalk.withContext(function($ctx2) {
  4311. return "Property does not exist";
  4312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  4313. $ctx1.sendIdx["at:ifAbsent:"]=3;
  4314. self._assert_equals_($3,(1));
  4315. $ctx1.sendIdx["assert:equals:"]=3;
  4316. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  4317. return smalltalk.withContext(function($ctx2) {
  4318. return "Property does not exist";
  4319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  4320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4321. args: [],
  4322. 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.",
  4323. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  4324. referencedClasses: []
  4325. }),
  4326. smalltalk.JSObjectProxyTest);
  4327. smalltalk.addMethod(
  4328. smalltalk.method({
  4329. selector: "testAtIfPresent",
  4330. protocol: 'tests',
  4331. fn: function (){
  4332. var self=this;
  4333. var testObject;
  4334. return smalltalk.withContext(function($ctx1) {
  4335. var $2,$1,$4,$3,$6,$5;
  4336. testObject=self._jsObject();
  4337. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  4338. return smalltalk.withContext(function($ctx2) {
  4339. $2=_st(x)._asString();
  4340. $ctx2.sendIdx["asString"]=1;
  4341. return "hello ".__comma($2);
  4342. $ctx2.sendIdx[","]=1;
  4343. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  4344. $ctx1.sendIdx["at:ifPresent:"]=1;
  4345. self._assert_equals_($1,nil);
  4346. $ctx1.sendIdx["assert:equals:"]=1;
  4347. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  4348. return smalltalk.withContext(function($ctx2) {
  4349. $4=_st(x)._asString();
  4350. $ctx2.sendIdx["asString"]=2;
  4351. return "hello ".__comma($4);
  4352. $ctx2.sendIdx[","]=2;
  4353. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  4354. $ctx1.sendIdx["at:ifPresent:"]=2;
  4355. self._assert_equals_($3,"hello nil");
  4356. $ctx1.sendIdx["assert:equals:"]=2;
  4357. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  4358. return smalltalk.withContext(function($ctx2) {
  4359. $6=_st(x)._asString();
  4360. $ctx2.sendIdx["asString"]=3;
  4361. return "hello ".__comma($6);
  4362. $ctx2.sendIdx[","]=3;
  4363. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  4364. $ctx1.sendIdx["at:ifPresent:"]=3;
  4365. self._assert_equals_($5,"hello 1");
  4366. $ctx1.sendIdx["assert:equals:"]=3;
  4367. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  4368. return smalltalk.withContext(function($ctx2) {
  4369. return "hello ".__comma(_st(x)._asString());
  4370. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  4371. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4372. args: [],
  4373. 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'.",
  4374. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  4375. referencedClasses: []
  4376. }),
  4377. smalltalk.JSObjectProxyTest);
  4378. smalltalk.addMethod(
  4379. smalltalk.method({
  4380. selector: "testAtIfPresentIfAbsent",
  4381. protocol: 'tests',
  4382. fn: function (){
  4383. var self=this;
  4384. var testObject;
  4385. return smalltalk.withContext(function($ctx1) {
  4386. var $2,$1,$4,$3,$6,$5;
  4387. testObject=self._jsObject();
  4388. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  4389. return smalltalk.withContext(function($ctx2) {
  4390. $2=_st(x)._asString();
  4391. $ctx2.sendIdx["asString"]=1;
  4392. return "hello ".__comma($2);
  4393. $ctx2.sendIdx[","]=1;
  4394. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  4395. return smalltalk.withContext(function($ctx2) {
  4396. return "not present";
  4397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4398. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  4399. self._assert_equals_($1,"not present");
  4400. $ctx1.sendIdx["assert:equals:"]=1;
  4401. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  4402. return smalltalk.withContext(function($ctx2) {
  4403. $4=_st(x)._asString();
  4404. $ctx2.sendIdx["asString"]=2;
  4405. return "hello ".__comma($4);
  4406. $ctx2.sendIdx[","]=2;
  4407. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  4408. return smalltalk.withContext(function($ctx2) {
  4409. return "not present";
  4410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4411. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  4412. self._assert_equals_($3,"hello nil");
  4413. $ctx1.sendIdx["assert:equals:"]=2;
  4414. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  4415. return smalltalk.withContext(function($ctx2) {
  4416. $6=_st(x)._asString();
  4417. $ctx2.sendIdx["asString"]=3;
  4418. return "hello ".__comma($6);
  4419. $ctx2.sendIdx[","]=3;
  4420. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  4421. return smalltalk.withContext(function($ctx2) {
  4422. return "not present";
  4423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4424. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  4425. self._assert_equals_($5,"hello 1");
  4426. $ctx1.sendIdx["assert:equals:"]=3;
  4427. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  4428. return smalltalk.withContext(function($ctx2) {
  4429. return "hello ".__comma(_st(x)._asString());
  4430. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  4431. return smalltalk.withContext(function($ctx2) {
  4432. return "not present";
  4433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  4434. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4435. args: [],
  4436. 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'.",
  4437. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  4438. referencedClasses: []
  4439. }),
  4440. smalltalk.JSObjectProxyTest);
  4441. smalltalk.addMethod(
  4442. smalltalk.method({
  4443. selector: "testAtPut",
  4444. protocol: 'tests',
  4445. fn: function (){
  4446. var self=this;
  4447. var testObject;
  4448. return smalltalk.withContext(function($ctx1) {
  4449. var $2,$1;
  4450. testObject=self._jsObject();
  4451. $2=_st(testObject)._at_("abc");
  4452. $ctx1.sendIdx["at:"]=1;
  4453. $1=_st($2).__tild_eq("xyz");
  4454. self._assert_($1);
  4455. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  4456. $ctx1.sendIdx["assert:equals:"]=1;
  4457. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  4458. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4459. args: [],
  4460. 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'",
  4461. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  4462. referencedClasses: []
  4463. }),
  4464. smalltalk.JSObjectProxyTest);
  4465. smalltalk.addMethod(
  4466. smalltalk.method({
  4467. selector: "testDNU",
  4468. protocol: 'tests',
  4469. fn: function (){
  4470. var self=this;
  4471. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4472. return smalltalk.withContext(function($ctx1) {
  4473. self._should_raise_((function(){
  4474. return smalltalk.withContext(function($ctx2) {
  4475. return _st(self._jsObject())._foo();
  4476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4477. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  4478. args: [],
  4479. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  4480. messageSends: ["should:raise:", "foo", "jsObject"],
  4481. referencedClasses: ["MessageNotUnderstood"]
  4482. }),
  4483. smalltalk.JSObjectProxyTest);
  4484. smalltalk.addMethod(
  4485. smalltalk.method({
  4486. selector: "testMessageSend",
  4487. protocol: 'tests',
  4488. fn: function (){
  4489. var self=this;
  4490. return smalltalk.withContext(function($ctx1) {
  4491. var $2,$1,$4,$3;
  4492. $2=self._jsObject();
  4493. $ctx1.sendIdx["jsObject"]=1;
  4494. $1=_st($2)._a();
  4495. self._assert_equals_($1,(1));
  4496. $ctx1.sendIdx["assert:equals:"]=1;
  4497. $4=self._jsObject();
  4498. $ctx1.sendIdx["jsObject"]=2;
  4499. $3=_st($4)._b();
  4500. self._assert_equals_($3,(2));
  4501. $ctx1.sendIdx["assert:equals:"]=2;
  4502. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  4503. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  4504. args: [],
  4505. 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",
  4506. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  4507. referencedClasses: []
  4508. }),
  4509. smalltalk.JSObjectProxyTest);
  4510. smalltalk.addMethod(
  4511. smalltalk.method({
  4512. selector: "testMethodWithArguments",
  4513. protocol: 'tests',
  4514. fn: function (){
  4515. var self=this;
  4516. return smalltalk.withContext(function($ctx1) {
  4517. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  4518. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  4519. args: [],
  4520. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  4521. messageSends: ["assert:equals:", "c:", "jsObject"],
  4522. referencedClasses: []
  4523. }),
  4524. smalltalk.JSObjectProxyTest);
  4525. smalltalk.addMethod(
  4526. smalltalk.method({
  4527. selector: "testPrinting",
  4528. protocol: 'tests',
  4529. fn: function (){
  4530. var self=this;
  4531. return smalltalk.withContext(function($ctx1) {
  4532. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  4533. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  4534. args: [],
  4535. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  4536. messageSends: ["assert:equals:", "printString", "jsObject"],
  4537. referencedClasses: []
  4538. }),
  4539. smalltalk.JSObjectProxyTest);
  4540. smalltalk.addMethod(
  4541. smalltalk.method({
  4542. selector: "testPropertyThatReturnsEmptyString",
  4543. protocol: 'tests',
  4544. fn: function (){
  4545. var self=this;
  4546. var object;
  4547. return smalltalk.withContext(function($ctx1) {
  4548. var $1;
  4549. object=self._jsObject();
  4550. $1=_st(object)._d();
  4551. $ctx1.sendIdx["d"]=1;
  4552. self._assert_equals_($1,"");
  4553. $ctx1.sendIdx["assert:equals:"]=1;
  4554. _st(object)._d_("hello");
  4555. self._assert_equals_(_st(object)._d(),"hello");
  4556. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  4557. args: [],
  4558. 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'",
  4559. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  4560. referencedClasses: []
  4561. }),
  4562. smalltalk.JSObjectProxyTest);
  4563. smalltalk.addMethod(
  4564. smalltalk.method({
  4565. selector: "testPropertyThatReturnsUndefined",
  4566. protocol: 'tests',
  4567. fn: function (){
  4568. var self=this;
  4569. var object;
  4570. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4571. return smalltalk.withContext(function($ctx1) {
  4572. object=self._jsObject();
  4573. self._shouldnt_raise_((function(){
  4574. return smalltalk.withContext(function($ctx2) {
  4575. return _st(object)._e();
  4576. $ctx2.sendIdx["e"]=1;
  4577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4578. self._assert_(_st(_st(object)._e())._isNil());
  4579. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  4580. args: [],
  4581. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  4582. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  4583. referencedClasses: ["MessageNotUnderstood"]
  4584. }),
  4585. smalltalk.JSObjectProxyTest);
  4586. smalltalk.addMethod(
  4587. smalltalk.method({
  4588. selector: "testValue",
  4589. protocol: 'tests',
  4590. fn: function (){
  4591. var self=this;
  4592. var testObject;
  4593. return smalltalk.withContext(function($ctx1) {
  4594. testObject=self._jsObject();
  4595. _st(testObject)._at_put_("value","aValue");
  4596. self._assert_equals_(_st(testObject)._value(),"aValue");
  4597. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4598. args: [],
  4599. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  4600. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  4601. referencedClasses: []
  4602. }),
  4603. smalltalk.JSObjectProxyTest);
  4604. smalltalk.addMethod(
  4605. smalltalk.method({
  4606. selector: "testYourself",
  4607. protocol: 'tests',
  4608. fn: function (){
  4609. var self=this;
  4610. var object;
  4611. return smalltalk.withContext(function($ctx1) {
  4612. var $1,$2;
  4613. $1=self._jsObject();
  4614. _st($1)._d_("test");
  4615. $2=_st($1)._yourself();
  4616. object=$2;
  4617. self._assert_equals_(_st(object)._d(),"test");
  4618. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4619. args: [],
  4620. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4621. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4622. referencedClasses: []
  4623. }),
  4624. smalltalk.JSObjectProxyTest);
  4625. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4626. smalltalk.addMethod(
  4627. smalltalk.method({
  4628. selector: "testCatchingException",
  4629. protocol: 'tests',
  4630. fn: function (){
  4631. var self=this;
  4632. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4633. return smalltalk.withContext(function($ctx1) {
  4634. _st((function(){
  4635. return smalltalk.withContext(function($ctx2) {
  4636. return self._throwException();
  4637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4638. return smalltalk.withContext(function($ctx2) {
  4639. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4640. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4641. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4642. args: [],
  4643. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4644. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4645. referencedClasses: ["Error"]
  4646. }),
  4647. smalltalk.JavaScriptExceptionTest);
  4648. smalltalk.addMethod(
  4649. smalltalk.method({
  4650. selector: "testRaisingException",
  4651. protocol: 'tests',
  4652. fn: function (){
  4653. var self=this;
  4654. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4655. return smalltalk.withContext(function($ctx1) {
  4656. self._should_raise_((function(){
  4657. return smalltalk.withContext(function($ctx2) {
  4658. return self._throwException();
  4659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  4660. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  4661. args: [],
  4662. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  4663. messageSends: ["should:raise:", "throwException"],
  4664. referencedClasses: ["JavaScriptException"]
  4665. }),
  4666. smalltalk.JavaScriptExceptionTest);
  4667. smalltalk.addMethod(
  4668. smalltalk.method({
  4669. selector: "throwException",
  4670. protocol: 'helpers',
  4671. fn: function (){
  4672. var self=this;
  4673. return smalltalk.withContext(function($ctx1) {
  4674. throw 'test';
  4675. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4676. args: [],
  4677. source: "throwException\x0a\x09<throw 'test'>",
  4678. messageSends: [],
  4679. referencedClasses: []
  4680. }),
  4681. smalltalk.JavaScriptExceptionTest);
  4682. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "testValue",
  4686. protocol: 'tests',
  4687. fn: function (){
  4688. var self=this;
  4689. var messageSend;
  4690. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4691. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4692. return smalltalk.withContext(function($ctx1) {
  4693. var $1,$2;
  4694. $1=_st($MessageSend())._new();
  4695. $ctx1.sendIdx["new"]=1;
  4696. _st($1)._receiver_(_st($Object())._new());
  4697. _st($1)._selector_("asString");
  4698. $2=_st($1)._yourself();
  4699. messageSend=$2;
  4700. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4701. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4702. args: [],
  4703. 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'",
  4704. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4705. referencedClasses: ["MessageSend", "Object"]
  4706. }),
  4707. smalltalk.MessageSendTest);
  4708. smalltalk.addMethod(
  4709. smalltalk.method({
  4710. selector: "testValueWithArguments",
  4711. protocol: 'tests',
  4712. fn: function (){
  4713. var self=this;
  4714. var messageSend;
  4715. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4716. return smalltalk.withContext(function($ctx1) {
  4717. var $1,$2;
  4718. $1=_st($MessageSend())._new();
  4719. _st($1)._receiver_((2));
  4720. _st($1)._selector_("+");
  4721. $2=_st($1)._yourself();
  4722. messageSend=$2;
  4723. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4724. $ctx1.sendIdx["assert:equals:"]=1;
  4725. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4726. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4727. args: [],
  4728. 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",
  4729. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4730. referencedClasses: ["MessageSend"]
  4731. }),
  4732. smalltalk.MessageSendTest);
  4733. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4734. smalltalk.addMethod(
  4735. smalltalk.method({
  4736. selector: "codeGeneratorClass",
  4737. protocol: 'accessing',
  4738. fn: function (){
  4739. var self=this;
  4740. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4741. return smalltalk.withContext(function($ctx1) {
  4742. return $CodeGenerator();
  4743. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4744. args: [],
  4745. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4746. messageSends: [],
  4747. referencedClasses: ["CodeGenerator"]
  4748. }),
  4749. smalltalk.MethodInheritanceTest);
  4750. smalltalk.addMethod(
  4751. smalltalk.method({
  4752. selector: "compiler",
  4753. protocol: 'factory',
  4754. fn: function (){
  4755. var self=this;
  4756. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4757. return smalltalk.withContext(function($ctx1) {
  4758. var $2,$3,$1;
  4759. $2=_st($Compiler())._new();
  4760. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4761. $3=_st($2)._yourself();
  4762. $1=$3;
  4763. return $1;
  4764. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4765. args: [],
  4766. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4767. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4768. referencedClasses: ["Compiler"]
  4769. }),
  4770. smalltalk.MethodInheritanceTest);
  4771. smalltalk.addMethod(
  4772. smalltalk.method({
  4773. selector: "deinstallBottom",
  4774. protocol: 'testing',
  4775. fn: function (){
  4776. var self=this;
  4777. return smalltalk.withContext(function($ctx1) {
  4778. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4779. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4780. args: [],
  4781. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4782. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4783. referencedClasses: []
  4784. }),
  4785. smalltalk.MethodInheritanceTest);
  4786. smalltalk.addMethod(
  4787. smalltalk.method({
  4788. selector: "deinstallMiddle",
  4789. protocol: 'testing',
  4790. fn: function (){
  4791. var self=this;
  4792. return smalltalk.withContext(function($ctx1) {
  4793. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4794. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4795. args: [],
  4796. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4797. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4798. referencedClasses: []
  4799. }),
  4800. smalltalk.MethodInheritanceTest);
  4801. smalltalk.addMethod(
  4802. smalltalk.method({
  4803. selector: "deinstallTop",
  4804. protocol: 'testing',
  4805. fn: function (){
  4806. var self=this;
  4807. return smalltalk.withContext(function($ctx1) {
  4808. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4809. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4810. args: [],
  4811. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4812. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4813. referencedClasses: []
  4814. }),
  4815. smalltalk.MethodInheritanceTest);
  4816. smalltalk.addMethod(
  4817. smalltalk.method({
  4818. selector: "installBottom:",
  4819. protocol: 'testing',
  4820. fn: function (aString){
  4821. var self=this;
  4822. return smalltalk.withContext(function($ctx1) {
  4823. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  4824. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4825. args: ["aString"],
  4826. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  4827. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  4828. referencedClasses: []
  4829. }),
  4830. smalltalk.MethodInheritanceTest);
  4831. smalltalk.addMethod(
  4832. smalltalk.method({
  4833. selector: "installMiddle:",
  4834. protocol: 'testing',
  4835. fn: function (aString){
  4836. var self=this;
  4837. return smalltalk.withContext(function($ctx1) {
  4838. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  4839. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4840. args: ["aString"],
  4841. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  4842. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  4843. referencedClasses: []
  4844. }),
  4845. smalltalk.MethodInheritanceTest);
  4846. smalltalk.addMethod(
  4847. smalltalk.method({
  4848. selector: "installTop:",
  4849. protocol: 'testing',
  4850. fn: function (aString){
  4851. var self=this;
  4852. return smalltalk.withContext(function($ctx1) {
  4853. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  4854. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4855. args: ["aString"],
  4856. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  4857. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  4858. referencedClasses: []
  4859. }),
  4860. smalltalk.MethodInheritanceTest);
  4861. smalltalk.addMethod(
  4862. smalltalk.method({
  4863. selector: "setUp",
  4864. protocol: 'initialization',
  4865. fn: function (){
  4866. var self=this;
  4867. return smalltalk.withContext(function($ctx1) {
  4868. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4869. $ctx1.sendIdx["new"]=1;
  4870. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4871. $ctx1.sendIdx["new"]=2;
  4872. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4873. self["@method"]=nil;
  4874. self["@performBlock"]=(function(){
  4875. return smalltalk.withContext(function($ctx2) {
  4876. return self._error_("performBlock not initialized");
  4877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4878. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4879. args: [],
  4880. 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' ]",
  4881. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4882. referencedClasses: []
  4883. }),
  4884. smalltalk.MethodInheritanceTest);
  4885. smalltalk.addMethod(
  4886. smalltalk.method({
  4887. selector: "shouldMNU",
  4888. protocol: 'testing',
  4889. fn: function (){
  4890. var self=this;
  4891. return smalltalk.withContext(function($ctx1) {
  4892. self._shouldMNUTop();
  4893. self._shouldMNUMiddle();
  4894. self._shouldMNUBottom();
  4895. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4896. args: [],
  4897. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4898. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4899. referencedClasses: []
  4900. }),
  4901. smalltalk.MethodInheritanceTest);
  4902. smalltalk.addMethod(
  4903. smalltalk.method({
  4904. selector: "shouldMNUBottom",
  4905. protocol: 'testing',
  4906. fn: function (){
  4907. var self=this;
  4908. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4909. return smalltalk.withContext(function($ctx1) {
  4910. self._should_raise_((function(){
  4911. return smalltalk.withContext(function($ctx2) {
  4912. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4914. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4915. args: [],
  4916. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4917. messageSends: ["should:raise:", "value:"],
  4918. referencedClasses: ["MessageNotUnderstood"]
  4919. }),
  4920. smalltalk.MethodInheritanceTest);
  4921. smalltalk.addMethod(
  4922. smalltalk.method({
  4923. selector: "shouldMNUMiddle",
  4924. protocol: 'testing',
  4925. fn: function (){
  4926. var self=this;
  4927. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4928. return smalltalk.withContext(function($ctx1) {
  4929. self._should_raise_((function(){
  4930. return smalltalk.withContext(function($ctx2) {
  4931. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4933. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4934. args: [],
  4935. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4936. messageSends: ["should:raise:", "value:"],
  4937. referencedClasses: ["MessageNotUnderstood"]
  4938. }),
  4939. smalltalk.MethodInheritanceTest);
  4940. smalltalk.addMethod(
  4941. smalltalk.method({
  4942. selector: "shouldMNUTop",
  4943. protocol: 'testing',
  4944. fn: function (){
  4945. var self=this;
  4946. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4947. return smalltalk.withContext(function($ctx1) {
  4948. self._should_raise_((function(){
  4949. return smalltalk.withContext(function($ctx2) {
  4950. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4952. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4953. args: [],
  4954. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4955. messageSends: ["should:raise:", "value:"],
  4956. referencedClasses: ["MessageNotUnderstood"]
  4957. }),
  4958. smalltalk.MethodInheritanceTest);
  4959. smalltalk.addMethod(
  4960. smalltalk.method({
  4961. selector: "shouldReturn:",
  4962. protocol: 'testing',
  4963. fn: function (anObject){
  4964. var self=this;
  4965. var result;
  4966. return smalltalk.withContext(function($ctx1) {
  4967. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4968. $ctx1.sendIdx["value:"]=1;
  4969. self._assert_equals_(["top",anObject],["top",result]);
  4970. $ctx1.sendIdx["assert:equals:"]=1;
  4971. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4972. $ctx1.sendIdx["value:"]=2;
  4973. self._assert_equals_(["middle",anObject],["middle",result]);
  4974. $ctx1.sendIdx["assert:equals:"]=2;
  4975. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4976. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4977. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4978. args: ["anObject"],
  4979. 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 }",
  4980. messageSends: ["value:", "assert:equals:"],
  4981. referencedClasses: []
  4982. }),
  4983. smalltalk.MethodInheritanceTest);
  4984. smalltalk.addMethod(
  4985. smalltalk.method({
  4986. selector: "shouldReturn:and:and:",
  4987. protocol: 'testing',
  4988. fn: function (anObject,anObject2,anObject3){
  4989. var self=this;
  4990. var result;
  4991. return smalltalk.withContext(function($ctx1) {
  4992. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4993. $ctx1.sendIdx["value:"]=1;
  4994. self._assert_equals_(["top",anObject],["top",result]);
  4995. $ctx1.sendIdx["assert:equals:"]=1;
  4996. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4997. $ctx1.sendIdx["value:"]=2;
  4998. self._assert_equals_(["middle",anObject2],["middle",result]);
  4999. $ctx1.sendIdx["assert:equals:"]=2;
  5000. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5001. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5002. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5003. args: ["anObject", "anObject2", "anObject3"],
  5004. 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 }",
  5005. messageSends: ["value:", "assert:equals:"],
  5006. referencedClasses: []
  5007. }),
  5008. smalltalk.MethodInheritanceTest);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "targetClassBottom",
  5012. protocol: 'accessing',
  5013. fn: function (){
  5014. var self=this;
  5015. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5016. return smalltalk.withContext(function($ctx1) {
  5017. return $JavaScriptException();
  5018. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5019. args: [],
  5020. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5021. messageSends: [],
  5022. referencedClasses: ["JavaScriptException"]
  5023. }),
  5024. smalltalk.MethodInheritanceTest);
  5025. smalltalk.addMethod(
  5026. smalltalk.method({
  5027. selector: "targetClassMiddle",
  5028. protocol: 'accessing',
  5029. fn: function (){
  5030. var self=this;
  5031. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5032. return smalltalk.withContext(function($ctx1) {
  5033. return $Error();
  5034. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5035. args: [],
  5036. source: "targetClassMiddle\x0a\x09^ Error",
  5037. messageSends: [],
  5038. referencedClasses: ["Error"]
  5039. }),
  5040. smalltalk.MethodInheritanceTest);
  5041. smalltalk.addMethod(
  5042. smalltalk.method({
  5043. selector: "targetClassTop",
  5044. protocol: 'accessing',
  5045. fn: function (){
  5046. var self=this;
  5047. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5048. return smalltalk.withContext(function($ctx1) {
  5049. return $Object();
  5050. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  5051. args: [],
  5052. source: "targetClassTop\x0a\x09^ Object",
  5053. messageSends: [],
  5054. referencedClasses: ["Object"]
  5055. }),
  5056. smalltalk.MethodInheritanceTest);
  5057. smalltalk.addMethod(
  5058. smalltalk.method({
  5059. selector: "tearDown",
  5060. protocol: 'initialization',
  5061. fn: function (){
  5062. var self=this;
  5063. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5064. return smalltalk.withContext(function($ctx1) {
  5065. _st((function(){
  5066. return smalltalk.withContext(function($ctx2) {
  5067. return self._deinstallTop();
  5068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  5069. return smalltalk.withContext(function($ctx2) {
  5070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5071. $ctx1.sendIdx["on:do:"]=1;
  5072. _st((function(){
  5073. return smalltalk.withContext(function($ctx2) {
  5074. return self._deinstallMiddle();
  5075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  5076. return smalltalk.withContext(function($ctx2) {
  5077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5078. $ctx1.sendIdx["on:do:"]=2;
  5079. _st((function(){
  5080. return smalltalk.withContext(function($ctx2) {
  5081. return self._deinstallBottom();
  5082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  5083. return smalltalk.withContext(function($ctx2) {
  5084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5085. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  5086. args: [],
  5087. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  5088. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  5089. referencedClasses: ["Error"]
  5090. }),
  5091. smalltalk.MethodInheritanceTest);
  5092. smalltalk.addMethod(
  5093. smalltalk.method({
  5094. selector: "testMNU11",
  5095. protocol: 'tests',
  5096. fn: function (){
  5097. var self=this;
  5098. return smalltalk.withContext(function($ctx1) {
  5099. self["@performBlock"]=(function(x){
  5100. return smalltalk.withContext(function($ctx2) {
  5101. return _st(x)._foo();
  5102. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5103. self._shouldMNU();
  5104. $ctx1.sendIdx["shouldMNU"]=1;
  5105. self._installTop_("foo ^ false");
  5106. $ctx1.sendIdx["installTop:"]=1;
  5107. self._installTop_("foo ^ true");
  5108. self._deinstallTop();
  5109. self._shouldMNU();
  5110. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  5111. args: [],
  5112. 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",
  5113. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  5114. referencedClasses: []
  5115. }),
  5116. smalltalk.MethodInheritanceTest);
  5117. smalltalk.addMethod(
  5118. smalltalk.method({
  5119. selector: "testMNU22",
  5120. protocol: 'tests',
  5121. fn: function (){
  5122. var self=this;
  5123. return smalltalk.withContext(function($ctx1) {
  5124. self["@performBlock"]=(function(x){
  5125. return smalltalk.withContext(function($ctx2) {
  5126. return _st(x)._foo();
  5127. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5128. self._shouldMNU();
  5129. $ctx1.sendIdx["shouldMNU"]=1;
  5130. self._installMiddle_("foo ^ false");
  5131. $ctx1.sendIdx["installMiddle:"]=1;
  5132. self._installMiddle_("foo ^ true");
  5133. self._deinstallMiddle();
  5134. self._shouldMNU();
  5135. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  5136. args: [],
  5137. 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",
  5138. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  5139. referencedClasses: []
  5140. }),
  5141. smalltalk.MethodInheritanceTest);
  5142. smalltalk.addMethod(
  5143. smalltalk.method({
  5144. selector: "testReturns1",
  5145. protocol: 'tests',
  5146. fn: function (){
  5147. var self=this;
  5148. return smalltalk.withContext(function($ctx1) {
  5149. self["@performBlock"]=(function(x){
  5150. return smalltalk.withContext(function($ctx2) {
  5151. return _st(x)._foo();
  5152. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5153. self._installTop_("foo ^ false");
  5154. $ctx1.sendIdx["installTop:"]=1;
  5155. self._shouldReturn_(false);
  5156. $ctx1.sendIdx["shouldReturn:"]=1;
  5157. self._installTop_("foo ^ true");
  5158. self._shouldReturn_(true);
  5159. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  5160. args: [],
  5161. 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",
  5162. messageSends: ["foo", "installTop:", "shouldReturn:"],
  5163. referencedClasses: []
  5164. }),
  5165. smalltalk.MethodInheritanceTest);
  5166. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "testAbs",
  5170. protocol: 'tests',
  5171. fn: function (){
  5172. var self=this;
  5173. return smalltalk.withContext(function($ctx1) {
  5174. var $1;
  5175. $1=(4)._abs();
  5176. $ctx1.sendIdx["abs"]=1;
  5177. self._assert_equals_($1,(4));
  5178. $ctx1.sendIdx["assert:equals:"]=1;
  5179. self._assert_equals_((-4)._abs(),(4));
  5180. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  5181. args: [],
  5182. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  5183. messageSends: ["assert:equals:", "abs"],
  5184. referencedClasses: []
  5185. }),
  5186. smalltalk.NumberTest);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "testArithmetic",
  5190. protocol: 'tests',
  5191. fn: function (){
  5192. var self=this;
  5193. return smalltalk.withContext(function($ctx1) {
  5194. var $1,$2,$3,$5,$4;
  5195. $1=(1.5).__plus((1));
  5196. $ctx1.sendIdx["+"]=1;
  5197. self._assert_equals_($1,(2.5));
  5198. $ctx1.sendIdx["assert:equals:"]=1;
  5199. $2=(2).__minus((1));
  5200. $ctx1.sendIdx["-"]=1;
  5201. self._assert_equals_($2,(1));
  5202. $ctx1.sendIdx["assert:equals:"]=2;
  5203. self._assert_equals_((-2).__minus((1)),(-3));
  5204. $ctx1.sendIdx["assert:equals:"]=3;
  5205. self._assert_equals_((12).__slash((2)),(6));
  5206. $ctx1.sendIdx["assert:equals:"]=4;
  5207. $3=(3).__star((4));
  5208. $ctx1.sendIdx["*"]=1;
  5209. self._assert_equals_($3,(12));
  5210. $ctx1.sendIdx["assert:equals:"]=5;
  5211. self._assert_equals_((7).__slash_slash((2)),(3));
  5212. $ctx1.sendIdx["assert:equals:"]=6;
  5213. self._assert_equals_((7).__backslash_backslash((2)),(1));
  5214. $ctx1.sendIdx["assert:equals:"]=7;
  5215. $5=(1).__plus((2));
  5216. $ctx1.sendIdx["+"]=2;
  5217. $4=_st($5).__star((3));
  5218. $ctx1.sendIdx["*"]=2;
  5219. self._assert_equals_($4,(9));
  5220. $ctx1.sendIdx["assert:equals:"]=8;
  5221. self._assert_equals_((1).__plus((2).__star((3))),(7));
  5222. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  5223. args: [],
  5224. 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",
  5225. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  5226. referencedClasses: []
  5227. }),
  5228. smalltalk.NumberTest);
  5229. smalltalk.addMethod(
  5230. smalltalk.method({
  5231. selector: "testAsNumber",
  5232. protocol: 'tests',
  5233. fn: function (){
  5234. var self=this;
  5235. return smalltalk.withContext(function($ctx1) {
  5236. self._assert_equals_((3)._asNumber(),(3));
  5237. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  5238. args: [],
  5239. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  5240. messageSends: ["assert:equals:", "asNumber"],
  5241. referencedClasses: []
  5242. }),
  5243. smalltalk.NumberTest);
  5244. smalltalk.addMethod(
  5245. smalltalk.method({
  5246. selector: "testCeiling",
  5247. protocol: 'tests',
  5248. fn: function (){
  5249. var self=this;
  5250. return smalltalk.withContext(function($ctx1) {
  5251. var $1,$2;
  5252. $1=(1.2)._ceiling();
  5253. $ctx1.sendIdx["ceiling"]=1;
  5254. self._assert_equals_($1,(2));
  5255. $ctx1.sendIdx["assert:equals:"]=1;
  5256. $2=(-1.2)._ceiling();
  5257. $ctx1.sendIdx["ceiling"]=2;
  5258. self._assert_equals_($2,(-1));
  5259. $ctx1.sendIdx["assert:equals:"]=2;
  5260. self._assert_equals_((1)._ceiling(),(1));
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  5262. args: [],
  5263. 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.",
  5264. messageSends: ["assert:equals:", "ceiling"],
  5265. referencedClasses: []
  5266. }),
  5267. smalltalk.NumberTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "testComparison",
  5271. protocol: 'tests',
  5272. fn: function (){
  5273. var self=this;
  5274. return smalltalk.withContext(function($ctx1) {
  5275. var $1,$2,$3,$4;
  5276. $1=(3).__gt((2));
  5277. $ctx1.sendIdx[">"]=1;
  5278. self._assert_($1);
  5279. $ctx1.sendIdx["assert:"]=1;
  5280. $2=(2).__lt((3));
  5281. $ctx1.sendIdx["<"]=1;
  5282. self._assert_($2);
  5283. $ctx1.sendIdx["assert:"]=2;
  5284. self._deny_((3).__lt((2)));
  5285. $ctx1.sendIdx["deny:"]=1;
  5286. self._deny_((2).__gt((3)));
  5287. $3=(3).__gt_eq((3));
  5288. $ctx1.sendIdx[">="]=1;
  5289. self._assert_($3);
  5290. $ctx1.sendIdx["assert:"]=3;
  5291. self._assert_((3.1).__gt_eq((3)));
  5292. $ctx1.sendIdx["assert:"]=4;
  5293. $4=(3).__lt_eq((3));
  5294. $ctx1.sendIdx["<="]=1;
  5295. self._assert_($4);
  5296. $ctx1.sendIdx["assert:"]=5;
  5297. self._assert_((3).__lt_eq((3.1)));
  5298. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  5299. args: [],
  5300. 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",
  5301. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  5302. referencedClasses: []
  5303. }),
  5304. smalltalk.NumberTest);
  5305. smalltalk.addMethod(
  5306. smalltalk.method({
  5307. selector: "testCopying",
  5308. protocol: 'tests',
  5309. fn: function (){
  5310. var self=this;
  5311. return smalltalk.withContext(function($ctx1) {
  5312. var $1;
  5313. $1=_st((1)._copy()).__eq_eq((1));
  5314. $ctx1.sendIdx["=="]=1;
  5315. self._assert_($1);
  5316. $ctx1.sendIdx["assert:"]=1;
  5317. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  5318. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  5319. args: [],
  5320. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  5321. messageSends: ["assert:", "==", "copy", "deepCopy"],
  5322. referencedClasses: []
  5323. }),
  5324. smalltalk.NumberTest);
  5325. smalltalk.addMethod(
  5326. smalltalk.method({
  5327. selector: "testEquality",
  5328. protocol: 'tests',
  5329. fn: function (){
  5330. var self=this;
  5331. return smalltalk.withContext(function($ctx1) {
  5332. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  5333. $1=(1).__eq((1));
  5334. $ctx1.sendIdx["="]=1;
  5335. self._assert_($1);
  5336. $ctx1.sendIdx["assert:"]=1;
  5337. $2=(0).__eq((0));
  5338. $ctx1.sendIdx["="]=2;
  5339. self._assert_($2);
  5340. $ctx1.sendIdx["assert:"]=2;
  5341. $3=(1).__eq((0));
  5342. $ctx1.sendIdx["="]=3;
  5343. self._deny_($3);
  5344. $ctx1.sendIdx["deny:"]=1;
  5345. $5=(1)._yourself();
  5346. $ctx1.sendIdx["yourself"]=1;
  5347. $4=_st($5).__eq((1));
  5348. $ctx1.sendIdx["="]=4;
  5349. self._assert_($4);
  5350. $ctx1.sendIdx["assert:"]=3;
  5351. $7=(1)._yourself();
  5352. $ctx1.sendIdx["yourself"]=2;
  5353. $6=(1).__eq($7);
  5354. $ctx1.sendIdx["="]=5;
  5355. self._assert_($6);
  5356. $ctx1.sendIdx["assert:"]=4;
  5357. $9=(1)._yourself();
  5358. $ctx1.sendIdx["yourself"]=3;
  5359. $8=_st($9).__eq((1)._yourself());
  5360. $ctx1.sendIdx["="]=6;
  5361. self._assert_($8);
  5362. $10=(0).__eq(false);
  5363. $ctx1.sendIdx["="]=7;
  5364. self._deny_($10);
  5365. $ctx1.sendIdx["deny:"]=2;
  5366. $11=false.__eq((0));
  5367. $ctx1.sendIdx["="]=8;
  5368. self._deny_($11);
  5369. $ctx1.sendIdx["deny:"]=3;
  5370. $12="".__eq((0));
  5371. $ctx1.sendIdx["="]=9;
  5372. self._deny_($12);
  5373. $ctx1.sendIdx["deny:"]=4;
  5374. self._deny_((0).__eq(""));
  5375. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  5376. args: [],
  5377. 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 = ''",
  5378. messageSends: ["assert:", "=", "deny:", "yourself"],
  5379. referencedClasses: []
  5380. }),
  5381. smalltalk.NumberTest);
  5382. smalltalk.addMethod(
  5383. smalltalk.method({
  5384. selector: "testFloor",
  5385. protocol: 'tests',
  5386. fn: function (){
  5387. var self=this;
  5388. return smalltalk.withContext(function($ctx1) {
  5389. var $1,$2;
  5390. $1=(1.2)._floor();
  5391. $ctx1.sendIdx["floor"]=1;
  5392. self._assert_equals_($1,(1));
  5393. $ctx1.sendIdx["assert:equals:"]=1;
  5394. $2=(-1.2)._floor();
  5395. $ctx1.sendIdx["floor"]=2;
  5396. self._assert_equals_($2,(-2));
  5397. $ctx1.sendIdx["assert:equals:"]=2;
  5398. self._assert_equals_((1)._floor(),(1));
  5399. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  5400. args: [],
  5401. 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.",
  5402. messageSends: ["assert:equals:", "floor"],
  5403. referencedClasses: []
  5404. }),
  5405. smalltalk.NumberTest);
  5406. smalltalk.addMethod(
  5407. smalltalk.method({
  5408. selector: "testHexNumbers",
  5409. protocol: 'tests',
  5410. fn: function (){
  5411. var self=this;
  5412. return smalltalk.withContext(function($ctx1) {
  5413. var $1,$2,$3,$4,$5;
  5414. self._assert_equals_((9),(9));
  5415. $ctx1.sendIdx["assert:equals:"]=1;
  5416. $1=(10)._truncated();
  5417. $ctx1.sendIdx["truncated"]=1;
  5418. self._assert_equals_($1,(10));
  5419. $ctx1.sendIdx["assert:equals:"]=2;
  5420. $2=(11)._truncated();
  5421. $ctx1.sendIdx["truncated"]=2;
  5422. self._assert_equals_($2,(11));
  5423. $ctx1.sendIdx["assert:equals:"]=3;
  5424. $3=(12)._truncated();
  5425. $ctx1.sendIdx["truncated"]=3;
  5426. self._assert_equals_($3,(12));
  5427. $ctx1.sendIdx["assert:equals:"]=4;
  5428. $4=(13)._truncated();
  5429. $ctx1.sendIdx["truncated"]=4;
  5430. self._assert_equals_($4,(13));
  5431. $ctx1.sendIdx["assert:equals:"]=5;
  5432. $5=(14)._truncated();
  5433. $ctx1.sendIdx["truncated"]=5;
  5434. self._assert_equals_($5,(14));
  5435. $ctx1.sendIdx["assert:equals:"]=6;
  5436. self._assert_equals_((15)._truncated(),(15));
  5437. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  5438. args: [],
  5439. 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",
  5440. messageSends: ["assert:equals:", "truncated"],
  5441. referencedClasses: []
  5442. }),
  5443. smalltalk.NumberTest);
  5444. smalltalk.addMethod(
  5445. smalltalk.method({
  5446. selector: "testIdentity",
  5447. protocol: 'tests',
  5448. fn: function (){
  5449. var self=this;
  5450. return smalltalk.withContext(function($ctx1) {
  5451. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  5452. $1=(1).__eq_eq((1));
  5453. $ctx1.sendIdx["=="]=1;
  5454. self._assert_($1);
  5455. $ctx1.sendIdx["assert:"]=1;
  5456. $2=(0).__eq_eq((0));
  5457. $ctx1.sendIdx["=="]=2;
  5458. self._assert_($2);
  5459. $ctx1.sendIdx["assert:"]=2;
  5460. $3=(1).__eq_eq((0));
  5461. $ctx1.sendIdx["=="]=3;
  5462. self._deny_($3);
  5463. $ctx1.sendIdx["deny:"]=1;
  5464. $5=(1)._yourself();
  5465. $ctx1.sendIdx["yourself"]=1;
  5466. $4=_st($5).__eq_eq((1));
  5467. $ctx1.sendIdx["=="]=4;
  5468. self._assert_($4);
  5469. $ctx1.sendIdx["assert:"]=3;
  5470. $7=(1)._yourself();
  5471. $ctx1.sendIdx["yourself"]=2;
  5472. $6=(1).__eq_eq($7);
  5473. $ctx1.sendIdx["=="]=5;
  5474. self._assert_($6);
  5475. $ctx1.sendIdx["assert:"]=4;
  5476. $9=(1)._yourself();
  5477. $ctx1.sendIdx["yourself"]=3;
  5478. $8=_st($9).__eq_eq((1)._yourself());
  5479. $ctx1.sendIdx["=="]=6;
  5480. self._assert_($8);
  5481. self._deny_((1).__eq_eq((2)));
  5482. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  5483. args: [],
  5484. 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",
  5485. messageSends: ["assert:", "==", "deny:", "yourself"],
  5486. referencedClasses: []
  5487. }),
  5488. smalltalk.NumberTest);
  5489. smalltalk.addMethod(
  5490. smalltalk.method({
  5491. selector: "testInvalidHexNumbers",
  5492. protocol: 'tests',
  5493. fn: function (){
  5494. var self=this;
  5495. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5496. return smalltalk.withContext(function($ctx1) {
  5497. self._should_raise_((function(){
  5498. return smalltalk.withContext(function($ctx2) {
  5499. return (16)._rG();
  5500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5501. $ctx1.sendIdx["should:raise:"]=1;
  5502. self._should_raise_((function(){
  5503. return smalltalk.withContext(function($ctx2) {
  5504. return (16)._rg();
  5505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  5506. $ctx1.sendIdx["should:raise:"]=2;
  5507. self._should_raise_((function(){
  5508. return smalltalk.withContext(function($ctx2) {
  5509. return (16)._rH();
  5510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  5511. $ctx1.sendIdx["should:raise:"]=3;
  5512. self._should_raise_((function(){
  5513. return smalltalk.withContext(function($ctx2) {
  5514. return (16)._rh();
  5515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  5516. $ctx1.sendIdx["should:raise:"]=4;
  5517. self._should_raise_((function(){
  5518. return smalltalk.withContext(function($ctx2) {
  5519. return (16)._rI();
  5520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  5521. $ctx1.sendIdx["should:raise:"]=5;
  5522. self._should_raise_((function(){
  5523. return smalltalk.withContext(function($ctx2) {
  5524. return (16)._ri();
  5525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  5526. $ctx1.sendIdx["should:raise:"]=6;
  5527. self._should_raise_((function(){
  5528. return smalltalk.withContext(function($ctx2) {
  5529. return (16)._rJ();
  5530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  5531. $ctx1.sendIdx["should:raise:"]=7;
  5532. self._should_raise_((function(){
  5533. return smalltalk.withContext(function($ctx2) {
  5534. return (16)._rj();
  5535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  5536. $ctx1.sendIdx["should:raise:"]=8;
  5537. self._should_raise_((function(){
  5538. return smalltalk.withContext(function($ctx2) {
  5539. return (16)._rK();
  5540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  5541. $ctx1.sendIdx["should:raise:"]=9;
  5542. self._should_raise_((function(){
  5543. return smalltalk.withContext(function($ctx2) {
  5544. return (16)._rk();
  5545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  5546. $ctx1.sendIdx["should:raise:"]=10;
  5547. self._should_raise_((function(){
  5548. return smalltalk.withContext(function($ctx2) {
  5549. return (16)._rL();
  5550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  5551. $ctx1.sendIdx["should:raise:"]=11;
  5552. self._should_raise_((function(){
  5553. return smalltalk.withContext(function($ctx2) {
  5554. return (16)._rl();
  5555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  5556. $ctx1.sendIdx["should:raise:"]=12;
  5557. self._should_raise_((function(){
  5558. return smalltalk.withContext(function($ctx2) {
  5559. return (16)._rM();
  5560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  5561. $ctx1.sendIdx["should:raise:"]=13;
  5562. self._should_raise_((function(){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. return (16)._rm();
  5565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  5566. $ctx1.sendIdx["should:raise:"]=14;
  5567. self._should_raise_((function(){
  5568. return smalltalk.withContext(function($ctx2) {
  5569. return (16)._rN();
  5570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  5571. $ctx1.sendIdx["should:raise:"]=15;
  5572. self._should_raise_((function(){
  5573. return smalltalk.withContext(function($ctx2) {
  5574. return (16)._rn();
  5575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  5576. $ctx1.sendIdx["should:raise:"]=16;
  5577. self._should_raise_((function(){
  5578. return smalltalk.withContext(function($ctx2) {
  5579. return (16)._rO();
  5580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  5581. $ctx1.sendIdx["should:raise:"]=17;
  5582. self._should_raise_((function(){
  5583. return smalltalk.withContext(function($ctx2) {
  5584. return (16)._ro();
  5585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  5586. $ctx1.sendIdx["should:raise:"]=18;
  5587. self._should_raise_((function(){
  5588. return smalltalk.withContext(function($ctx2) {
  5589. return (16)._rP();
  5590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5591. $ctx1.sendIdx["should:raise:"]=19;
  5592. self._should_raise_((function(){
  5593. return smalltalk.withContext(function($ctx2) {
  5594. return (16)._rp();
  5595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5596. $ctx1.sendIdx["should:raise:"]=20;
  5597. self._should_raise_((function(){
  5598. return smalltalk.withContext(function($ctx2) {
  5599. return (16)._rQ();
  5600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5601. $ctx1.sendIdx["should:raise:"]=21;
  5602. self._should_raise_((function(){
  5603. return smalltalk.withContext(function($ctx2) {
  5604. return (16)._rq();
  5605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5606. $ctx1.sendIdx["should:raise:"]=22;
  5607. self._should_raise_((function(){
  5608. return smalltalk.withContext(function($ctx2) {
  5609. return (16)._rR();
  5610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5611. $ctx1.sendIdx["should:raise:"]=23;
  5612. self._should_raise_((function(){
  5613. return smalltalk.withContext(function($ctx2) {
  5614. return (16)._rr();
  5615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5616. $ctx1.sendIdx["should:raise:"]=24;
  5617. self._should_raise_((function(){
  5618. return smalltalk.withContext(function($ctx2) {
  5619. return (16)._rS();
  5620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5621. $ctx1.sendIdx["should:raise:"]=25;
  5622. self._should_raise_((function(){
  5623. return smalltalk.withContext(function($ctx2) {
  5624. return (16)._rs();
  5625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5626. $ctx1.sendIdx["should:raise:"]=26;
  5627. self._should_raise_((function(){
  5628. return smalltalk.withContext(function($ctx2) {
  5629. return (16)._rT();
  5630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5631. $ctx1.sendIdx["should:raise:"]=27;
  5632. self._should_raise_((function(){
  5633. return smalltalk.withContext(function($ctx2) {
  5634. return (16)._rt();
  5635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5636. $ctx1.sendIdx["should:raise:"]=28;
  5637. self._should_raise_((function(){
  5638. return smalltalk.withContext(function($ctx2) {
  5639. return (16)._rU();
  5640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5641. $ctx1.sendIdx["should:raise:"]=29;
  5642. self._should_raise_((function(){
  5643. return smalltalk.withContext(function($ctx2) {
  5644. return (16)._ru();
  5645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5646. $ctx1.sendIdx["should:raise:"]=30;
  5647. self._should_raise_((function(){
  5648. return smalltalk.withContext(function($ctx2) {
  5649. return (16)._rV();
  5650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5651. $ctx1.sendIdx["should:raise:"]=31;
  5652. self._should_raise_((function(){
  5653. return smalltalk.withContext(function($ctx2) {
  5654. return (16)._rv();
  5655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5656. $ctx1.sendIdx["should:raise:"]=32;
  5657. self._should_raise_((function(){
  5658. return smalltalk.withContext(function($ctx2) {
  5659. return (16)._rW();
  5660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5661. $ctx1.sendIdx["should:raise:"]=33;
  5662. self._should_raise_((function(){
  5663. return smalltalk.withContext(function($ctx2) {
  5664. return (16)._rw();
  5665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5666. $ctx1.sendIdx["should:raise:"]=34;
  5667. self._should_raise_((function(){
  5668. return smalltalk.withContext(function($ctx2) {
  5669. return (16)._rX();
  5670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5671. $ctx1.sendIdx["should:raise:"]=35;
  5672. self._should_raise_((function(){
  5673. return smalltalk.withContext(function($ctx2) {
  5674. return (16)._rx();
  5675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5676. $ctx1.sendIdx["should:raise:"]=36;
  5677. self._should_raise_((function(){
  5678. return smalltalk.withContext(function($ctx2) {
  5679. return (16)._rY();
  5680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5681. $ctx1.sendIdx["should:raise:"]=37;
  5682. self._should_raise_((function(){
  5683. return smalltalk.withContext(function($ctx2) {
  5684. return (16)._ry();
  5685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5686. $ctx1.sendIdx["should:raise:"]=38;
  5687. self._should_raise_((function(){
  5688. return smalltalk.withContext(function($ctx2) {
  5689. return (16)._rZ();
  5690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5691. $ctx1.sendIdx["should:raise:"]=39;
  5692. self._should_raise_((function(){
  5693. return smalltalk.withContext(function($ctx2) {
  5694. return (16)._rz();
  5695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5696. $ctx1.sendIdx["should:raise:"]=40;
  5697. self._should_raise_((function(){
  5698. return smalltalk.withContext(function($ctx2) {
  5699. return (11259375)._Z();
  5700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5701. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5702. args: [],
  5703. 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.",
  5704. 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"],
  5705. referencedClasses: ["MessageNotUnderstood"]
  5706. }),
  5707. smalltalk.NumberTest);
  5708. smalltalk.addMethod(
  5709. smalltalk.method({
  5710. selector: "testLog",
  5711. protocol: 'tests',
  5712. fn: function (){
  5713. var self=this;
  5714. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5715. return smalltalk.withContext(function($ctx1) {
  5716. self._assert_equals_((10000)._log(),(4));
  5717. $ctx1.sendIdx["assert:equals:"]=1;
  5718. self._assert_equals_((512)._log_((2)),(9));
  5719. $ctx1.sendIdx["assert:equals:"]=2;
  5720. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5721. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5722. args: [],
  5723. 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.",
  5724. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5725. referencedClasses: ["Number"]
  5726. }),
  5727. smalltalk.NumberTest);
  5728. smalltalk.addMethod(
  5729. smalltalk.method({
  5730. selector: "testMinMax",
  5731. protocol: 'tests',
  5732. fn: function (){
  5733. var self=this;
  5734. return smalltalk.withContext(function($ctx1) {
  5735. self._assert_equals_((2)._max_((5)),(5));
  5736. $ctx1.sendIdx["assert:equals:"]=1;
  5737. self._assert_equals_((2)._min_((5)),(2));
  5738. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5739. args: [],
  5740. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5741. messageSends: ["assert:equals:", "max:", "min:"],
  5742. referencedClasses: []
  5743. }),
  5744. smalltalk.NumberTest);
  5745. smalltalk.addMethod(
  5746. smalltalk.method({
  5747. selector: "testNegated",
  5748. protocol: 'tests',
  5749. fn: function (){
  5750. var self=this;
  5751. return smalltalk.withContext(function($ctx1) {
  5752. var $1;
  5753. $1=(3)._negated();
  5754. $ctx1.sendIdx["negated"]=1;
  5755. self._assert_equals_($1,(-3));
  5756. $ctx1.sendIdx["assert:equals:"]=1;
  5757. self._assert_equals_((-3)._negated(),(3));
  5758. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5759. args: [],
  5760. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5761. messageSends: ["assert:equals:", "negated"],
  5762. referencedClasses: []
  5763. }),
  5764. smalltalk.NumberTest);
  5765. smalltalk.addMethod(
  5766. smalltalk.method({
  5767. selector: "testPrintShowingDecimalPlaces",
  5768. protocol: 'tests',
  5769. fn: function (){
  5770. var self=this;
  5771. return smalltalk.withContext(function($ctx1) {
  5772. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  5773. $1=(23)._printShowingDecimalPlaces_((2));
  5774. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5775. self._assert_equals_($1,"23.00");
  5776. $ctx1.sendIdx["assert:equals:"]=1;
  5777. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5778. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5779. self._assert_equals_($2,"23.57");
  5780. $ctx1.sendIdx["assert:equals:"]=2;
  5781. $4=(234.567)._negated();
  5782. $ctx1.sendIdx["negated"]=1;
  5783. $3=_st($4)._printShowingDecimalPlaces_((5));
  5784. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5785. self._assert_equals_($3,"-234.56700");
  5786. $ctx1.sendIdx["assert:equals:"]=3;
  5787. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5788. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5789. self._assert_equals_($5,"23");
  5790. $ctx1.sendIdx["assert:equals:"]=4;
  5791. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5792. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5793. self._assert_equals_($6,"24");
  5794. $ctx1.sendIdx["assert:equals:"]=5;
  5795. $8=(23.4567)._negated();
  5796. $ctx1.sendIdx["negated"]=2;
  5797. $7=_st($8)._printShowingDecimalPlaces_((0));
  5798. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5799. self._assert_equals_($7,"-23");
  5800. $ctx1.sendIdx["assert:equals:"]=6;
  5801. $10=(23.5567)._negated();
  5802. $ctx1.sendIdx["negated"]=3;
  5803. $9=_st($10)._printShowingDecimalPlaces_((0));
  5804. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5805. self._assert_equals_($9,"-24");
  5806. $ctx1.sendIdx["assert:equals:"]=7;
  5807. $11=(100000000)._printShowingDecimalPlaces_((1));
  5808. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5809. self._assert_equals_($11,"100000000.0");
  5810. $ctx1.sendIdx["assert:equals:"]=8;
  5811. $12=(0.98)._printShowingDecimalPlaces_((5));
  5812. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5813. self._assert_equals_($12,"0.98000");
  5814. $ctx1.sendIdx["assert:equals:"]=9;
  5815. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5816. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5817. self._assert_equals_($13,"-0.98");
  5818. $ctx1.sendIdx["assert:equals:"]=10;
  5819. $14=(2.567)._printShowingDecimalPlaces_((2));
  5820. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5821. self._assert_equals_($14,"2.57");
  5822. $ctx1.sendIdx["assert:equals:"]=11;
  5823. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5824. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5825. self._assert_equals_($15,"-2.57");
  5826. $ctx1.sendIdx["assert:equals:"]=12;
  5827. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5828. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5829. args: [],
  5830. 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'.",
  5831. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5832. referencedClasses: []
  5833. }),
  5834. smalltalk.NumberTest);
  5835. smalltalk.addMethod(
  5836. smalltalk.method({
  5837. selector: "testRaisedTo",
  5838. protocol: 'tests',
  5839. fn: function (){
  5840. var self=this;
  5841. return smalltalk.withContext(function($ctx1) {
  5842. var $1,$2,$3;
  5843. $1=(2)._raisedTo_((4));
  5844. $ctx1.sendIdx["raisedTo:"]=1;
  5845. self._assert_equals_($1,(16));
  5846. $ctx1.sendIdx["assert:equals:"]=1;
  5847. $2=(2)._raisedTo_((0));
  5848. $ctx1.sendIdx["raisedTo:"]=2;
  5849. self._assert_equals_($2,(1));
  5850. $ctx1.sendIdx["assert:equals:"]=2;
  5851. $3=(2)._raisedTo_((-3));
  5852. $ctx1.sendIdx["raisedTo:"]=3;
  5853. self._assert_equals_($3,(0.125));
  5854. $ctx1.sendIdx["assert:equals:"]=3;
  5855. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5856. $ctx1.sendIdx["assert:equals:"]=4;
  5857. self._assert_equals_((2).__star_star((4)),(16));
  5858. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5859. args: [],
  5860. 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.",
  5861. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5862. referencedClasses: []
  5863. }),
  5864. smalltalk.NumberTest);
  5865. smalltalk.addMethod(
  5866. smalltalk.method({
  5867. selector: "testRounded",
  5868. protocol: 'tests',
  5869. fn: function (){
  5870. var self=this;
  5871. return smalltalk.withContext(function($ctx1) {
  5872. var $1,$2;
  5873. $1=(3)._rounded();
  5874. $ctx1.sendIdx["rounded"]=1;
  5875. self._assert_equals_($1,(3));
  5876. $ctx1.sendIdx["assert:equals:"]=1;
  5877. $2=(3.212)._rounded();
  5878. $ctx1.sendIdx["rounded"]=2;
  5879. self._assert_equals_($2,(3));
  5880. $ctx1.sendIdx["assert:equals:"]=2;
  5881. self._assert_equals_((3.51)._rounded(),(4));
  5882. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5883. args: [],
  5884. 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",
  5885. messageSends: ["assert:equals:", "rounded"],
  5886. referencedClasses: []
  5887. }),
  5888. smalltalk.NumberTest);
  5889. smalltalk.addMethod(
  5890. smalltalk.method({
  5891. selector: "testSign",
  5892. protocol: 'tests',
  5893. fn: function (){
  5894. var self=this;
  5895. return smalltalk.withContext(function($ctx1) {
  5896. var $1,$2;
  5897. $1=(5)._sign();
  5898. $ctx1.sendIdx["sign"]=1;
  5899. self._assert_equals_($1,(1));
  5900. $ctx1.sendIdx["assert:equals:"]=1;
  5901. $2=(0)._sign();
  5902. $ctx1.sendIdx["sign"]=2;
  5903. self._assert_equals_($2,(0));
  5904. $ctx1.sendIdx["assert:equals:"]=2;
  5905. self._assert_equals_((-1.4)._sign(),(-1));
  5906. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5907. args: [],
  5908. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5909. messageSends: ["assert:equals:", "sign"],
  5910. referencedClasses: []
  5911. }),
  5912. smalltalk.NumberTest);
  5913. smalltalk.addMethod(
  5914. smalltalk.method({
  5915. selector: "testSqrt",
  5916. protocol: 'tests',
  5917. fn: function (){
  5918. var self=this;
  5919. return smalltalk.withContext(function($ctx1) {
  5920. var $1;
  5921. $1=(4)._sqrt();
  5922. $ctx1.sendIdx["sqrt"]=1;
  5923. self._assert_equals_($1,(2));
  5924. $ctx1.sendIdx["assert:equals:"]=1;
  5925. self._assert_equals_((16)._sqrt(),(4));
  5926. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5927. args: [],
  5928. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5929. messageSends: ["assert:equals:", "sqrt"],
  5930. referencedClasses: []
  5931. }),
  5932. smalltalk.NumberTest);
  5933. smalltalk.addMethod(
  5934. smalltalk.method({
  5935. selector: "testSquared",
  5936. protocol: 'tests',
  5937. fn: function (){
  5938. var self=this;
  5939. return smalltalk.withContext(function($ctx1) {
  5940. self._assert_equals_((4)._squared(),(16));
  5941. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5942. args: [],
  5943. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5944. messageSends: ["assert:equals:", "squared"],
  5945. referencedClasses: []
  5946. }),
  5947. smalltalk.NumberTest);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "testTimesRepeat",
  5951. protocol: 'tests',
  5952. fn: function (){
  5953. var self=this;
  5954. var i;
  5955. return smalltalk.withContext(function($ctx1) {
  5956. i=(0);
  5957. (0)._timesRepeat_((function(){
  5958. return smalltalk.withContext(function($ctx2) {
  5959. i=_st(i).__plus((1));
  5960. $ctx2.sendIdx["+"]=1;
  5961. return i;
  5962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5963. $ctx1.sendIdx["timesRepeat:"]=1;
  5964. self._assert_equals_(i,(0));
  5965. $ctx1.sendIdx["assert:equals:"]=1;
  5966. (5)._timesRepeat_((function(){
  5967. return smalltalk.withContext(function($ctx2) {
  5968. i=_st(i).__plus((1));
  5969. return i;
  5970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5971. self._assert_equals_(i,(5));
  5972. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5973. args: [],
  5974. 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",
  5975. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5976. referencedClasses: []
  5977. }),
  5978. smalltalk.NumberTest);
  5979. smalltalk.addMethod(
  5980. smalltalk.method({
  5981. selector: "testTo",
  5982. protocol: 'tests',
  5983. fn: function (){
  5984. var self=this;
  5985. return smalltalk.withContext(function($ctx1) {
  5986. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5987. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5988. args: [],
  5989. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5990. messageSends: ["assert:equals:", "to:"],
  5991. referencedClasses: []
  5992. }),
  5993. smalltalk.NumberTest);
  5994. smalltalk.addMethod(
  5995. smalltalk.method({
  5996. selector: "testToBy",
  5997. protocol: 'tests',
  5998. fn: function (){
  5999. var self=this;
  6000. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6001. return smalltalk.withContext(function($ctx1) {
  6002. var $1;
  6003. $1=(0)._to_by_((6),(2));
  6004. $ctx1.sendIdx["to:by:"]=1;
  6005. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6006. self._should_raise_((function(){
  6007. return smalltalk.withContext(function($ctx2) {
  6008. return (1)._to_by_((4),(0));
  6009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6010. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6011. args: [],
  6012. 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",
  6013. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6014. referencedClasses: ["Error"]
  6015. }),
  6016. smalltalk.NumberTest);
  6017. smalltalk.addMethod(
  6018. smalltalk.method({
  6019. selector: "testTrigonometry",
  6020. protocol: 'tests',
  6021. fn: function (){
  6022. var self=this;
  6023. return smalltalk.withContext(function($ctx1) {
  6024. self._assert_equals_((0)._cos(),(1));
  6025. $ctx1.sendIdx["assert:equals:"]=1;
  6026. self._assert_equals_((0)._sin(),(0));
  6027. $ctx1.sendIdx["assert:equals:"]=2;
  6028. self._assert_equals_((0)._tan(),(0));
  6029. $ctx1.sendIdx["assert:equals:"]=3;
  6030. self._assert_equals_((1)._arcCos(),(0));
  6031. $ctx1.sendIdx["assert:equals:"]=4;
  6032. self._assert_equals_((0)._arcSin(),(0));
  6033. $ctx1.sendIdx["assert:equals:"]=5;
  6034. self._assert_equals_((0)._arcTan(),(0));
  6035. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6036. args: [],
  6037. 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.",
  6038. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6039. referencedClasses: []
  6040. }),
  6041. smalltalk.NumberTest);
  6042. smalltalk.addMethod(
  6043. smalltalk.method({
  6044. selector: "testTruncated",
  6045. protocol: 'tests',
  6046. fn: function (){
  6047. var self=this;
  6048. return smalltalk.withContext(function($ctx1) {
  6049. var $1,$2;
  6050. $1=(3)._truncated();
  6051. $ctx1.sendIdx["truncated"]=1;
  6052. self._assert_equals_($1,(3));
  6053. $ctx1.sendIdx["assert:equals:"]=1;
  6054. $2=(3.212)._truncated();
  6055. $ctx1.sendIdx["truncated"]=2;
  6056. self._assert_equals_($2,(3));
  6057. $ctx1.sendIdx["assert:equals:"]=2;
  6058. self._assert_equals_((3.51)._truncated(),(3));
  6059. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  6060. args: [],
  6061. 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",
  6062. messageSends: ["assert:equals:", "truncated"],
  6063. referencedClasses: []
  6064. }),
  6065. smalltalk.NumberTest);
  6066. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  6067. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  6068. smalltalk.addMethod(
  6069. smalltalk.method({
  6070. selector: "foo",
  6071. protocol: 'not yet classified',
  6072. fn: function (){
  6073. var self=this;
  6074. return smalltalk.withContext(function($ctx1) {
  6075. var $1;
  6076. $1=self["@foo"];
  6077. return $1;
  6078. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  6079. args: [],
  6080. source: "foo\x0a\x09^ foo",
  6081. messageSends: [],
  6082. referencedClasses: []
  6083. }),
  6084. smalltalk.ObjectMock);
  6085. smalltalk.addMethod(
  6086. smalltalk.method({
  6087. selector: "foo:",
  6088. protocol: 'not yet classified',
  6089. fn: function (anObject){
  6090. var self=this;
  6091. return smalltalk.withContext(function($ctx1) {
  6092. self["@foo"]=anObject;
  6093. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  6094. args: ["anObject"],
  6095. source: "foo: anObject\x0a\x09foo := anObject",
  6096. messageSends: [],
  6097. referencedClasses: []
  6098. }),
  6099. smalltalk.ObjectMock);
  6100. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6101. smalltalk.addMethod(
  6102. smalltalk.method({
  6103. selector: "notDefined",
  6104. protocol: 'tests',
  6105. fn: function (){
  6106. var self=this;
  6107. return smalltalk.withContext(function($ctx1) {
  6108. return void 0;;
  6109. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  6110. args: [],
  6111. source: "notDefined\x0a\x09<return void 0;>",
  6112. messageSends: [],
  6113. referencedClasses: []
  6114. }),
  6115. smalltalk.ObjectTest);
  6116. smalltalk.addMethod(
  6117. smalltalk.method({
  6118. selector: "testBasicAccess",
  6119. protocol: 'tests',
  6120. fn: function (){
  6121. var self=this;
  6122. var o;
  6123. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6124. return smalltalk.withContext(function($ctx1) {
  6125. var $1;
  6126. o=_st($Object())._new();
  6127. _st(o)._basicAt_put_("a",(1));
  6128. $1=_st(o)._basicAt_("a");
  6129. $ctx1.sendIdx["basicAt:"]=1;
  6130. self._assert_equals_($1,(1));
  6131. $ctx1.sendIdx["assert:equals:"]=1;
  6132. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  6133. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  6134. args: [],
  6135. 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",
  6136. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  6137. referencedClasses: ["Object"]
  6138. }),
  6139. smalltalk.ObjectTest);
  6140. smalltalk.addMethod(
  6141. smalltalk.method({
  6142. selector: "testBasicPerform",
  6143. protocol: 'tests',
  6144. fn: function (){
  6145. var self=this;
  6146. var o;
  6147. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6148. return smalltalk.withContext(function($ctx1) {
  6149. o=_st($Object())._new();
  6150. _st(o)._basicAt_put_("func",(function(){
  6151. return smalltalk.withContext(function($ctx2) {
  6152. return "hello";
  6153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6154. $ctx1.sendIdx["basicAt:put:"]=1;
  6155. _st(o)._basicAt_put_("func2",(function(a){
  6156. return smalltalk.withContext(function($ctx2) {
  6157. return _st(a).__plus((1));
  6158. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  6159. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  6160. $ctx1.sendIdx["assert:equals:"]=1;
  6161. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  6162. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  6163. args: [],
  6164. 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",
  6165. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  6166. referencedClasses: ["Object"]
  6167. }),
  6168. smalltalk.ObjectTest);
  6169. smalltalk.addMethod(
  6170. smalltalk.method({
  6171. selector: "testDNU",
  6172. protocol: 'tests',
  6173. fn: function (){
  6174. var self=this;
  6175. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6176. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6177. return smalltalk.withContext(function($ctx1) {
  6178. self._should_raise_((function(){
  6179. return smalltalk.withContext(function($ctx2) {
  6180. return _st(_st($Object())._new())._foo();
  6181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6182. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  6183. args: [],
  6184. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  6185. messageSends: ["should:raise:", "foo", "new"],
  6186. referencedClasses: ["Object", "MessageNotUnderstood"]
  6187. }),
  6188. smalltalk.ObjectTest);
  6189. smalltalk.addMethod(
  6190. smalltalk.method({
  6191. selector: "testEquality",
  6192. protocol: 'tests',
  6193. fn: function (){
  6194. var self=this;
  6195. var o;
  6196. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6197. return smalltalk.withContext(function($ctx1) {
  6198. var $1,$2,$4,$3;
  6199. o=_st($Object())._new();
  6200. $ctx1.sendIdx["new"]=1;
  6201. $1=_st(o).__eq(_st($Object())._new());
  6202. $ctx1.sendIdx["="]=1;
  6203. self._deny_($1);
  6204. $2=_st(o).__eq(o);
  6205. $ctx1.sendIdx["="]=2;
  6206. self._assert_($2);
  6207. $ctx1.sendIdx["assert:"]=1;
  6208. $4=_st(o)._yourself();
  6209. $ctx1.sendIdx["yourself"]=1;
  6210. $3=_st($4).__eq(o);
  6211. $ctx1.sendIdx["="]=3;
  6212. self._assert_($3);
  6213. $ctx1.sendIdx["assert:"]=2;
  6214. self._assert_(_st(o).__eq(_st(o)._yourself()));
  6215. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  6216. args: [],
  6217. 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)",
  6218. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  6219. referencedClasses: ["Object"]
  6220. }),
  6221. smalltalk.ObjectTest);
  6222. smalltalk.addMethod(
  6223. smalltalk.method({
  6224. selector: "testHalt",
  6225. protocol: 'tests',
  6226. fn: function (){
  6227. var self=this;
  6228. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6229. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6230. return smalltalk.withContext(function($ctx1) {
  6231. self._should_raise_((function(){
  6232. return smalltalk.withContext(function($ctx2) {
  6233. return _st(_st($Object())._new())._halt();
  6234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6235. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  6236. args: [],
  6237. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  6238. messageSends: ["should:raise:", "halt", "new"],
  6239. referencedClasses: ["Object", "Error"]
  6240. }),
  6241. smalltalk.ObjectTest);
  6242. smalltalk.addMethod(
  6243. smalltalk.method({
  6244. selector: "testIdentity",
  6245. protocol: 'tests',
  6246. fn: function (){
  6247. var self=this;
  6248. var o;
  6249. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6250. return smalltalk.withContext(function($ctx1) {
  6251. var $1,$2,$4,$3;
  6252. o=_st($Object())._new();
  6253. $ctx1.sendIdx["new"]=1;
  6254. $1=_st(o).__eq_eq(_st($Object())._new());
  6255. $ctx1.sendIdx["=="]=1;
  6256. self._deny_($1);
  6257. $2=_st(o).__eq_eq(o);
  6258. $ctx1.sendIdx["=="]=2;
  6259. self._assert_($2);
  6260. $ctx1.sendIdx["assert:"]=1;
  6261. $4=_st(o)._yourself();
  6262. $ctx1.sendIdx["yourself"]=1;
  6263. $3=_st($4).__eq_eq(o);
  6264. $ctx1.sendIdx["=="]=3;
  6265. self._assert_($3);
  6266. $ctx1.sendIdx["assert:"]=2;
  6267. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  6268. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  6269. args: [],
  6270. 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",
  6271. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  6272. referencedClasses: ["Object"]
  6273. }),
  6274. smalltalk.ObjectTest);
  6275. smalltalk.addMethod(
  6276. smalltalk.method({
  6277. selector: "testIfNil",
  6278. protocol: 'tests',
  6279. fn: function (){
  6280. var self=this;
  6281. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6282. return smalltalk.withContext(function($ctx1) {
  6283. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  6284. $2=_st($Object())._new();
  6285. $ctx1.sendIdx["new"]=1;
  6286. $1=_st($2)._isNil();
  6287. self._deny_($1);
  6288. $ctx1.sendIdx["deny:"]=1;
  6289. $5=_st($Object())._new();
  6290. $ctx1.sendIdx["new"]=2;
  6291. if(($receiver = $5) == nil || $receiver == null){
  6292. $4=true;
  6293. } else {
  6294. $4=$5;
  6295. };
  6296. $3=_st($4).__eq(true);
  6297. self._deny_($3);
  6298. $7=_st($Object())._new();
  6299. $ctx1.sendIdx["new"]=3;
  6300. if(($receiver = $7) == nil || $receiver == null){
  6301. $6=$7;
  6302. } else {
  6303. $6=true;
  6304. };
  6305. self._assert_equals_($6,true);
  6306. $ctx1.sendIdx["assert:equals:"]=1;
  6307. $9=_st($Object())._new();
  6308. $ctx1.sendIdx["new"]=4;
  6309. if(($receiver = $9) == nil || $receiver == null){
  6310. $8=false;
  6311. } else {
  6312. $8=true;
  6313. };
  6314. self._assert_equals_($8,true);
  6315. $ctx1.sendIdx["assert:equals:"]=2;
  6316. $11=_st($Object())._new();
  6317. if(($receiver = $11) == nil || $receiver == null){
  6318. $10=false;
  6319. } else {
  6320. $10=true;
  6321. };
  6322. self._assert_equals_($10,true);
  6323. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  6324. args: [],
  6325. 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",
  6326. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6327. referencedClasses: ["Object"]
  6328. }),
  6329. smalltalk.ObjectTest);
  6330. smalltalk.addMethod(
  6331. smalltalk.method({
  6332. selector: "testInstVars",
  6333. protocol: 'tests',
  6334. fn: function (){
  6335. var self=this;
  6336. var o;
  6337. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6338. return smalltalk.withContext(function($ctx1) {
  6339. var $1,$2;
  6340. o=_st($ObjectMock())._new();
  6341. $1=_st(o)._instVarAt_("foo");
  6342. $ctx1.sendIdx["instVarAt:"]=1;
  6343. self._assert_equals_($1,nil);
  6344. $ctx1.sendIdx["assert:equals:"]=1;
  6345. _st(o)._instVarAt_put_("foo",(1));
  6346. $2=_st(o)._instVarAt_("foo");
  6347. $ctx1.sendIdx["instVarAt:"]=2;
  6348. self._assert_equals_($2,(1));
  6349. $ctx1.sendIdx["assert:equals:"]=2;
  6350. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  6351. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  6352. args: [],
  6353. 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",
  6354. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  6355. referencedClasses: ["ObjectMock"]
  6356. }),
  6357. smalltalk.ObjectTest);
  6358. smalltalk.addMethod(
  6359. smalltalk.method({
  6360. selector: "testNilUndefined",
  6361. protocol: 'tests',
  6362. fn: function (){
  6363. var self=this;
  6364. return smalltalk.withContext(function($ctx1) {
  6365. self._assert_equals_(self._notDefined(),nil);
  6366. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  6367. args: [],
  6368. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  6369. messageSends: ["assert:equals:", "notDefined"],
  6370. referencedClasses: []
  6371. }),
  6372. smalltalk.ObjectTest);
  6373. smalltalk.addMethod(
  6374. smalltalk.method({
  6375. selector: "testYourself",
  6376. protocol: 'tests',
  6377. fn: function (){
  6378. var self=this;
  6379. var o;
  6380. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6381. return smalltalk.withContext(function($ctx1) {
  6382. o=_st($ObjectMock())._new();
  6383. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  6384. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  6385. args: [],
  6386. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  6387. messageSends: ["new", "assert:", "==", "yourself"],
  6388. referencedClasses: ["ObjectMock"]
  6389. }),
  6390. smalltalk.ObjectTest);
  6391. smalltalk.addMethod(
  6392. smalltalk.method({
  6393. selector: "testidentityHash",
  6394. protocol: 'tests',
  6395. fn: function (){
  6396. var self=this;
  6397. var o1,o2;
  6398. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6399. return smalltalk.withContext(function($ctx1) {
  6400. var $2,$3,$1,$5,$4;
  6401. o1=_st($Object())._new();
  6402. $ctx1.sendIdx["new"]=1;
  6403. o2=_st($Object())._new();
  6404. $2=_st(o1)._identityHash();
  6405. $ctx1.sendIdx["identityHash"]=1;
  6406. $3=_st(o1)._identityHash();
  6407. $ctx1.sendIdx["identityHash"]=2;
  6408. $1=_st($2).__eq_eq($3);
  6409. $ctx1.sendIdx["=="]=1;
  6410. self._assert_($1);
  6411. $5=_st(o1)._identityHash();
  6412. $ctx1.sendIdx["identityHash"]=3;
  6413. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  6414. self._deny_($4);
  6415. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  6416. args: [],
  6417. 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",
  6418. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  6419. referencedClasses: ["Object"]
  6420. }),
  6421. smalltalk.ObjectTest);
  6422. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6423. smalltalk.addMethod(
  6424. smalltalk.method({
  6425. selector: "testAccessing",
  6426. protocol: 'tests',
  6427. fn: function (){
  6428. var self=this;
  6429. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6430. return smalltalk.withContext(function($ctx1) {
  6431. var $2,$1,$3,$6,$5,$4;
  6432. $2=_st($Point())._x_y_((3),(4));
  6433. $ctx1.sendIdx["x:y:"]=1;
  6434. $1=_st($2)._x();
  6435. $ctx1.sendIdx["x"]=1;
  6436. self._assert_equals_($1,(3));
  6437. $ctx1.sendIdx["assert:equals:"]=1;
  6438. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  6439. $ctx1.sendIdx["y"]=1;
  6440. self._assert_equals_($3,(4));
  6441. $ctx1.sendIdx["assert:equals:"]=2;
  6442. $6=_st($Point())._new();
  6443. $ctx1.sendIdx["new"]=1;
  6444. $5=_st($6)._x_((3));
  6445. $4=_st($5)._x();
  6446. self._assert_equals_($4,(3));
  6447. $ctx1.sendIdx["assert:equals:"]=3;
  6448. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  6449. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  6450. args: [],
  6451. 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",
  6452. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  6453. referencedClasses: ["Point"]
  6454. }),
  6455. smalltalk.PointTest);
  6456. smalltalk.addMethod(
  6457. smalltalk.method({
  6458. selector: "testArithmetic",
  6459. protocol: 'tests',
  6460. fn: function (){
  6461. var self=this;
  6462. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6463. return smalltalk.withContext(function($ctx1) {
  6464. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  6465. $2=(3).__at((4));
  6466. $ctx1.sendIdx["@"]=1;
  6467. $3=(3).__at((4));
  6468. $ctx1.sendIdx["@"]=2;
  6469. $1=_st($2).__star($3);
  6470. $4=_st($Point())._x_y_((9),(16));
  6471. $ctx1.sendIdx["x:y:"]=1;
  6472. self._assert_equals_($1,$4);
  6473. $ctx1.sendIdx["assert:equals:"]=1;
  6474. $6=(3).__at((4));
  6475. $ctx1.sendIdx["@"]=3;
  6476. $7=(3).__at((4));
  6477. $ctx1.sendIdx["@"]=4;
  6478. $5=_st($6).__plus($7);
  6479. $8=_st($Point())._x_y_((6),(8));
  6480. $ctx1.sendIdx["x:y:"]=2;
  6481. self._assert_equals_($5,$8);
  6482. $ctx1.sendIdx["assert:equals:"]=2;
  6483. $10=(3).__at((4));
  6484. $ctx1.sendIdx["@"]=5;
  6485. $11=(3).__at((4));
  6486. $ctx1.sendIdx["@"]=6;
  6487. $9=_st($10).__minus($11);
  6488. $12=_st($Point())._x_y_((0),(0));
  6489. $ctx1.sendIdx["x:y:"]=3;
  6490. self._assert_equals_($9,$12);
  6491. $ctx1.sendIdx["assert:equals:"]=3;
  6492. $14=(6).__at((8));
  6493. $ctx1.sendIdx["@"]=7;
  6494. $13=_st($14).__slash((3).__at((4)));
  6495. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  6496. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  6497. args: [],
  6498. 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)",
  6499. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  6500. referencedClasses: ["Point"]
  6501. }),
  6502. smalltalk.PointTest);
  6503. smalltalk.addMethod(
  6504. smalltalk.method({
  6505. selector: "testAt",
  6506. protocol: 'tests',
  6507. fn: function (){
  6508. var self=this;
  6509. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6510. return smalltalk.withContext(function($ctx1) {
  6511. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  6512. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  6513. args: [],
  6514. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  6515. messageSends: ["assert:equals:", "@", "x:y:"],
  6516. referencedClasses: ["Point"]
  6517. }),
  6518. smalltalk.PointTest);
  6519. smalltalk.addMethod(
  6520. smalltalk.method({
  6521. selector: "testEgality",
  6522. protocol: 'tests',
  6523. fn: function (){
  6524. var self=this;
  6525. return smalltalk.withContext(function($ctx1) {
  6526. var $2,$3,$1,$5,$4;
  6527. $2=(3).__at((4));
  6528. $ctx1.sendIdx["@"]=1;
  6529. $3=(3).__at((4));
  6530. $ctx1.sendIdx["@"]=2;
  6531. $1=_st($2).__eq($3);
  6532. $ctx1.sendIdx["="]=1;
  6533. self._assert_($1);
  6534. $5=(3).__at((5));
  6535. $ctx1.sendIdx["@"]=3;
  6536. $4=_st($5).__eq((3).__at((6)));
  6537. self._deny_($4);
  6538. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  6539. args: [],
  6540. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  6541. messageSends: ["assert:", "=", "@", "deny:"],
  6542. referencedClasses: []
  6543. }),
  6544. smalltalk.PointTest);
  6545. smalltalk.addMethod(
  6546. smalltalk.method({
  6547. selector: "testNew",
  6548. protocol: 'tests',
  6549. fn: function (){
  6550. var self=this;
  6551. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6552. return smalltalk.withContext(function($ctx1) {
  6553. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  6554. $3=_st($Point())._new();
  6555. $ctx1.sendIdx["new"]=1;
  6556. $2=_st($3)._x_((3));
  6557. $ctx1.sendIdx["x:"]=1;
  6558. $1=_st($2)._y();
  6559. $ctx1.sendIdx["y"]=1;
  6560. self._assert_equals_($1,nil);
  6561. $ctx1.sendIdx["assert:equals:"]=1;
  6562. $7=_st($Point())._new();
  6563. $ctx1.sendIdx["new"]=2;
  6564. $6=_st($7)._x_((3));
  6565. $5=_st($6)._x();
  6566. $ctx1.sendIdx["x"]=1;
  6567. $4=_st($5).__eq((0));
  6568. $ctx1.sendIdx["="]=1;
  6569. self._deny_($4);
  6570. $ctx1.sendIdx["deny:"]=1;
  6571. $10=_st($Point())._new();
  6572. $ctx1.sendIdx["new"]=3;
  6573. $9=_st($10)._y_((4));
  6574. $ctx1.sendIdx["y:"]=1;
  6575. $8=_st($9)._x();
  6576. self._assert_equals_($8,nil);
  6577. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  6578. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  6579. args: [],
  6580. 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",
  6581. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  6582. referencedClasses: ["Point"]
  6583. }),
  6584. smalltalk.PointTest);
  6585. smalltalk.addMethod(
  6586. smalltalk.method({
  6587. selector: "testTranslateBy",
  6588. protocol: 'tests',
  6589. fn: function (){
  6590. var self=this;
  6591. return smalltalk.withContext(function($ctx1) {
  6592. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6593. $2=(3).__at((3));
  6594. $ctx1.sendIdx["@"]=1;
  6595. $3=(0).__at((1));
  6596. $ctx1.sendIdx["@"]=2;
  6597. $1=_st($2)._translateBy_($3);
  6598. $ctx1.sendIdx["translateBy:"]=1;
  6599. $4=(3).__at((4));
  6600. $ctx1.sendIdx["@"]=3;
  6601. self._assert_equals_($1,$4);
  6602. $ctx1.sendIdx["assert:equals:"]=1;
  6603. $6=(3).__at((3));
  6604. $ctx1.sendIdx["@"]=4;
  6605. $8=(1)._negated();
  6606. $ctx1.sendIdx["negated"]=1;
  6607. $7=(0).__at($8);
  6608. $ctx1.sendIdx["@"]=5;
  6609. $5=_st($6)._translateBy_($7);
  6610. $ctx1.sendIdx["translateBy:"]=2;
  6611. $9=(3).__at((2));
  6612. $ctx1.sendIdx["@"]=6;
  6613. self._assert_equals_($5,$9);
  6614. $ctx1.sendIdx["assert:equals:"]=2;
  6615. $11=(3).__at((3));
  6616. $ctx1.sendIdx["@"]=7;
  6617. $12=(2).__at((3));
  6618. $ctx1.sendIdx["@"]=8;
  6619. $10=_st($11)._translateBy_($12);
  6620. $ctx1.sendIdx["translateBy:"]=3;
  6621. $13=(5).__at((6));
  6622. $ctx1.sendIdx["@"]=9;
  6623. self._assert_equals_($10,$13);
  6624. $ctx1.sendIdx["assert:equals:"]=3;
  6625. $15=(3).__at((3));
  6626. $ctx1.sendIdx["@"]=10;
  6627. $16=_st((3)._negated()).__at((0));
  6628. $ctx1.sendIdx["@"]=11;
  6629. $14=_st($15)._translateBy_($16);
  6630. self._assert_equals_($14,(0).__at((3)));
  6631. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6632. args: [],
  6633. 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.",
  6634. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6635. referencedClasses: []
  6636. }),
  6637. smalltalk.PointTest);
  6638. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6639. smalltalk.addMethod(
  6640. smalltalk.method({
  6641. selector: "testNextIfAbsent",
  6642. protocol: 'tests',
  6643. fn: function (){
  6644. var self=this;
  6645. var queue;
  6646. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6647. return smalltalk.withContext(function($ctx1) {
  6648. var $2,$1;
  6649. queue=_st($Queue())._new();
  6650. _st(queue)._nextPut_("index1");
  6651. $2=_st(queue)._nextIfAbsent_("empty");
  6652. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6653. $1=_st($2).__eq("index1");
  6654. $ctx1.sendIdx["="]=1;
  6655. self._assert_($1);
  6656. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  6657. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6658. args: [],
  6659. 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'",
  6660. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6661. referencedClasses: ["Queue"]
  6662. }),
  6663. smalltalk.QueueTest);
  6664. smalltalk.addMethod(
  6665. smalltalk.method({
  6666. selector: "testQueueNext",
  6667. protocol: 'tests',
  6668. fn: function (){
  6669. var self=this;
  6670. var queue;
  6671. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6672. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6673. return smalltalk.withContext(function($ctx1) {
  6674. var $1,$2,$4,$3,$6,$5;
  6675. queue=_st($Queue())._new();
  6676. $1=queue;
  6677. _st($1)._nextPut_("index1");
  6678. $ctx1.sendIdx["nextPut:"]=1;
  6679. $2=_st($1)._nextPut_("index2");
  6680. $4=_st(queue)._next();
  6681. $ctx1.sendIdx["next"]=1;
  6682. $3=_st($4).__eq("index1");
  6683. $ctx1.sendIdx["="]=1;
  6684. self._assert_($3);
  6685. $6=_st(queue)._next();
  6686. $ctx1.sendIdx["next"]=2;
  6687. $5=_st($6).__eq("index");
  6688. self._deny_($5);
  6689. self._should_raise_((function(){
  6690. return smalltalk.withContext(function($ctx2) {
  6691. return _st(queue)._next();
  6692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6693. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6694. args: [],
  6695. 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",
  6696. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6697. referencedClasses: ["Queue", "Error"]
  6698. }),
  6699. smalltalk.QueueTest);
  6700. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6701. smalltalk.addMethod(
  6702. smalltalk.method({
  6703. selector: "testAtRandomNumber",
  6704. protocol: 'tests',
  6705. fn: function (){
  6706. var self=this;
  6707. var val;
  6708. return smalltalk.withContext(function($ctx1) {
  6709. (100)._timesRepeat_((function(){
  6710. return smalltalk.withContext(function($ctx2) {
  6711. val=(10)._atRandom();
  6712. val;
  6713. self._assert_(_st(val).__gt((0)));
  6714. $ctx2.sendIdx["assert:"]=1;
  6715. return self._assert_(_st(val).__lt((11)));
  6716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6717. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6718. args: [],
  6719. 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]",
  6720. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6721. referencedClasses: []
  6722. }),
  6723. smalltalk.RandomTest);
  6724. smalltalk.addMethod(
  6725. smalltalk.method({
  6726. selector: "testAtRandomSequenceableCollection",
  6727. protocol: 'tests',
  6728. fn: function (){
  6729. var self=this;
  6730. var val;
  6731. return smalltalk.withContext(function($ctx1) {
  6732. var $3,$4,$2,$1;
  6733. (100)._timesRepeat_((function(){
  6734. return smalltalk.withContext(function($ctx2) {
  6735. val="abc"._atRandom();
  6736. val;
  6737. $3=_st(val).__eq("a");
  6738. $ctx2.sendIdx["="]=1;
  6739. $4=_st(val).__eq("b");
  6740. $ctx2.sendIdx["="]=2;
  6741. $2=_st($3).__or($4);
  6742. $1=_st($2).__or(_st(val).__eq("c"));
  6743. $ctx2.sendIdx["|"]=1;
  6744. return self._assert_($1);
  6745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6746. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6747. args: [],
  6748. 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].",
  6749. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6750. referencedClasses: []
  6751. }),
  6752. smalltalk.RandomTest);
  6753. smalltalk.addMethod(
  6754. smalltalk.method({
  6755. selector: "textNext",
  6756. protocol: 'tests',
  6757. fn: function (){
  6758. var self=this;
  6759. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6760. return smalltalk.withContext(function($ctx1) {
  6761. var $1;
  6762. (10000)._timesRepeat_((function(){
  6763. var current,next;
  6764. return smalltalk.withContext(function($ctx2) {
  6765. next=_st(_st($Random())._new())._next();
  6766. next;
  6767. self._assert_(_st(next).__gt_eq((0)));
  6768. $ctx2.sendIdx["assert:"]=1;
  6769. self._assert_(_st(next).__lt((1)));
  6770. $1=_st(current).__eq(next);
  6771. $ctx2.sendIdx["="]=1;
  6772. self._deny_($1);
  6773. return _st(next).__eq(current);
  6774. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6775. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6776. args: [],
  6777. 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 ]",
  6778. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6779. referencedClasses: ["Random"]
  6780. }),
  6781. smalltalk.RandomTest);
  6782. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6783. smalltalk.addMethod(
  6784. smalltalk.method({
  6785. selector: "testAddRemove",
  6786. protocol: 'tests',
  6787. fn: function (){
  6788. var self=this;
  6789. var set;
  6790. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6791. return smalltalk.withContext(function($ctx1) {
  6792. var $1,$2;
  6793. set=_st($Set())._new();
  6794. self._assert_(_st(set)._isEmpty());
  6795. $ctx1.sendIdx["assert:"]=1;
  6796. _st(set)._add_((3));
  6797. $ctx1.sendIdx["add:"]=1;
  6798. $1=_st(set)._includes_((3));
  6799. $ctx1.sendIdx["includes:"]=1;
  6800. self._assert_($1);
  6801. $ctx1.sendIdx["assert:"]=2;
  6802. _st(set)._add_((5));
  6803. $2=_st(set)._includes_((5));
  6804. $ctx1.sendIdx["includes:"]=2;
  6805. self._assert_($2);
  6806. _st(set)._remove_((3));
  6807. self._deny_(_st(set)._includes_((3)));
  6808. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6809. args: [],
  6810. 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)",
  6811. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6812. referencedClasses: ["Set"]
  6813. }),
  6814. smalltalk.SetTest);
  6815. smalltalk.addMethod(
  6816. smalltalk.method({
  6817. selector: "testAt",
  6818. protocol: 'tests',
  6819. fn: function (){
  6820. var self=this;
  6821. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6822. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6823. return smalltalk.withContext(function($ctx1) {
  6824. self._should_raise_((function(){
  6825. return smalltalk.withContext(function($ctx2) {
  6826. return _st(_st($Set())._new())._at_put_((1),(2));
  6827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6828. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6829. args: [],
  6830. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6831. messageSends: ["should:raise:", "at:put:", "new"],
  6832. referencedClasses: ["Set", "Error"]
  6833. }),
  6834. smalltalk.SetTest);
  6835. smalltalk.addMethod(
  6836. smalltalk.method({
  6837. selector: "testCollect",
  6838. protocol: 'tests',
  6839. fn: function (){
  6840. var self=this;
  6841. return smalltalk.withContext(function($ctx1) {
  6842. var $2,$1;
  6843. $2=[(5), (6), (8)]._asSet();
  6844. $ctx1.sendIdx["asSet"]=1;
  6845. $1=_st($2)._collect_((function(x){
  6846. return smalltalk.withContext(function($ctx2) {
  6847. return _st(x).__backslash_backslash((3));
  6848. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6849. self._assert_equals_($1,[(0), (2)]._asSet());
  6850. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6851. args: [],
  6852. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6853. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6854. referencedClasses: []
  6855. }),
  6856. smalltalk.SetTest);
  6857. smalltalk.addMethod(
  6858. smalltalk.method({
  6859. selector: "testComparing",
  6860. protocol: 'tests',
  6861. fn: function (){
  6862. var self=this;
  6863. return smalltalk.withContext(function($ctx1) {
  6864. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6865. $1=[(0), (2)]._asSet();
  6866. $ctx1.sendIdx["asSet"]=1;
  6867. $2=[(0), (2)]._asSet();
  6868. $ctx1.sendIdx["asSet"]=2;
  6869. self._assert_equals_($1,$2);
  6870. $ctx1.sendIdx["assert:equals:"]=1;
  6871. $3=[(2), (0)]._asSet();
  6872. $ctx1.sendIdx["asSet"]=3;
  6873. $4=[(0), (2)]._asSet();
  6874. $ctx1.sendIdx["asSet"]=4;
  6875. self._assert_equals_($3,$4);
  6876. $6=[(0), (2), (3)]._asSet();
  6877. $ctx1.sendIdx["asSet"]=5;
  6878. $7=[(0), (2)]._asSet();
  6879. $ctx1.sendIdx["asSet"]=6;
  6880. $5=_st($6).__eq($7);
  6881. $ctx1.sendIdx["="]=1;
  6882. self._deny_($5);
  6883. $ctx1.sendIdx["deny:"]=1;
  6884. $9=[(1), (2)]._asSet();
  6885. $ctx1.sendIdx["asSet"]=7;
  6886. $8=_st($9).__eq([(0), (2)]._asSet());
  6887. self._deny_($8);
  6888. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6889. args: [],
  6890. 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",
  6891. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6892. referencedClasses: []
  6893. }),
  6894. smalltalk.SetTest);
  6895. smalltalk.addMethod(
  6896. smalltalk.method({
  6897. selector: "testPrintString",
  6898. protocol: 'tests',
  6899. fn: function (){
  6900. var self=this;
  6901. var set;
  6902. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6903. return smalltalk.withContext(function($ctx1) {
  6904. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  6905. set=_st($Set())._new();
  6906. $1=_st(set)._printString();
  6907. $ctx1.sendIdx["printString"]=1;
  6908. self._assert_equals_($1,"a Set ()");
  6909. $ctx1.sendIdx["assert:equals:"]=1;
  6910. $2=set;
  6911. _st($2)._add_((1));
  6912. $ctx1.sendIdx["add:"]=1;
  6913. $3=_st($2)._add_((3));
  6914. $ctx1.sendIdx["add:"]=2;
  6915. $4=_st(set)._printString();
  6916. $ctx1.sendIdx["printString"]=2;
  6917. self._assert_equals_($4,"a Set (1 3)");
  6918. $ctx1.sendIdx["assert:equals:"]=2;
  6919. _st(set)._add_("foo");
  6920. $ctx1.sendIdx["add:"]=3;
  6921. $5=_st(set)._printString();
  6922. $ctx1.sendIdx["printString"]=3;
  6923. self._assert_equals_($5,"a Set (1 3 'foo')");
  6924. $ctx1.sendIdx["assert:equals:"]=3;
  6925. $6=set;
  6926. _st($6)._remove_((1));
  6927. $ctx1.sendIdx["remove:"]=1;
  6928. $7=_st($6)._remove_((3));
  6929. $8=_st(set)._printString();
  6930. $ctx1.sendIdx["printString"]=4;
  6931. self._assert_equals_($8,"a Set ('foo')");
  6932. $ctx1.sendIdx["assert:equals:"]=4;
  6933. _st(set)._add_((3));
  6934. $ctx1.sendIdx["add:"]=4;
  6935. $9=_st(set)._printString();
  6936. $ctx1.sendIdx["printString"]=5;
  6937. self._assert_equals_($9,"a Set ('foo' 3)");
  6938. $ctx1.sendIdx["assert:equals:"]=5;
  6939. _st(set)._add_((3));
  6940. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6941. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6942. args: [],
  6943. 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)'",
  6944. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6945. referencedClasses: ["Set"]
  6946. }),
  6947. smalltalk.SetTest);
  6948. smalltalk.addMethod(
  6949. smalltalk.method({
  6950. selector: "testSize",
  6951. protocol: 'tests',
  6952. fn: function (){
  6953. var self=this;
  6954. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6955. return smalltalk.withContext(function($ctx1) {
  6956. var $1,$3,$2;
  6957. $1=_st(_st($Set())._new())._size();
  6958. $ctx1.sendIdx["size"]=1;
  6959. self._assert_equals_($1,(0));
  6960. $ctx1.sendIdx["assert:equals:"]=1;
  6961. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6962. $ctx1.sendIdx["withAll:"]=1;
  6963. $2=_st($3)._size();
  6964. $ctx1.sendIdx["size"]=2;
  6965. self._assert_equals_($2,(4));
  6966. $ctx1.sendIdx["assert:equals:"]=2;
  6967. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6968. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6969. args: [],
  6970. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  6971. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6972. referencedClasses: ["Set"]
  6973. }),
  6974. smalltalk.SetTest);
  6975. smalltalk.addMethod(
  6976. smalltalk.method({
  6977. selector: "testUnboxedObjects",
  6978. protocol: 'tests',
  6979. fn: function (){
  6980. var self=this;
  6981. return smalltalk.withContext(function($ctx1) {
  6982. var $4,$3,$2,$1;
  6983. $4="foo"._yourself();
  6984. $ctx1.sendIdx["yourself"]=1;
  6985. $3=[$4,"foo"._yourself()];
  6986. $2=_st($3)._asSet();
  6987. $1=_st($2)._asArray();
  6988. self._assert_equals_($1,["foo"]);
  6989. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6990. args: [],
  6991. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6992. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6993. referencedClasses: []
  6994. }),
  6995. smalltalk.SetTest);
  6996. smalltalk.addMethod(
  6997. smalltalk.method({
  6998. selector: "testUnicity",
  6999. protocol: 'tests',
  7000. fn: function (){
  7001. var self=this;
  7002. var set;
  7003. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7004. return smalltalk.withContext(function($ctx1) {
  7005. var $1;
  7006. set=_st($Set())._new();
  7007. _st(set)._add_((21));
  7008. $ctx1.sendIdx["add:"]=1;
  7009. _st(set)._add_("hello");
  7010. $ctx1.sendIdx["add:"]=2;
  7011. _st(set)._add_((21));
  7012. $ctx1.sendIdx["add:"]=3;
  7013. $1=_st(set)._size();
  7014. $ctx1.sendIdx["size"]=1;
  7015. self._assert_equals_($1,(2));
  7016. $ctx1.sendIdx["assert:equals:"]=1;
  7017. _st(set)._add_("hello");
  7018. self._assert_equals_(_st(set)._size(),(2));
  7019. $ctx1.sendIdx["assert:equals:"]=2;
  7020. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  7021. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  7022. args: [],
  7023. 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')",
  7024. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  7025. referencedClasses: ["Set"]
  7026. }),
  7027. smalltalk.SetTest);
  7028. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7029. smalltalk.addMethod(
  7030. smalltalk.method({
  7031. selector: "collectionClass",
  7032. protocol: 'accessing',
  7033. fn: function (){
  7034. var self=this;
  7035. return smalltalk.withContext(function($ctx1) {
  7036. var $1;
  7037. $1=_st(self._class())._collectionClass();
  7038. return $1;
  7039. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7040. args: [],
  7041. source: "collectionClass\x0a\x09^ self class collectionClass",
  7042. messageSends: ["collectionClass", "class"],
  7043. referencedClasses: []
  7044. }),
  7045. smalltalk.StreamTest);
  7046. smalltalk.addMethod(
  7047. smalltalk.method({
  7048. selector: "newCollection",
  7049. protocol: 'accessing',
  7050. fn: function (){
  7051. var self=this;
  7052. return smalltalk.withContext(function($ctx1) {
  7053. var $1;
  7054. $1=_st(self._collectionClass())._new();
  7055. return $1;
  7056. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7057. args: [],
  7058. source: "newCollection\x0a\x09^ self collectionClass new",
  7059. messageSends: ["new", "collectionClass"],
  7060. referencedClasses: []
  7061. }),
  7062. smalltalk.StreamTest);
  7063. smalltalk.addMethod(
  7064. smalltalk.method({
  7065. selector: "newStream",
  7066. protocol: 'accessing',
  7067. fn: function (){
  7068. var self=this;
  7069. return smalltalk.withContext(function($ctx1) {
  7070. var $1;
  7071. $1=_st(_st(self._collectionClass())._new())._stream();
  7072. return $1;
  7073. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7074. args: [],
  7075. source: "newStream\x0a\x09^ self collectionClass new stream",
  7076. messageSends: ["stream", "new", "collectionClass"],
  7077. referencedClasses: []
  7078. }),
  7079. smalltalk.StreamTest);
  7080. smalltalk.addMethod(
  7081. smalltalk.method({
  7082. selector: "testAtStartAtEnd",
  7083. protocol: 'tests',
  7084. fn: function (){
  7085. var self=this;
  7086. var stream;
  7087. return smalltalk.withContext(function($ctx1) {
  7088. var $1,$2,$3,$4;
  7089. stream=self._newStream();
  7090. $1=_st(stream)._atStart();
  7091. $ctx1.sendIdx["atStart"]=1;
  7092. self._assert_($1);
  7093. $ctx1.sendIdx["assert:"]=1;
  7094. $2=_st(stream)._atEnd();
  7095. $ctx1.sendIdx["atEnd"]=1;
  7096. self._assert_($2);
  7097. $ctx1.sendIdx["assert:"]=2;
  7098. _st(stream)._nextPutAll_(self._newCollection());
  7099. $3=_st(stream)._atEnd();
  7100. $ctx1.sendIdx["atEnd"]=2;
  7101. self._assert_($3);
  7102. $4=_st(stream)._atStart();
  7103. $ctx1.sendIdx["atStart"]=2;
  7104. self._deny_($4);
  7105. $ctx1.sendIdx["deny:"]=1;
  7106. _st(stream)._position_((1));
  7107. self._deny_(_st(stream)._atEnd());
  7108. $ctx1.sendIdx["deny:"]=2;
  7109. self._deny_(_st(stream)._atStart());
  7110. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7111. args: [],
  7112. 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",
  7113. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7114. referencedClasses: []
  7115. }),
  7116. smalltalk.StreamTest);
  7117. smalltalk.addMethod(
  7118. smalltalk.method({
  7119. selector: "testContents",
  7120. protocol: 'tests',
  7121. fn: function (){
  7122. var self=this;
  7123. var stream;
  7124. return smalltalk.withContext(function($ctx1) {
  7125. var $1,$2;
  7126. stream=self._newStream();
  7127. $1=stream;
  7128. $2=self._newCollection();
  7129. $ctx1.sendIdx["newCollection"]=1;
  7130. _st($1)._nextPutAll_($2);
  7131. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7132. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7133. args: [],
  7134. 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",
  7135. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7136. referencedClasses: []
  7137. }),
  7138. smalltalk.StreamTest);
  7139. smalltalk.addMethod(
  7140. smalltalk.method({
  7141. selector: "testIsEmpty",
  7142. protocol: 'tests',
  7143. fn: function (){
  7144. var self=this;
  7145. var stream;
  7146. return smalltalk.withContext(function($ctx1) {
  7147. var $1;
  7148. stream=self._newStream();
  7149. $1=_st(stream)._isEmpty();
  7150. $ctx1.sendIdx["isEmpty"]=1;
  7151. self._assert_($1);
  7152. _st(stream)._nextPutAll_(self._newCollection());
  7153. self._deny_(_st(stream)._isEmpty());
  7154. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7155. args: [],
  7156. 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",
  7157. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7158. referencedClasses: []
  7159. }),
  7160. smalltalk.StreamTest);
  7161. smalltalk.addMethod(
  7162. smalltalk.method({
  7163. selector: "testPosition",
  7164. protocol: 'tests',
  7165. fn: function (){
  7166. var self=this;
  7167. var collection,stream;
  7168. return smalltalk.withContext(function($ctx1) {
  7169. var $1,$2,$3;
  7170. collection=self._newCollection();
  7171. stream=self._newStream();
  7172. _st(stream)._nextPutAll_(collection);
  7173. $1=_st(stream)._position();
  7174. $ctx1.sendIdx["position"]=1;
  7175. self._assert_equals_($1,_st(collection)._size());
  7176. $ctx1.sendIdx["assert:equals:"]=1;
  7177. _st(stream)._position_((0));
  7178. $2=_st(stream)._position();
  7179. $ctx1.sendIdx["position"]=2;
  7180. self._assert_equals_($2,(0));
  7181. $ctx1.sendIdx["assert:equals:"]=2;
  7182. _st(stream)._next();
  7183. $ctx1.sendIdx["next"]=1;
  7184. $3=_st(stream)._position();
  7185. $ctx1.sendIdx["position"]=3;
  7186. self._assert_equals_($3,(1));
  7187. $ctx1.sendIdx["assert:equals:"]=3;
  7188. _st(stream)._next();
  7189. self._assert_equals_(_st(stream)._position(),(2));
  7190. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7191. args: [],
  7192. 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",
  7193. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7194. referencedClasses: []
  7195. }),
  7196. smalltalk.StreamTest);
  7197. smalltalk.addMethod(
  7198. smalltalk.method({
  7199. selector: "testReading",
  7200. protocol: 'tests',
  7201. fn: function (){
  7202. var self=this;
  7203. var stream,collection;
  7204. return smalltalk.withContext(function($ctx1) {
  7205. var $1,$2,$3;
  7206. collection=self._newCollection();
  7207. stream=self._newStream();
  7208. $1=stream;
  7209. _st($1)._nextPutAll_(collection);
  7210. $2=_st($1)._position_((0));
  7211. _st(collection)._do_((function(each){
  7212. return smalltalk.withContext(function($ctx2) {
  7213. $3=_st(stream)._next();
  7214. $ctx2.sendIdx["next"]=1;
  7215. return self._assert_equals_($3,each);
  7216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7217. self._assert_(_st(_st(stream)._next())._isNil());
  7218. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7219. args: [],
  7220. 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",
  7221. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7222. referencedClasses: []
  7223. }),
  7224. smalltalk.StreamTest);
  7225. smalltalk.addMethod(
  7226. smalltalk.method({
  7227. selector: "testStreamContents",
  7228. protocol: 'tests',
  7229. fn: function (){
  7230. var self=this;
  7231. return smalltalk.withContext(function($ctx1) {
  7232. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7233. args: [],
  7234. source: "testStreamContents",
  7235. messageSends: [],
  7236. referencedClasses: []
  7237. }),
  7238. smalltalk.StreamTest);
  7239. smalltalk.addMethod(
  7240. smalltalk.method({
  7241. selector: "testWrite",
  7242. protocol: 'tests',
  7243. fn: function (){
  7244. var self=this;
  7245. var stream,collection;
  7246. return smalltalk.withContext(function($ctx1) {
  7247. collection=self._newCollection();
  7248. stream=self._newStream();
  7249. _st(collection)._do_((function(each){
  7250. return smalltalk.withContext(function($ctx2) {
  7251. return _st(stream).__lt_lt(each);
  7252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7253. self._assert_equals_(_st(stream)._contents(),collection);
  7254. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7255. args: [],
  7256. 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",
  7257. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7258. referencedClasses: []
  7259. }),
  7260. smalltalk.StreamTest);
  7261. smalltalk.addMethod(
  7262. smalltalk.method({
  7263. selector: "testWriting",
  7264. protocol: 'tests',
  7265. fn: function (){
  7266. var self=this;
  7267. var stream,collection;
  7268. return smalltalk.withContext(function($ctx1) {
  7269. var $1;
  7270. collection=self._newCollection();
  7271. stream=self._newStream();
  7272. $ctx1.sendIdx["newStream"]=1;
  7273. _st(collection)._do_((function(each){
  7274. return smalltalk.withContext(function($ctx2) {
  7275. return _st(stream)._nextPut_(each);
  7276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7277. $1=_st(stream)._contents();
  7278. $ctx1.sendIdx["contents"]=1;
  7279. self._assert_equals_($1,collection);
  7280. $ctx1.sendIdx["assert:equals:"]=1;
  7281. stream=self._newStream();
  7282. _st(stream)._nextPutAll_(collection);
  7283. self._assert_equals_(_st(stream)._contents(),collection);
  7284. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7285. args: [],
  7286. 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",
  7287. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7288. referencedClasses: []
  7289. }),
  7290. smalltalk.StreamTest);
  7291. smalltalk.addMethod(
  7292. smalltalk.method({
  7293. selector: "collectionClass",
  7294. protocol: 'accessing',
  7295. fn: function (){
  7296. var self=this;
  7297. return smalltalk.withContext(function($ctx1) {
  7298. return nil;
  7299. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7300. args: [],
  7301. source: "collectionClass\x0a\x09^ nil",
  7302. messageSends: [],
  7303. referencedClasses: []
  7304. }),
  7305. smalltalk.StreamTest.klass);
  7306. smalltalk.addMethod(
  7307. smalltalk.method({
  7308. selector: "isAbstract",
  7309. protocol: 'testing',
  7310. fn: function (){
  7311. var self=this;
  7312. return smalltalk.withContext(function($ctx1) {
  7313. var $1;
  7314. $1=_st(self._collectionClass())._isNil();
  7315. return $1;
  7316. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  7317. args: [],
  7318. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  7319. messageSends: ["isNil", "collectionClass"],
  7320. referencedClasses: []
  7321. }),
  7322. smalltalk.StreamTest.klass);
  7323. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7324. smalltalk.addMethod(
  7325. smalltalk.method({
  7326. selector: "newCollection",
  7327. protocol: 'accessing',
  7328. fn: function (){
  7329. var self=this;
  7330. return smalltalk.withContext(function($ctx1) {
  7331. var $1;
  7332. $1=[true,(1),(3).__at((4)),"foo"];
  7333. return $1;
  7334. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  7335. args: [],
  7336. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  7337. messageSends: ["@"],
  7338. referencedClasses: []
  7339. }),
  7340. smalltalk.ArrayStreamTest);
  7341. smalltalk.addMethod(
  7342. smalltalk.method({
  7343. selector: "collectionClass",
  7344. protocol: 'accessing',
  7345. fn: function (){
  7346. var self=this;
  7347. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7348. return smalltalk.withContext(function($ctx1) {
  7349. return $Array();
  7350. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  7351. args: [],
  7352. source: "collectionClass\x0a\x09^ Array",
  7353. messageSends: [],
  7354. referencedClasses: ["Array"]
  7355. }),
  7356. smalltalk.ArrayStreamTest.klass);
  7357. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7358. smalltalk.addMethod(
  7359. smalltalk.method({
  7360. selector: "newCollection",
  7361. protocol: 'accessing',
  7362. fn: function (){
  7363. var self=this;
  7364. return smalltalk.withContext(function($ctx1) {
  7365. return "hello world";
  7366. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  7367. args: [],
  7368. source: "newCollection\x0a\x09^ 'hello world'",
  7369. messageSends: [],
  7370. referencedClasses: []
  7371. }),
  7372. smalltalk.StringStreamTest);
  7373. smalltalk.addMethod(
  7374. smalltalk.method({
  7375. selector: "collectionClass",
  7376. protocol: 'accessing',
  7377. fn: function (){
  7378. var self=this;
  7379. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7380. return smalltalk.withContext(function($ctx1) {
  7381. return $String();
  7382. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  7383. args: [],
  7384. source: "collectionClass\x0a\x09^ String",
  7385. messageSends: [],
  7386. referencedClasses: ["String"]
  7387. }),
  7388. smalltalk.StringStreamTest.klass);
  7389. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7390. smalltalk.addMethod(
  7391. smalltalk.method({
  7392. selector: "testCopying",
  7393. protocol: 'tests',
  7394. fn: function (){
  7395. var self=this;
  7396. return smalltalk.withContext(function($ctx1) {
  7397. self._assert_equals_(nil._copy(),nil);
  7398. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  7399. args: [],
  7400. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  7401. messageSends: ["assert:equals:", "copy"],
  7402. referencedClasses: []
  7403. }),
  7404. smalltalk.UndefinedTest);
  7405. smalltalk.addMethod(
  7406. smalltalk.method({
  7407. selector: "testDeepCopy",
  7408. protocol: 'tests',
  7409. fn: function (){
  7410. var self=this;
  7411. return smalltalk.withContext(function($ctx1) {
  7412. self._assert_(_st(nil._deepCopy()).__eq(nil));
  7413. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  7414. args: [],
  7415. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  7416. messageSends: ["assert:", "=", "deepCopy"],
  7417. referencedClasses: []
  7418. }),
  7419. smalltalk.UndefinedTest);
  7420. smalltalk.addMethod(
  7421. smalltalk.method({
  7422. selector: "testIfNil",
  7423. protocol: 'tests',
  7424. fn: function (){
  7425. var self=this;
  7426. return smalltalk.withContext(function($ctx1) {
  7427. var $1,$3,$2,$4,$6,$5;
  7428. if(($receiver = nil) == nil || $receiver == null){
  7429. $1=true;
  7430. } else {
  7431. $1=nil;
  7432. };
  7433. self._assert_equals_($1,true);
  7434. $ctx1.sendIdx["assert:equals:"]=1;
  7435. if(($receiver = nil) == nil || $receiver == null){
  7436. $3=nil;
  7437. } else {
  7438. $3=true;
  7439. };
  7440. $2=_st($3).__eq(true);
  7441. $ctx1.sendIdx["="]=1;
  7442. self._deny_($2);
  7443. $ctx1.sendIdx["deny:"]=1;
  7444. if(($receiver = nil) == nil || $receiver == null){
  7445. $4=true;
  7446. } else {
  7447. $4=false;
  7448. };
  7449. self._assert_equals_($4,true);
  7450. if(($receiver = nil) == nil || $receiver == null){
  7451. $6=false;
  7452. } else {
  7453. $6=true;
  7454. };
  7455. $5=_st($6).__eq(true);
  7456. self._deny_($5);
  7457. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  7458. args: [],
  7459. 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",
  7460. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7461. referencedClasses: []
  7462. }),
  7463. smalltalk.UndefinedTest);
  7464. smalltalk.addMethod(
  7465. smalltalk.method({
  7466. selector: "testIsNil",
  7467. protocol: 'tests',
  7468. fn: function (){
  7469. var self=this;
  7470. return smalltalk.withContext(function($ctx1) {
  7471. self._assert_(nil._isNil());
  7472. self._deny_(nil._notNil());
  7473. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  7474. args: [],
  7475. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  7476. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  7477. referencedClasses: []
  7478. }),
  7479. smalltalk.UndefinedTest);
  7480. });