2
0

Kernel-Tests.deploy.js 140 KB

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