Kernel-Tests.js 187 KB

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