Kernel-Tests.js 158 KB

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