Kernel-Tests.js 199 KB

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