Kernel-Tests.deploy.js 139 KB

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