1
0

Kernel-Tests.js 176 KB

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