2
0

Kernel-Tests.deploy.js 137 KB

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