1
0

Kernel-Tests.js 146 KB

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