2
0

Kernel-Tests.js 215 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  11. return smalltalk.withContext(function($ctx1) {
  12. self._shouldnt_raise_((function(){
  13. return smalltalk.withContext(function($ctx2) {
  14. return _st(_st((function(){
  15. return smalltalk.withContext(function($ctx3) {
  16. return _st(_st($Error())._new())._signal();
  17. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._valueWithInterval_((0)))._clearInterval();
  18. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  19. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  20. args: [],
  21. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  22. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  23. referencedClasses: ["Error"]
  24. }),
  25. smalltalk.BlockClosureTest);
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "testCanClearTimeout",
  29. category: 'tests',
  30. fn: function (){
  31. var self=this;
  32. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  33. return smalltalk.withContext(function($ctx1) {
  34. self._shouldnt_raise_((function(){
  35. return smalltalk.withContext(function($ctx2) {
  36. return _st(_st((function(){
  37. return smalltalk.withContext(function($ctx3) {
  38. return _st(_st($Error())._new())._signal();
  39. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._valueWithTimeout_((0)))._clearTimeout();
  40. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  41. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  42. args: [],
  43. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  44. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  45. referencedClasses: ["Error"]
  46. }),
  47. smalltalk.BlockClosureTest);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "testCompiledSource",
  51. category: 'tests',
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. self._assert_(_st(_st((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return (1).__plus((1));
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  59. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  60. args: [],
  61. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  62. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.BlockClosureTest);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "testCurrySelf",
  69. category: 'tests',
  70. fn: function (){
  71. var self=this;
  72. var curriedMethod,array;
  73. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  74. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  75. return smalltalk.withContext(function($ctx1) {
  76. curriedMethod=_st(_st((function(selfarg,x){
  77. return smalltalk.withContext(function($ctx2) {
  78. return _st(selfarg)._at_(x);
  79. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  80. array=[(3), (1), (4)];
  81. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  82. _st((function(){
  83. return smalltalk.withContext(function($ctx2) {
  84. return self._assert_equals_(_st(array)._foo_((2)),(1));
  85. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  86. return smalltalk.withContext(function($ctx2) {
  87. return _st($Array())._removeCompiledMethod_(curriedMethod);
  88. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  89. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  90. args: [],
  91. 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 category: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  92. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"],
  93. referencedClasses: ["Array", "ClassBuilder"]
  94. }),
  95. smalltalk.BlockClosureTest);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "testEnsure",
  99. category: 'tests',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. self._assert_equals_(_st((function(){
  104. return smalltalk.withContext(function($ctx2) {
  105. return (3);
  106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  107. return smalltalk.withContext(function($ctx2) {
  108. return (4);
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  111. args: [],
  112. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  113. messageSends: ["assert:equals:", "ensure:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. smalltalk.method({
  119. selector: "testEnsureRaises",
  120. category: 'tests',
  121. fn: function (){
  122. var self=this;
  123. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  124. return smalltalk.withContext(function($ctx1) {
  125. self._should_raise_((function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. return _st((function(){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(_st($Error())._new())._signal();
  130. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  131. return smalltalk.withContext(function($ctx3) {
  132. return true;
  133. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  135. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  136. args: [],
  137. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  138. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  139. referencedClasses: ["Error"]
  140. }),
  141. smalltalk.BlockClosureTest);
  142. smalltalk.addMethod(
  143. smalltalk.method({
  144. selector: "testExceptionSemantics",
  145. category: 'tests',
  146. fn: function (){
  147. var self=this;
  148. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  149. return smalltalk.withContext(function($ctx1) {
  150. self._timeout_((100));
  151. _st(self._async_((function(){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st((function(){
  154. return smalltalk.withContext(function($ctx3) {
  155. self._assert_(true);
  156. _st($Error())._signal();
  157. self._deny_(true);
  158. return self._finished();
  159. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._on_do_($Error(),(function(ex){
  160. return smalltalk.withContext(function($ctx3) {
  161. return self._finished();
  162. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2)})}));
  163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  165. args: [],
  166. 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",
  167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"],
  168. referencedClasses: ["Error"]
  169. }),
  170. smalltalk.BlockClosureTest);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "testNewWithValues",
  174. category: 'tests',
  175. fn: function (){
  176. var self=this;
  177. return smalltalk.withContext(function($ctx1) {
  178. function theTestPrototype() {this.name = "theTestPrototype";}
  179. function theTestConstructor(arg1, arg2, arg3) {}
  180. theTestConstructor.prototype = new theTestPrototype;
  181. var theWrappedConstructor = _st(theTestConstructor);
  182. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  183. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  184. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  185. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  186. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  187. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  188. args: [],
  189. 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>",
  190. messageSends: [],
  191. referencedClasses: []
  192. }),
  193. smalltalk.BlockClosureTest);
  194. smalltalk.addMethod(
  195. smalltalk.method({
  196. selector: "testNumArgs",
  197. category: 'tests',
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. self._assert_equals_(_st((function(){
  202. return smalltalk.withContext(function($ctx2) {
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  204. self._assert_equals_(_st((function(a,b){
  205. return smalltalk.withContext(function($ctx2) {
  206. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  208. args: [],
  209. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  210. messageSends: ["assert:equals:", "numArgs"],
  211. referencedClasses: []
  212. }),
  213. smalltalk.BlockClosureTest);
  214. smalltalk.addMethod(
  215. smalltalk.method({
  216. selector: "testOnDo",
  217. category: 'tests',
  218. fn: function (){
  219. var self=this;
  220. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  221. return smalltalk.withContext(function($ctx1) {
  222. self._assert_(_st((function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st(_st($Error())._new())._signal();
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  226. return smalltalk.withContext(function($ctx2) {
  227. return true;
  228. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  229. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  230. args: [],
  231. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  232. messageSends: ["assert:", "on:do:", "signal", "new"],
  233. referencedClasses: ["Error"]
  234. }),
  235. smalltalk.BlockClosureTest);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "testValue",
  239. category: 'tests',
  240. fn: function (){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) {
  243. self._assert_equals_(_st((function(){
  244. return smalltalk.withContext(function($ctx2) {
  245. return (1).__plus((1));
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  247. self._assert_equals_(_st((function(x){
  248. return smalltalk.withContext(function($ctx2) {
  249. return _st(x).__plus((1));
  250. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  251. self._assert_equals_(_st((function(x,y){
  252. return smalltalk.withContext(function($ctx2) {
  253. return _st(x).__star(y);
  254. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  255. self._assert_equals_(_st((function(a,b,c){
  256. return smalltalk.withContext(function($ctx2) {
  257. return (1);
  258. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  259. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  260. args: [],
  261. 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",
  262. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  263. referencedClasses: []
  264. }),
  265. smalltalk.BlockClosureTest);
  266. smalltalk.addMethod(
  267. smalltalk.method({
  268. selector: "testValueWithPossibleArguments",
  269. category: 'tests',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) {
  273. self._assert_equals_(_st((function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return (1);
  276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  277. self._assert_equals_(_st((function(a){
  278. return smalltalk.withContext(function($ctx2) {
  279. return _st(a).__plus((4));
  280. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  281. self._assert_equals_(_st((function(a,b){
  282. return smalltalk.withContext(function($ctx2) {
  283. return _st(a).__plus(b);
  284. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  285. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  286. args: [],
  287. 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.",
  288. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  289. referencedClasses: []
  290. }),
  291. smalltalk.BlockClosureTest);
  292. smalltalk.addMethod(
  293. smalltalk.method({
  294. selector: "testWhileFalse",
  295. category: 'tests',
  296. fn: function (){
  297. var self=this;
  298. var i;
  299. return smalltalk.withContext(function($ctx1) {
  300. i=(0);
  301. _st((function(){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(i).__gt((5));
  304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  305. return smalltalk.withContext(function($ctx2) {
  306. i=_st(i).__plus((1));
  307. return i;
  308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  309. self._assert_equals_(i,(6));
  310. i=(0);
  311. _st((function(){
  312. return smalltalk.withContext(function($ctx2) {
  313. i=_st(i).__plus((1));
  314. i;
  315. return _st(i).__gt((5));
  316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  317. self._assert_equals_(i,(6));
  318. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  319. args: [],
  320. 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",
  321. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
  322. referencedClasses: []
  323. }),
  324. smalltalk.BlockClosureTest);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "testWhileTrue",
  328. category: 'tests',
  329. fn: function (){
  330. var self=this;
  331. var i;
  332. return smalltalk.withContext(function($ctx1) {
  333. i=(0);
  334. _st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(i).__lt((5));
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  338. return smalltalk.withContext(function($ctx2) {
  339. i=_st(i).__plus((1));
  340. return i;
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  342. self._assert_equals_(i,(5));
  343. i=(0);
  344. _st((function(){
  345. return smalltalk.withContext(function($ctx2) {
  346. i=_st(i).__plus((1));
  347. i;
  348. return _st(i).__lt((5));
  349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  350. self._assert_equals_(i,(5));
  351. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  352. args: [],
  353. 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",
  354. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
  355. referencedClasses: []
  356. }),
  357. smalltalk.BlockClosureTest);
  358. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  359. smalltalk.addMethod(
  360. smalltalk.method({
  361. selector: "testEquality",
  362. category: 'tests',
  363. fn: function (){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. self._deny_((0).__eq(false));
  367. self._deny_(false.__eq((0)));
  368. self._deny_("".__eq(false));
  369. self._deny_(false.__eq(""));
  370. self._assert_(true.__eq(true));
  371. self._deny_(false.__eq(true));
  372. self._deny_(true.__eq(false));
  373. self._assert_(false.__eq(false));
  374. self._assert_(_st(true._yourself()).__eq(true));
  375. self._assert_(_st(true._yourself()).__eq(true._yourself()));
  376. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  377. args: [],
  378. 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)",
  379. messageSends: ["deny:", "=", "assert:", "yourself"],
  380. referencedClasses: []
  381. }),
  382. smalltalk.BooleanTest);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "testIdentity",
  386. category: 'tests',
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. self._deny_((0).__eq_eq(false));
  391. self._deny_(false.__eq_eq((0)));
  392. self._deny_("".__eq_eq(false));
  393. self._deny_(false.__eq_eq(""));
  394. self._assert_(true.__eq_eq(true));
  395. self._deny_(false.__eq_eq(true));
  396. self._deny_(true.__eq_eq(false));
  397. self._assert_(false.__eq_eq(false));
  398. self._assert_(_st(true._yourself()).__eq_eq(true));
  399. self._assert_(_st(true._yourself()).__eq_eq(true._yourself()));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  401. args: [],
  402. 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",
  403. messageSends: ["deny:", "==", "assert:", "yourself"],
  404. referencedClasses: []
  405. }),
  406. smalltalk.BooleanTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testIfTrueIfFalse",
  410. category: 'tests',
  411. fn: function (){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  415. $1=self;
  416. if(smalltalk.assert(true)){
  417. $2="alternative block";
  418. };
  419. _st($1)._assert_equals_($2,"alternative block");
  420. $3=self;
  421. if(! smalltalk.assert(true)){
  422. $4="alternative block";
  423. };
  424. _st($3)._assert_equals_($4,nil);
  425. $5=self;
  426. if(smalltalk.assert(false)){
  427. $6="alternative block";
  428. };
  429. _st($5)._assert_equals_($6,nil);
  430. $7=self;
  431. if(! smalltalk.assert(false)){
  432. $8="alternative block";
  433. };
  434. _st($7)._assert_equals_($8,"alternative block");
  435. $9=self;
  436. if(smalltalk.assert(false)){
  437. $10="alternative block";
  438. } else {
  439. $10="alternative block2";
  440. };
  441. _st($9)._assert_equals_($10,"alternative block2");
  442. $11=self;
  443. if(smalltalk.assert(false)){
  444. $12="alternative block2";
  445. } else {
  446. $12="alternative block";
  447. };
  448. _st($11)._assert_equals_($12,"alternative block");
  449. $13=self;
  450. if(smalltalk.assert(true)){
  451. $14="alternative block";
  452. } else {
  453. $14="alternative block2";
  454. };
  455. _st($13)._assert_equals_($14,"alternative block");
  456. $15=self;
  457. if(smalltalk.assert(true)){
  458. $16="alternative block2";
  459. } else {
  460. $16="alternative block";
  461. };
  462. _st($15)._assert_equals_($16,"alternative block2");
  463. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  464. args: [],
  465. 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'.",
  466. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  467. referencedClasses: []
  468. }),
  469. smalltalk.BooleanTest);
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "testIfTrueIfFalseWithBoxing",
  473. category: 'tests',
  474. fn: function (){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) {
  477. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  478. $1=self;
  479. $3=true._yourself();
  480. if(smalltalk.assert($3)){
  481. $2="alternative block";
  482. };
  483. _st($1)._assert_equals_($2,"alternative block");
  484. $4=self;
  485. $6=true._yourself();
  486. if(! smalltalk.assert($6)){
  487. $5="alternative block";
  488. };
  489. _st($4)._assert_equals_($5,nil);
  490. $7=self;
  491. $9=false._yourself();
  492. if(smalltalk.assert($9)){
  493. $8="alternative block";
  494. };
  495. _st($7)._assert_equals_($8,nil);
  496. $10=self;
  497. $12=false._yourself();
  498. if(! smalltalk.assert($12)){
  499. $11="alternative block";
  500. };
  501. _st($10)._assert_equals_($11,"alternative block");
  502. $13=self;
  503. $15=false._yourself();
  504. if(smalltalk.assert($15)){
  505. $14="alternative block";
  506. } else {
  507. $14="alternative block2";
  508. };
  509. _st($13)._assert_equals_($14,"alternative block2");
  510. $16=self;
  511. $18=false._yourself();
  512. if(smalltalk.assert($18)){
  513. $17="alternative block2";
  514. } else {
  515. $17="alternative block";
  516. };
  517. _st($16)._assert_equals_($17,"alternative block");
  518. $19=self;
  519. $21=true._yourself();
  520. if(smalltalk.assert($21)){
  521. $20="alternative block";
  522. } else {
  523. $20="alternative block2";
  524. };
  525. _st($19)._assert_equals_($20,"alternative block");
  526. $22=self;
  527. $24=true._yourself();
  528. if(smalltalk.assert($24)){
  529. $23="alternative block2";
  530. } else {
  531. $23="alternative block";
  532. };
  533. _st($22)._assert_equals_($23,"alternative block2");
  534. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  535. args: [],
  536. 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'.",
  537. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  538. referencedClasses: []
  539. }),
  540. smalltalk.BooleanTest);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "testLogic",
  544. category: 'tests',
  545. fn: function (){
  546. var self=this;
  547. return smalltalk.withContext(function($ctx1) {
  548. var $1,$2,$3,$4,$5,$6,$7,$8;
  549. $1=self;
  550. _st($1)._assert_(true.__and(true));
  551. _st($1)._deny_(true.__and(false));
  552. _st($1)._deny_(false.__and(true));
  553. $2=_st($1)._deny_(false.__and(false));
  554. $3=self;
  555. _st($3)._assert_(true.__or(true));
  556. _st($3)._assert_(true.__or(false));
  557. _st($3)._assert_(false.__or(true));
  558. $4=_st($3)._deny_(false.__or(false));
  559. $5=self;
  560. _st($5)._assert_(true.__and((1).__gt((0))));
  561. _st($5)._deny_(_st((1).__gt((0))).__and(false));
  562. $6=_st($5)._deny_(_st((1).__gt((0))).__and((1).__gt((2))));
  563. $7=self;
  564. _st($7)._assert_(false.__or((1).__gt((0))));
  565. _st($7)._assert_(_st((1).__gt((0))).__or(false));
  566. $8=_st($7)._assert_(_st((1).__gt((0))).__or((1).__gt((2))));
  567. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  568. args: [],
  569. 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))",
  570. messageSends: ["assert:", "&", "deny:", "|", ">"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.BooleanTest);
  574. smalltalk.addMethod(
  575. smalltalk.method({
  576. selector: "testLogicKeywords",
  577. category: 'tests',
  578. fn: function (){
  579. var self=this;
  580. return smalltalk.withContext(function($ctx1) {
  581. var $1,$2,$3,$4,$5,$6,$7,$8;
  582. $1=self;
  583. _st($1)._assert_(true._and_((function(){
  584. return smalltalk.withContext(function($ctx2) {
  585. return true;
  586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  587. _st($1)._deny_(true._and_((function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return false;
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  591. _st($1)._deny_(false._and_((function(){
  592. return smalltalk.withContext(function($ctx2) {
  593. return true;
  594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  595. $2=_st($1)._deny_(false._and_((function(){
  596. return smalltalk.withContext(function($ctx2) {
  597. return false;
  598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  599. $3=self;
  600. _st($3)._assert_(true._or_((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. return true;
  603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  604. _st($3)._assert_(true._or_((function(){
  605. return smalltalk.withContext(function($ctx2) {
  606. return false;
  607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  608. _st($3)._assert_(false._or_((function(){
  609. return smalltalk.withContext(function($ctx2) {
  610. return true;
  611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  612. $4=_st($3)._deny_(false._or_((function(){
  613. return smalltalk.withContext(function($ctx2) {
  614. return false;
  615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  616. $5=self;
  617. _st($5)._assert_(true._and_((function(){
  618. return smalltalk.withContext(function($ctx2) {
  619. return (1).__gt((0));
  620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  621. _st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  622. return smalltalk.withContext(function($ctx2) {
  623. return false;
  624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  625. $6=_st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  626. return smalltalk.withContext(function($ctx2) {
  627. return (1).__gt((2));
  628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  629. $7=self;
  630. _st($7)._assert_(false._or_((function(){
  631. return smalltalk.withContext(function($ctx2) {
  632. return (1).__gt((0));
  633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  634. _st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  635. return smalltalk.withContext(function($ctx2) {
  636. return false;
  637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  638. $8=_st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  639. return smalltalk.withContext(function($ctx2) {
  640. return (1).__gt((2));
  641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  642. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  643. args: [],
  644. 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 ])",
  645. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  646. referencedClasses: []
  647. }),
  648. smalltalk.BooleanTest);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "testNonBooleanError",
  652. category: 'tests',
  653. fn: function (){
  654. var self=this;
  655. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  656. return smalltalk.withContext(function($ctx1) {
  657. self._should_raise_((function(){
  658. return smalltalk.withContext(function($ctx2) {
  659. if(smalltalk.assert("")){
  660. } else {
  661. };
  662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$NonBooleanReceiver());
  663. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  664. args: [],
  665. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  666. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  667. referencedClasses: ["NonBooleanReceiver"]
  668. }),
  669. smalltalk.BooleanTest);
  670. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "setUp",
  674. category: 'running',
  675. fn: function (){
  676. var self=this;
  677. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  678. return smalltalk.withContext(function($ctx1) {
  679. self["@builder"]=_st($ClassBuilder())._new();
  680. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  681. args: [],
  682. source: "setUp\x0a\x09builder := ClassBuilder new",
  683. messageSends: ["new"],
  684. referencedClasses: ["ClassBuilder"]
  685. }),
  686. smalltalk.ClassBuilderTest);
  687. smalltalk.addMethod(
  688. smalltalk.method({
  689. selector: "tearDown",
  690. category: 'running',
  691. fn: function (){
  692. var self=this;
  693. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  694. return smalltalk.withContext(function($ctx1) {
  695. var $1;
  696. $1=self["@theClass"];
  697. if(($receiver = $1) == nil || $receiver == undefined){
  698. $1;
  699. } else {
  700. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  701. self["@theClass"]=nil;
  702. self["@theClass"];
  703. };
  704. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  705. args: [],
  706. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  707. messageSends: ["ifNotNil:", "removeClass:", "current"],
  708. referencedClasses: ["Smalltalk"]
  709. }),
  710. smalltalk.ClassBuilderTest);
  711. smalltalk.addMethod(
  712. smalltalk.method({
  713. selector: "testClassCopy",
  714. category: 'tests',
  715. fn: function (){
  716. var self=this;
  717. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  718. return smalltalk.withContext(function($ctx1) {
  719. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  720. self._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  721. self._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  722. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  723. self._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  724. self._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  725. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  726. args: [],
  727. 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",
  728. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  729. referencedClasses: ["ObjectMock"]
  730. }),
  731. smalltalk.ClassBuilderTest);
  732. smalltalk.addMethod(
  733. smalltalk.method({
  734. selector: "testClassMigration",
  735. category: 'tests',
  736. fn: function (){
  737. var self=this;
  738. var instance,oldClass;
  739. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  740. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  741. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  742. return smalltalk.withContext(function($ctx1) {
  743. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  744. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  745. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  746. self._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  747. self._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  748. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  749. self._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  750. self._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  751. self._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  752. self._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  753. self._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  754. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  755. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  756. args: [],
  757. 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",
  758. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  759. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  760. }),
  761. smalltalk.ClassBuilderTest);
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "testClassMigrationWithClassInstanceVariables",
  765. category: 'tests',
  766. fn: function (){
  767. var self=this;
  768. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  769. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  770. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  771. return smalltalk.withContext(function($ctx1) {
  772. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  773. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  774. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  775. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  776. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  777. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  778. args: [],
  779. 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",
  780. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  781. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  782. }),
  783. smalltalk.ClassBuilderTest);
  784. smalltalk.addMethod(
  785. smalltalk.method({
  786. selector: "testClassMigrationWithSubclasses",
  787. category: 'tests',
  788. fn: function (){
  789. var self=this;
  790. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  791. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  792. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  793. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  794. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  795. return smalltalk.withContext(function($ctx1) {
  796. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  797. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  798. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  799. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  800. self._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  801. self._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  802. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  803. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  804. return smalltalk.withContext(function($ctx2) {
  805. return _st(_st($Smalltalk())._current())._removeClass_(each);
  806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  807. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  808. args: [],
  809. 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 ]",
  810. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"],
  811. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  812. }),
  813. smalltalk.ClassBuilderTest);
  814. smalltalk.addMethod(
  815. smalltalk.method({
  816. selector: "testInstanceVariableNames",
  817. category: 'tests',
  818. fn: function (){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  822. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  823. args: [],
  824. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  825. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  826. referencedClasses: []
  827. }),
  828. smalltalk.ClassBuilderTest);
  829. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "assertSameContents:as:",
  833. category: 'convenience',
  834. fn: function (aCollection,anotherCollection){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) {
  837. self._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  838. _st(aCollection)._do_((function(each){
  839. return smalltalk.withContext(function($ctx2) {
  840. return self._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  842. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  843. args: ["aCollection", "anotherCollection"],
  844. 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)) ]",
  845. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.CollectionTest);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "collection",
  852. category: 'accessing',
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  860. args: [],
  861. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  862. messageSends: ["withAll:", "defaultValues", "collectionClass"],
  863. referencedClasses: []
  864. }),
  865. smalltalk.CollectionTest);
  866. smalltalk.addMethod(
  867. smalltalk.method({
  868. selector: "collectionClass",
  869. category: 'accessing',
  870. fn: function (){
  871. var self=this;
  872. return smalltalk.withContext(function($ctx1) {
  873. var $1;
  874. $1=_st(self._class())._collectionClass();
  875. return $1;
  876. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  877. args: [],
  878. source: "collectionClass\x0a\x09^ self class collectionClass",
  879. messageSends: ["collectionClass", "class"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.CollectionTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "collectionWithDuplicates",
  886. category: 'accessing',
  887. fn: function (){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1;
  891. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  892. return $1;
  893. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  894. args: [],
  895. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  896. messageSends: ["withAll:", "collectionClass"],
  897. referencedClasses: []
  898. }),
  899. smalltalk.CollectionTest);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "defaultValues",
  903. category: 'accessing',
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) {
  907. var $1;
  908. $1=[(1), (2), (3), (-4)];
  909. return $1;
  910. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  911. args: [],
  912. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.CollectionTest);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "isCollectionReadOnly",
  920. category: 'testing',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. return false;
  925. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  926. args: [],
  927. source: "isCollectionReadOnly\x0a\x09^ false",
  928. messageSends: [],
  929. referencedClasses: []
  930. }),
  931. smalltalk.CollectionTest);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "testAsArray",
  935. category: 'tests',
  936. fn: function (){
  937. var self=this;
  938. return smalltalk.withContext(function($ctx1) {
  939. self._assertSameContents_as_(self._collection(),_st(self._collection())._asArray());
  940. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  941. args: [],
  942. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  943. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  944. referencedClasses: []
  945. }),
  946. smalltalk.CollectionTest);
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "testAsOrderedCollection",
  950. category: 'tests',
  951. fn: function (){
  952. var self=this;
  953. return smalltalk.withContext(function($ctx1) {
  954. self._assertSameContents_as_(self._collection(),_st(self._collection())._asOrderedCollection());
  955. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  956. args: [],
  957. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  958. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  959. referencedClasses: []
  960. }),
  961. smalltalk.CollectionTest);
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "testAsSet",
  965. category: 'tests',
  966. fn: function (){
  967. var self=this;
  968. var c,set;
  969. return smalltalk.withContext(function($ctx1) {
  970. c=self._collectionWithDuplicates();
  971. set=_st(c)._asSet();
  972. self._assert_equals_(_st(set)._size(),(5));
  973. _st(c)._do_((function(each){
  974. return smalltalk.withContext(function($ctx2) {
  975. return self._assert_(_st(set)._includes_(each));
  976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  977. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  978. args: [],
  979. 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) ]",
  980. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.CollectionTest);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "testCollect",
  987. category: 'tests',
  988. fn: function (){
  989. var self=this;
  990. var newCollection;
  991. return smalltalk.withContext(function($ctx1) {
  992. newCollection=[(1), (2), (3), (4)];
  993. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  994. return smalltalk.withContext(function($ctx2) {
  995. return _st(each)._abs();
  996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  997. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  998. args: [],
  999. 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",
  1000. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.CollectionTest);
  1004. smalltalk.addMethod(
  1005. smalltalk.method({
  1006. selector: "testDetect",
  1007. category: 'tests',
  1008. fn: function (){
  1009. var self=this;
  1010. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1011. return smalltalk.withContext(function($ctx1) {
  1012. self._assert_equals_(_st(self._collection())._detect_((function(each){
  1013. return smalltalk.withContext(function($ctx2) {
  1014. return _st(each).__lt((0));
  1015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  1016. self._should_raise_((function(){
  1017. return smalltalk.withContext(function($ctx2) {
  1018. return _st(self._collection())._detect_((function(each){
  1019. return smalltalk.withContext(function($ctx3) {
  1020. return _st(each).__eq((6));
  1021. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  1022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1023. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1024. args: [],
  1025. 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",
  1026. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="],
  1027. referencedClasses: ["Error"]
  1028. }),
  1029. smalltalk.CollectionTest);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "testDo",
  1033. category: 'tests',
  1034. fn: function (){
  1035. var self=this;
  1036. var newCollection;
  1037. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1038. return smalltalk.withContext(function($ctx1) {
  1039. newCollection=_st($OrderedCollection())._new();
  1040. _st(self._collection())._do_((function(each){
  1041. return smalltalk.withContext(function($ctx2) {
  1042. return _st(newCollection)._add_(each);
  1043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1044. self._assertSameContents_as_(self._collection(),newCollection);
  1045. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1046. args: [],
  1047. 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",
  1048. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
  1049. referencedClasses: ["OrderedCollection"]
  1050. }),
  1051. smalltalk.CollectionTest);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "testIsEmpty",
  1055. category: 'tests',
  1056. fn: function (){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) {
  1059. self._assert_(_st(_st(self._collectionClass())._new())._isEmpty());
  1060. self._deny_(_st(self._collection())._isEmpty());
  1061. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1062. args: [],
  1063. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1064. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1065. referencedClasses: []
  1066. }),
  1067. smalltalk.CollectionTest);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "testSelect",
  1071. category: 'tests',
  1072. fn: function (){
  1073. var self=this;
  1074. var newCollection;
  1075. return smalltalk.withContext(function($ctx1) {
  1076. newCollection=[(2), (-4)];
  1077. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1078. return smalltalk.withContext(function($ctx2) {
  1079. return _st(each)._even();
  1080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1081. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1082. args: [],
  1083. 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",
  1084. messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.CollectionTest);
  1088. smalltalk.addMethod(
  1089. smalltalk.method({
  1090. selector: "testSize",
  1091. category: 'tests',
  1092. fn: function (){
  1093. var self=this;
  1094. return smalltalk.withContext(function($ctx1) {
  1095. self._assert_equals_(_st(_st(self._collectionClass())._new())._size(),(0));
  1096. self._assert_equals_(_st(self._collection())._size(),(4));
  1097. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1098. args: [],
  1099. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1100. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1101. referencedClasses: []
  1102. }),
  1103. smalltalk.CollectionTest);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "collectionClass",
  1107. category: 'accessing',
  1108. fn: function (){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. return nil;
  1112. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1113. args: [],
  1114. source: "collectionClass\x0a\x09^ nil",
  1115. messageSends: [],
  1116. referencedClasses: []
  1117. }),
  1118. smalltalk.CollectionTest.klass);
  1119. smalltalk.addMethod(
  1120. smalltalk.method({
  1121. selector: "isAbstract",
  1122. category: 'testing',
  1123. fn: function (){
  1124. var self=this;
  1125. return smalltalk.withContext(function($ctx1) {
  1126. var $1;
  1127. $1=_st(self._collectionClass())._isNil();
  1128. return $1;
  1129. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1130. args: [],
  1131. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1132. messageSends: ["isNil", "collectionClass"],
  1133. referencedClasses: []
  1134. }),
  1135. smalltalk.CollectionTest.klass);
  1136. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1137. smalltalk.addMethod(
  1138. smalltalk.method({
  1139. selector: "testAt",
  1140. category: 'tests',
  1141. fn: function (){
  1142. var self=this;
  1143. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1144. return smalltalk.withContext(function($ctx1) {
  1145. self._assert_equals_(_st(self._collection())._at_((4)),(-4));
  1146. self._should_raise_((function(){
  1147. return smalltalk.withContext(function($ctx2) {
  1148. return _st(self._collection())._at_((5));
  1149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1150. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1151. args: [],
  1152. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1153. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1154. referencedClasses: ["Error"]
  1155. }),
  1156. smalltalk.IndexableCollectionTest);
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "testAtIfAbsent",
  1160. category: 'tests',
  1161. fn: function (){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. self._assert_equals_(_st(self._collection())._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1165. return smalltalk.withContext(function($ctx2) {
  1166. return "none";
  1167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  1168. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1169. args: [],
  1170. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1171. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"],
  1172. referencedClasses: []
  1173. }),
  1174. smalltalk.IndexableCollectionTest);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "testContains",
  1178. category: 'tests',
  1179. fn: function (){
  1180. var self=this;
  1181. var collection;
  1182. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1183. return smalltalk.withContext(function($ctx1) {
  1184. collection=self._collection();
  1185. self._assert_(_st(self._collection())._contains_((function(each){
  1186. return smalltalk.withContext(function($ctx2) {
  1187. return _st(each).__eq(_st(self._collection())._first());
  1188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1189. self._deny_(_st(self._collection())._contains_((function(each){
  1190. return smalltalk.withContext(function($ctx2) {
  1191. return _st(each).__eq(_st($Object())._new());
  1192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1193. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1194. args: [],
  1195. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1196. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1197. referencedClasses: ["Object"]
  1198. }),
  1199. smalltalk.IndexableCollectionTest);
  1200. smalltalk.addMethod(
  1201. smalltalk.method({
  1202. selector: "testIndexOf",
  1203. category: 'tests',
  1204. fn: function (){
  1205. var self=this;
  1206. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. self._assert_equals_(_st(self._collection())._indexOf_((2)),(2));
  1209. self._should_raise_((function(){
  1210. return smalltalk.withContext(function($ctx2) {
  1211. return _st(self._collection())._indexOf_((999));
  1212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1213. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1214. return smalltalk.withContext(function($ctx2) {
  1215. return "sentinel";
  1216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1217. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1218. args: [],
  1219. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1220. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1221. referencedClasses: ["Error"]
  1222. }),
  1223. smalltalk.IndexableCollectionTest);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "testWithIndexDo",
  1227. category: 'tests',
  1228. fn: function (){
  1229. var self=this;
  1230. var collection;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. collection=self._collection();
  1233. _st(self._collection())._withIndexDo_((function(each,index){
  1234. return smalltalk.withContext(function($ctx2) {
  1235. return self._assert_equals_(_st(collection)._at_(index),each);
  1236. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  1237. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1238. args: [],
  1239. 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 ]",
  1240. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1241. referencedClasses: []
  1242. }),
  1243. smalltalk.IndexableCollectionTest);
  1244. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1245. smalltalk.addMethod(
  1246. smalltalk.method({
  1247. selector: "collection",
  1248. category: 'accessing',
  1249. fn: function (){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $1;
  1253. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4))]);
  1254. return $1;
  1255. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1256. args: [],
  1257. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1258. messageSends: ["->"],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.HashedCollectionTest);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "collectionWithDuplicates",
  1265. category: 'accessing',
  1266. fn: function (){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. var $1;
  1270. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4)),"e".__minus_gt((1)),"f".__minus_gt((2)),"g".__minus_gt((10))]);
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1273. args: [],
  1274. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1275. messageSends: ["->"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.HashedCollectionTest);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "testAsDictionary",
  1282. category: 'tests',
  1283. fn: function (){
  1284. var self=this;
  1285. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1286. return smalltalk.withContext(function($ctx1) {
  1287. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1288. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1289. args: [],
  1290. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1291. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1292. referencedClasses: ["Dictionary"]
  1293. }),
  1294. smalltalk.HashedCollectionTest);
  1295. smalltalk.addMethod(
  1296. smalltalk.method({
  1297. selector: "testAt",
  1298. category: 'tests',
  1299. fn: function (){
  1300. var self=this;
  1301. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1302. return smalltalk.withContext(function($ctx1) {
  1303. self._assert_equals_(_st(self._collection())._at_("a"),(2));
  1304. self._should_raise_((function(){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return _st(self._collection())._at_((5));
  1307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1309. args: [],
  1310. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1311. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1312. referencedClasses: ["Error"]
  1313. }),
  1314. smalltalk.HashedCollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "testContains",
  1318. category: 'tests',
  1319. fn: function (){
  1320. var self=this;
  1321. var collection;
  1322. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1323. return smalltalk.withContext(function($ctx1) {
  1324. collection=self._collection();
  1325. self._assert_(_st(self._collection())._contains_((function(each){
  1326. return smalltalk.withContext(function($ctx2) {
  1327. return _st(each).__eq(_st(_st(self._collection())._values())._first());
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1329. self._deny_(_st(self._collection())._contains_((function(each){
  1330. return smalltalk.withContext(function($ctx2) {
  1331. return _st(each).__eq(_st($Object())._new());
  1332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1333. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1334. args: [],
  1335. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection values first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1336. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1337. referencedClasses: ["Object"]
  1338. }),
  1339. smalltalk.HashedCollectionTest);
  1340. smalltalk.addMethod(
  1341. smalltalk.method({
  1342. selector: "testFrom",
  1343. category: 'tests',
  1344. fn: function (){
  1345. var self=this;
  1346. var associations;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. associations=["a".__minus_gt((1)),"b".__minus_gt((2))];
  1349. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1350. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1351. args: [],
  1352. 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 }.",
  1353. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.HashedCollectionTest);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "testIndexOf",
  1360. category: 'tests',
  1361. fn: function (){
  1362. var self=this;
  1363. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1364. return smalltalk.withContext(function($ctx1) {
  1365. self._assert_equals_(_st(self._collection())._indexOf_((2)),"a");
  1366. self._should_raise_((function(){
  1367. return smalltalk.withContext(function($ctx2) {
  1368. return _st(self._collection())._indexOf_((999));
  1369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1370. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. return "sentinel";
  1373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1374. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1375. args: [],
  1376. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 'a'.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1377. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1378. referencedClasses: ["Error"]
  1379. }),
  1380. smalltalk.HashedCollectionTest);
  1381. smalltalk.addMethod(
  1382. smalltalk.method({
  1383. selector: "testNewFromPairs",
  1384. category: 'tests',
  1385. fn: function (){
  1386. var self=this;
  1387. var flattenedAssociations;
  1388. return smalltalk.withContext(function($ctx1) {
  1389. flattenedAssociations=["a",(1),"b",(2)];
  1390. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1391. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1392. args: [],
  1393. 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 }.",
  1394. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1395. referencedClasses: []
  1396. }),
  1397. smalltalk.HashedCollectionTest);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "collectionClass",
  1401. category: 'accessing',
  1402. fn: function (){
  1403. var self=this;
  1404. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1405. return smalltalk.withContext(function($ctx1) {
  1406. var $1;
  1407. $1=$HashedCollection();
  1408. return $1;
  1409. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1410. args: [],
  1411. source: "collectionClass\x0a\x09^ HashedCollection",
  1412. messageSends: [],
  1413. referencedClasses: ["HashedCollection"]
  1414. }),
  1415. smalltalk.HashedCollectionTest.klass);
  1416. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1417. smalltalk.addMethod(
  1418. smalltalk.method({
  1419. selector: "collection",
  1420. category: 'accessing',
  1421. fn: function (){
  1422. var self=this;
  1423. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1424. return smalltalk.withContext(function($ctx1) {
  1425. var $2,$3,$1;
  1426. $2=_st($Dictionary())._new();
  1427. _st($2)._at_put_((1),(1));
  1428. _st($2)._at_put_("a",(2));
  1429. _st($2)._at_put_(true,(3));
  1430. _st($2)._at_put_((4),(-4));
  1431. $3=_st($2)._yourself();
  1432. $1=$3;
  1433. return $1;
  1434. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1435. args: [],
  1436. 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: 4 put: -4;\x0a\x09\x09yourself",
  1437. messageSends: ["at:put:", "new", "yourself"],
  1438. referencedClasses: ["Dictionary"]
  1439. }),
  1440. smalltalk.DictionaryTest);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "collectionWithDuplicates",
  1444. category: 'accessing',
  1445. fn: function (){
  1446. var self=this;
  1447. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $2,$3,$1;
  1450. $2=_st($Dictionary())._new();
  1451. _st($2)._at_put_((1),(1));
  1452. _st($2)._at_put_("a",(2));
  1453. _st($2)._at_put_(true,(3));
  1454. _st($2)._at_put_((4),(-4));
  1455. _st($2)._at_put_("b",(1));
  1456. _st($2)._at_put_((3),(3));
  1457. _st($2)._at_put_(false,(12));
  1458. $3=_st($2)._yourself();
  1459. $1=$3;
  1460. return $1;
  1461. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1462. args: [],
  1463. 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",
  1464. messageSends: ["at:put:", "new", "yourself"],
  1465. referencedClasses: ["Dictionary"]
  1466. }),
  1467. smalltalk.DictionaryTest);
  1468. smalltalk.addMethod(
  1469. smalltalk.method({
  1470. selector: "testAccessing",
  1471. category: 'tests',
  1472. fn: function (){
  1473. var self=this;
  1474. var d;
  1475. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1476. return smalltalk.withContext(function($ctx1) {
  1477. d=_st($Dictionary())._new();
  1478. _st(d)._at_put_("hello","world");
  1479. self._assert_equals_(_st(d)._at_("hello"),"world");
  1480. self._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1481. return smalltalk.withContext(function($ctx2) {
  1482. return nil;
  1483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1484. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1485. return smalltalk.withContext(function($ctx2) {
  1486. return nil;
  1487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1488. self._assert_(_st(d)._includesKey_("hello"));
  1489. self._deny_(_st(d)._includesKey_("foo"));
  1490. _st(d)._at_put_((1),(2));
  1491. self._assert_equals_(_st(d)._at_((1)),(2));
  1492. _st(d)._at_put_((1).__at((3)),(3));
  1493. self._assert_equals_(_st(d)._at_((1).__at((3))),(3));
  1494. self._assert_(_st(d)._includesKey_((1).__at((3))));
  1495. self._deny_(_st(d)._includesKey_((3).__at((1))));
  1496. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1497. args: [],
  1498. 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)",
  1499. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1500. referencedClasses: ["Dictionary"]
  1501. }),
  1502. smalltalk.DictionaryTest);
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "testAsHashedCollection",
  1506. category: 'tests',
  1507. fn: function (){
  1508. var self=this;
  1509. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1510. return smalltalk.withContext(function($ctx1) {
  1511. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  1512. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  1513. args: [],
  1514. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  1515. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  1516. referencedClasses: ["HashedCollection"]
  1517. }),
  1518. smalltalk.DictionaryTest);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "testDynamicDictionaries",
  1522. category: 'tests',
  1523. fn: function (){
  1524. var self=this;
  1525. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1526. return smalltalk.withContext(function($ctx1) {
  1527. self._assert_equals_(_st(smalltalk.HashedCollection._from_(["hello".__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1529. args: [],
  1530. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1531. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1532. referencedClasses: ["Dictionary"]
  1533. }),
  1534. smalltalk.DictionaryTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testEquality",
  1538. category: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var d1,d2;
  1542. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1543. return smalltalk.withContext(function($ctx1) {
  1544. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1545. self._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1546. $1=_st($Dictionary())._new();
  1547. _st($1)._at_put_((1),(2));
  1548. $2=_st($1)._yourself();
  1549. d1=$2;
  1550. $3=_st($Dictionary())._new();
  1551. _st($3)._at_put_((1),(2));
  1552. $4=_st($3)._yourself();
  1553. d2=$4;
  1554. self._assert_(_st(d1).__eq(d2));
  1555. $5=_st($Dictionary())._new();
  1556. _st($5)._at_put_((1),(3));
  1557. $6=_st($5)._yourself();
  1558. d2=$6;
  1559. self._deny_(_st(d1).__eq(d2));
  1560. $7=_st($Dictionary())._new();
  1561. _st($7)._at_put_((2),(2));
  1562. $8=_st($7)._yourself();
  1563. d2=$8;
  1564. self._deny_(_st(d1).__eq(d2));
  1565. $9=_st($Dictionary())._new();
  1566. _st($9)._at_put_((1),(2));
  1567. _st($9)._at_put_((3),(4));
  1568. $10=_st($9)._yourself();
  1569. d2=$10;
  1570. self._deny_(_st(d1).__eq(d2));
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1572. args: [],
  1573. 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.",
  1574. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1575. referencedClasses: ["Dictionary"]
  1576. }),
  1577. smalltalk.DictionaryTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testIfAbsent",
  1581. category: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var d,visited;
  1585. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1586. return smalltalk.withContext(function($ctx1) {
  1587. visited=false;
  1588. d=_st($Dictionary())._new();
  1589. _st(d)._at_ifAbsent_("hello",(function(){
  1590. return smalltalk.withContext(function($ctx2) {
  1591. visited=true;
  1592. return visited;
  1593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1594. self._assert_(visited);
  1595. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1596. args: [],
  1597. source: "testIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1598. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1599. referencedClasses: ["Dictionary"]
  1600. }),
  1601. smalltalk.DictionaryTest);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "testIfPresent",
  1605. category: 'tests',
  1606. fn: function (){
  1607. var self=this;
  1608. var d,visited,absent;
  1609. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1610. return smalltalk.withContext(function($ctx1) {
  1611. visited=false;
  1612. d=_st($Dictionary())._new();
  1613. _st(d)._at_put_("hello","world");
  1614. _st(d)._at_ifPresent_("hello",(function(value){
  1615. return smalltalk.withContext(function($ctx2) {
  1616. visited=value;
  1617. return visited;
  1618. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1619. self._assert_equals_(visited,"world");
  1620. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. visited=value;
  1623. return visited;
  1624. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1625. self._assert_(_st(absent)._isNil());
  1626. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1627. args: [],
  1628. source: "testIfPresent\x0a\x0a\x09| d visited absent |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  1629. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  1630. referencedClasses: ["Dictionary"]
  1631. }),
  1632. smalltalk.DictionaryTest);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "testIfPresentIfAbsent",
  1636. category: 'tests',
  1637. fn: function (){
  1638. var self=this;
  1639. var d,visited;
  1640. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1641. return smalltalk.withContext(function($ctx1) {
  1642. visited=false;
  1643. d=_st($Dictionary())._new();
  1644. _st(d)._at_put_("hello","world");
  1645. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1646. return smalltalk.withContext(function($ctx2) {
  1647. visited=value;
  1648. return visited;
  1649. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1650. return smalltalk.withContext(function($ctx2) {
  1651. visited=true;
  1652. return visited;
  1653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1654. self._assert_equals_(visited,"world");
  1655. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1656. return smalltalk.withContext(function($ctx2) {
  1657. visited=value;
  1658. return visited;
  1659. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1660. return smalltalk.withContext(function($ctx2) {
  1661. visited=true;
  1662. return visited;
  1663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1664. self._assert_(visited);
  1665. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1666. args: [],
  1667. source: "testIfPresentIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1668. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  1669. referencedClasses: ["Dictionary"]
  1670. }),
  1671. smalltalk.DictionaryTest);
  1672. smalltalk.addMethod(
  1673. smalltalk.method({
  1674. selector: "testKeys",
  1675. category: 'tests',
  1676. fn: function (){
  1677. var self=this;
  1678. var d;
  1679. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1680. return smalltalk.withContext(function($ctx1) {
  1681. d=_st($Dictionary())._new();
  1682. _st(d)._at_put_((1),(2));
  1683. _st(d)._at_put_((2),(3));
  1684. _st(d)._at_put_((3),(4));
  1685. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1686. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1687. args: [],
  1688. 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)",
  1689. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  1690. referencedClasses: ["Dictionary"]
  1691. }),
  1692. smalltalk.DictionaryTest);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "testPointKey",
  1696. category: 'tests',
  1697. fn: function (){
  1698. var self=this;
  1699. var d;
  1700. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1701. return smalltalk.withContext(function($ctx1) {
  1702. d=_st($Dictionary())._new();
  1703. _st(d)._at_put_((1).__at((1)),"foo");
  1704. self._assert_equals_(_st(d)._at_((1).__at((1))),"foo");
  1705. _st(d)._at_put_((1).__at((1)),"bar");
  1706. self._assert_equals_(_st(d)._at_((1).__at((1))),"bar");
  1707. _st(d)._removeKey_((1).__at((1)));
  1708. self._assert_equals_(_st(d)._at_ifAbsent_((1).__at((1)),(function(){
  1709. return smalltalk.withContext(function($ctx2) {
  1710. return "baz";
  1711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1712. self._deny_(_st(d)._includesKey_((1).__at((1))));
  1713. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1714. args: [],
  1715. 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)",
  1716. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  1717. referencedClasses: ["Dictionary"]
  1718. }),
  1719. smalltalk.DictionaryTest);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "testPrintString",
  1723. category: 'tests',
  1724. fn: function (){
  1725. var self=this;
  1726. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1727. return smalltalk.withContext(function($ctx1) {
  1728. var $1,$2;
  1729. $1=_st($Dictionary())._new();
  1730. _st($1)._at_put_("firstname","James");
  1731. _st($1)._at_put_("lastname","Bond");
  1732. $2=_st($1)._printString();
  1733. self._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1735. args: [],
  1736. 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'')'",
  1737. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1738. referencedClasses: ["Dictionary"]
  1739. }),
  1740. smalltalk.DictionaryTest);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "testRemoveKey",
  1744. category: 'tests',
  1745. fn: function (){
  1746. var self=this;
  1747. var d,key;
  1748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. d=_st($Dictionary())._new();
  1751. _st(d)._at_put_((1),(2));
  1752. _st(d)._at_put_((2),(3));
  1753. _st(d)._at_put_((3),(4));
  1754. key=(2);
  1755. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1756. _st(d)._removeKey_(key);
  1757. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1758. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  1759. self._deny_(_st(d)._includesKey_((2)));
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1761. args: [],
  1762. 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)",
  1763. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1764. referencedClasses: ["Dictionary"]
  1765. }),
  1766. smalltalk.DictionaryTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testRemoveKeyIfAbsent",
  1770. category: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. var d,key;
  1774. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1775. return smalltalk.withContext(function($ctx1) {
  1776. d=_st($Dictionary())._new();
  1777. _st(d)._at_put_((1),(2));
  1778. _st(d)._at_put_((2),(3));
  1779. _st(d)._at_put_((3),(4));
  1780. key=(2);
  1781. self._assert_equals_(_st(d)._removeKey_(key),(3));
  1782. key=(3);
  1783. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1784. return smalltalk.withContext(function($ctx2) {
  1785. return (42);
  1786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1787. key="why";
  1788. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return (42);
  1791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1792. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1793. args: [],
  1794. 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.",
  1795. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  1796. referencedClasses: ["Dictionary"]
  1797. }),
  1798. smalltalk.DictionaryTest);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "testSize",
  1802. category: 'tests',
  1803. fn: function (){
  1804. var self=this;
  1805. var d;
  1806. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1807. return smalltalk.withContext(function($ctx1) {
  1808. d=_st($Dictionary())._new();
  1809. self._assert_equals_(_st(d)._size(),(0));
  1810. _st(d)._at_put_((1),(2));
  1811. self._assert_equals_(_st(d)._size(),(1));
  1812. _st(d)._at_put_((2),(3));
  1813. self._assert_equals_(_st(d)._size(),(2));
  1814. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1815. args: [],
  1816. 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.",
  1817. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  1818. referencedClasses: ["Dictionary"]
  1819. }),
  1820. smalltalk.DictionaryTest);
  1821. smalltalk.addMethod(
  1822. smalltalk.method({
  1823. selector: "testValues",
  1824. category: 'tests',
  1825. fn: function (){
  1826. var self=this;
  1827. var d;
  1828. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1829. return smalltalk.withContext(function($ctx1) {
  1830. d=_st($Dictionary())._new();
  1831. _st(d)._at_put_((1),(2));
  1832. _st(d)._at_put_((2),(3));
  1833. _st(d)._at_put_((3),(4));
  1834. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1835. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1836. args: [],
  1837. 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)",
  1838. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  1839. referencedClasses: ["Dictionary"]
  1840. }),
  1841. smalltalk.DictionaryTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "collectionClass",
  1845. category: 'accessing',
  1846. fn: function (){
  1847. var self=this;
  1848. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1849. return smalltalk.withContext(function($ctx1) {
  1850. var $1;
  1851. $1=$Dictionary();
  1852. return $1;
  1853. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1854. args: [],
  1855. source: "collectionClass\x0a\x09^ Dictionary",
  1856. messageSends: [],
  1857. referencedClasses: ["Dictionary"]
  1858. }),
  1859. smalltalk.DictionaryTest.klass);
  1860. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1861. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "testAtIfAbsent",
  1865. category: 'tests',
  1866. fn: function (){
  1867. var self=this;
  1868. var array;
  1869. return smalltalk.withContext(function($ctx1) {
  1870. array=["hello", "world"];
  1871. self._assert_equals_(_st(array)._at_((1)),"hello");
  1872. self._assert_equals_(_st(array)._at_((2)),"world");
  1873. self._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1874. return smalltalk.withContext(function($ctx2) {
  1875. return "not found";
  1876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1877. self._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return "not found";
  1880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1881. self._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1882. return smalltalk.withContext(function($ctx2) {
  1883. return "not found";
  1884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1885. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1886. return smalltalk.withContext(function($ctx2) {
  1887. return "not found";
  1888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1890. args: [],
  1891. source: "testAtIfAbsent\x0a\x09| array |\x0a\x09array := #('hello' 'world').\x0a\x09self assert: (array at: 1) equals: 'hello'.\x0a\x09self assert: (array at: 2) equals: 'world'.\x0a\x09self assert: (array at: 2 ifAbsent: ['not found']) equals: 'world'.\x0a\x09self assert: (array at: 0 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: -10 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: 3 ifAbsent: ['not found']) equals: 'not found'.",
  1892. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1893. referencedClasses: []
  1894. }),
  1895. smalltalk.ArrayTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testFirstN",
  1899. category: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. return smalltalk.withContext(function($ctx1) {
  1903. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1904. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1905. args: [],
  1906. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  1907. messageSends: ["assert:equals:", "first:"],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.ArrayTest);
  1911. smalltalk.addMethod(
  1912. smalltalk.method({
  1913. selector: "testIfEmpty",
  1914. category: 'tests',
  1915. fn: function (){
  1916. var self=this;
  1917. return smalltalk.withContext(function($ctx1) {
  1918. self._assert_equals_(""._ifEmpty_((function(){
  1919. return smalltalk.withContext(function($ctx2) {
  1920. return "zork";
  1921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1922. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1923. args: [],
  1924. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  1925. messageSends: ["assert:equals:", "ifEmpty:"],
  1926. referencedClasses: []
  1927. }),
  1928. smalltalk.ArrayTest);
  1929. smalltalk.addMethod(
  1930. smalltalk.method({
  1931. selector: "testPrintString",
  1932. category: 'tests',
  1933. fn: function (){
  1934. var self=this;
  1935. var array;
  1936. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1937. return smalltalk.withContext(function($ctx1) {
  1938. var $1,$2,$3,$4;
  1939. array=_st($Array())._new();
  1940. self._assert_equals_(_st(array)._printString(),"an Array ()");
  1941. $1=array;
  1942. _st($1)._add_((1));
  1943. $2=_st($1)._add_((3));
  1944. self._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1945. _st(array)._add_("foo");
  1946. self._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1947. $3=array;
  1948. _st($3)._remove_((1));
  1949. $4=_st($3)._remove_((3));
  1950. self._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1951. _st(array)._addLast_((3));
  1952. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1953. _st(array)._addLast_((3));
  1954. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1955. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1956. args: [],
  1957. 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)'.",
  1958. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1959. referencedClasses: ["Array"]
  1960. }),
  1961. smalltalk.ArrayTest);
  1962. smalltalk.addMethod(
  1963. smalltalk.method({
  1964. selector: "testRemoveFromTo",
  1965. category: 'tests',
  1966. fn: function (){
  1967. var self=this;
  1968. return smalltalk.withContext(function($ctx1) {
  1969. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((1),(3)),[(4)]);
  1970. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(3)),[(1), (4)]);
  1971. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  1972. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  1973. args: [],
  1974. 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)",
  1975. messageSends: ["assert:equals:", "removeFrom:to:"],
  1976. referencedClasses: []
  1977. }),
  1978. smalltalk.ArrayTest);
  1979. smalltalk.addMethod(
  1980. smalltalk.method({
  1981. selector: "testRemoveIndex",
  1982. category: 'tests',
  1983. fn: function (){
  1984. var self=this;
  1985. return smalltalk.withContext(function($ctx1) {
  1986. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((2)),[(1), (3), (4)]);
  1987. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((1)),[(2), (3), (4)]);
  1988. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  1989. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  1990. args: [],
  1991. 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: #()",
  1992. messageSends: ["assert:equals:", "removeIndex:"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.ArrayTest);
  1996. smalltalk.addMethod(
  1997. smalltalk.method({
  1998. selector: "collectionClass",
  1999. category: 'accessing',
  2000. fn: function (){
  2001. var self=this;
  2002. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2003. return smalltalk.withContext(function($ctx1) {
  2004. var $1;
  2005. $1=$Array();
  2006. return $1;
  2007. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2008. args: [],
  2009. source: "collectionClass\x0a\x09^ Array",
  2010. messageSends: [],
  2011. referencedClasses: ["Array"]
  2012. }),
  2013. smalltalk.ArrayTest.klass);
  2014. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "collection",
  2018. category: 'accessing',
  2019. fn: function (){
  2020. var self=this;
  2021. return smalltalk.withContext(function($ctx1) {
  2022. return "hello";
  2023. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2024. args: [],
  2025. source: "collection\x0a\x09^'hello'",
  2026. messageSends: [],
  2027. referencedClasses: []
  2028. }),
  2029. smalltalk.StringTest);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "collectionWithDuplicates",
  2033. category: 'accessing',
  2034. fn: function (){
  2035. var self=this;
  2036. return smalltalk.withContext(function($ctx1) {
  2037. return "abbaerte";
  2038. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2039. args: [],
  2040. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2041. messageSends: [],
  2042. referencedClasses: []
  2043. }),
  2044. smalltalk.StringTest);
  2045. smalltalk.addMethod(
  2046. smalltalk.method({
  2047. selector: "testAddRemove",
  2048. category: 'tests',
  2049. fn: function (){
  2050. var self=this;
  2051. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2052. return smalltalk.withContext(function($ctx1) {
  2053. self._should_raise_((function(){
  2054. return smalltalk.withContext(function($ctx2) {
  2055. return "hello"._add_("a");
  2056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2057. self._should_raise_((function(){
  2058. return smalltalk.withContext(function($ctx2) {
  2059. return "hello"._remove_("h");
  2060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2061. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2062. args: [],
  2063. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2064. messageSends: ["should:raise:", "add:", "remove:"],
  2065. referencedClasses: ["Error"]
  2066. }),
  2067. smalltalk.StringTest);
  2068. smalltalk.addMethod(
  2069. smalltalk.method({
  2070. selector: "testAsArray",
  2071. category: 'tests',
  2072. fn: function (){
  2073. var self=this;
  2074. return smalltalk.withContext(function($ctx1) {
  2075. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2076. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2077. args: [],
  2078. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2079. messageSends: ["assert:equals:", "asArray"],
  2080. referencedClasses: []
  2081. }),
  2082. smalltalk.StringTest);
  2083. smalltalk.addMethod(
  2084. smalltalk.method({
  2085. selector: "testAt",
  2086. category: 'tests',
  2087. fn: function (){
  2088. var self=this;
  2089. return smalltalk.withContext(function($ctx1) {
  2090. self._assert_equals_("hello"._at_((1)),"h");
  2091. self._assert_equals_("hello"._at_((5)),"o");
  2092. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2093. return smalltalk.withContext(function($ctx2) {
  2094. return nil;
  2095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2096. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2097. args: [],
  2098. source: "testAt\x0a\x09self assert: ('hello' at: 1) equals: 'h'.\x0a\x09self assert: ('hello' at: 5) equals: 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [nil]) equals: nil",
  2099. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2100. referencedClasses: []
  2101. }),
  2102. smalltalk.StringTest);
  2103. smalltalk.addMethod(
  2104. smalltalk.method({
  2105. selector: "testAtPut",
  2106. category: 'tests',
  2107. fn: function (){
  2108. var self=this;
  2109. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2110. return smalltalk.withContext(function($ctx1) {
  2111. self._should_raise_((function(){
  2112. return smalltalk.withContext(function($ctx2) {
  2113. return "hello"._at_put_((1),"a");
  2114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2115. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2116. args: [],
  2117. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2118. messageSends: ["should:raise:", "at:put:"],
  2119. referencedClasses: ["Error"]
  2120. }),
  2121. smalltalk.StringTest);
  2122. smalltalk.addMethod(
  2123. smalltalk.method({
  2124. selector: "testCollect",
  2125. category: 'tests',
  2126. fn: function (){
  2127. var self=this;
  2128. var newCollection;
  2129. return smalltalk.withContext(function($ctx1) {
  2130. newCollection="hheelllloo";
  2131. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  2132. return smalltalk.withContext(function($ctx2) {
  2133. return _st(each).__comma(each);
  2134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2135. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  2136. args: [],
  2137. 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",
  2138. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2139. referencedClasses: []
  2140. }),
  2141. smalltalk.StringTest);
  2142. smalltalk.addMethod(
  2143. smalltalk.method({
  2144. selector: "testCopyWithoutAll",
  2145. category: 'tests',
  2146. fn: function (){
  2147. var self=this;
  2148. return smalltalk.withContext(function($ctx1) {
  2149. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  2150. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  2151. args: [],
  2152. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  2153. messageSends: ["assert:equals:", "copyWithoutAll:"],
  2154. referencedClasses: []
  2155. }),
  2156. smalltalk.StringTest);
  2157. smalltalk.addMethod(
  2158. smalltalk.method({
  2159. selector: "testDetect",
  2160. category: 'tests',
  2161. fn: function (){
  2162. var self=this;
  2163. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2164. return smalltalk.withContext(function($ctx1) {
  2165. self._assert_equals_(_st(self._collection())._detect_((function(each){
  2166. return smalltalk.withContext(function($ctx2) {
  2167. return _st(each).__eq("h");
  2168. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  2169. self._should_raise_((function(){
  2170. return smalltalk.withContext(function($ctx2) {
  2171. return _st(self._collection())._detect_((function(each){
  2172. return smalltalk.withContext(function($ctx3) {
  2173. return _st(each).__eq((6));
  2174. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  2175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2176. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  2177. args: [],
  2178. 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",
  2179. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  2180. referencedClasses: ["Error"]
  2181. }),
  2182. smalltalk.StringTest);
  2183. smalltalk.addMethod(
  2184. smalltalk.method({
  2185. selector: "testEquality",
  2186. category: 'tests',
  2187. fn: function (){
  2188. var self=this;
  2189. return smalltalk.withContext(function($ctx1) {
  2190. self._assert_equals_("hello","hello");
  2191. self._deny_("hello".__eq("world"));
  2192. self._deny_("hello".__eq([]._at_ifAbsent_((1),(function(){
  2193. return smalltalk.withContext(function($ctx2) {
  2194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))));
  2195. self._assert_equals_("hello","hello"._yourself());
  2196. self._assert_equals_("hello"._yourself(),"hello");
  2197. self._deny_("".__eq((0)));
  2198. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  2199. args: [],
  2200. 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",
  2201. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  2202. referencedClasses: []
  2203. }),
  2204. smalltalk.StringTest);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "testIdentity",
  2208. category: 'tests',
  2209. fn: function (){
  2210. var self=this;
  2211. return smalltalk.withContext(function($ctx1) {
  2212. self._assert_("hello".__eq_eq("hello"));
  2213. self._deny_("hello".__eq_eq("world"));
  2214. self._assert_("hello".__eq_eq("hello"._yourself()));
  2215. self._assert_(_st("hello"._yourself()).__eq_eq("hello"));
  2216. self._deny_("".__eq_eq((0)));
  2217. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  2218. args: [],
  2219. 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",
  2220. messageSends: ["assert:", "==", "deny:", "yourself"],
  2221. referencedClasses: []
  2222. }),
  2223. smalltalk.StringTest);
  2224. smalltalk.addMethod(
  2225. smalltalk.method({
  2226. selector: "testIncludesSubString",
  2227. category: 'tests',
  2228. fn: function (){
  2229. var self=this;
  2230. return smalltalk.withContext(function($ctx1) {
  2231. self._assert_("amber"._includesSubString_("ber"));
  2232. self._deny_("amber"._includesSubString_("zork"));
  2233. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  2234. args: [],
  2235. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2236. messageSends: ["assert:", "includesSubString:", "deny:"],
  2237. referencedClasses: []
  2238. }),
  2239. smalltalk.StringTest);
  2240. smalltalk.addMethod(
  2241. smalltalk.method({
  2242. selector: "testIndexOf",
  2243. category: 'tests',
  2244. fn: function (){
  2245. var self=this;
  2246. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2247. return smalltalk.withContext(function($ctx1) {
  2248. self._assert_equals_(_st(self._collection())._indexOf_("e"),(2));
  2249. self._should_raise_((function(){
  2250. return smalltalk.withContext(function($ctx2) {
  2251. return _st(self._collection())._indexOf_((999));
  2252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2253. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  2254. return smalltalk.withContext(function($ctx2) {
  2255. return "sentinel";
  2256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  2257. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  2258. args: [],
  2259. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 'e') equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  2260. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2261. referencedClasses: ["Error"]
  2262. }),
  2263. smalltalk.StringTest);
  2264. smalltalk.addMethod(
  2265. smalltalk.method({
  2266. selector: "testJoin",
  2267. category: 'tests',
  2268. fn: function (){
  2269. var self=this;
  2270. return smalltalk.withContext(function($ctx1) {
  2271. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  2272. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  2273. args: [],
  2274. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2275. messageSends: ["assert:equals:", "join:"],
  2276. referencedClasses: []
  2277. }),
  2278. smalltalk.StringTest);
  2279. smalltalk.addMethod(
  2280. smalltalk.method({
  2281. selector: "testSelect",
  2282. category: 'tests',
  2283. fn: function (){
  2284. var self=this;
  2285. var newCollection;
  2286. return smalltalk.withContext(function($ctx1) {
  2287. newCollection="o";
  2288. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. return _st(each).__eq("o");
  2291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2292. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  2293. args: [],
  2294. 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",
  2295. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2296. referencedClasses: []
  2297. }),
  2298. smalltalk.StringTest);
  2299. smalltalk.addMethod(
  2300. smalltalk.method({
  2301. selector: "testSize",
  2302. category: 'tests',
  2303. fn: function (){
  2304. var self=this;
  2305. return smalltalk.withContext(function($ctx1) {
  2306. self._assert_equals_("smalltalk"._size(),(9));
  2307. self._assert_equals_(""._size(),(0));
  2308. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  2309. args: [],
  2310. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2311. messageSends: ["assert:equals:", "size"],
  2312. referencedClasses: []
  2313. }),
  2314. smalltalk.StringTest);
  2315. smalltalk.addMethod(
  2316. smalltalk.method({
  2317. selector: "testStreamContents",
  2318. category: 'tests',
  2319. fn: function (){
  2320. var self=this;
  2321. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2322. return smalltalk.withContext(function($ctx1) {
  2323. var $1,$2;
  2324. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. $1=aStream;
  2327. _st($1)._nextPutAll_("hello");
  2328. _st($1)._space();
  2329. $2=_st($1)._nextPutAll_("world");
  2330. return $2;
  2331. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  2332. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  2333. args: [],
  2334. 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'",
  2335. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2336. referencedClasses: ["String"]
  2337. }),
  2338. smalltalk.StringTest);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "collectionClass",
  2342. category: 'accessing',
  2343. fn: function (){
  2344. var self=this;
  2345. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2346. return smalltalk.withContext(function($ctx1) {
  2347. var $1;
  2348. $1=$String();
  2349. return $1;
  2350. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  2351. args: [],
  2352. source: "collectionClass\x0a\x09^ String",
  2353. messageSends: [],
  2354. referencedClasses: ["String"]
  2355. }),
  2356. smalltalk.StringTest.klass);
  2357. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2358. smalltalk.addMethod(
  2359. smalltalk.method({
  2360. selector: "testShow",
  2361. category: 'tests',
  2362. fn: function (){
  2363. var self=this;
  2364. var originalTranscript;
  2365. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2366. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  2367. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2368. return smalltalk.withContext(function($ctx1) {
  2369. originalTranscript=_st($Transcript())._current();
  2370. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  2371. self._shouldnt_raise_((function(){
  2372. return smalltalk.withContext(function($ctx2) {
  2373. return _st($Transcript())._show_("Hello console!");
  2374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2375. self._shouldnt_raise_((function(){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. return _st($Transcript())._show_(console);
  2378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2379. _st($Transcript())._register_(originalTranscript);
  2380. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  2381. args: [],
  2382. 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.",
  2383. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  2384. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  2385. }),
  2386. smalltalk.ConsoleTranscriptTest);
  2387. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2388. smalltalk.addMethod(
  2389. smalltalk.method({
  2390. selector: "jsObject",
  2391. category: 'accessing',
  2392. fn: function (){
  2393. var self=this;
  2394. return smalltalk.withContext(function($ctx1) {
  2395. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2396. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  2397. args: [],
  2398. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2399. messageSends: [],
  2400. referencedClasses: []
  2401. }),
  2402. smalltalk.JSObjectProxyTest);
  2403. smalltalk.addMethod(
  2404. smalltalk.method({
  2405. selector: "testAtIfAbsent",
  2406. category: 'tests',
  2407. fn: function (){
  2408. var self=this;
  2409. var testObject;
  2410. return smalltalk.withContext(function($ctx1) {
  2411. testObject=self._jsObject();
  2412. self._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. return "Property does not exist";
  2415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  2416. self._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2417. return smalltalk.withContext(function($ctx2) {
  2418. return "Property does not exist";
  2419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2420. self._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2421. return smalltalk.withContext(function($ctx2) {
  2422. return "Property does not exist";
  2423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  2424. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2425. return smalltalk.withContext(function($ctx2) {
  2426. return "Property does not exist";
  2427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2428. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2429. args: [],
  2430. 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.",
  2431. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2432. referencedClasses: []
  2433. }),
  2434. smalltalk.JSObjectProxyTest);
  2435. smalltalk.addMethod(
  2436. smalltalk.method({
  2437. selector: "testAtIfPresent",
  2438. category: 'tests',
  2439. fn: function (){
  2440. var self=this;
  2441. var testObject;
  2442. return smalltalk.withContext(function($ctx1) {
  2443. testObject=self._jsObject();
  2444. self._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  2445. return smalltalk.withContext(function($ctx2) {
  2446. return "hello ".__comma(_st(x)._asString());
  2447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),nil);
  2448. self._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return "hello ".__comma(_st(x)._asString());
  2451. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2452. self._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  2453. return smalltalk.withContext(function($ctx2) {
  2454. return "hello ".__comma(_st(x)._asString());
  2455. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello 1");
  2456. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  2457. return smalltalk.withContext(function($ctx2) {
  2458. return "hello ".__comma(_st(x)._asString());
  2459. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2460. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2461. args: [],
  2462. 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'.",
  2463. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  2464. referencedClasses: []
  2465. }),
  2466. smalltalk.JSObjectProxyTest);
  2467. smalltalk.addMethod(
  2468. smalltalk.method({
  2469. selector: "testAtIfPresentIfAbsent",
  2470. category: 'tests',
  2471. fn: function (){
  2472. var self=this;
  2473. var testObject;
  2474. return smalltalk.withContext(function($ctx1) {
  2475. testObject=self._jsObject();
  2476. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  2477. return smalltalk.withContext(function($ctx2) {
  2478. return "hello ".__comma(_st(x)._asString());
  2479. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2480. return smalltalk.withContext(function($ctx2) {
  2481. return "not present";
  2482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not present");
  2483. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  2484. return smalltalk.withContext(function($ctx2) {
  2485. return "hello ".__comma(_st(x)._asString());
  2486. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return "not present";
  2489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2490. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  2491. return smalltalk.withContext(function($ctx2) {
  2492. return "hello ".__comma(_st(x)._asString());
  2493. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2494. return smalltalk.withContext(function($ctx2) {
  2495. return "not present";
  2496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello 1");
  2497. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  2498. return smalltalk.withContext(function($ctx2) {
  2499. return "hello ".__comma(_st(x)._asString());
  2500. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2501. return smalltalk.withContext(function($ctx2) {
  2502. return "not present";
  2503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2504. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2505. args: [],
  2506. 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'.",
  2507. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  2508. referencedClasses: []
  2509. }),
  2510. smalltalk.JSObjectProxyTest);
  2511. smalltalk.addMethod(
  2512. smalltalk.method({
  2513. selector: "testDNU",
  2514. category: 'tests',
  2515. fn: function (){
  2516. var self=this;
  2517. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2518. return smalltalk.withContext(function($ctx1) {
  2519. self._should_raise_((function(){
  2520. return smalltalk.withContext(function($ctx2) {
  2521. return _st(self._jsObject())._foo();
  2522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2523. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  2524. args: [],
  2525. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2526. messageSends: ["should:raise:", "foo", "jsObject"],
  2527. referencedClasses: ["MessageNotUnderstood"]
  2528. }),
  2529. smalltalk.JSObjectProxyTest);
  2530. smalltalk.addMethod(
  2531. smalltalk.method({
  2532. selector: "testMessageSend",
  2533. category: 'tests',
  2534. fn: function (){
  2535. var self=this;
  2536. return smalltalk.withContext(function($ctx1) {
  2537. self._assert_equals_(_st(self._jsObject())._a(),(1));
  2538. self._assert_equals_(_st(self._jsObject())._b(),(2));
  2539. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  2541. args: [],
  2542. 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",
  2543. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.JSObjectProxyTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testMethodWithArguments",
  2550. category: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. return smalltalk.withContext(function($ctx1) {
  2554. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  2555. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  2556. args: [],
  2557. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2558. messageSends: ["assert:equals:", "c:", "jsObject"],
  2559. referencedClasses: []
  2560. }),
  2561. smalltalk.JSObjectProxyTest);
  2562. smalltalk.addMethod(
  2563. smalltalk.method({
  2564. selector: "testPrinting",
  2565. category: 'tests',
  2566. fn: function (){
  2567. var self=this;
  2568. return smalltalk.withContext(function($ctx1) {
  2569. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  2570. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  2571. args: [],
  2572. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2573. messageSends: ["assert:equals:", "printString", "jsObject"],
  2574. referencedClasses: []
  2575. }),
  2576. smalltalk.JSObjectProxyTest);
  2577. smalltalk.addMethod(
  2578. smalltalk.method({
  2579. selector: "testPropertyThatReturnsEmptyString",
  2580. category: 'tests',
  2581. fn: function (){
  2582. var self=this;
  2583. var object;
  2584. return smalltalk.withContext(function($ctx1) {
  2585. object=self._jsObject();
  2586. self._assert_equals_(_st(object)._d(),"");
  2587. _st(object)._d_("hello");
  2588. self._assert_equals_(_st(object)._d(),"hello");
  2589. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  2590. args: [],
  2591. 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'",
  2592. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2593. referencedClasses: []
  2594. }),
  2595. smalltalk.JSObjectProxyTest);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "testPropertyThatReturnsUndefined",
  2599. category: 'tests',
  2600. fn: function (){
  2601. var self=this;
  2602. var object;
  2603. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2604. return smalltalk.withContext(function($ctx1) {
  2605. object=self._jsObject();
  2606. self._shouldnt_raise_((function(){
  2607. return smalltalk.withContext(function($ctx2) {
  2608. return _st(object)._e();
  2609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2610. self._assert_(_st(_st(object)._e())._isNil());
  2611. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2612. args: [],
  2613. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  2614. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2615. referencedClasses: ["MessageNotUnderstood"]
  2616. }),
  2617. smalltalk.JSObjectProxyTest);
  2618. smalltalk.addMethod(
  2619. smalltalk.method({
  2620. selector: "testValue",
  2621. category: 'tests',
  2622. fn: function (){
  2623. var self=this;
  2624. var testObject;
  2625. return smalltalk.withContext(function($ctx1) {
  2626. testObject=self._jsObject();
  2627. self._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2628. _st(testObject)._at_put_("value","aValue");
  2629. self._assert_equals_(_st(testObject)._value(),"aValue");
  2630. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2631. args: [],
  2632. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: testObject value printString equals: '[object Object]'.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  2633. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2634. referencedClasses: []
  2635. }),
  2636. smalltalk.JSObjectProxyTest);
  2637. smalltalk.addMethod(
  2638. smalltalk.method({
  2639. selector: "testYourself",
  2640. category: 'tests',
  2641. fn: function (){
  2642. var self=this;
  2643. var object;
  2644. return smalltalk.withContext(function($ctx1) {
  2645. var $1,$2;
  2646. $1=self._jsObject();
  2647. _st($1)._d_("test");
  2648. $2=_st($1)._yourself();
  2649. object=$2;
  2650. self._assert_equals_(_st(object)._d(),"test");
  2651. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2652. args: [],
  2653. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2654. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.JSObjectProxyTest);
  2658. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "testCatchingException",
  2662. category: 'tests',
  2663. fn: function (){
  2664. var self=this;
  2665. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2666. return smalltalk.withContext(function($ctx1) {
  2667. _st((function(){
  2668. return smalltalk.withContext(function($ctx2) {
  2669. return self._throwException();
  2670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  2671. return smalltalk.withContext(function($ctx2) {
  2672. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  2673. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2674. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2675. args: [],
  2676. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2677. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2678. referencedClasses: ["Error"]
  2679. }),
  2680. smalltalk.JavaScriptExceptionTest);
  2681. smalltalk.addMethod(
  2682. smalltalk.method({
  2683. selector: "testRaisingException",
  2684. category: 'tests',
  2685. fn: function (){
  2686. var self=this;
  2687. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2688. return smalltalk.withContext(function($ctx1) {
  2689. self._should_raise_((function(){
  2690. return smalltalk.withContext(function($ctx2) {
  2691. return self._throwException();
  2692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$JavaScriptException());
  2693. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2694. args: [],
  2695. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2696. messageSends: ["should:raise:", "throwException"],
  2697. referencedClasses: ["JavaScriptException"]
  2698. }),
  2699. smalltalk.JavaScriptExceptionTest);
  2700. smalltalk.addMethod(
  2701. smalltalk.method({
  2702. selector: "throwException",
  2703. category: 'helpers',
  2704. fn: function (){
  2705. var self=this;
  2706. return smalltalk.withContext(function($ctx1) {
  2707. throw 'test';
  2708. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2709. args: [],
  2710. source: "throwException\x0a\x09<throw 'test'>",
  2711. messageSends: [],
  2712. referencedClasses: []
  2713. }),
  2714. smalltalk.JavaScriptExceptionTest);
  2715. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2716. smalltalk.addMethod(
  2717. smalltalk.method({
  2718. selector: "testValue",
  2719. category: 'tests',
  2720. fn: function (){
  2721. var self=this;
  2722. var messageSend;
  2723. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2724. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2725. return smalltalk.withContext(function($ctx1) {
  2726. var $1,$2;
  2727. $1=_st($MessageSend())._new();
  2728. _st($1)._receiver_(_st($Object())._new());
  2729. _st($1)._selector_("asString");
  2730. $2=_st($1)._yourself();
  2731. messageSend=$2;
  2732. self._assert_equals_(_st(messageSend)._value(),"an Object");
  2733. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2734. args: [],
  2735. 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'",
  2736. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  2737. referencedClasses: ["Object", "MessageSend"]
  2738. }),
  2739. smalltalk.MessageSendTest);
  2740. smalltalk.addMethod(
  2741. smalltalk.method({
  2742. selector: "testValueWithArguments",
  2743. category: 'tests',
  2744. fn: function (){
  2745. var self=this;
  2746. var messageSend;
  2747. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2748. return smalltalk.withContext(function($ctx1) {
  2749. var $1,$2;
  2750. $1=_st($MessageSend())._new();
  2751. _st($1)._receiver_((2));
  2752. _st($1)._selector_("+");
  2753. $2=_st($1)._yourself();
  2754. messageSend=$2;
  2755. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  2756. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2757. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2758. args: [],
  2759. 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",
  2760. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  2761. referencedClasses: ["MessageSend"]
  2762. }),
  2763. smalltalk.MessageSendTest);
  2764. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  2765. smalltalk.addMethod(
  2766. smalltalk.method({
  2767. selector: "codeGeneratorClass",
  2768. category: 'accessing',
  2769. fn: function (){
  2770. var self=this;
  2771. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  2772. return smalltalk.withContext(function($ctx1) {
  2773. var $1;
  2774. $1=$CodeGenerator();
  2775. return $1;
  2776. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  2777. args: [],
  2778. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  2779. messageSends: [],
  2780. referencedClasses: ["CodeGenerator"]
  2781. }),
  2782. smalltalk.MethodInheritanceTest);
  2783. smalltalk.addMethod(
  2784. smalltalk.method({
  2785. selector: "compiler",
  2786. category: 'factory',
  2787. fn: function (){
  2788. var self=this;
  2789. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  2790. return smalltalk.withContext(function($ctx1) {
  2791. var $2,$3,$1;
  2792. $2=_st($Compiler())._new();
  2793. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  2794. $3=_st($2)._yourself();
  2795. $1=$3;
  2796. return $1;
  2797. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  2798. args: [],
  2799. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  2800. messageSends: ["codeGeneratorClass:", "codeGeneratorClass", "new", "yourself"],
  2801. referencedClasses: ["Compiler"]
  2802. }),
  2803. smalltalk.MethodInheritanceTest);
  2804. smalltalk.addMethod(
  2805. smalltalk.method({
  2806. selector: "deinstallBottom",
  2807. category: 'testing',
  2808. fn: function (){
  2809. var self=this;
  2810. return smalltalk.withContext(function($ctx1) {
  2811. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  2812. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  2813. args: [],
  2814. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  2815. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  2816. referencedClasses: []
  2817. }),
  2818. smalltalk.MethodInheritanceTest);
  2819. smalltalk.addMethod(
  2820. smalltalk.method({
  2821. selector: "deinstallMiddle",
  2822. category: 'testing',
  2823. fn: function (){
  2824. var self=this;
  2825. return smalltalk.withContext(function($ctx1) {
  2826. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  2827. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  2828. args: [],
  2829. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  2830. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  2831. referencedClasses: []
  2832. }),
  2833. smalltalk.MethodInheritanceTest);
  2834. smalltalk.addMethod(
  2835. smalltalk.method({
  2836. selector: "deinstallTop",
  2837. category: 'testing',
  2838. fn: function (){
  2839. var self=this;
  2840. return smalltalk.withContext(function($ctx1) {
  2841. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  2842. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  2843. args: [],
  2844. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  2845. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  2846. referencedClasses: []
  2847. }),
  2848. smalltalk.MethodInheritanceTest);
  2849. smalltalk.addMethod(
  2850. smalltalk.method({
  2851. selector: "installBottom:",
  2852. category: 'testing',
  2853. fn: function (aString){
  2854. var self=this;
  2855. return smalltalk.withContext(function($ctx1) {
  2856. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  2857. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  2858. args: ["aString"],
  2859. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  2860. messageSends: ["install:forClass:category:", "targetClassBottom", "compiler"],
  2861. referencedClasses: []
  2862. }),
  2863. smalltalk.MethodInheritanceTest);
  2864. smalltalk.addMethod(
  2865. smalltalk.method({
  2866. selector: "installMiddle:",
  2867. category: 'testing',
  2868. fn: function (aString){
  2869. var self=this;
  2870. return smalltalk.withContext(function($ctx1) {
  2871. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  2872. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  2873. args: ["aString"],
  2874. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  2875. messageSends: ["install:forClass:category:", "targetClassMiddle", "compiler"],
  2876. referencedClasses: []
  2877. }),
  2878. smalltalk.MethodInheritanceTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "installTop:",
  2882. category: 'testing',
  2883. fn: function (aString){
  2884. var self=this;
  2885. return smalltalk.withContext(function($ctx1) {
  2886. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  2887. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  2888. args: ["aString"],
  2889. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  2890. messageSends: ["install:forClass:category:", "targetClassTop", "compiler"],
  2891. referencedClasses: []
  2892. }),
  2893. smalltalk.MethodInheritanceTest);
  2894. smalltalk.addMethod(
  2895. smalltalk.method({
  2896. selector: "setUp",
  2897. category: 'initialization',
  2898. fn: function (){
  2899. var self=this;
  2900. return smalltalk.withContext(function($ctx1) {
  2901. self["@receiverTop"]=_st(self._targetClassTop())._new();
  2902. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  2903. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  2904. self["@method"]=nil;
  2905. self["@performBlock"]=(function(){
  2906. return smalltalk.withContext(function($ctx2) {
  2907. return self._error_("performBlock not initialized");
  2908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  2909. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  2910. args: [],
  2911. 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' ]",
  2912. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  2913. referencedClasses: []
  2914. }),
  2915. smalltalk.MethodInheritanceTest);
  2916. smalltalk.addMethod(
  2917. smalltalk.method({
  2918. selector: "shouldMNU",
  2919. category: 'testing',
  2920. fn: function (){
  2921. var self=this;
  2922. return smalltalk.withContext(function($ctx1) {
  2923. self._shouldMNUTop();
  2924. self._shouldMNUMiddle();
  2925. self._shouldMNUBottom();
  2926. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  2927. args: [],
  2928. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  2929. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  2930. referencedClasses: []
  2931. }),
  2932. smalltalk.MethodInheritanceTest);
  2933. smalltalk.addMethod(
  2934. smalltalk.method({
  2935. selector: "shouldMNUBottom",
  2936. category: 'testing',
  2937. fn: function (){
  2938. var self=this;
  2939. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2940. return smalltalk.withContext(function($ctx1) {
  2941. self._should_raise_((function(){
  2942. return smalltalk.withContext(function($ctx2) {
  2943. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  2944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2945. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  2946. args: [],
  2947. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  2948. messageSends: ["should:raise:", "value:"],
  2949. referencedClasses: ["MessageNotUnderstood"]
  2950. }),
  2951. smalltalk.MethodInheritanceTest);
  2952. smalltalk.addMethod(
  2953. smalltalk.method({
  2954. selector: "shouldMNUMiddle",
  2955. category: 'testing',
  2956. fn: function (){
  2957. var self=this;
  2958. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2959. return smalltalk.withContext(function($ctx1) {
  2960. self._should_raise_((function(){
  2961. return smalltalk.withContext(function($ctx2) {
  2962. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  2963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2964. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  2965. args: [],
  2966. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  2967. messageSends: ["should:raise:", "value:"],
  2968. referencedClasses: ["MessageNotUnderstood"]
  2969. }),
  2970. smalltalk.MethodInheritanceTest);
  2971. smalltalk.addMethod(
  2972. smalltalk.method({
  2973. selector: "shouldMNUTop",
  2974. category: 'testing',
  2975. fn: function (){
  2976. var self=this;
  2977. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2978. return smalltalk.withContext(function($ctx1) {
  2979. self._should_raise_((function(){
  2980. return smalltalk.withContext(function($ctx2) {
  2981. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  2982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2983. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  2984. args: [],
  2985. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  2986. messageSends: ["should:raise:", "value:"],
  2987. referencedClasses: ["MessageNotUnderstood"]
  2988. }),
  2989. smalltalk.MethodInheritanceTest);
  2990. smalltalk.addMethod(
  2991. smalltalk.method({
  2992. selector: "shouldReturn:",
  2993. category: 'testing',
  2994. fn: function (anObject){
  2995. var self=this;
  2996. var result;
  2997. return smalltalk.withContext(function($ctx1) {
  2998. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  2999. self._assert_equals_(["top",anObject],["top",result]);
  3000. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3001. self._assert_equals_(["middle",anObject],["middle",result]);
  3002. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3003. self._assert_equals_(["bottom",anObject],["bottom",result]);
  3004. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  3005. args: ["anObject"],
  3006. 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 }",
  3007. messageSends: ["value:", "assert:equals:"],
  3008. referencedClasses: []
  3009. }),
  3010. smalltalk.MethodInheritanceTest);
  3011. smalltalk.addMethod(
  3012. smalltalk.method({
  3013. selector: "shouldReturn:and:and:",
  3014. category: 'testing',
  3015. fn: function (anObject,anObject2,anObject3){
  3016. var self=this;
  3017. var result;
  3018. return smalltalk.withContext(function($ctx1) {
  3019. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3020. self._assert_equals_(["top",anObject],["top",result]);
  3021. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3022. self._assert_equals_(["middle",anObject2],["middle",result]);
  3023. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3024. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  3025. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  3026. args: ["anObject", "anObject2", "anObject3"],
  3027. 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 }",
  3028. messageSends: ["value:", "assert:equals:"],
  3029. referencedClasses: []
  3030. }),
  3031. smalltalk.MethodInheritanceTest);
  3032. smalltalk.addMethod(
  3033. smalltalk.method({
  3034. selector: "targetClassBottom",
  3035. category: 'accessing',
  3036. fn: function (){
  3037. var self=this;
  3038. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3039. return smalltalk.withContext(function($ctx1) {
  3040. var $1;
  3041. $1=$JavaScriptException();
  3042. return $1;
  3043. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  3044. args: [],
  3045. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  3046. messageSends: [],
  3047. referencedClasses: ["JavaScriptException"]
  3048. }),
  3049. smalltalk.MethodInheritanceTest);
  3050. smalltalk.addMethod(
  3051. smalltalk.method({
  3052. selector: "targetClassMiddle",
  3053. category: 'accessing',
  3054. fn: function (){
  3055. var self=this;
  3056. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3057. return smalltalk.withContext(function($ctx1) {
  3058. var $1;
  3059. $1=$Error();
  3060. return $1;
  3061. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  3062. args: [],
  3063. source: "targetClassMiddle\x0a\x09^ Error",
  3064. messageSends: [],
  3065. referencedClasses: ["Error"]
  3066. }),
  3067. smalltalk.MethodInheritanceTest);
  3068. smalltalk.addMethod(
  3069. smalltalk.method({
  3070. selector: "targetClassTop",
  3071. category: 'accessing',
  3072. fn: function (){
  3073. var self=this;
  3074. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3075. return smalltalk.withContext(function($ctx1) {
  3076. var $1;
  3077. $1=$Object();
  3078. return $1;
  3079. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  3080. args: [],
  3081. source: "targetClassTop\x0a\x09^ Object",
  3082. messageSends: [],
  3083. referencedClasses: ["Object"]
  3084. }),
  3085. smalltalk.MethodInheritanceTest);
  3086. smalltalk.addMethod(
  3087. smalltalk.method({
  3088. selector: "tearDown",
  3089. category: 'initialization',
  3090. fn: function (){
  3091. var self=this;
  3092. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3093. return smalltalk.withContext(function($ctx1) {
  3094. _st((function(){
  3095. return smalltalk.withContext(function($ctx2) {
  3096. return self._deinstallTop();
  3097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(){
  3098. return smalltalk.withContext(function($ctx2) {
  3099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3100. _st((function(){
  3101. return smalltalk.withContext(function($ctx2) {
  3102. return self._deinstallMiddle();
  3103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(){
  3104. return smalltalk.withContext(function($ctx2) {
  3105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3106. _st((function(){
  3107. return smalltalk.withContext(function($ctx2) {
  3108. return self._deinstallBottom();
  3109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(){
  3110. return smalltalk.withContext(function($ctx2) {
  3111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3112. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  3113. args: [],
  3114. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  3115. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  3116. referencedClasses: ["Error"]
  3117. }),
  3118. smalltalk.MethodInheritanceTest);
  3119. smalltalk.addMethod(
  3120. smalltalk.method({
  3121. selector: "testMNU11",
  3122. category: 'tests',
  3123. fn: function (){
  3124. var self=this;
  3125. return smalltalk.withContext(function($ctx1) {
  3126. self["@performBlock"]=(function(x){
  3127. return smalltalk.withContext(function($ctx2) {
  3128. return _st(x)._foo();
  3129. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})});
  3130. self._shouldMNU();
  3131. self._installTop_("foo ^ false");
  3132. self._installTop_("foo ^ true");
  3133. self._deinstallTop();
  3134. self._shouldMNU();
  3135. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  3136. args: [],
  3137. 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",
  3138. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  3139. referencedClasses: []
  3140. }),
  3141. smalltalk.MethodInheritanceTest);
  3142. smalltalk.addMethod(
  3143. smalltalk.method({
  3144. selector: "testMNU22",
  3145. category: 'tests',
  3146. fn: function (){
  3147. var self=this;
  3148. return smalltalk.withContext(function($ctx1) {
  3149. self["@performBlock"]=(function(x){
  3150. return smalltalk.withContext(function($ctx2) {
  3151. return _st(x)._foo();
  3152. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})});
  3153. self._shouldMNU();
  3154. self._installMiddle_("foo ^ false");
  3155. self._installMiddle_("foo ^ true");
  3156. self._deinstallMiddle();
  3157. self._shouldMNU();
  3158. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  3159. args: [],
  3160. 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",
  3161. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  3162. referencedClasses: []
  3163. }),
  3164. smalltalk.MethodInheritanceTest);
  3165. smalltalk.addMethod(
  3166. smalltalk.method({
  3167. selector: "testReturns1",
  3168. category: 'tests',
  3169. fn: function (){
  3170. var self=this;
  3171. return smalltalk.withContext(function($ctx1) {
  3172. self["@performBlock"]=(function(x){
  3173. return smalltalk.withContext(function($ctx2) {
  3174. return _st(x)._foo();
  3175. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})});
  3176. self._installTop_("foo ^ false");
  3177. self._shouldReturn_(false);
  3178. self._installTop_("foo ^ true");
  3179. self._shouldReturn_(true);
  3180. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  3181. args: [],
  3182. 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",
  3183. messageSends: ["foo", "installTop:", "shouldReturn:"],
  3184. referencedClasses: []
  3185. }),
  3186. smalltalk.MethodInheritanceTest);
  3187. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3188. smalltalk.addMethod(
  3189. smalltalk.method({
  3190. selector: "testAbs",
  3191. category: 'tests',
  3192. fn: function (){
  3193. var self=this;
  3194. return smalltalk.withContext(function($ctx1) {
  3195. self._assert_equals_((4)._abs(),(4));
  3196. self._assert_equals_((-4)._abs(),(4));
  3197. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  3198. args: [],
  3199. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  3200. messageSends: ["assert:equals:", "abs"],
  3201. referencedClasses: []
  3202. }),
  3203. smalltalk.NumberTest);
  3204. smalltalk.addMethod(
  3205. smalltalk.method({
  3206. selector: "testArithmetic",
  3207. category: 'tests',
  3208. fn: function (){
  3209. var self=this;
  3210. return smalltalk.withContext(function($ctx1) {
  3211. self._assert_equals_((1.5).__plus((1)),(2.5));
  3212. self._assert_equals_((2).__minus((1)),(1));
  3213. self._assert_equals_((-2).__minus((1)),(-3));
  3214. self._assert_equals_((12).__slash((2)),(6));
  3215. self._assert_equals_((3).__star((4)),(12));
  3216. self._assert_equals_(_st((1).__plus((2))).__star((3)),(9));
  3217. self._assert_equals_((1).__plus((2).__star((3))),(7));
  3218. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  3219. args: [],
  3220. 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\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  3221. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  3222. referencedClasses: []
  3223. }),
  3224. smalltalk.NumberTest);
  3225. smalltalk.addMethod(
  3226. smalltalk.method({
  3227. selector: "testComparison",
  3228. category: 'tests',
  3229. fn: function (){
  3230. var self=this;
  3231. return smalltalk.withContext(function($ctx1) {
  3232. self._assert_((3).__gt((2)));
  3233. self._assert_((2).__lt((3)));
  3234. self._deny_((3).__lt((2)));
  3235. self._deny_((2).__gt((3)));
  3236. self._assert_((3).__gt_eq((3)));
  3237. self._assert_((3.1).__gt_eq((3)));
  3238. self._assert_((3).__lt_eq((3)));
  3239. self._assert_((3).__lt_eq((3.1)));
  3240. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  3241. args: [],
  3242. 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",
  3243. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  3244. referencedClasses: []
  3245. }),
  3246. smalltalk.NumberTest);
  3247. smalltalk.addMethod(
  3248. smalltalk.method({
  3249. selector: "testCopying",
  3250. category: 'tests',
  3251. fn: function (){
  3252. var self=this;
  3253. return smalltalk.withContext(function($ctx1) {
  3254. self._assert_(_st((1)._copy()).__eq_eq((1)));
  3255. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  3256. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  3257. args: [],
  3258. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  3259. messageSends: ["assert:", "==", "copy", "deepCopy"],
  3260. referencedClasses: []
  3261. }),
  3262. smalltalk.NumberTest);
  3263. smalltalk.addMethod(
  3264. smalltalk.method({
  3265. selector: "testEquality",
  3266. category: 'tests',
  3267. fn: function (){
  3268. var self=this;
  3269. return smalltalk.withContext(function($ctx1) {
  3270. self._assert_((1).__eq((1)));
  3271. self._assert_((0).__eq((0)));
  3272. self._deny_((1).__eq((0)));
  3273. self._assert_(_st((1)._yourself()).__eq((1)));
  3274. self._assert_((1).__eq((1)._yourself()));
  3275. self._assert_(_st((1)._yourself()).__eq((1)._yourself()));
  3276. self._deny_((0).__eq(false));
  3277. self._deny_(false.__eq((0)));
  3278. self._deny_("".__eq((0)));
  3279. self._deny_((0).__eq(""));
  3280. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  3281. args: [],
  3282. 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 = ''",
  3283. messageSends: ["assert:", "=", "deny:", "yourself"],
  3284. referencedClasses: []
  3285. }),
  3286. smalltalk.NumberTest);
  3287. smalltalk.addMethod(
  3288. smalltalk.method({
  3289. selector: "testHexNumbers",
  3290. category: 'tests',
  3291. fn: function (){
  3292. var self=this;
  3293. return smalltalk.withContext(function($ctx1) {
  3294. self._assert_equals_((9),(9));
  3295. self._assert_equals_((10)._truncated(),(10));
  3296. self._assert_equals_((11)._truncated(),(11));
  3297. self._assert_equals_((12)._truncated(),(12));
  3298. self._assert_equals_((13)._truncated(),(13));
  3299. self._assert_equals_((14)._truncated(),(14));
  3300. self._assert_equals_((15)._truncated(),(15));
  3301. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  3302. args: [],
  3303. 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",
  3304. messageSends: ["assert:equals:", "truncated"],
  3305. referencedClasses: []
  3306. }),
  3307. smalltalk.NumberTest);
  3308. smalltalk.addMethod(
  3309. smalltalk.method({
  3310. selector: "testIdentity",
  3311. category: 'tests',
  3312. fn: function (){
  3313. var self=this;
  3314. return smalltalk.withContext(function($ctx1) {
  3315. self._assert_((1).__eq_eq((1)));
  3316. self._assert_((0).__eq_eq((0)));
  3317. self._deny_((1).__eq_eq((0)));
  3318. self._assert_(_st((1)._yourself()).__eq_eq((1)));
  3319. self._assert_((1).__eq_eq((1)._yourself()));
  3320. self._assert_(_st((1)._yourself()).__eq_eq((1)._yourself()));
  3321. self._deny_((1).__eq_eq((2)));
  3322. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  3323. args: [],
  3324. 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",
  3325. messageSends: ["assert:", "==", "deny:", "yourself"],
  3326. referencedClasses: []
  3327. }),
  3328. smalltalk.NumberTest);
  3329. smalltalk.addMethod(
  3330. smalltalk.method({
  3331. selector: "testInvalidHexNumbers",
  3332. category: 'tests',
  3333. fn: function (){
  3334. var self=this;
  3335. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3336. return smalltalk.withContext(function($ctx1) {
  3337. self._should_raise_((function(){
  3338. return smalltalk.withContext(function($ctx2) {
  3339. return (16)._rG();
  3340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3341. self._should_raise_((function(){
  3342. return smalltalk.withContext(function($ctx2) {
  3343. return (16)._rg();
  3344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3345. self._should_raise_((function(){
  3346. return smalltalk.withContext(function($ctx2) {
  3347. return (16)._rH();
  3348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3349. self._should_raise_((function(){
  3350. return smalltalk.withContext(function($ctx2) {
  3351. return (16)._rh();
  3352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3353. self._should_raise_((function(){
  3354. return smalltalk.withContext(function($ctx2) {
  3355. return (16)._rI();
  3356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3357. self._should_raise_((function(){
  3358. return smalltalk.withContext(function($ctx2) {
  3359. return (16)._ri();
  3360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3361. self._should_raise_((function(){
  3362. return smalltalk.withContext(function($ctx2) {
  3363. return (16)._rJ();
  3364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3365. self._should_raise_((function(){
  3366. return smalltalk.withContext(function($ctx2) {
  3367. return (16)._rj();
  3368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3369. self._should_raise_((function(){
  3370. return smalltalk.withContext(function($ctx2) {
  3371. return (16)._rK();
  3372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3373. self._should_raise_((function(){
  3374. return smalltalk.withContext(function($ctx2) {
  3375. return (16)._rk();
  3376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3377. self._should_raise_((function(){
  3378. return smalltalk.withContext(function($ctx2) {
  3379. return (16)._rL();
  3380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3381. self._should_raise_((function(){
  3382. return smalltalk.withContext(function($ctx2) {
  3383. return (16)._rl();
  3384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3385. self._should_raise_((function(){
  3386. return smalltalk.withContext(function($ctx2) {
  3387. return (16)._rM();
  3388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3389. self._should_raise_((function(){
  3390. return smalltalk.withContext(function($ctx2) {
  3391. return (16)._rm();
  3392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3393. self._should_raise_((function(){
  3394. return smalltalk.withContext(function($ctx2) {
  3395. return (16)._rN();
  3396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3397. self._should_raise_((function(){
  3398. return smalltalk.withContext(function($ctx2) {
  3399. return (16)._rn();
  3400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3401. self._should_raise_((function(){
  3402. return smalltalk.withContext(function($ctx2) {
  3403. return (16)._rO();
  3404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3405. self._should_raise_((function(){
  3406. return smalltalk.withContext(function($ctx2) {
  3407. return (16)._ro();
  3408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3409. self._should_raise_((function(){
  3410. return smalltalk.withContext(function($ctx2) {
  3411. return (16)._rP();
  3412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3413. self._should_raise_((function(){
  3414. return smalltalk.withContext(function($ctx2) {
  3415. return (16)._rp();
  3416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3417. self._should_raise_((function(){
  3418. return smalltalk.withContext(function($ctx2) {
  3419. return (16)._rQ();
  3420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3421. self._should_raise_((function(){
  3422. return smalltalk.withContext(function($ctx2) {
  3423. return (16)._rq();
  3424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3425. self._should_raise_((function(){
  3426. return smalltalk.withContext(function($ctx2) {
  3427. return (16)._rR();
  3428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3429. self._should_raise_((function(){
  3430. return smalltalk.withContext(function($ctx2) {
  3431. return (16)._rr();
  3432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3433. self._should_raise_((function(){
  3434. return smalltalk.withContext(function($ctx2) {
  3435. return (16)._rS();
  3436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3437. self._should_raise_((function(){
  3438. return smalltalk.withContext(function($ctx2) {
  3439. return (16)._rs();
  3440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3441. self._should_raise_((function(){
  3442. return smalltalk.withContext(function($ctx2) {
  3443. return (16)._rT();
  3444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3445. self._should_raise_((function(){
  3446. return smalltalk.withContext(function($ctx2) {
  3447. return (16)._rt();
  3448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3449. self._should_raise_((function(){
  3450. return smalltalk.withContext(function($ctx2) {
  3451. return (16)._rU();
  3452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3453. self._should_raise_((function(){
  3454. return smalltalk.withContext(function($ctx2) {
  3455. return (16)._ru();
  3456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3457. self._should_raise_((function(){
  3458. return smalltalk.withContext(function($ctx2) {
  3459. return (16)._rV();
  3460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3461. self._should_raise_((function(){
  3462. return smalltalk.withContext(function($ctx2) {
  3463. return (16)._rv();
  3464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3465. self._should_raise_((function(){
  3466. return smalltalk.withContext(function($ctx2) {
  3467. return (16)._rW();
  3468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3469. self._should_raise_((function(){
  3470. return smalltalk.withContext(function($ctx2) {
  3471. return (16)._rw();
  3472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3473. self._should_raise_((function(){
  3474. return smalltalk.withContext(function($ctx2) {
  3475. return (16)._rX();
  3476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3477. self._should_raise_((function(){
  3478. return smalltalk.withContext(function($ctx2) {
  3479. return (16)._rx();
  3480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3481. self._should_raise_((function(){
  3482. return smalltalk.withContext(function($ctx2) {
  3483. return (16)._rY();
  3484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3485. self._should_raise_((function(){
  3486. return smalltalk.withContext(function($ctx2) {
  3487. return (16)._ry();
  3488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3489. self._should_raise_((function(){
  3490. return smalltalk.withContext(function($ctx2) {
  3491. return (16)._rZ();
  3492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3493. self._should_raise_((function(){
  3494. return smalltalk.withContext(function($ctx2) {
  3495. return (16)._rz();
  3496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3497. self._should_raise_((function(){
  3498. return smalltalk.withContext(function($ctx2) {
  3499. return (11259375)._Z();
  3500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3501. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  3502. args: [],
  3503. 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.",
  3504. 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"],
  3505. referencedClasses: ["MessageNotUnderstood"]
  3506. }),
  3507. smalltalk.NumberTest);
  3508. smalltalk.addMethod(
  3509. smalltalk.method({
  3510. selector: "testMinMax",
  3511. category: 'tests',
  3512. fn: function (){
  3513. var self=this;
  3514. return smalltalk.withContext(function($ctx1) {
  3515. self._assert_equals_((2)._max_((5)),(5));
  3516. self._assert_equals_((2)._min_((5)),(2));
  3517. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  3518. args: [],
  3519. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3520. messageSends: ["assert:equals:", "max:", "min:"],
  3521. referencedClasses: []
  3522. }),
  3523. smalltalk.NumberTest);
  3524. smalltalk.addMethod(
  3525. smalltalk.method({
  3526. selector: "testNegated",
  3527. category: 'tests',
  3528. fn: function (){
  3529. var self=this;
  3530. return smalltalk.withContext(function($ctx1) {
  3531. self._assert_equals_((3)._negated(),(-3));
  3532. self._assert_equals_((-3)._negated(),(3));
  3533. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  3534. args: [],
  3535. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3536. messageSends: ["assert:equals:", "negated"],
  3537. referencedClasses: []
  3538. }),
  3539. smalltalk.NumberTest);
  3540. smalltalk.addMethod(
  3541. smalltalk.method({
  3542. selector: "testPrintShowingDecimalPlaces",
  3543. category: 'tests',
  3544. fn: function (){
  3545. var self=this;
  3546. return smalltalk.withContext(function($ctx1) {
  3547. self._assert_equals_((23)._printShowingDecimalPlaces_((2)),"23.00");
  3548. self._assert_equals_((23.5698)._printShowingDecimalPlaces_((2)),"23.57");
  3549. self._assert_equals_(_st((234.567)._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3550. self._assert_equals_((23.4567)._printShowingDecimalPlaces_((0)),"23");
  3551. self._assert_equals_((23.5567)._printShowingDecimalPlaces_((0)),"24");
  3552. self._assert_equals_(_st((23.4567)._negated())._printShowingDecimalPlaces_((0)),"-23");
  3553. self._assert_equals_(_st((23.5567)._negated())._printShowingDecimalPlaces_((0)),"-24");
  3554. self._assert_equals_((100000000)._printShowingDecimalPlaces_((1)),"100000000.0");
  3555. self._assert_equals_((0.98)._printShowingDecimalPlaces_((5)),"0.98000");
  3556. self._assert_equals_(_st((0.98)._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3557. self._assert_equals_((2.567)._printShowingDecimalPlaces_((2)),"2.57");
  3558. self._assert_equals_((-2.567)._printShowingDecimalPlaces_((2)),"-2.57");
  3559. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  3560. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  3561. args: [],
  3562. 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'.",
  3563. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3564. referencedClasses: []
  3565. }),
  3566. smalltalk.NumberTest);
  3567. smalltalk.addMethod(
  3568. smalltalk.method({
  3569. selector: "testRounded",
  3570. category: 'tests',
  3571. fn: function (){
  3572. var self=this;
  3573. return smalltalk.withContext(function($ctx1) {
  3574. self._assert_equals_((3)._rounded(),(3));
  3575. self._assert_equals_((3.212)._rounded(),(3));
  3576. self._assert_equals_((3.51)._rounded(),(4));
  3577. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  3578. args: [],
  3579. 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",
  3580. messageSends: ["assert:equals:", "rounded"],
  3581. referencedClasses: []
  3582. }),
  3583. smalltalk.NumberTest);
  3584. smalltalk.addMethod(
  3585. smalltalk.method({
  3586. selector: "testSqrt",
  3587. category: 'tests',
  3588. fn: function (){
  3589. var self=this;
  3590. return smalltalk.withContext(function($ctx1) {
  3591. self._assert_equals_((4)._sqrt(),(2));
  3592. self._assert_equals_((16)._sqrt(),(4));
  3593. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  3594. args: [],
  3595. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3596. messageSends: ["assert:equals:", "sqrt"],
  3597. referencedClasses: []
  3598. }),
  3599. smalltalk.NumberTest);
  3600. smalltalk.addMethod(
  3601. smalltalk.method({
  3602. selector: "testSquared",
  3603. category: 'tests',
  3604. fn: function (){
  3605. var self=this;
  3606. return smalltalk.withContext(function($ctx1) {
  3607. self._assert_equals_((4)._squared(),(16));
  3608. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  3609. args: [],
  3610. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3611. messageSends: ["assert:equals:", "squared"],
  3612. referencedClasses: []
  3613. }),
  3614. smalltalk.NumberTest);
  3615. smalltalk.addMethod(
  3616. smalltalk.method({
  3617. selector: "testTimesRepeat",
  3618. category: 'tests',
  3619. fn: function (){
  3620. var self=this;
  3621. var i;
  3622. return smalltalk.withContext(function($ctx1) {
  3623. i=(0);
  3624. (0)._timesRepeat_((function(){
  3625. return smalltalk.withContext(function($ctx2) {
  3626. i=_st(i).__plus((1));
  3627. return i;
  3628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3629. self._assert_equals_(i,(0));
  3630. (5)._timesRepeat_((function(){
  3631. return smalltalk.withContext(function($ctx2) {
  3632. i=_st(i).__plus((1));
  3633. return i;
  3634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3635. self._assert_equals_(i,(5));
  3636. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  3637. args: [],
  3638. 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",
  3639. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3640. referencedClasses: []
  3641. }),
  3642. smalltalk.NumberTest);
  3643. smalltalk.addMethod(
  3644. smalltalk.method({
  3645. selector: "testTo",
  3646. category: 'tests',
  3647. fn: function (){
  3648. var self=this;
  3649. return smalltalk.withContext(function($ctx1) {
  3650. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  3651. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  3652. args: [],
  3653. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3654. messageSends: ["assert:equals:", "to:"],
  3655. referencedClasses: []
  3656. }),
  3657. smalltalk.NumberTest);
  3658. smalltalk.addMethod(
  3659. smalltalk.method({
  3660. selector: "testToBy",
  3661. category: 'tests',
  3662. fn: function (){
  3663. var self=this;
  3664. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3665. return smalltalk.withContext(function($ctx1) {
  3666. self._assert_equals_((0)._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3667. self._should_raise_((function(){
  3668. return smalltalk.withContext(function($ctx2) {
  3669. return (1)._to_by_((4),(0));
  3670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3671. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  3672. args: [],
  3673. 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",
  3674. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3675. referencedClasses: ["Error"]
  3676. }),
  3677. smalltalk.NumberTest);
  3678. smalltalk.addMethod(
  3679. smalltalk.method({
  3680. selector: "testTruncated",
  3681. category: 'tests',
  3682. fn: function (){
  3683. var self=this;
  3684. return smalltalk.withContext(function($ctx1) {
  3685. self._assert_equals_((3)._truncated(),(3));
  3686. self._assert_equals_((3.212)._truncated(),(3));
  3687. self._assert_equals_((3.51)._truncated(),(3));
  3688. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  3689. args: [],
  3690. 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",
  3691. messageSends: ["assert:equals:", "truncated"],
  3692. referencedClasses: []
  3693. }),
  3694. smalltalk.NumberTest);
  3695. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3696. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  3697. smalltalk.addMethod(
  3698. smalltalk.method({
  3699. selector: "foo",
  3700. category: 'not yet classified',
  3701. fn: function (){
  3702. var self=this;
  3703. return smalltalk.withContext(function($ctx1) {
  3704. var $1;
  3705. $1=self["@foo"];
  3706. return $1;
  3707. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  3708. args: [],
  3709. source: "foo\x0a\x09^foo",
  3710. messageSends: [],
  3711. referencedClasses: []
  3712. }),
  3713. smalltalk.ObjectMock);
  3714. smalltalk.addMethod(
  3715. smalltalk.method({
  3716. selector: "foo:",
  3717. category: 'not yet classified',
  3718. fn: function (anObject){
  3719. var self=this;
  3720. return smalltalk.withContext(function($ctx1) {
  3721. self["@foo"]=anObject;
  3722. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  3723. args: ["anObject"],
  3724. source: "foo: anObject\x0a\x09foo := anObject",
  3725. messageSends: [],
  3726. referencedClasses: []
  3727. }),
  3728. smalltalk.ObjectMock);
  3729. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3730. smalltalk.addMethod(
  3731. smalltalk.method({
  3732. selector: "notDefined",
  3733. category: 'tests',
  3734. fn: function (){
  3735. var self=this;
  3736. return smalltalk.withContext(function($ctx1) {
  3737. return undefined;;
  3738. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  3739. args: [],
  3740. source: "notDefined\x0a\x09<return undefined;>",
  3741. messageSends: [],
  3742. referencedClasses: []
  3743. }),
  3744. smalltalk.ObjectTest);
  3745. smalltalk.addMethod(
  3746. smalltalk.method({
  3747. selector: "testBasicAccess",
  3748. category: 'tests',
  3749. fn: function (){
  3750. var self=this;
  3751. var o;
  3752. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3753. return smalltalk.withContext(function($ctx1) {
  3754. o=_st($Object())._new();
  3755. _st(o)._basicAt_put_("a",(1));
  3756. self._assert_equals_(_st(o)._basicAt_("a"),(1));
  3757. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  3758. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  3759. args: [],
  3760. 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",
  3761. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  3762. referencedClasses: ["Object"]
  3763. }),
  3764. smalltalk.ObjectTest);
  3765. smalltalk.addMethod(
  3766. smalltalk.method({
  3767. selector: "testBasicPerform",
  3768. category: 'tests',
  3769. fn: function (){
  3770. var self=this;
  3771. var o;
  3772. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3773. return smalltalk.withContext(function($ctx1) {
  3774. o=_st($Object())._new();
  3775. _st(o)._basicAt_put_("func",(function(){
  3776. return smalltalk.withContext(function($ctx2) {
  3777. return "hello";
  3778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3779. _st(o)._basicAt_put_("func2",(function(a){
  3780. return smalltalk.withContext(function($ctx2) {
  3781. return _st(a).__plus((1));
  3782. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  3783. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  3784. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  3785. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  3786. args: [],
  3787. 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",
  3788. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  3789. referencedClasses: ["Object"]
  3790. }),
  3791. smalltalk.ObjectTest);
  3792. smalltalk.addMethod(
  3793. smalltalk.method({
  3794. selector: "testDNU",
  3795. category: 'tests',
  3796. fn: function (){
  3797. var self=this;
  3798. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3799. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3800. return smalltalk.withContext(function($ctx1) {
  3801. self._should_raise_((function(){
  3802. return smalltalk.withContext(function($ctx2) {
  3803. return _st(_st($Object())._new())._foo();
  3804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3805. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  3806. args: [],
  3807. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  3808. messageSends: ["should:raise:", "foo", "new"],
  3809. referencedClasses: ["Object", "MessageNotUnderstood"]
  3810. }),
  3811. smalltalk.ObjectTest);
  3812. smalltalk.addMethod(
  3813. smalltalk.method({
  3814. selector: "testEquality",
  3815. category: 'tests',
  3816. fn: function (){
  3817. var self=this;
  3818. var o;
  3819. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3820. return smalltalk.withContext(function($ctx1) {
  3821. o=_st($Object())._new();
  3822. self._deny_(_st(o).__eq(_st($Object())._new()));
  3823. self._assert_(_st(o).__eq(o));
  3824. self._assert_(_st(_st(o)._yourself()).__eq(o));
  3825. self._assert_(_st(o).__eq(_st(o)._yourself()));
  3826. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  3827. args: [],
  3828. 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)",
  3829. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  3830. referencedClasses: ["Object"]
  3831. }),
  3832. smalltalk.ObjectTest);
  3833. smalltalk.addMethod(
  3834. smalltalk.method({
  3835. selector: "testHalt",
  3836. category: 'tests',
  3837. fn: function (){
  3838. var self=this;
  3839. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3840. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3841. return smalltalk.withContext(function($ctx1) {
  3842. self._should_raise_((function(){
  3843. return smalltalk.withContext(function($ctx2) {
  3844. return _st(_st($Object())._new())._halt();
  3845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3846. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  3847. args: [],
  3848. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  3849. messageSends: ["should:raise:", "halt", "new"],
  3850. referencedClasses: ["Object", "Error"]
  3851. }),
  3852. smalltalk.ObjectTest);
  3853. smalltalk.addMethod(
  3854. smalltalk.method({
  3855. selector: "testIdentity",
  3856. category: 'tests',
  3857. fn: function (){
  3858. var self=this;
  3859. var o;
  3860. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3861. return smalltalk.withContext(function($ctx1) {
  3862. o=_st($Object())._new();
  3863. self._deny_(_st(o).__eq_eq(_st($Object())._new()));
  3864. self._assert_(_st(o).__eq_eq(o));
  3865. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3866. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  3867. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  3868. args: [],
  3869. 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",
  3870. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  3871. referencedClasses: ["Object"]
  3872. }),
  3873. smalltalk.ObjectTest);
  3874. smalltalk.addMethod(
  3875. smalltalk.method({
  3876. selector: "testIfNil",
  3877. category: 'tests',
  3878. fn: function (){
  3879. var self=this;
  3880. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3881. return smalltalk.withContext(function($ctx1) {
  3882. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  3883. self._deny_(_st(_st($Object())._new())._isNil());
  3884. $1=self;
  3885. $4=_st($Object())._new();
  3886. if(($receiver = $4) == nil || $receiver == undefined){
  3887. $3=true;
  3888. } else {
  3889. $3=$4;
  3890. };
  3891. $2=_st($3).__eq(true);
  3892. _st($1)._deny_($2);
  3893. $5=self;
  3894. $7=_st($Object())._new();
  3895. if(($receiver = $7) == nil || $receiver == undefined){
  3896. $6=$7;
  3897. } else {
  3898. $6=true;
  3899. };
  3900. _st($5)._assert_equals_($6,true);
  3901. $8=self;
  3902. $10=_st($Object())._new();
  3903. if(($receiver = $10) == nil || $receiver == undefined){
  3904. $9=false;
  3905. } else {
  3906. $9=true;
  3907. };
  3908. _st($8)._assert_equals_($9,true);
  3909. $11=self;
  3910. $13=_st($Object())._new();
  3911. if(($receiver = $13) == nil || $receiver == undefined){
  3912. $12=false;
  3913. } else {
  3914. $12=true;
  3915. };
  3916. _st($11)._assert_equals_($12,true);
  3917. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  3918. args: [],
  3919. 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",
  3920. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3921. referencedClasses: ["Object"]
  3922. }),
  3923. smalltalk.ObjectTest);
  3924. smalltalk.addMethod(
  3925. smalltalk.method({
  3926. selector: "testInstVars",
  3927. category: 'tests',
  3928. fn: function (){
  3929. var self=this;
  3930. var o;
  3931. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  3932. return smalltalk.withContext(function($ctx1) {
  3933. o=_st($ObjectMock())._new();
  3934. self._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  3935. _st(o)._instVarAt_put_("foo",(1));
  3936. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3937. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3938. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  3939. args: [],
  3940. 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",
  3941. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  3942. referencedClasses: ["ObjectMock"]
  3943. }),
  3944. smalltalk.ObjectTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "testNilUndefined",
  3948. category: 'tests',
  3949. fn: function (){
  3950. var self=this;
  3951. return smalltalk.withContext(function($ctx1) {
  3952. self._assert_equals_(self._notDefined(),nil);
  3953. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  3954. args: [],
  3955. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  3956. messageSends: ["assert:equals:", "notDefined"],
  3957. referencedClasses: []
  3958. }),
  3959. smalltalk.ObjectTest);
  3960. smalltalk.addMethod(
  3961. smalltalk.method({
  3962. selector: "testYourself",
  3963. category: 'tests',
  3964. fn: function (){
  3965. var self=this;
  3966. var o;
  3967. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  3968. return smalltalk.withContext(function($ctx1) {
  3969. o=_st($ObjectMock())._new();
  3970. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3971. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  3972. args: [],
  3973. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  3974. messageSends: ["new", "assert:", "==", "yourself"],
  3975. referencedClasses: ["ObjectMock"]
  3976. }),
  3977. smalltalk.ObjectTest);
  3978. smalltalk.addMethod(
  3979. smalltalk.method({
  3980. selector: "testidentityHash",
  3981. category: 'tests',
  3982. fn: function (){
  3983. var self=this;
  3984. var o1,o2;
  3985. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3986. return smalltalk.withContext(function($ctx1) {
  3987. o1=_st($Object())._new();
  3988. o2=_st($Object())._new();
  3989. self._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  3990. self._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  3991. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  3992. args: [],
  3993. 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",
  3994. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  3995. referencedClasses: ["Object"]
  3996. }),
  3997. smalltalk.ObjectTest);
  3998. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  3999. smalltalk.addMethod(
  4000. smalltalk.method({
  4001. selector: "setUp",
  4002. category: 'running',
  4003. fn: function (){
  4004. var self=this;
  4005. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  4006. return smalltalk.withContext(function($ctx1) {
  4007. var $1,$2;
  4008. self["@backUpCommitPathJs"]=_st($Package())._defaultCommitPathJs();
  4009. self["@backUpCommitPathSt"]=_st($Package())._defaultCommitPathSt();
  4010. _st($Package())._resetCommitPaths();
  4011. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  4012. $1=_st($Package())._new();
  4013. _st($1)._name_("Grul");
  4014. _st($1)._commitPathJs_("server/grul/js");
  4015. _st($1)._commitPathSt_("grul/st");
  4016. $2=_st($1)._yourself();
  4017. self["@grulPackage"]=$2;
  4018. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageTest)})},
  4019. args: [],
  4020. source: "setUp\x0a\x09backUpCommitPathJs := Package defaultCommitPathJs.\x0a\x09backUpCommitPathSt := Package defaultCommitPathSt.\x0a\x0a\x09Package resetCommitPaths.\x0a\x0a\x09zorkPackage := Package new name: 'Zork'.\x0a\x09grulPackage := Package new\x0a\x09\x09\x09\x09\x09name: 'Grul';\x0a\x09\x09\x09\x09\x09commitPathJs: 'server/grul/js';\x0a\x09\x09\x09\x09\x09commitPathSt: 'grul/st';\x0a\x09\x09\x09\x09\x09yourself",
  4021. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  4022. referencedClasses: ["Package"]
  4023. }),
  4024. smalltalk.PackageTest);
  4025. smalltalk.addMethod(
  4026. smalltalk.method({
  4027. selector: "tearDown",
  4028. category: 'running',
  4029. fn: function (){
  4030. var self=this;
  4031. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  4032. return smalltalk.withContext(function($ctx1) {
  4033. var $1,$2;
  4034. $1=$Package();
  4035. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  4036. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  4037. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.PackageTest)})},
  4038. args: [],
  4039. source: "tearDown\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  4040. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  4041. referencedClasses: ["Package"]
  4042. }),
  4043. smalltalk.PackageTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  4047. category: 'tests',
  4048. fn: function (){
  4049. var self=this;
  4050. return smalltalk.withContext(function($ctx1) {
  4051. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  4052. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageTest)})},
  4053. args: [],
  4054. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  4055. messageSends: ["assert:equals:", "commitPathJs"],
  4056. referencedClasses: []
  4057. }),
  4058. smalltalk.PackageTest);
  4059. smalltalk.addMethod(
  4060. smalltalk.method({
  4061. selector: "testGrulCommitPathStShouldBeGrulSt",
  4062. category: 'tests',
  4063. fn: function (){
  4064. var self=this;
  4065. return smalltalk.withContext(function($ctx1) {
  4066. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  4067. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageTest)})},
  4068. args: [],
  4069. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  4070. messageSends: ["assert:equals:", "commitPathSt"],
  4071. referencedClasses: []
  4072. }),
  4073. smalltalk.PackageTest);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "testZorkCommitPathJsShouldBeJs",
  4077. category: 'tests',
  4078. fn: function (){
  4079. var self=this;
  4080. return smalltalk.withContext(function($ctx1) {
  4081. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  4082. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.PackageTest)})},
  4083. args: [],
  4084. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  4085. messageSends: ["assert:equals:", "commitPathJs"],
  4086. referencedClasses: []
  4087. }),
  4088. smalltalk.PackageTest);
  4089. smalltalk.addMethod(
  4090. smalltalk.method({
  4091. selector: "testZorkCommitPathStShouldBeSt",
  4092. category: 'tests',
  4093. fn: function (){
  4094. var self=this;
  4095. return smalltalk.withContext(function($ctx1) {
  4096. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  4097. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.PackageTest)})},
  4098. args: [],
  4099. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  4100. messageSends: ["assert:equals:", "commitPathSt"],
  4101. referencedClasses: []
  4102. }),
  4103. smalltalk.PackageTest);
  4104. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  4105. smalltalk.addMethod(
  4106. smalltalk.method({
  4107. selector: "setUp",
  4108. category: 'running',
  4109. fn: function (){
  4110. var self=this;
  4111. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  4112. return smalltalk.withContext(function($ctx1) {
  4113. var $1,$2;
  4114. smalltalk.PackageWithDefaultCommitPathChangedTest.superclass.fn.prototype._setUp.apply(_st(self), []);
  4115. $1=$Package();
  4116. _st($1)._defaultCommitPathJs_("javascripts/");
  4117. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  4118. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  4119. args: [],
  4120. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  4121. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  4122. referencedClasses: ["Package"]
  4123. }),
  4124. smalltalk.PackageWithDefaultCommitPathChangedTest);
  4125. smalltalk.addMethod(
  4126. smalltalk.method({
  4127. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  4128. category: 'tests',
  4129. fn: function (){
  4130. var self=this;
  4131. return smalltalk.withContext(function($ctx1) {
  4132. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  4133. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  4134. args: [],
  4135. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  4136. messageSends: ["assert:equals:", "commitPathJs"],
  4137. referencedClasses: []
  4138. }),
  4139. smalltalk.PackageWithDefaultCommitPathChangedTest);
  4140. smalltalk.addMethod(
  4141. smalltalk.method({
  4142. selector: "testGrulCommitPathStShouldBeGrulSt",
  4143. category: 'tests',
  4144. fn: function (){
  4145. var self=this;
  4146. return smalltalk.withContext(function($ctx1) {
  4147. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  4148. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  4149. args: [],
  4150. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  4151. messageSends: ["assert:equals:", "commitPathSt"],
  4152. referencedClasses: []
  4153. }),
  4154. smalltalk.PackageWithDefaultCommitPathChangedTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testZorkCommitPathJsShouldBeJavascript",
  4158. category: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  4163. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  4164. args: [],
  4165. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  4166. messageSends: ["assert:equals:", "commitPathJs"],
  4167. referencedClasses: []
  4168. }),
  4169. smalltalk.PackageWithDefaultCommitPathChangedTest);
  4170. smalltalk.addMethod(
  4171. smalltalk.method({
  4172. selector: "testZorkCommitPathStShouldBeSmalltalk",
  4173. category: 'tests',
  4174. fn: function (){
  4175. var self=this;
  4176. return smalltalk.withContext(function($ctx1) {
  4177. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  4178. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  4179. args: [],
  4180. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  4181. messageSends: ["assert:equals:", "commitPathSt"],
  4182. referencedClasses: []
  4183. }),
  4184. smalltalk.PackageWithDefaultCommitPathChangedTest);
  4185. smalltalk.addMethod(
  4186. smalltalk.method({
  4187. selector: "shouldInheritSelectors",
  4188. category: 'accessing',
  4189. fn: function (){
  4190. var self=this;
  4191. return smalltalk.withContext(function($ctx1) {
  4192. return false;
  4193. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.PackageWithDefaultCommitPathChangedTest.klass)})},
  4194. args: [],
  4195. source: "shouldInheritSelectors\x0a\x09^ false",
  4196. messageSends: [],
  4197. referencedClasses: []
  4198. }),
  4199. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  4200. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4201. smalltalk.addMethod(
  4202. smalltalk.method({
  4203. selector: "testAccessing",
  4204. category: 'tests',
  4205. fn: function (){
  4206. var self=this;
  4207. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4208. return smalltalk.withContext(function($ctx1) {
  4209. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  4210. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  4211. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  4212. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  4213. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  4214. args: [],
  4215. 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",
  4216. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  4217. referencedClasses: ["Point"]
  4218. }),
  4219. smalltalk.PointTest);
  4220. smalltalk.addMethod(
  4221. smalltalk.method({
  4222. selector: "testArithmetic",
  4223. category: 'tests',
  4224. fn: function (){
  4225. var self=this;
  4226. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4227. return smalltalk.withContext(function($ctx1) {
  4228. self._assert_equals_(_st((3).__at((4))).__star((3).__at((4))),_st($Point())._x_y_((9),(16)));
  4229. self._assert_equals_(_st((3).__at((4))).__plus((3).__at((4))),_st($Point())._x_y_((6),(8)));
  4230. self._assert_equals_(_st((3).__at((4))).__minus((3).__at((4))),_st($Point())._x_y_((0),(0)));
  4231. self._assert_equals_(_st((6).__at((8))).__slash((3).__at((4))),_st($Point())._x_y_((2),(2)));
  4232. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  4233. args: [],
  4234. 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)",
  4235. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  4236. referencedClasses: ["Point"]
  4237. }),
  4238. smalltalk.PointTest);
  4239. smalltalk.addMethod(
  4240. smalltalk.method({
  4241. selector: "testAt",
  4242. category: 'tests',
  4243. fn: function (){
  4244. var self=this;
  4245. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4246. return smalltalk.withContext(function($ctx1) {
  4247. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  4248. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  4249. args: [],
  4250. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  4251. messageSends: ["assert:equals:", "@", "x:y:"],
  4252. referencedClasses: ["Point"]
  4253. }),
  4254. smalltalk.PointTest);
  4255. smalltalk.addMethod(
  4256. smalltalk.method({
  4257. selector: "testEgality",
  4258. category: 'tests',
  4259. fn: function (){
  4260. var self=this;
  4261. return smalltalk.withContext(function($ctx1) {
  4262. self._assert_(_st((3).__at((4))).__eq((3).__at((4))));
  4263. self._deny_(_st((3).__at((5))).__eq((3).__at((6))));
  4264. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  4265. args: [],
  4266. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  4267. messageSends: ["assert:", "=", "@", "deny:"],
  4268. referencedClasses: []
  4269. }),
  4270. smalltalk.PointTest);
  4271. smalltalk.addMethod(
  4272. smalltalk.method({
  4273. selector: "testTranslateBy",
  4274. category: 'tests',
  4275. fn: function (){
  4276. var self=this;
  4277. return smalltalk.withContext(function($ctx1) {
  4278. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1))),(3).__at((4)));
  4279. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1)._negated())),(3).__at((2)));
  4280. self._assert_equals_(_st((3).__at((3)))._translateBy_((2).__at((3))),(5).__at((6)));
  4281. self._assert_equals_(_st((3).__at((3)))._translateBy_(_st((3)._negated()).__at((0))),(0).__at((3)));
  4282. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  4283. args: [],
  4284. 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.",
  4285. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  4286. referencedClasses: []
  4287. }),
  4288. smalltalk.PointTest);
  4289. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "textNext",
  4293. category: 'tests',
  4294. fn: function (){
  4295. var self=this;
  4296. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  4297. return smalltalk.withContext(function($ctx1) {
  4298. (10000)._timesRepeat_((function(){
  4299. var current,next;
  4300. return smalltalk.withContext(function($ctx2) {
  4301. next=_st(_st($Random())._new())._next();
  4302. next;
  4303. self._assert_(_st(next).__gt_eq((0)));
  4304. self._assert_(_st(next).__lt((1)));
  4305. self._deny_(_st(current).__eq(next));
  4306. return _st(next).__eq(current);
  4307. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  4308. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  4309. args: [],
  4310. 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]",
  4311. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  4312. referencedClasses: ["Random"]
  4313. }),
  4314. smalltalk.RandomTest);
  4315. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "testAddRemove",
  4319. category: 'tests',
  4320. fn: function (){
  4321. var self=this;
  4322. var set;
  4323. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4324. return smalltalk.withContext(function($ctx1) {
  4325. set=_st($Set())._new();
  4326. self._assert_(_st(set)._isEmpty());
  4327. _st(set)._add_((3));
  4328. self._assert_(_st(set)._includes_((3)));
  4329. _st(set)._add_((5));
  4330. self._assert_(_st(set)._includes_((5)));
  4331. _st(set)._remove_((3));
  4332. self._deny_(_st(set)._includes_((3)));
  4333. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4334. args: [],
  4335. 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)",
  4336. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4337. referencedClasses: ["Set"]
  4338. }),
  4339. smalltalk.SetTest);
  4340. smalltalk.addMethod(
  4341. smalltalk.method({
  4342. selector: "testAt",
  4343. category: 'tests',
  4344. fn: function (){
  4345. var self=this;
  4346. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4347. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4348. return smalltalk.withContext(function($ctx1) {
  4349. self._should_raise_((function(){
  4350. return smalltalk.withContext(function($ctx2) {
  4351. return _st(_st($Set())._new())._at_put_((1),(2));
  4352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  4353. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  4354. args: [],
  4355. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  4356. messageSends: ["should:raise:", "at:put:", "new"],
  4357. referencedClasses: ["Set", "Error"]
  4358. }),
  4359. smalltalk.SetTest);
  4360. smalltalk.addMethod(
  4361. smalltalk.method({
  4362. selector: "testCollect",
  4363. category: 'tests',
  4364. fn: function (){
  4365. var self=this;
  4366. return smalltalk.withContext(function($ctx1) {
  4367. self._assert_equals_(_st([(5), (6), (8)]._asSet())._collect_((function(x){
  4368. return smalltalk.withContext(function($ctx2) {
  4369. return _st(x).__backslash_backslash((3));
  4370. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),[(0), (2)]._asSet());
  4371. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  4372. args: [],
  4373. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  4374. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"],
  4375. referencedClasses: []
  4376. }),
  4377. smalltalk.SetTest);
  4378. smalltalk.addMethod(
  4379. smalltalk.method({
  4380. selector: "testComparing",
  4381. category: 'tests',
  4382. fn: function (){
  4383. var self=this;
  4384. return smalltalk.withContext(function($ctx1) {
  4385. self._assert_equals_([(0), (2)]._asSet(),[(0), (2)]._asSet());
  4386. self._assert_equals_([(2), (0)]._asSet(),[(0), (2)]._asSet());
  4387. self._deny_(_st([(0), (2), (3)]._asSet()).__eq([(0), (2)]._asSet()));
  4388. self._deny_(_st([(1), (2)]._asSet()).__eq([(0), (2)]._asSet()));
  4389. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  4390. args: [],
  4391. 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",
  4392. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  4393. referencedClasses: []
  4394. }),
  4395. smalltalk.SetTest);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "testPrintString",
  4399. category: 'tests',
  4400. fn: function (){
  4401. var self=this;
  4402. var set;
  4403. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4404. return smalltalk.withContext(function($ctx1) {
  4405. var $1,$2,$3,$4;
  4406. set=_st($Set())._new();
  4407. self._assert_equals_(_st(set)._printString(),"a Set ()");
  4408. $1=set;
  4409. _st($1)._add_((1));
  4410. $2=_st($1)._add_((3));
  4411. self._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  4412. _st(set)._add_("foo");
  4413. self._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  4414. $3=set;
  4415. _st($3)._remove_((1));
  4416. $4=_st($3)._remove_((3));
  4417. self._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  4418. _st(set)._add_((3));
  4419. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4420. _st(set)._add_((3));
  4421. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4422. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  4423. args: [],
  4424. 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)'",
  4425. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  4426. referencedClasses: ["Set"]
  4427. }),
  4428. smalltalk.SetTest);
  4429. smalltalk.addMethod(
  4430. smalltalk.method({
  4431. selector: "testSize",
  4432. category: 'tests',
  4433. fn: function (){
  4434. var self=this;
  4435. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4436. return smalltalk.withContext(function($ctx1) {
  4437. self._assert_equals_(_st(_st($Set())._new())._size(),(0));
  4438. self._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  4439. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  4440. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  4441. args: [],
  4442. 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",
  4443. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  4444. referencedClasses: ["Set"]
  4445. }),
  4446. smalltalk.SetTest);
  4447. smalltalk.addMethod(
  4448. smalltalk.method({
  4449. selector: "testUnboxedObjects",
  4450. category: 'tests',
  4451. fn: function (){
  4452. var self=this;
  4453. return smalltalk.withContext(function($ctx1) {
  4454. self._assert_equals_(_st(_st(["foo"._yourself(),"foo"._yourself()])._asSet())._asArray(),["foo"]);
  4455. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  4456. args: [],
  4457. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  4458. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  4459. referencedClasses: []
  4460. }),
  4461. smalltalk.SetTest);
  4462. smalltalk.addMethod(
  4463. smalltalk.method({
  4464. selector: "testUnicity",
  4465. category: 'tests',
  4466. fn: function (){
  4467. var self=this;
  4468. var set;
  4469. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4470. return smalltalk.withContext(function($ctx1) {
  4471. set=_st($Set())._new();
  4472. _st(set)._add_((21));
  4473. _st(set)._add_("hello");
  4474. _st(set)._add_((21));
  4475. self._assert_equals_(_st(set)._size(),(2));
  4476. _st(set)._add_("hello");
  4477. self._assert_equals_(_st(set)._size(),(2));
  4478. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  4479. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  4480. args: [],
  4481. 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')",
  4482. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4483. referencedClasses: ["Set"]
  4484. }),
  4485. smalltalk.SetTest);
  4486. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4487. smalltalk.addMethod(
  4488. smalltalk.method({
  4489. selector: "collectionClass",
  4490. category: 'accessing',
  4491. fn: function (){
  4492. var self=this;
  4493. return smalltalk.withContext(function($ctx1) {
  4494. var $1;
  4495. $1=_st(self._class())._collectionClass();
  4496. return $1;
  4497. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  4498. args: [],
  4499. source: "collectionClass\x0a\x09^ self class collectionClass",
  4500. messageSends: ["collectionClass", "class"],
  4501. referencedClasses: []
  4502. }),
  4503. smalltalk.StreamTest);
  4504. smalltalk.addMethod(
  4505. smalltalk.method({
  4506. selector: "newCollection",
  4507. category: 'accessing',
  4508. fn: function (){
  4509. var self=this;
  4510. return smalltalk.withContext(function($ctx1) {
  4511. var $1;
  4512. $1=_st(self._collectionClass())._new();
  4513. return $1;
  4514. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  4515. args: [],
  4516. source: "newCollection\x0a\x09^ self collectionClass new",
  4517. messageSends: ["new", "collectionClass"],
  4518. referencedClasses: []
  4519. }),
  4520. smalltalk.StreamTest);
  4521. smalltalk.addMethod(
  4522. smalltalk.method({
  4523. selector: "newStream",
  4524. category: 'accessing',
  4525. fn: function (){
  4526. var self=this;
  4527. return smalltalk.withContext(function($ctx1) {
  4528. var $1;
  4529. $1=_st(_st(self._collectionClass())._new())._stream();
  4530. return $1;
  4531. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  4532. args: [],
  4533. source: "newStream\x0a\x09^ self collectionClass new stream",
  4534. messageSends: ["stream", "new", "collectionClass"],
  4535. referencedClasses: []
  4536. }),
  4537. smalltalk.StreamTest);
  4538. smalltalk.addMethod(
  4539. smalltalk.method({
  4540. selector: "testAtStartAtEnd",
  4541. category: 'tests',
  4542. fn: function (){
  4543. var self=this;
  4544. var stream;
  4545. return smalltalk.withContext(function($ctx1) {
  4546. stream=self._newStream();
  4547. self._assert_(_st(stream)._atStart());
  4548. self._assert_(_st(stream)._atEnd());
  4549. _st(stream)._nextPutAll_(self._newCollection());
  4550. self._assert_(_st(stream)._atEnd());
  4551. self._deny_(_st(stream)._atStart());
  4552. _st(stream)._position_((1));
  4553. self._deny_(_st(stream)._atEnd());
  4554. self._deny_(_st(stream)._atStart());
  4555. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  4556. args: [],
  4557. 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",
  4558. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  4559. referencedClasses: []
  4560. }),
  4561. smalltalk.StreamTest);
  4562. smalltalk.addMethod(
  4563. smalltalk.method({
  4564. selector: "testContents",
  4565. category: 'tests',
  4566. fn: function (){
  4567. var self=this;
  4568. var stream;
  4569. return smalltalk.withContext(function($ctx1) {
  4570. stream=self._newStream();
  4571. _st(stream)._nextPutAll_(self._newCollection());
  4572. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  4573. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  4574. args: [],
  4575. 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",
  4576. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  4577. referencedClasses: []
  4578. }),
  4579. smalltalk.StreamTest);
  4580. smalltalk.addMethod(
  4581. smalltalk.method({
  4582. selector: "testIsEmpty",
  4583. category: 'tests',
  4584. fn: function (){
  4585. var self=this;
  4586. var stream;
  4587. return smalltalk.withContext(function($ctx1) {
  4588. stream=self._newStream();
  4589. self._assert_(_st(stream)._isEmpty());
  4590. _st(stream)._nextPutAll_(self._newCollection());
  4591. self._deny_(_st(stream)._isEmpty());
  4592. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  4593. args: [],
  4594. 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",
  4595. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  4596. referencedClasses: []
  4597. }),
  4598. smalltalk.StreamTest);
  4599. smalltalk.addMethod(
  4600. smalltalk.method({
  4601. selector: "testPosition",
  4602. category: 'tests',
  4603. fn: function (){
  4604. var self=this;
  4605. var collection,stream;
  4606. return smalltalk.withContext(function($ctx1) {
  4607. collection=self._newCollection();
  4608. stream=self._newStream();
  4609. _st(stream)._nextPutAll_(collection);
  4610. self._assert_equals_(_st(stream)._position(),_st(collection)._size());
  4611. _st(stream)._position_((0));
  4612. self._assert_equals_(_st(stream)._position(),(0));
  4613. _st(stream)._next();
  4614. self._assert_equals_(_st(stream)._position(),(1));
  4615. _st(stream)._next();
  4616. self._assert_equals_(_st(stream)._position(),(2));
  4617. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  4618. args: [],
  4619. 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",
  4620. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  4621. referencedClasses: []
  4622. }),
  4623. smalltalk.StreamTest);
  4624. smalltalk.addMethod(
  4625. smalltalk.method({
  4626. selector: "testReading",
  4627. category: 'tests',
  4628. fn: function (){
  4629. var self=this;
  4630. var stream,collection;
  4631. return smalltalk.withContext(function($ctx1) {
  4632. var $1,$2;
  4633. collection=self._newCollection();
  4634. stream=self._newStream();
  4635. $1=stream;
  4636. _st($1)._nextPutAll_(collection);
  4637. $2=_st($1)._position_((0));
  4638. _st(collection)._do_((function(each){
  4639. return smalltalk.withContext(function($ctx2) {
  4640. return self._assert_equals_(_st(stream)._next(),each);
  4641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4642. self._assert_(_st(_st(stream)._next())._isNil());
  4643. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4644. args: [],
  4645. 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",
  4646. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  4647. referencedClasses: []
  4648. }),
  4649. smalltalk.StreamTest);
  4650. smalltalk.addMethod(
  4651. smalltalk.method({
  4652. selector: "testStreamContents",
  4653. category: 'tests',
  4654. fn: function (){
  4655. var self=this;
  4656. return smalltalk.withContext(function($ctx1) {
  4657. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  4658. args: [],
  4659. source: "testStreamContents",
  4660. messageSends: [],
  4661. referencedClasses: []
  4662. }),
  4663. smalltalk.StreamTest);
  4664. smalltalk.addMethod(
  4665. smalltalk.method({
  4666. selector: "testWrite",
  4667. category: 'tests',
  4668. fn: function (){
  4669. var self=this;
  4670. var stream,collection;
  4671. return smalltalk.withContext(function($ctx1) {
  4672. collection=self._newCollection();
  4673. stream=self._newStream();
  4674. _st(collection)._do_((function(each){
  4675. return smalltalk.withContext(function($ctx2) {
  4676. return _st(stream).__lt_lt(each);
  4677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4678. self._assert_equals_(_st(stream)._contents(),collection);
  4679. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4680. args: [],
  4681. 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",
  4682. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  4683. referencedClasses: []
  4684. }),
  4685. smalltalk.StreamTest);
  4686. smalltalk.addMethod(
  4687. smalltalk.method({
  4688. selector: "testWriting",
  4689. category: 'tests',
  4690. fn: function (){
  4691. var self=this;
  4692. var stream,collection;
  4693. return smalltalk.withContext(function($ctx1) {
  4694. collection=self._newCollection();
  4695. stream=self._newStream();
  4696. _st(collection)._do_((function(each){
  4697. return smalltalk.withContext(function($ctx2) {
  4698. return _st(stream)._nextPut_(each);
  4699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4700. self._assert_equals_(_st(stream)._contents(),collection);
  4701. stream=self._newStream();
  4702. _st(stream)._nextPutAll_(collection);
  4703. self._assert_equals_(_st(stream)._contents(),collection);
  4704. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4705. args: [],
  4706. 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",
  4707. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  4708. referencedClasses: []
  4709. }),
  4710. smalltalk.StreamTest);
  4711. smalltalk.addMethod(
  4712. smalltalk.method({
  4713. selector: "collectionClass",
  4714. category: 'accessing',
  4715. fn: function (){
  4716. var self=this;
  4717. return smalltalk.withContext(function($ctx1) {
  4718. return nil;
  4719. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  4720. args: [],
  4721. source: "collectionClass\x0a\x09^ nil",
  4722. messageSends: [],
  4723. referencedClasses: []
  4724. }),
  4725. smalltalk.StreamTest.klass);
  4726. smalltalk.addMethod(
  4727. smalltalk.method({
  4728. selector: "isAbstract",
  4729. category: 'testing',
  4730. fn: function (){
  4731. var self=this;
  4732. return smalltalk.withContext(function($ctx1) {
  4733. var $1;
  4734. $1=_st(self._collectionClass())._isNil();
  4735. return $1;
  4736. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  4737. args: [],
  4738. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  4739. messageSends: ["isNil", "collectionClass"],
  4740. referencedClasses: []
  4741. }),
  4742. smalltalk.StreamTest.klass);
  4743. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4744. smalltalk.addMethod(
  4745. smalltalk.method({
  4746. selector: "newCollection",
  4747. category: 'accessing',
  4748. fn: function (){
  4749. var self=this;
  4750. return smalltalk.withContext(function($ctx1) {
  4751. var $1;
  4752. $1=[true,(1),(3).__at((4)),"foo"];
  4753. return $1;
  4754. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  4755. args: [],
  4756. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  4757. messageSends: ["@"],
  4758. referencedClasses: []
  4759. }),
  4760. smalltalk.ArrayStreamTest);
  4761. smalltalk.addMethod(
  4762. smalltalk.method({
  4763. selector: "collectionClass",
  4764. category: 'accessing',
  4765. fn: function (){
  4766. var self=this;
  4767. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4768. return smalltalk.withContext(function($ctx1) {
  4769. var $1;
  4770. $1=$Array();
  4771. return $1;
  4772. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  4773. args: [],
  4774. source: "collectionClass\x0a\x09^ Array",
  4775. messageSends: [],
  4776. referencedClasses: ["Array"]
  4777. }),
  4778. smalltalk.ArrayStreamTest.klass);
  4779. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4780. smalltalk.addMethod(
  4781. smalltalk.method({
  4782. selector: "newCollection",
  4783. category: 'accessing',
  4784. fn: function (){
  4785. var self=this;
  4786. return smalltalk.withContext(function($ctx1) {
  4787. return "hello world";
  4788. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  4789. args: [],
  4790. source: "newCollection\x0a\x09^ 'hello world'",
  4791. messageSends: [],
  4792. referencedClasses: []
  4793. }),
  4794. smalltalk.StringStreamTest);
  4795. smalltalk.addMethod(
  4796. smalltalk.method({
  4797. selector: "collectionClass",
  4798. category: 'accessing',
  4799. fn: function (){
  4800. var self=this;
  4801. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4802. return smalltalk.withContext(function($ctx1) {
  4803. var $1;
  4804. $1=$String();
  4805. return $1;
  4806. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  4807. args: [],
  4808. source: "collectionClass\x0a\x09^ String",
  4809. messageSends: [],
  4810. referencedClasses: ["String"]
  4811. }),
  4812. smalltalk.StringStreamTest.klass);
  4813. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4814. smalltalk.addMethod(
  4815. smalltalk.method({
  4816. selector: "testCopying",
  4817. category: 'tests',
  4818. fn: function (){
  4819. var self=this;
  4820. return smalltalk.withContext(function($ctx1) {
  4821. self._assert_equals_(nil._copy(),nil);
  4822. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  4823. args: [],
  4824. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4825. messageSends: ["assert:equals:", "copy"],
  4826. referencedClasses: []
  4827. }),
  4828. smalltalk.UndefinedTest);
  4829. smalltalk.addMethod(
  4830. smalltalk.method({
  4831. selector: "testDeepCopy",
  4832. category: 'tests',
  4833. fn: function (){
  4834. var self=this;
  4835. return smalltalk.withContext(function($ctx1) {
  4836. self._assert_(_st(nil._deepCopy()).__eq(nil));
  4837. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  4838. args: [],
  4839. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4840. messageSends: ["assert:", "=", "deepCopy"],
  4841. referencedClasses: []
  4842. }),
  4843. smalltalk.UndefinedTest);
  4844. smalltalk.addMethod(
  4845. smalltalk.method({
  4846. selector: "testIfNil",
  4847. category: 'tests',
  4848. fn: function (){
  4849. var self=this;
  4850. return smalltalk.withContext(function($ctx1) {
  4851. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  4852. $1=self;
  4853. if(($receiver = nil) == nil || $receiver == undefined){
  4854. $2=true;
  4855. } else {
  4856. $2=nil;
  4857. };
  4858. _st($1)._assert_equals_($2,true);
  4859. $3=self;
  4860. if(($receiver = nil) == nil || $receiver == undefined){
  4861. $5=nil;
  4862. } else {
  4863. $5=true;
  4864. };
  4865. $4=_st($5).__eq(true);
  4866. _st($3)._deny_($4);
  4867. $6=self;
  4868. if(($receiver = nil) == nil || $receiver == undefined){
  4869. $7=true;
  4870. } else {
  4871. $7=false;
  4872. };
  4873. _st($6)._assert_equals_($7,true);
  4874. $8=self;
  4875. if(($receiver = nil) == nil || $receiver == undefined){
  4876. $10=false;
  4877. } else {
  4878. $10=true;
  4879. };
  4880. $9=_st($10).__eq(true);
  4881. _st($8)._deny_($9);
  4882. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  4883. args: [],
  4884. 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",
  4885. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4886. referencedClasses: []
  4887. }),
  4888. smalltalk.UndefinedTest);
  4889. smalltalk.addMethod(
  4890. smalltalk.method({
  4891. selector: "testIsNil",
  4892. category: 'tests',
  4893. fn: function (){
  4894. var self=this;
  4895. return smalltalk.withContext(function($ctx1) {
  4896. self._assert_(nil._isNil());
  4897. self._deny_(nil._notNil());
  4898. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  4899. args: [],
  4900. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4901. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4902. referencedClasses: []
  4903. }),
  4904. smalltalk.UndefinedTest);
  4905. })(global_smalltalk,global_nil,global__st);