Kernel-Tests.js 166 KB

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