Kernel-Tests.deploy.js 128 KB

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