Kernel-Tests.js 216 KB

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