Kernel-Tests.js 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('ArrayTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testAtIfAbsent",
  5. smalltalk.method({
  6. selector: "testAtIfAbsent",
  7. category: 'testing',
  8. fn: function (){
  9. var self=this;
  10. var array=nil;
  11. (array=["hello", "world"]);
  12. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(1)]), "hello"]);
  13. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(2)]), "world"]);
  14. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(2), (function(){return "not found";})]), "world"]);
  15. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(0), (function(){return "not found";})]), "not found"]);
  16. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(-10), (function(){return "not found";})]), "not found"]);
  17. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(3), (function(){return "not found";})]), "not found"]);
  18. return self;},
  19. args: [],
  20. source: "testAtIfAbsent\x0a\x09| array |\x0a\x09array := #('hello' 'world').\x0a\x09self assert: (array at: 1) equals: 'hello'.\x0a\x09self assert: (array at: 2) equals: 'world'.\x0a\x09self assert: (array at: 2 ifAbsent: ['not found']) equals: 'world'.\x0a\x09self assert: (array at: 0 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: -10 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: 3 ifAbsent: ['not found']) equals: 'not found'.",
  21. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  22. referencedClasses: []
  23. }),
  24. smalltalk.ArrayTest);
  25. smalltalk.addMethod(
  26. "_testFirstN",
  27. smalltalk.method({
  28. selector: "testFirstN",
  29. category: 'testing',
  30. fn: function (){
  31. var self=this;
  32. smalltalk.send(self, "_assert_equals_", [[(1),(2),(3)], smalltalk.send([(1),(2),(3),(4),(5)], "_first_", [(3)])]);
  33. return self;},
  34. args: [],
  35. source: "testFirstN\x0a\x09self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).",
  36. messageSends: ["assert:equals:", "first:"],
  37. referencedClasses: []
  38. }),
  39. smalltalk.ArrayTest);
  40. smalltalk.addMethod(
  41. "_testIfEmpty",
  42. smalltalk.method({
  43. selector: "testIfEmpty",
  44. category: 'testing',
  45. fn: function (){
  46. var self=this;
  47. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [(function(){return "zork";})])]);
  48. return self;},
  49. args: [],
  50. source: "testIfEmpty\x0a\x09self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )",
  51. messageSends: ["assert:equals:", "ifEmpty:"],
  52. referencedClasses: []
  53. }),
  54. smalltalk.ArrayTest);
  55. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  56. smalltalk.addMethod(
  57. "_testCompiledSource",
  58. smalltalk.method({
  59. selector: "testCompiledSource",
  60. category: 'tests',
  61. fn: function (){
  62. var self=this;
  63. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
  64. return self;},
  65. args: [],
  66. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  67. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  68. referencedClasses: []
  69. }),
  70. smalltalk.BlockClosureTest);
  71. smalltalk.addMethod(
  72. "_testEnsure",
  73. smalltalk.method({
  74. selector: "testEnsure",
  75. category: 'tests',
  76. fn: function (){
  77. var self=this;
  78. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  79. return self;},
  80. args: [],
  81. source: "testEnsure\x0a\x09self assert: ([Error new] ensure: [true])",
  82. messageSends: ["assert:", "ensure:", "new"],
  83. referencedClasses: ["Error"]
  84. }),
  85. smalltalk.BlockClosureTest);
  86. smalltalk.addMethod(
  87. "_testNumArgs",
  88. smalltalk.method({
  89. selector: "testNumArgs",
  90. category: 'tests',
  91. fn: function (){
  92. var self=this;
  93. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  94. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  95. return self;},
  96. args: [],
  97. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  98. messageSends: ["assert:equals:", "numArgs"],
  99. referencedClasses: []
  100. }),
  101. smalltalk.BlockClosureTest);
  102. smalltalk.addMethod(
  103. "_testOnDo",
  104. smalltalk.method({
  105. selector: "testOnDo",
  106. category: 'tests',
  107. fn: function (){
  108. var self=this;
  109. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
  110. return self;},
  111. args: [],
  112. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  113. messageSends: ["assert:", "on:do:", "signal", "new"],
  114. referencedClasses: ["Error"]
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. "_testValue",
  119. smalltalk.method({
  120. selector: "testValue",
  121. category: 'tests',
  122. fn: function (){
  123. var self=this;
  124. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  125. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
  126. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
  127. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  128. return self;},
  129. args: [],
  130. source: "testValue\x0a\x09self assert: ([1+1] value) equals: 2.\x0a\x09self assert: ([:x | x +1] value: 2) equals: 3.\x0a\x09self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8. \x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([:a :b :c | 1] value) equals: 1",
  131. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  132. referencedClasses: []
  133. }),
  134. smalltalk.BlockClosureTest);
  135. smalltalk.addMethod(
  136. "_testValueWithPossibleArguments",
  137. smalltalk.method({
  138. selector: "testValueWithPossibleArguments",
  139. category: 'tests',
  140. fn: function (){
  141. var self=this;
  142. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  143. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
  144. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
  145. return self;},
  146. args: [],
  147. source: "testValueWithPossibleArguments\x0a\x09self assert: ([1] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([:a | a + 4] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([:a :b | a + b] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  148. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  149. referencedClasses: []
  150. }),
  151. smalltalk.BlockClosureTest);
  152. smalltalk.addMethod(
  153. "_testWhileFalse",
  154. smalltalk.method({
  155. selector: "testWhileFalse",
  156. category: 'tests',
  157. fn: function (){
  158. var self=this;
  159. var i=nil;
  160. (i=(0));
  161. (function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  162. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  163. (i=(0));
  164. (function(){while(!(function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
  165. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  166. return self;},
  167. args: [],
  168. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[i > 5] whileFalse: [i := i + 1].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[i := i + 1. i > 5] whileFalse.\x0a\x09self assert: i equals: 6",
  169. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. "_testWhileTrue",
  175. smalltalk.method({
  176. selector: "testWhileTrue",
  177. category: 'tests',
  178. fn: function (){
  179. var self=this;
  180. var i=nil;
  181. (i=(0));
  182. (function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  183. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  184. (i=(0));
  185. (function(){while((function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
  186. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  187. return self;},
  188. args: [],
  189. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[i < 5] whileTrue: [i := i + 1].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[i := i + 1. i < 5] whileTrue.\x0a\x09self assert: i equals: 5",
  190. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  191. referencedClasses: []
  192. }),
  193. smalltalk.BlockClosureTest);
  194. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  195. smalltalk.addMethod(
  196. "_testEquality",
  197. smalltalk.method({
  198. selector: "testEquality",
  199. category: 'tests',
  200. fn: function (){
  201. var self=this;
  202. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  203. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  204. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  205. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  206. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  207. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  208. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  209. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  210. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  211. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  212. return self;},
  213. args: [],
  214. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false. \x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: true = true.\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: false = false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself = true.\x0a\x09self assert: true yourself = true yourself",
  215. messageSends: ["deny:", "=", "assert:", "yourself"],
  216. referencedClasses: []
  217. }),
  218. smalltalk.BooleanTest);
  219. smalltalk.addMethod(
  220. "_testIdentity",
  221. smalltalk.method({
  222. selector: "testIdentity",
  223. category: 'tests',
  224. fn: function (){
  225. var self=this;
  226. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq_eq", [false])]);
  227. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [(0)])]);
  228. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
  229. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
  230. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  231. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
  232. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  233. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
  234. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  235. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  236. return self;},
  237. args: [],
  238. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false. \x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  239. messageSends: ["deny:", "==", "assert:", "yourself"],
  240. referencedClasses: []
  241. }),
  242. smalltalk.BooleanTest);
  243. smalltalk.addMethod(
  244. "_testIfTrueIfFalse",
  245. smalltalk.method({
  246. selector: "testIfTrueIfFalse",
  247. category: 'tests',
  248. fn: function (){
  249. var self=this;
  250. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  251. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  252. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  253. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  254. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  255. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  256. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  257. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  258. return self;},
  259. args: [],
  260. source: "testIfTrueIfFalse\x0a \x0a\x09self assert: (true ifTrue: ['alternative block']) = 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block']) = nil.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block']) = nil.\x0a\x09self assert: (false ifFalse: ['alternative block']) = 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block2'.\x0a\x09self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block2'.",
  261. messageSends: ["assert:", "=", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  262. referencedClasses: []
  263. }),
  264. smalltalk.BooleanTest);
  265. smalltalk.addMethod(
  266. "_testLogic",
  267. smalltalk.method({
  268. selector: "testLogic",
  269. category: 'tests',
  270. fn: function (){
  271. var self=this;
  272. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
  273. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
  274. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
  275. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
  276. return self;},
  277. args: [],
  278. source: "testLogic\x0a \x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true); deny: (true & false); deny: (false & true); deny: (false & false).\x0a\x09self assert: (true | true); assert: (true | false); assert: (false | true); deny: (false | false).\x0a \x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0)); deny: ((1 > 0) & false); deny: ((1 > 0) & (1 > 2)).\x0a self assert: (false | (1 > 0)); assert: ((1 > 0) | false); assert: ((1 > 0) | (1 > 2))",
  279. messageSends: ["assert:", "&", "deny:", "|", ">"],
  280. referencedClasses: []
  281. }),
  282. smalltalk.BooleanTest);
  283. smalltalk.addMethod(
  284. "_testLogicKeywords",
  285. smalltalk.method({
  286. selector: "testLogicKeywords",
  287. category: 'tests',
  288. fn: function (){
  289. var self=this;
  290. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
  291. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
  292. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
  293. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
  294. return self;},
  295. args: [],
  296. source: "testLogicKeywords\x0a \x0a\x09\x22Trivial logic table\x22\x0a\x09self \x0a\x09\x09assert: (true and: [ true]); \x0a\x09\x09deny: (true and: [ false ]); \x0a\x09\x09deny: (false and: [ true ]); \x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self \x0a\x09\x09assert: (true or: [ true ]); \x0a\x09\x09assert: (true or: [ false ]); \x0a\x09\x09assert: (false or: [ true ]); \x0a\x09\x09deny: (false or: [ false ]).\x0a \x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self \x0a\x09\x09assert: (true and: [ 1 > 0 ]); \x0a\x09\x09deny: ((1 > 0) and: [ false ]); \x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a self \x0a\x09\x09assert: (false or: [ 1 > 0 ]); \x0a\x09\x09assert: ((1 > 0) or: [ false ]); \x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  297. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  298. referencedClasses: []
  299. }),
  300. smalltalk.BooleanTest);
  301. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  302. smalltalk.addMethod(
  303. "_setUp",
  304. smalltalk.method({
  305. selector: "setUp",
  306. category: 'running',
  307. fn: function (){
  308. var self=this;
  309. (self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []));
  310. return self;},
  311. args: [],
  312. source: "setUp\x0a\x09builder := ClassBuilder new",
  313. messageSends: ["new"],
  314. referencedClasses: ["ClassBuilder"]
  315. }),
  316. smalltalk.ClassBuilderTest);
  317. smalltalk.addMethod(
  318. "_tearDown",
  319. smalltalk.method({
  320. selector: "tearDown",
  321. category: 'running',
  322. fn: function (){
  323. var self=this;
  324. (($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return (self['@theClass']=nil);})() : nil;
  325. return self;},
  326. args: [],
  327. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  328. messageSends: ["ifNotNil:", "removeClass:", "current"],
  329. referencedClasses: ["Smalltalk"]
  330. }),
  331. smalltalk.ClassBuilderTest);
  332. smalltalk.addMethod(
  333. "_testClassCopy",
  334. smalltalk.method({
  335. selector: "testClassCopy",
  336. category: 'running',
  337. fn: function (){
  338. var self=this;
  339. (self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]));
  340. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
  341. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
  342. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  343. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
  344. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
  345. return self;},
  346. args: [],
  347. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  348. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  349. referencedClasses: ["ObjectMock"]
  350. }),
  351. smalltalk.ClassBuilderTest);
  352. smalltalk.addMethod(
  353. "_testInstanceVariableNames",
  354. smalltalk.method({
  355. selector: "testInstanceVariableNames",
  356. category: 'running',
  357. fn: function (){
  358. var self=this;
  359. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  360. return self;},
  361. args: [],
  362. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  363. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  364. referencedClasses: []
  365. }),
  366. smalltalk.ClassBuilderTest);
  367. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  368. smalltalk.addMethod(
  369. "_testAccessing",
  370. smalltalk.method({
  371. selector: "testAccessing",
  372. category: 'tests',
  373. fn: function (){
  374. var self=this;
  375. var d=nil;
  376. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  377. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  378. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  379. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  380. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  381. smalltalk.send(d, "_at_put_", [(1), (2)]);
  382. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  383. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  384. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  385. return self;},
  386. args: [],
  387. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') = 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [nil]) = 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) = 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) = 3",
  388. messageSends: ["new", "at:put:", "assert:", "=", "at:", "at:ifAbsent:", "deny:", "@"],
  389. referencedClasses: ["Dictionary"]
  390. }),
  391. smalltalk.DictionaryTest);
  392. smalltalk.addMethod(
  393. "_testDynamicDictionaries",
  394. smalltalk.method({
  395. selector: "testDynamicDictionaries",
  396. category: 'tests',
  397. fn: function (){
  398. var self=this;
  399. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [(1)])]), "_asDictionary", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_", [smalltalk.send("hello", "__minus_gt", [(1)])])])]);
  400. return self;},
  401. args: [],
  402. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary = (Dictionary with: 'hello' -> 1)",
  403. messageSends: ["assert:", "=", "asDictionary", "->", "with:"],
  404. referencedClasses: ["Dictionary"]
  405. }),
  406. smalltalk.DictionaryTest);
  407. smalltalk.addMethod(
  408. "_testEquality",
  409. smalltalk.method({
  410. selector: "testEquality",
  411. category: 'tests',
  412. fn: function (){
  413. var self=this;
  414. var d1=nil;
  415. var d2=nil;
  416. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  417. (d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  418. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  419. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  420. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  421. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  422. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  423. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  424. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  425. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  426. return self;},
  427. args: [],
  428. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: Dictionary new = Dictionary new.\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  429. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  430. referencedClasses: ["Dictionary"]
  431. }),
  432. smalltalk.DictionaryTest);
  433. smalltalk.addMethod(
  434. "_testKeys",
  435. smalltalk.method({
  436. selector: "testKeys",
  437. category: 'tests',
  438. fn: function (){
  439. var self=this;
  440. var d=nil;
  441. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  442. smalltalk.send(d, "_at_put_", [(1), (2)]);
  443. smalltalk.send(d, "_at_put_", [(2), (3)]);
  444. smalltalk.send(d, "_at_put_", [(3), (4)]);
  445. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  446. return self;},
  447. args: [],
  448. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys = #(1 2 3)",
  449. messageSends: ["new", "at:put:", "assert:", "=", "keys"],
  450. referencedClasses: ["Dictionary"]
  451. }),
  452. smalltalk.DictionaryTest);
  453. smalltalk.addMethod(
  454. "_testPrintString",
  455. smalltalk.method({
  456. selector: "testPrintString",
  457. category: 'tests',
  458. fn: function (){
  459. var self=this;
  460. smalltalk.send(self, "_assert_equals_", ["a Dictionary('firstname' -> 'James' , 'lastname' -> 'Bond')", (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []))]);
  461. return self;},
  462. args: [],
  463. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: 'a Dictionary(''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')' \x0a\x09\x09equals: (Dictionary new \x0a \x09at:'firstname' put: 'James';\x0a \x09at:'lastname' put: 'Bond';\x0a \x09printString)",
  464. messageSends: ["assert:equals:", "at:put:", "printString", "new"],
  465. referencedClasses: ["Dictionary"]
  466. }),
  467. smalltalk.DictionaryTest);
  468. smalltalk.addMethod(
  469. "_testRemoveKey",
  470. smalltalk.method({
  471. selector: "testRemoveKey",
  472. category: 'tests',
  473. fn: function (){
  474. var self=this;
  475. var d=nil;
  476. var key=nil;
  477. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  478. smalltalk.send(d, "_at_put_", [(1), (2)]);
  479. smalltalk.send(d, "_at_put_", [(2), (3)]);
  480. smalltalk.send(d, "_at_put_", [(3), (4)]);
  481. (key=(2));
  482. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  483. smalltalk.send(d, "_removeKey_", [key]);
  484. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (3)]])]);
  485. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (4)]])]);
  486. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [(2)])]);
  487. return self;},
  488. args: [],
  489. source: "testRemoveKey\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a\x0a self assert: d keys = #(1 2 3).\x0a\x0a d removeKey: key.\x0a self assert: d keys = #(1 3).\x0a self assert: d values = #(2 4).\x0a self deny: (d includesKey: 2)",
  490. messageSends: ["new", "at:put:", "assert:", "=", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  491. referencedClasses: ["Dictionary"]
  492. }),
  493. smalltalk.DictionaryTest);
  494. smalltalk.addMethod(
  495. "_testRemoveKeyIfAbsent",
  496. smalltalk.method({
  497. selector: "testRemoveKeyIfAbsent",
  498. category: 'tests',
  499. fn: function (){
  500. var self=this;
  501. var d=nil;
  502. var key=nil;
  503. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  504. smalltalk.send(d, "_at_put_", [(1), (2)]);
  505. smalltalk.send(d, "_at_put_", [(2), (3)]);
  506. smalltalk.send(d, "_at_put_", [(3), (4)]);
  507. (key=(2));
  508. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [(3)])]);
  509. (key=(3));
  510. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(4)])]);
  511. (key="why");
  512. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(42)])]);
  513. return self;},
  514. args: [],
  515. source: "testRemoveKeyIfAbsent\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a self assert: (d removeKey: key) = 3.\x0a\x0a key := 3.\x0a self assert: (d removeKey: key ifAbsent: [42]) = 4.\x0a\x0a key := 'why'.\x0a self assert: (d removeKey: key ifAbsent: [42] ) = 42.",
  516. messageSends: ["new", "at:put:", "assert:", "=", "removeKey:", "removeKey:ifAbsent:"],
  517. referencedClasses: ["Dictionary"]
  518. }),
  519. smalltalk.DictionaryTest);
  520. smalltalk.addMethod(
  521. "_testSize",
  522. smalltalk.method({
  523. selector: "testSize",
  524. category: 'tests',
  525. fn: function (){
  526. var self=this;
  527. var d=nil;
  528. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  529. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  530. smalltalk.send(d, "_at_put_", [(1), (2)]);
  531. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  532. smalltalk.send(d, "_at_put_", [(2), (3)]);
  533. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  534. return self;},
  535. args: [],
  536. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size = 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size = 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size = 2.",
  537. messageSends: ["new", "assert:", "=", "size", "at:put:"],
  538. referencedClasses: ["Dictionary"]
  539. }),
  540. smalltalk.DictionaryTest);
  541. smalltalk.addMethod(
  542. "_testValues",
  543. smalltalk.method({
  544. selector: "testValues",
  545. category: 'tests',
  546. fn: function (){
  547. var self=this;
  548. var d=nil;
  549. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  550. smalltalk.send(d, "_at_put_", [(1), (2)]);
  551. smalltalk.send(d, "_at_put_", [(2), (3)]);
  552. smalltalk.send(d, "_at_put_", [(3), (4)]);
  553. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  554. return self;},
  555. args: [],
  556. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values = #(2 3 4)",
  557. messageSends: ["new", "at:put:", "assert:", "=", "values"],
  558. referencedClasses: ["Dictionary"]
  559. }),
  560. smalltalk.DictionaryTest);
  561. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  562. smalltalk.addMethod(
  563. "_jsObject",
  564. smalltalk.method({
  565. selector: "jsObject",
  566. category: 'accessing',
  567. fn: function (){
  568. var self=this;
  569. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  570. return self;},
  571. args: [],
  572. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}}>",
  573. messageSends: [],
  574. referencedClasses: []
  575. }),
  576. smalltalk.JSObjectProxyTest);
  577. smalltalk.addMethod(
  578. "_testDNU",
  579. smalltalk.method({
  580. selector: "testDNU",
  581. category: 'tests',
  582. fn: function (){
  583. var self=this;
  584. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  585. return self;},
  586. args: [],
  587. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  588. messageSends: ["should:raise:", "foo", "jsObject"],
  589. referencedClasses: ["MessageNotUnderstood"]
  590. }),
  591. smalltalk.JSObjectProxyTest);
  592. smalltalk.addMethod(
  593. "_testMessageSend",
  594. smalltalk.method({
  595. selector: "testMessageSend",
  596. category: 'tests',
  597. fn: function (){
  598. var self=this;
  599. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  600. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  601. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  602. return self;},
  603. args: [],
  604. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  605. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  606. referencedClasses: []
  607. }),
  608. smalltalk.JSObjectProxyTest);
  609. smalltalk.addMethod(
  610. "_testMethodWithArguments",
  611. smalltalk.method({
  612. selector: "testMethodWithArguments",
  613. category: 'tests',
  614. fn: function (){
  615. var self=this;
  616. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  617. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  618. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  619. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  620. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  621. return self;},
  622. args: [],
  623. source: "testMethodWithArguments\x0a\x09self deny: ('body' asJQuery hasClass: 'amber').\x0a\x0a\x09'body' asJQuery addClass: 'amber'.\x0a\x09self assert: ('body' asJQuery hasClass: 'amber').\x0a\x0a\x09'body' asJQuery removeClass: 'amber'.\x0a\x09self deny: ('body' asJQuery hasClass: 'amber').",
  624. messageSends: ["deny:", "hasClass:", "asJQuery", "addClass:", "assert:", "removeClass:"],
  625. referencedClasses: []
  626. }),
  627. smalltalk.JSObjectProxyTest);
  628. smalltalk.addMethod(
  629. "_testPrinting",
  630. smalltalk.method({
  631. selector: "testPrinting",
  632. category: 'tests',
  633. fn: function (){
  634. var self=this;
  635. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  636. return self;},
  637. args: [],
  638. source: "testPrinting\x0a\x09self assert: self jsObject printString = '[object Object]'",
  639. messageSends: ["assert:", "=", "printString", "jsObject"],
  640. referencedClasses: []
  641. }),
  642. smalltalk.JSObjectProxyTest);
  643. smalltalk.addMethod(
  644. "_testPropertyThatReturnsEmptyString",
  645. smalltalk.method({
  646. selector: "testPropertyThatReturnsEmptyString",
  647. category: 'tests',
  648. fn: function (){
  649. var self=this;
  650. document.location.hash = '';
  651. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  652. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  653. smalltalk.send(self, "_assert_equals_", ["#test", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  654. return self;},
  655. args: [],
  656. source: "testPropertyThatReturnsEmptyString\x0a\x09<document.location.hash = ''>.\x0a\x09self assert: '' equals: document location hash.\x0a\x0a\x09document location hash: 'test'.\x0a\x09self assert: '#test' equals: document location hash.",
  657. messageSends: ["assert:equals:", "hash", "location", "hash:"],
  658. referencedClasses: []
  659. }),
  660. smalltalk.JSObjectProxyTest);
  661. smalltalk.addMethod(
  662. "_testYourself",
  663. smalltalk.method({
  664. selector: "testYourself",
  665. category: 'tests',
  666. fn: function (){
  667. var self=this;
  668. var body=nil;
  669. (body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
  670. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  671. smalltalk.send(body, "_removeClass_", ["amber"]);
  672. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  673. return self;},
  674. args: [],
  675. source: "testYourself\x0a\x09|body|\x0a\x09body := 'body' asJQuery\x0a\x09\x09\x09\x09addClass: 'amber';\x0a\x09\x09\x09\x09yourself.\x0a\x0a\x09self assert: (body hasClass: 'amber').\x0a\x0a\x09body removeClass: 'amber'.\x0a\x09self deny: (body hasClass: 'amber').",
  676. messageSends: ["addClass:", "yourself", "asJQuery", "assert:", "hasClass:", "removeClass:", "deny:"],
  677. referencedClasses: []
  678. }),
  679. smalltalk.JSObjectProxyTest);
  680. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  681. smalltalk.addMethod(
  682. "_testArithmetic",
  683. smalltalk.method({
  684. selector: "testArithmetic",
  685. category: 'tests',
  686. fn: function (){
  687. var self=this;
  688. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  689. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  690. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  691. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  692. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  693. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  694. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  695. return self;},
  696. args: [],
  697. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if \x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 = 2.5.\x0a\x09self assert: 2 - 1 = 1.\x0a\x09self assert: -2 - 1 = -3.\x0a\x09self assert: 12 / 2 = 6.\x0a\x09self assert: 3 * 4 = 12.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x0a\x09self assert: 1 + 2 * 3 = 9.\x0a\x09self assert: 1 + (2 * 3) = 7",
  698. messageSends: ["assert:", "=", "+", "-", "/", "*"],
  699. referencedClasses: []
  700. }),
  701. smalltalk.NumberTest);
  702. smalltalk.addMethod(
  703. "_testComparison",
  704. smalltalk.method({
  705. selector: "testComparison",
  706. category: 'tests',
  707. fn: function (){
  708. var self=this;
  709. smalltalk.send(self, "_assert_", [(3) > (2)]);
  710. smalltalk.send(self, "_assert_", [(2) < (3)]);
  711. smalltalk.send(self, "_deny_", [(3) < (2)]);
  712. smalltalk.send(self, "_deny_", [(2) > (3)]);
  713. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  714. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  715. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  716. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  717. return self;},
  718. args: [],
  719. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  720. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  721. referencedClasses: []
  722. }),
  723. smalltalk.NumberTest);
  724. smalltalk.addMethod(
  725. "_testCopying",
  726. smalltalk.method({
  727. selector: "testCopying",
  728. category: 'tests',
  729. fn: function (){
  730. var self=this;
  731. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  732. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  733. return self;},
  734. args: [],
  735. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  736. messageSends: ["assert:", "==", "copy", "deepCopy"],
  737. referencedClasses: []
  738. }),
  739. smalltalk.NumberTest);
  740. smalltalk.addMethod(
  741. "_testEquality",
  742. smalltalk.method({
  743. selector: "testEquality",
  744. category: 'tests',
  745. fn: function (){
  746. var self=this;
  747. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  748. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  749. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  750. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  751. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  752. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  753. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  754. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  755. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  756. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  757. return self;},
  758. args: [],
  759. source: "testEquality\x0a\x09self assert: 1 = 1.\x0a\x09self assert: 0 = 0.\x0a\x09self deny: 1 = 0.\x0a\x0a\x09self assert: 1 yourself = 1.\x0a\x09self assert: 1 = 1 yourself.\x0a\x09self assert: 1 yourself = 1 yourself.\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  760. messageSends: ["assert:", "=", "deny:", "yourself"],
  761. referencedClasses: []
  762. }),
  763. smalltalk.NumberTest);
  764. smalltalk.addMethod(
  765. "_testIdentity",
  766. smalltalk.method({
  767. selector: "testIdentity",
  768. category: 'tests',
  769. fn: function (){
  770. var self=this;
  771. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  772. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  773. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  774. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  775. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  776. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  777. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  778. return self;},
  779. args: [],
  780. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  781. messageSends: ["assert:", "==", "deny:", "yourself"],
  782. referencedClasses: []
  783. }),
  784. smalltalk.NumberTest);
  785. smalltalk.addMethod(
  786. "_testMinMax",
  787. smalltalk.method({
  788. selector: "testMinMax",
  789. category: 'tests',
  790. fn: function (){
  791. var self=this;
  792. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  793. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  794. return self;},
  795. args: [],
  796. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  797. messageSends: ["assert:equals:", "max:", "min:"],
  798. referencedClasses: []
  799. }),
  800. smalltalk.NumberTest);
  801. smalltalk.addMethod(
  802. "_testNegated",
  803. smalltalk.method({
  804. selector: "testNegated",
  805. category: 'tests',
  806. fn: function (){
  807. var self=this;
  808. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  809. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  810. return self;},
  811. args: [],
  812. source: "testNegated\x0a\x09self assert: 3 negated = -3.\x0a\x09self assert: -3 negated = 3",
  813. messageSends: ["assert:", "=", "negated"],
  814. referencedClasses: []
  815. }),
  816. smalltalk.NumberTest);
  817. smalltalk.addMethod(
  818. "_testPrintShowingDecimalPlaces",
  819. smalltalk.method({
  820. selector: "testPrintShowingDecimalPlaces",
  821. category: 'tests',
  822. fn: function (){
  823. var self=this;
  824. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  825. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  826. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  827. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  828. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  829. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  830. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  831. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  832. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  833. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  834. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  835. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  836. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  837. return self;},
  838. args: [],
  839. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: '23.00' equals: (23 printShowingDecimalPlaces: 2).\x0a\x09self assert: '23.57' equals: (23.5698 printShowingDecimalPlaces: 2).\x0a\x09self assert: '-234.56700' equals:( 234.567 negated printShowingDecimalPlaces: 5).\x0a\x09self assert: '23' equals: (23.4567 printShowingDecimalPlaces: 0).\x0a\x09self assert: '24' equals: (23.5567 printShowingDecimalPlaces: 0).\x0a\x09self assert: '-23' equals: (23.4567 negated printShowingDecimalPlaces: 0).\x0a\x09self assert: '-24' equals: (23.5567 negated printShowingDecimalPlaces: 0).\x0a\x09self assert: '100000000.0' equals: (100000000 printShowingDecimalPlaces: 1).\x0a\x09self assert: '0.98000' equals: (0.98 printShowingDecimalPlaces: 5).\x0a\x09self assert: '-0.98' equals: (0.98 negated printShowingDecimalPlaces: 2).\x0a\x09self assert: '2.57' equals: (2.567 printShowingDecimalPlaces: 2).\x0a\x09self assert: '-2.57' equals: (-2.567 printShowingDecimalPlaces: 2).\x0a\x09self assert: '0.00' equals: (0 printShowingDecimalPlaces: 2).",
  840. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  841. referencedClasses: []
  842. }),
  843. smalltalk.NumberTest);
  844. smalltalk.addMethod(
  845. "_testRounded",
  846. smalltalk.method({
  847. selector: "testRounded",
  848. category: 'tests',
  849. fn: function (){
  850. var self=this;
  851. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  852. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  853. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  854. return self;},
  855. args: [],
  856. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded = 3.\x0a\x09self assert: 3.212 rounded = 3.\x0a\x09self assert: 3.51 rounded = 4",
  857. messageSends: ["assert:", "=", "rounded"],
  858. referencedClasses: []
  859. }),
  860. smalltalk.NumberTest);
  861. smalltalk.addMethod(
  862. "_testSqrt",
  863. smalltalk.method({
  864. selector: "testSqrt",
  865. category: 'tests',
  866. fn: function (){
  867. var self=this;
  868. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  869. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  870. return self;},
  871. args: [],
  872. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt = 2.\x0a\x09self assert: 16 sqrt = 4",
  873. messageSends: ["assert:", "=", "sqrt"],
  874. referencedClasses: []
  875. }),
  876. smalltalk.NumberTest);
  877. smalltalk.addMethod(
  878. "_testSquared",
  879. smalltalk.method({
  880. selector: "testSquared",
  881. category: 'tests',
  882. fn: function (){
  883. var self=this;
  884. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  885. return self;},
  886. args: [],
  887. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared = 16",
  888. messageSends: ["assert:", "=", "squared"],
  889. referencedClasses: []
  890. }),
  891. smalltalk.NumberTest);
  892. smalltalk.addMethod(
  893. "_testTimesRepeat",
  894. smalltalk.method({
  895. selector: "testTimesRepeat",
  896. category: 'tests',
  897. fn: function (){
  898. var self=this;
  899. var i=nil;
  900. (i=(0));
  901. smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  902. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  903. smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  904. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  905. return self;},
  906. args: [],
  907. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [i := i + 1].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [i := i + 1].\x0a\x09self assert: i equals: 5",
  908. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  909. referencedClasses: []
  910. }),
  911. smalltalk.NumberTest);
  912. smalltalk.addMethod(
  913. "_testTo",
  914. smalltalk.method({
  915. selector: "testTo",
  916. category: 'tests',
  917. fn: function (){
  918. var self=this;
  919. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  920. return self;},
  921. args: [],
  922. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  923. messageSends: ["assert:equals:", "to:"],
  924. referencedClasses: []
  925. }),
  926. smalltalk.NumberTest);
  927. smalltalk.addMethod(
  928. "_testToBy",
  929. smalltalk.method({
  930. selector: "testToBy",
  931. category: 'tests',
  932. fn: function (){
  933. var self=this;
  934. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  935. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  936. return self;},
  937. args: [],
  938. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [1 to: 4 by: 0] raise: Error",
  939. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  940. referencedClasses: ["Error"]
  941. }),
  942. smalltalk.NumberTest);
  943. smalltalk.addMethod(
  944. "_testTruncated",
  945. smalltalk.method({
  946. selector: "testTruncated",
  947. category: 'tests',
  948. fn: function (){
  949. var self=this;
  950. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  951. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  952. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  953. return self;},
  954. args: [],
  955. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated = 3.\x0a\x09self assert: 3.212 truncated = 3.\x0a\x09self assert: 3.51 truncated = 3",
  956. messageSends: ["assert:", "=", "truncated"],
  957. referencedClasses: []
  958. }),
  959. smalltalk.NumberTest);
  960. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  961. smalltalk.addMethod(
  962. "_foo",
  963. smalltalk.method({
  964. selector: "foo",
  965. category: 'not yet classified',
  966. fn: function (){
  967. var self=this;
  968. return self['@foo'];
  969. return self;},
  970. args: [],
  971. source: "foo\x0a\x09^foo",
  972. messageSends: [],
  973. referencedClasses: []
  974. }),
  975. smalltalk.ObjectMock);
  976. smalltalk.addMethod(
  977. "_foo_",
  978. smalltalk.method({
  979. selector: "foo:",
  980. category: 'not yet classified',
  981. fn: function (anObject){
  982. var self=this;
  983. (self['@foo']=anObject);
  984. return self;},
  985. args: ["anObject"],
  986. source: "foo: anObject\x0a\x09foo := anObject",
  987. messageSends: [],
  988. referencedClasses: []
  989. }),
  990. smalltalk.ObjectMock);
  991. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  992. smalltalk.addMethod(
  993. "_testBasicAccess",
  994. smalltalk.method({
  995. selector: "testBasicAccess",
  996. category: 'tests',
  997. fn: function (){
  998. var self=this;
  999. var o=nil;
  1000. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1001. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  1002. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  1003. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  1004. return self;},
  1005. args: [],
  1006. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  1007. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  1008. referencedClasses: ["Object"]
  1009. }),
  1010. smalltalk.ObjectTest);
  1011. smalltalk.addMethod(
  1012. "_testBasicPerform",
  1013. smalltalk.method({
  1014. selector: "testBasicPerform",
  1015. category: 'tests',
  1016. fn: function (){
  1017. var self=this;
  1018. var o=nil;
  1019. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1020. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  1021. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  1022. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  1023. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  1024. return self;},
  1025. args: [],
  1026. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: ['hello'].\x09\x0a\x09o basicAt: 'func2' put: [:a | a + 1].\x0a\x0a\x09self assert: (o basicPerform: 'func')\x09 equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  1027. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  1028. referencedClasses: ["Object"]
  1029. }),
  1030. smalltalk.ObjectTest);
  1031. smalltalk.addMethod(
  1032. "_testDNU",
  1033. smalltalk.method({
  1034. selector: "testDNU",
  1035. category: 'tests',
  1036. fn: function (){
  1037. var self=this;
  1038. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1039. return self;},
  1040. args: [],
  1041. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  1042. messageSends: ["should:raise:", "foo", "new"],
  1043. referencedClasses: ["Object", "MessageNotUnderstood"]
  1044. }),
  1045. smalltalk.ObjectTest);
  1046. smalltalk.addMethod(
  1047. "_testEquality",
  1048. smalltalk.method({
  1049. selector: "testEquality",
  1050. category: 'tests',
  1051. fn: function (){
  1052. var self=this;
  1053. var o=nil;
  1054. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1055. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1056. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  1057. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  1058. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  1059. return self;},
  1060. args: [],
  1061. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: o = o.\x0a\x09self assert: o yourself = o.\x0a\x09self assert: o = o yourself",
  1062. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  1063. referencedClasses: ["Object"]
  1064. }),
  1065. smalltalk.ObjectTest);
  1066. smalltalk.addMethod(
  1067. "_testHalt",
  1068. smalltalk.method({
  1069. selector: "testHalt",
  1070. category: 'tests',
  1071. fn: function (){
  1072. var self=this;
  1073. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  1074. return self;},
  1075. args: [],
  1076. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  1077. messageSends: ["should:raise:", "halt", "new"],
  1078. referencedClasses: ["Object", "Error"]
  1079. }),
  1080. smalltalk.ObjectTest);
  1081. smalltalk.addMethod(
  1082. "_testIdentity",
  1083. smalltalk.method({
  1084. selector: "testIdentity",
  1085. category: 'tests',
  1086. fn: function (){
  1087. var self=this;
  1088. var o=nil;
  1089. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1090. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  1091. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  1092. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1093. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  1094. return self;},
  1095. args: [],
  1096. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  1097. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  1098. referencedClasses: ["Object"]
  1099. }),
  1100. smalltalk.ObjectTest);
  1101. smalltalk.addMethod(
  1102. "_testIfNil",
  1103. smalltalk.method({
  1104. selector: "testIfNil",
  1105. category: 'tests',
  1106. fn: function (){
  1107. var self=this;
  1108. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  1109. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  1110. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1111. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1112. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1113. return self;},
  1114. args: [],
  1115. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true]) = true.\x0a\x0a\x09self assert: (Object new ifNil: [false] ifNotNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true] ifNil: [false]) = true",
  1116. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  1117. referencedClasses: ["Object"]
  1118. }),
  1119. smalltalk.ObjectTest);
  1120. smalltalk.addMethod(
  1121. "_testInstVars",
  1122. smalltalk.method({
  1123. selector: "testInstVars",
  1124. category: 'tests',
  1125. fn: function (){
  1126. var self=this;
  1127. var o=nil;
  1128. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1129. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  1130. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  1131. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  1132. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  1133. return self;},
  1134. args: [],
  1135. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  1136. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  1137. referencedClasses: ["ObjectMock"]
  1138. }),
  1139. smalltalk.ObjectTest);
  1140. smalltalk.addMethod(
  1141. "_testNilUndefined",
  1142. smalltalk.method({
  1143. selector: "testNilUndefined",
  1144. category: 'tests',
  1145. fn: function (){
  1146. var self=this;
  1147. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  1148. return self;},
  1149. args: [],
  1150. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: nil = undefined",
  1151. messageSends: ["assert:", "="],
  1152. referencedClasses: []
  1153. }),
  1154. smalltalk.ObjectTest);
  1155. smalltalk.addMethod(
  1156. "_testYourself",
  1157. smalltalk.method({
  1158. selector: "testYourself",
  1159. category: 'tests',
  1160. fn: function (){
  1161. var self=this;
  1162. var o=nil;
  1163. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  1164. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1165. return self;},
  1166. args: [],
  1167. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  1168. messageSends: ["new", "assert:", "==", "yourself"],
  1169. referencedClasses: ["ObjectMock"]
  1170. }),
  1171. smalltalk.ObjectTest);
  1172. smalltalk.addMethod(
  1173. "_testidentityHash",
  1174. smalltalk.method({
  1175. selector: "testidentityHash",
  1176. category: 'tests',
  1177. fn: function (){
  1178. var self=this;
  1179. var o1=nil;
  1180. var o2=nil;
  1181. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1182. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  1183. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1184. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1185. return self;},
  1186. args: [],
  1187. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  1188. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  1189. referencedClasses: ["Object"]
  1190. }),
  1191. smalltalk.ObjectTest);
  1192. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1193. smalltalk.addMethod(
  1194. "_setUp",
  1195. smalltalk.method({
  1196. selector: "setUp",
  1197. category: 'running',
  1198. fn: function (){
  1199. var self=this;
  1200. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  1201. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  1202. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  1203. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  1204. (self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", ["server/grul/js"]);smalltalk.send($rec, "_commitPathSt_", ["grul/st"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", [])));
  1205. return self;},
  1206. args: [],
  1207. source: "setUp\x0a\x09backUpCommitPathJs := Package defaultCommitPathJs.\x0a\x09backUpCommitPathSt := Package defaultCommitPathSt.\x0a\x0a\x09Package resetCommitPaths.\x0a\x0a\x09zorkPackage := Package new name: 'Zork'.\x0a\x09grulPackage := Package new \x0a\x09\x09\x09\x09\x09name: 'Grul';\x0a\x09\x09\x09\x09\x09commitPathJs: 'server/grul/js';\x0a\x09\x09\x09\x09\x09commitPathSt: 'grul/st';\x0a\x09\x09\x09\x09\x09yourself",
  1208. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  1209. referencedClasses: ["Package"]
  1210. }),
  1211. smalltalk.PackageTest);
  1212. smalltalk.addMethod(
  1213. "_tearDown",
  1214. smalltalk.method({
  1215. selector: "tearDown",
  1216. category: 'running',
  1217. fn: function (){
  1218. var self=this;
  1219. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  1220. return self;},
  1221. args: [],
  1222. source: "tearDown\x0a\x09 Package \x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  1223. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  1224. referencedClasses: ["Package"]
  1225. }),
  1226. smalltalk.PackageTest);
  1227. smalltalk.addMethod(
  1228. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1229. smalltalk.method({
  1230. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1231. category: 'tests',
  1232. fn: function (){
  1233. var self=this;
  1234. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1235. return self;},
  1236. args: [],
  1237. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: 'server/grul/js' equals: grulPackage commitPathJs",
  1238. messageSends: ["assert:equals:", "commitPathJs"],
  1239. referencedClasses: []
  1240. }),
  1241. smalltalk.PackageTest);
  1242. smalltalk.addMethod(
  1243. "_testGrulCommitPathStShouldBeGrulSt",
  1244. smalltalk.method({
  1245. selector: "testGrulCommitPathStShouldBeGrulSt",
  1246. category: 'tests',
  1247. fn: function (){
  1248. var self=this;
  1249. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1250. return self;},
  1251. args: [],
  1252. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: 'grul/st' equals: grulPackage commitPathSt",
  1253. messageSends: ["assert:equals:", "commitPathSt"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.PackageTest);
  1257. smalltalk.addMethod(
  1258. "_testZorkCommitPathJsShouldBeJs",
  1259. smalltalk.method({
  1260. selector: "testZorkCommitPathJsShouldBeJs",
  1261. category: 'tests',
  1262. fn: function (){
  1263. var self=this;
  1264. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1265. return self;},
  1266. args: [],
  1267. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: 'js' equals: zorkPackage commitPathJs",
  1268. messageSends: ["assert:equals:", "commitPathJs"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.PackageTest);
  1272. smalltalk.addMethod(
  1273. "_testZorkCommitPathStShouldBeSt",
  1274. smalltalk.method({
  1275. selector: "testZorkCommitPathStShouldBeSt",
  1276. category: 'tests',
  1277. fn: function (){
  1278. var self=this;
  1279. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1280. return self;},
  1281. args: [],
  1282. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: 'st' equals: zorkPackage commitPathSt",
  1283. messageSends: ["assert:equals:", "commitPathSt"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.PackageTest);
  1287. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  1288. smalltalk.addMethod(
  1289. "_setUp",
  1290. smalltalk.method({
  1291. selector: "setUp",
  1292. category: 'running',
  1293. fn: function (){
  1294. var self=this;
  1295. smalltalk.send(self, "_setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest.superclass || nil);
  1296. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", ["javascripts/"]);return smalltalk.send($rec, "_defaultCommitPathSt_", ["smalltalk/"]);})((smalltalk.Package || Package));
  1297. return self;},
  1298. args: [],
  1299. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  1300. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  1301. referencedClasses: ["Package"]
  1302. }),
  1303. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1304. smalltalk.addMethod(
  1305. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1306. smalltalk.method({
  1307. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1308. category: 'tests',
  1309. fn: function (){
  1310. var self=this;
  1311. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1312. return self;},
  1313. args: [],
  1314. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: 'server/grul/js' equals: grulPackage commitPathJs",
  1315. messageSends: ["assert:equals:", "commitPathJs"],
  1316. referencedClasses: []
  1317. }),
  1318. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1319. smalltalk.addMethod(
  1320. "_testGrulCommitPathStShouldBeGrulSt",
  1321. smalltalk.method({
  1322. selector: "testGrulCommitPathStShouldBeGrulSt",
  1323. category: 'tests',
  1324. fn: function (){
  1325. var self=this;
  1326. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1327. return self;},
  1328. args: [],
  1329. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: 'grul/st' equals: grulPackage commitPathSt",
  1330. messageSends: ["assert:equals:", "commitPathSt"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1334. smalltalk.addMethod(
  1335. "_testZorkCommitPathJsShouldBeJavascript",
  1336. smalltalk.method({
  1337. selector: "testZorkCommitPathJsShouldBeJavascript",
  1338. category: 'tests',
  1339. fn: function (){
  1340. var self=this;
  1341. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1342. return self;},
  1343. args: [],
  1344. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: 'javascripts/' equals: zorkPackage commitPathJs",
  1345. messageSends: ["assert:equals:", "commitPathJs"],
  1346. referencedClasses: []
  1347. }),
  1348. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1349. smalltalk.addMethod(
  1350. "_testZorkCommitPathStShouldBeSmalltalk",
  1351. smalltalk.method({
  1352. selector: "testZorkCommitPathStShouldBeSmalltalk",
  1353. category: 'tests',
  1354. fn: function (){
  1355. var self=this;
  1356. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1357. return self;},
  1358. args: [],
  1359. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: 'smalltalk/' equals: zorkPackage commitPathSt",
  1360. messageSends: ["assert:equals:", "commitPathSt"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1364. smalltalk.addMethod(
  1365. "_shouldInheritSelectors",
  1366. smalltalk.method({
  1367. selector: "shouldInheritSelectors",
  1368. category: 'accessing',
  1369. fn: function (){
  1370. var self=this;
  1371. return false;
  1372. return self;},
  1373. args: [],
  1374. source: "shouldInheritSelectors\x0a\x09^ false",
  1375. messageSends: [],
  1376. referencedClasses: []
  1377. }),
  1378. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  1379. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1380. smalltalk.addMethod(
  1381. "_testAccessing",
  1382. smalltalk.method({
  1383. selector: "testAccessing",
  1384. category: 'tests',
  1385. fn: function (){
  1386. var self=this;
  1387. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1388. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1389. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1390. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1391. return self;},
  1392. args: [],
  1393. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  1394. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  1395. referencedClasses: ["Point"]
  1396. }),
  1397. smalltalk.PointTest);
  1398. smalltalk.addMethod(
  1399. "_testArithmetic",
  1400. smalltalk.method({
  1401. selector: "testArithmetic",
  1402. category: 'tests',
  1403. fn: function (){
  1404. var self=this;
  1405. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__star", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(9), (16)])]);
  1406. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver +smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(6), (8)])]);
  1407. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver -smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__minus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(0), (0)])]);
  1408. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((6), "__at", [(8)])).klass === smalltalk.Number) ? $receiver /smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__slash", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(2), (2)])]);
  1409. return self;},
  1410. args: [],
  1411. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  1412. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  1413. referencedClasses: ["Point"]
  1414. }),
  1415. smalltalk.PointTest);
  1416. smalltalk.addMethod(
  1417. "_testAt",
  1418. smalltalk.method({
  1419. selector: "testAt",
  1420. category: 'tests',
  1421. fn: function (){
  1422. var self=this;
  1423. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1424. return self;},
  1425. args: [],
  1426. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  1427. messageSends: ["assert:equals:", "@", "x:y:"],
  1428. referencedClasses: ["Point"]
  1429. }),
  1430. smalltalk.PointTest);
  1431. smalltalk.addMethod(
  1432. "_testEgality",
  1433. smalltalk.method({
  1434. selector: "testEgality",
  1435. category: 'tests',
  1436. fn: function (){
  1437. var self=this;
  1438. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1439. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1440. return self;},
  1441. args: [],
  1442. source: "testEgality\x0a\x09self assert: 3@4 = (3@4).\x0a\x09self deny: 3@5 = (3@6)",
  1443. messageSends: ["assert:", "=", "@", "deny:"],
  1444. referencedClasses: []
  1445. }),
  1446. smalltalk.PointTest);
  1447. smalltalk.addMethod(
  1448. "_testTranslateBy",
  1449. smalltalk.method({
  1450. selector: "testTranslateBy",
  1451. category: 'tests',
  1452. fn: function (){
  1453. var self=this;
  1454. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1455. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(2)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [smalltalk.send((1), "_negated", [])])])]);
  1456. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1457. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "__at", [(3)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__at", [(0)])])]);
  1458. return self;},
  1459. args: [],
  1460. source: "testTranslateBy\x0a\x09self assert: 3@4 equals: (3@3 translateBy: 0@1).\x0a\x09self assert: 3@2 equals: (3@3 translateBy: 0@1 negated).\x0a\x09self assert: 5@6 equals: (3@3 translateBy: 2@3).\x0a\x09self assert: 0@3 equals: (3@3 translateBy: 3 negated @0).",
  1461. messageSends: ["assert:equals:", "@", "translateBy:", "negated"],
  1462. referencedClasses: []
  1463. }),
  1464. smalltalk.PointTest);
  1465. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1466. smalltalk.addMethod(
  1467. "_textNext",
  1468. smalltalk.method({
  1469. selector: "textNext",
  1470. category: 'tests',
  1471. fn: function (){
  1472. var self=this;
  1473. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1474. var next=nil;
  1475. (next=smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", []));smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver >=(0) : smalltalk.send($receiver, "__gt_eq", [(0)]))]);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver <(1) : smalltalk.send($receiver, "__lt", [(1)]))]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);})]);
  1476. return self;},
  1477. args: [],
  1478. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next | \x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current]",
  1479. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  1480. referencedClasses: ["Random"]
  1481. }),
  1482. smalltalk.RandomTest);
  1483. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1484. smalltalk.addMethod(
  1485. "_testAddRemove",
  1486. smalltalk.method({
  1487. selector: "testAddRemove",
  1488. category: 'tests',
  1489. fn: function (){
  1490. var self=this;
  1491. var set=nil;
  1492. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1493. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1494. smalltalk.send(set, "_add_", [(3)]);
  1495. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1496. smalltalk.send(set, "_add_", [(5)]);
  1497. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1498. smalltalk.send(set, "_remove_", [(3)]);
  1499. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1500. return self;},
  1501. args: [],
  1502. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  1503. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  1504. referencedClasses: ["Set"]
  1505. }),
  1506. smalltalk.SetTest);
  1507. smalltalk.addMethod(
  1508. "_testAt",
  1509. smalltalk.method({
  1510. selector: "testAt",
  1511. category: 'tests',
  1512. fn: function (){
  1513. var self=this;
  1514. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1515. return self;},
  1516. args: [],
  1517. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  1518. messageSends: ["should:raise:", "at:put:", "new"],
  1519. referencedClasses: ["Set", "Error"]
  1520. }),
  1521. smalltalk.SetTest);
  1522. smalltalk.addMethod(
  1523. "_testSize",
  1524. smalltalk.method({
  1525. selector: "testSize",
  1526. category: 'tests',
  1527. fn: function (){
  1528. var self=this;
  1529. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1530. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1531. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1532. return self;},
  1533. args: [],
  1534. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  1535. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  1536. referencedClasses: ["Set"]
  1537. }),
  1538. smalltalk.SetTest);
  1539. smalltalk.addMethod(
  1540. "_testUnicity",
  1541. smalltalk.method({
  1542. selector: "testUnicity",
  1543. category: 'tests',
  1544. fn: function (){
  1545. var self=this;
  1546. var set=nil;
  1547. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1548. smalltalk.send(set, "_add_", [(21)]);
  1549. smalltalk.send(set, "_add_", ["hello"]);
  1550. smalltalk.send(set, "_add_", [(21)]);
  1551. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1552. smalltalk.send(set, "_add_", ["hello"]);
  1553. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1554. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1555. return self;},
  1556. args: [],
  1557. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size = 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size = 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  1558. messageSends: ["new", "add:", "assert:", "=", "size", "assert:equals:", "asArray"],
  1559. referencedClasses: ["Set"]
  1560. }),
  1561. smalltalk.SetTest);
  1562. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1563. smalltalk.addMethod(
  1564. "_testAddRemove",
  1565. smalltalk.method({
  1566. selector: "testAddRemove",
  1567. category: 'tests',
  1568. fn: function (){
  1569. var self=this;
  1570. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1571. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1572. return self;},
  1573. args: [],
  1574. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  1575. messageSends: ["should:raise:", "add:", "remove:"],
  1576. referencedClasses: ["Error"]
  1577. }),
  1578. smalltalk.StringTest);
  1579. smalltalk.addMethod(
  1580. "_testAsArray",
  1581. smalltalk.method({
  1582. selector: "testAsArray",
  1583. category: 'tests',
  1584. fn: function (){
  1585. var self=this;
  1586. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1587. return self;},
  1588. args: [],
  1589. source: "testAsArray\x0a\x09self assert: 'hello' asArray = #('h' 'e' 'l' 'l' 'o').",
  1590. messageSends: ["assert:", "=", "asArray"],
  1591. referencedClasses: []
  1592. }),
  1593. smalltalk.StringTest);
  1594. smalltalk.addMethod(
  1595. "_testAt",
  1596. smalltalk.method({
  1597. selector: "testAt",
  1598. category: 'tests',
  1599. fn: function (){
  1600. var self=this;
  1601. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1602. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1603. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1604. return self;},
  1605. args: [],
  1606. source: "testAt\x0a\x09self assert: ('hello' at: 1) = 'h'.\x0a\x09self assert: ('hello' at: 5) = 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [nil]) = nil",
  1607. messageSends: ["assert:", "=", "at:", "at:ifAbsent:"],
  1608. referencedClasses: []
  1609. }),
  1610. smalltalk.StringTest);
  1611. smalltalk.addMethod(
  1612. "_testAtPut",
  1613. smalltalk.method({
  1614. selector: "testAtPut",
  1615. category: 'tests',
  1616. fn: function (){
  1617. var self=this;
  1618. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1619. return self;},
  1620. args: [],
  1621. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  1622. messageSends: ["should:raise:", "at:put:"],
  1623. referencedClasses: ["Error"]
  1624. }),
  1625. smalltalk.StringTest);
  1626. smalltalk.addMethod(
  1627. "_testCopyWithoutAll",
  1628. smalltalk.method({
  1629. selector: "testCopyWithoutAll",
  1630. category: 'tests',
  1631. fn: function (){
  1632. var self=this;
  1633. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1634. return self;},
  1635. args: [],
  1636. source: "testCopyWithoutAll\x0a\x09self \x0a\x09\x09assert: 'hello world' \x0a\x09\x09equals: ('*hello* *world*' copyWithoutAll: '*')",
  1637. messageSends: ["assert:equals:", "copyWithoutAll:"],
  1638. referencedClasses: []
  1639. }),
  1640. smalltalk.StringTest);
  1641. smalltalk.addMethod(
  1642. "_testEquality",
  1643. smalltalk.method({
  1644. selector: "testEquality",
  1645. category: 'tests',
  1646. fn: function (){
  1647. var self=this;
  1648. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1649. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1650. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1651. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1652. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1653. return self;},
  1654. args: [],
  1655. source: "testEquality\x0a\x09self assert: 'hello' = 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x0a\x09self assert: 'hello' = 'hello' yourself.\x0a\x09self assert: 'hello' yourself = 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  1656. messageSends: ["assert:", "=", "deny:", "yourself"],
  1657. referencedClasses: []
  1658. }),
  1659. smalltalk.StringTest);
  1660. smalltalk.addMethod(
  1661. "_testIdentity",
  1662. smalltalk.method({
  1663. selector: "testIdentity",
  1664. category: 'tests',
  1665. fn: function (){
  1666. var self=this;
  1667. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1668. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1669. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1670. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1671. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
  1672. return self;},
  1673. args: [],
  1674. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  1675. messageSends: ["assert:", "==", "deny:", "yourself"],
  1676. referencedClasses: []
  1677. }),
  1678. smalltalk.StringTest);
  1679. smalltalk.addMethod(
  1680. "_testIncludesSubString",
  1681. smalltalk.method({
  1682. selector: "testIncludesSubString",
  1683. category: 'tests',
  1684. fn: function (){
  1685. var self=this;
  1686. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1687. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1688. return self;},
  1689. args: [],
  1690. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  1691. messageSends: ["assert:", "includesSubString:", "deny:"],
  1692. referencedClasses: []
  1693. }),
  1694. smalltalk.StringTest);
  1695. smalltalk.addMethod(
  1696. "_testJoin",
  1697. smalltalk.method({
  1698. selector: "testJoin",
  1699. category: 'tests',
  1700. fn: function (){
  1701. var self=this;
  1702. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1703. return self;},
  1704. args: [],
  1705. source: "testJoin\x0a\x09self assert: 'hello,world' equals: (',' join: #('hello' 'world'))",
  1706. messageSends: ["assert:equals:", "join:"],
  1707. referencedClasses: []
  1708. }),
  1709. smalltalk.StringTest);
  1710. smalltalk.addMethod(
  1711. "_testSize",
  1712. smalltalk.method({
  1713. selector: "testSize",
  1714. category: 'tests',
  1715. fn: function (){
  1716. var self=this;
  1717. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1718. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1719. return self;},
  1720. args: [],
  1721. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  1722. messageSends: ["assert:equals:", "size"],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.StringTest);
  1726. smalltalk.addMethod(
  1727. "_testStreamContents",
  1728. smalltalk.method({
  1729. selector: "testStreamContents",
  1730. category: 'tests',
  1731. fn: function (){
  1732. var self=this;
  1733. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  1734. return self;},
  1735. args: [],
  1736. source: "testStreamContents\x0a\x09self \x0a\x09\x09assert: 'hello world' \x0a\x09\x09equals: (String streamContents: [:aStream| aStream \x0a \x09\x09\x09\x09\x09nextPutAll: 'hello'; space; \x0a \x09\x09\x09\x09\x09nextPutAll: 'world'])",
  1737. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  1738. referencedClasses: ["String"]
  1739. }),
  1740. smalltalk.StringTest);
  1741. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1742. smalltalk.addMethod(
  1743. "_testAsString",
  1744. smalltalk.method({
  1745. selector: "testAsString",
  1746. category: 'tests',
  1747. fn: function (){
  1748. var self=this;
  1749. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1750. return self;},
  1751. args: [],
  1752. source: "testAsString\x0a\x09self assert: #hello asString equals: 'hello'",
  1753. messageSends: ["assert:equals:", "asString"],
  1754. referencedClasses: []
  1755. }),
  1756. smalltalk.SymbolTest);
  1757. smalltalk.addMethod(
  1758. "_testAsSymbol",
  1759. smalltalk.method({
  1760. selector: "testAsSymbol",
  1761. category: 'tests',
  1762. fn: function (){
  1763. var self=this;
  1764. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1765. return self;},
  1766. args: [],
  1767. source: "testAsSymbol\x0a\x09self assert: #hello == #hello asSymbol",
  1768. messageSends: ["assert:", "==", "asSymbol"],
  1769. referencedClasses: []
  1770. }),
  1771. smalltalk.SymbolTest);
  1772. smalltalk.addMethod(
  1773. "_testAt",
  1774. smalltalk.method({
  1775. selector: "testAt",
  1776. category: 'tests',
  1777. fn: function (){
  1778. var self=this;
  1779. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1780. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1781. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1782. return self;},
  1783. args: [],
  1784. source: "testAt\x0a\x09self assert: (#hello at: 1) = 'h'.\x0a\x09self assert: (#hello at: 5) = 'o'.\x0a\x09self assert: (#hello at: 6 ifAbsent: [nil]) = nil",
  1785. messageSends: ["assert:", "=", "at:", "at:ifAbsent:"],
  1786. referencedClasses: []
  1787. }),
  1788. smalltalk.SymbolTest);
  1789. smalltalk.addMethod(
  1790. "_testAtPut",
  1791. smalltalk.method({
  1792. selector: "testAtPut",
  1793. category: 'tests',
  1794. fn: function (){
  1795. var self=this;
  1796. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1797. return self;},
  1798. args: [],
  1799. source: "testAtPut\x0a\x09\x22Symbol instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  1800. messageSends: ["should:raise:", "at:put:"],
  1801. referencedClasses: ["Error"]
  1802. }),
  1803. smalltalk.SymbolTest);
  1804. smalltalk.addMethod(
  1805. "_testComparing",
  1806. smalltalk.method({
  1807. selector: "testComparing",
  1808. category: 'tests',
  1809. fn: function (){
  1810. var self=this;
  1811. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1812. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1813. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1814. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1815. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1816. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1817. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1818. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1819. return self;},
  1820. args: [],
  1821. source: "testComparing\x0a\x09self assert: #ab > #aa.\x0a\x09self deny: #ab > #ba.\x0a\x0a\x09self assert: #ab < #ba.\x0a\x09self deny: #bb < #ba.\x0a\x0a\x09self assert: #ab >= #aa.\x0a\x09self deny: #ab >= #ba.\x0a\x0a\x09self assert: #ab <= #ba.\x0a\x09self deny: #bb <= #ba",
  1822. messageSends: ["assert:", ">", "deny:", "<", ">=", "<="],
  1823. referencedClasses: []
  1824. }),
  1825. smalltalk.SymbolTest);
  1826. smalltalk.addMethod(
  1827. "_testCopying",
  1828. smalltalk.method({
  1829. selector: "testCopying",
  1830. category: 'tests',
  1831. fn: function (){
  1832. var self=this;
  1833. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1834. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1835. return self;},
  1836. args: [],
  1837. source: "testCopying\x0a\x09self assert: #hello copy == #hello.\x0a\x09self assert: #hello deepCopy == #hello",
  1838. messageSends: ["assert:", "==", "copy", "deepCopy"],
  1839. referencedClasses: []
  1840. }),
  1841. smalltalk.SymbolTest);
  1842. smalltalk.addMethod(
  1843. "_testEquality",
  1844. smalltalk.method({
  1845. selector: "testEquality",
  1846. category: 'tests',
  1847. fn: function (){
  1848. var self=this;
  1849. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1850. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1851. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1852. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1853. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1854. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1855. return self;},
  1856. args: [],
  1857. source: "testEquality\x0a\x09self assert: #hello = #hello.\x0a\x09self deny: #hello = #world.\x0a\x0a\x09self assert: #hello = #hello yourself.\x0a\x09self assert: #hello yourself = #hello.\x0a\x0a\x09self deny: #hello = 'hello'.\x0a\x09self deny: 'hello' = #hello.",
  1858. messageSends: ["assert:", "=", "deny:", "yourself"],
  1859. referencedClasses: []
  1860. }),
  1861. smalltalk.SymbolTest);
  1862. smalltalk.addMethod(
  1863. "_testIdentity",
  1864. smalltalk.method({
  1865. selector: "testIdentity",
  1866. category: 'tests',
  1867. fn: function (){
  1868. var self=this;
  1869. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1870. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1871. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1872. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1873. return self;},
  1874. args: [],
  1875. source: "testIdentity\x0a\x09self assert: #hello == #hello.\x0a\x09self deny: #hello == #world.\x0a\x0a\x09self assert: #hello = #hello yourself.\x0a\x09self assert: #hello yourself = #hello asString asSymbol",
  1876. messageSends: ["assert:", "==", "deny:", "=", "yourself", "asSymbol", "asString"],
  1877. referencedClasses: []
  1878. }),
  1879. smalltalk.SymbolTest);
  1880. smalltalk.addMethod(
  1881. "_testIsSymbolIsString",
  1882. smalltalk.method({
  1883. selector: "testIsSymbolIsString",
  1884. category: 'tests',
  1885. fn: function (){
  1886. var self=this;
  1887. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1888. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1889. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1890. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1891. return self;},
  1892. args: [],
  1893. source: "testIsSymbolIsString\x0a\x09self assert: #hello isSymbol.\x0a\x09self deny: 'hello' isSymbol.\x0a\x09self deny: #hello isString.\x0a\x09self assert: 'hello' isString",
  1894. messageSends: ["assert:", "isSymbol", "deny:", "isString"],
  1895. referencedClasses: []
  1896. }),
  1897. smalltalk.SymbolTest);
  1898. smalltalk.addMethod(
  1899. "_testSize",
  1900. smalltalk.method({
  1901. selector: "testSize",
  1902. category: 'tests',
  1903. fn: function (){
  1904. var self=this;
  1905. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1906. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1907. return self;},
  1908. args: [],
  1909. source: "testSize\x0a\x09self assert: #a size equals: 1.\x0a\x09self assert: #aaaaa size equals: 5",
  1910. messageSends: ["assert:equals:", "size"],
  1911. referencedClasses: []
  1912. }),
  1913. smalltalk.SymbolTest);
  1914. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1915. smalltalk.addMethod(
  1916. "_testCopying",
  1917. smalltalk.method({
  1918. selector: "testCopying",
  1919. category: 'tests',
  1920. fn: function (){
  1921. var self=this;
  1922. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1923. return self;},
  1924. args: [],
  1925. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  1926. messageSends: ["assert:equals:", "copy"],
  1927. referencedClasses: []
  1928. }),
  1929. smalltalk.UndefinedTest);
  1930. smalltalk.addMethod(
  1931. "_testDeepCopy",
  1932. smalltalk.method({
  1933. selector: "testDeepCopy",
  1934. category: 'tests',
  1935. fn: function (){
  1936. var self=this;
  1937. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1938. return self;},
  1939. args: [],
  1940. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  1941. messageSends: ["assert:", "=", "deepCopy"],
  1942. referencedClasses: []
  1943. }),
  1944. smalltalk.UndefinedTest);
  1945. smalltalk.addMethod(
  1946. "_testIfNil",
  1947. smalltalk.method({
  1948. selector: "testIfNil",
  1949. category: 'tests',
  1950. fn: function (){
  1951. var self=this;
  1952. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1953. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1954. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1955. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1956. return self;},
  1957. args: [],
  1958. source: "testIfNil\x0a\x09self assert: (nil ifNil: [true]) equals: true.\x0a\x09self deny: (nil ifNotNil: [true]) = true.\x0a\x09self assert: (nil ifNil: [true] ifNotNil: [false]) equals: true.\x0a\x09self deny: (nil ifNotNil: [true] ifNil: [false]) = true",
  1959. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  1960. referencedClasses: []
  1961. }),
  1962. smalltalk.UndefinedTest);
  1963. smalltalk.addMethod(
  1964. "_testIsNil",
  1965. smalltalk.method({
  1966. selector: "testIsNil",
  1967. category: 'tests',
  1968. fn: function (){
  1969. var self=this;
  1970. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1971. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1972. return self;},
  1973. args: [],
  1974. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  1975. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  1976. referencedClasses: []
  1977. }),
  1978. smalltalk.UndefinedTest);