Kernel-Tests.deploy.js 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCompiledSource",
  5. smalltalk.method({
  6. selector: "testCompiledSource",
  7. fn: function (){
  8. var self=this;
  9. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((function(){
  10. return smalltalk.send((1),"__plus",[(1)]);
  11. }),"_compiledSource",[]),"_includesSubString_",["function"])]);
  12. return self}
  13. }),
  14. smalltalk.BlockClosureTest);
  15. smalltalk.addMethod(
  16. "_testEnsure",
  17. smalltalk.method({
  18. selector: "testEnsure",
  19. fn: function (){
  20. var self=this;
  21. smalltalk.send(self,"_assert_",[smalltalk.send((function(){
  22. return smalltalk.send((smalltalk.Error || Error),"_new",[]);
  23. }),"_ensure_",[(function(){
  24. return true;
  25. })])]);
  26. return self}
  27. }),
  28. smalltalk.BlockClosureTest);
  29. smalltalk.addMethod(
  30. "_testNumArgs",
  31. smalltalk.method({
  32. selector: "testNumArgs",
  33. fn: function (){
  34. var self=this;
  35. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  36. }),"_numArgs",[]),(0)]);
  37. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
  38. }),"_numArgs",[]),(2)]);
  39. return self}
  40. }),
  41. smalltalk.BlockClosureTest);
  42. smalltalk.addMethod(
  43. "_testOnDo",
  44. smalltalk.method({
  45. selector: "testOnDo",
  46. fn: function (){
  47. var self=this;
  48. smalltalk.send(self,"_assert_",[smalltalk.send((function(){
  49. return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
  50. }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
  51. return true;
  52. })])]);
  53. return self}
  54. }),
  55. smalltalk.BlockClosureTest);
  56. smalltalk.addMethod(
  57. "_testValue",
  58. smalltalk.method({
  59. selector: "testValue",
  60. fn: function (){
  61. var self=this;
  62. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  63. return smalltalk.send((1),"__plus",[(1)]);
  64. }),"_value",[]),(2)]);
  65. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x){
  66. return smalltalk.send(x,"__plus",[(1)]);
  67. }),"_value_",[(2)]),(3)]);
  68. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x,y){
  69. return smalltalk.send(x,"__star",[y]);
  70. }),"_value_value_",[(2),(4)]),(8)]);
  71. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b,c){
  72. return (1);
  73. }),"_value",[]),(1)]);
  74. return self}
  75. }),
  76. smalltalk.BlockClosureTest);
  77. smalltalk.addMethod(
  78. "_testValueWithPossibleArguments",
  79. smalltalk.method({
  80. selector: "testValueWithPossibleArguments",
  81. fn: function (){
  82. var self=this;
  83. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  84. return (1);
  85. }),"_valueWithPossibleArguments_",[[(3), (4)]]),(1)]);
  86. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a){
  87. return smalltalk.send(a,"__plus",[(4)]);
  88. }),"_valueWithPossibleArguments_",[[(3), (4)]]),(7)]);
  89. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
  90. return smalltalk.send(a,"__plus",[b]);
  91. }),"_valueWithPossibleArguments_",[[(3), (4), (5)]]),(7)]);
  92. return self}
  93. }),
  94. smalltalk.BlockClosureTest);
  95. smalltalk.addMethod(
  96. "_testWhileFalse",
  97. smalltalk.method({
  98. selector: "testWhileFalse",
  99. fn: function (){
  100. var self=this;
  101. var i;
  102. i=(0);
  103. smalltalk.send((function(){
  104. return smalltalk.send(i,"__gt",[(5)]);
  105. }),"_whileFalse_",[(function(){
  106. i=smalltalk.send(i,"__plus",[(1)]);
  107. return i;
  108. })]);
  109. smalltalk.send(self,"_assert_equals_",[i,(6)]);
  110. i=(0);
  111. smalltalk.send((function(){
  112. i=smalltalk.send(i,"__plus",[(1)]);
  113. i;
  114. return smalltalk.send(i,"__gt",[(5)]);
  115. }),"_whileFalse",[]);
  116. smalltalk.send(self,"_assert_equals_",[i,(6)]);
  117. return self}
  118. }),
  119. smalltalk.BlockClosureTest);
  120. smalltalk.addMethod(
  121. "_testWhileTrue",
  122. smalltalk.method({
  123. selector: "testWhileTrue",
  124. fn: function (){
  125. var self=this;
  126. var i;
  127. i=(0);
  128. smalltalk.send((function(){
  129. return smalltalk.send(i,"__lt",[(5)]);
  130. }),"_whileTrue_",[(function(){
  131. i=smalltalk.send(i,"__plus",[(1)]);
  132. return i;
  133. })]);
  134. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  135. i=(0);
  136. smalltalk.send((function(){
  137. i=smalltalk.send(i,"__plus",[(1)]);
  138. i;
  139. return smalltalk.send(i,"__lt",[(5)]);
  140. }),"_whileTrue",[]);
  141. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  142. return self}
  143. }),
  144. smalltalk.BlockClosureTest);
  145. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  146. smalltalk.addMethod(
  147. "_testEquality",
  148. smalltalk.method({
  149. selector: "testEquality",
  150. fn: function (){
  151. var self=this;
  152. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
  153. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
  154. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[false])]);
  155. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[""])]);
  156. smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq",[true])]);
  157. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[true])]);
  158. smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq",[false])]);
  159. smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq",[false])]);
  160. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[true])]);
  161. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[smalltalk.send(true,"_yourself",[])])]);
  162. return self}
  163. }),
  164. smalltalk.BooleanTest);
  165. smalltalk.addMethod(
  166. "_testIdentity",
  167. smalltalk.method({
  168. selector: "testIdentity",
  169. fn: function (){
  170. var self=this;
  171. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq_eq",[false])]);
  172. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[(0)])]);
  173. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[false])]);
  174. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[""])]);
  175. smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq_eq",[true])]);
  176. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[true])]);
  177. smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq_eq",[false])]);
  178. smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq_eq",[false])]);
  179. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[true])]);
  180. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[smalltalk.send(true,"_yourself",[])])]);
  181. return self}
  182. }),
  183. smalltalk.BooleanTest);
  184. smalltalk.addMethod(
  185. "_testIfTrueIfFalse",
  186. smalltalk.method({
  187. selector: "testIfTrueIfFalse",
  188. fn: function (){
  189. var self=this;
  190. var $1,$2,$3,$4,$5,$6,$7,$8;
  191. if(smalltalk.assert(true)){
  192. $1="alternative block";
  193. };
  194. smalltalk.send(self,"_assert_",[smalltalk.send($1,"__eq",["alternative block"])]);
  195. if(! smalltalk.assert(true)){
  196. $2="alternative block";
  197. };
  198. smalltalk.send(self,"_assert_",[smalltalk.send($2,"__eq",[nil])]);
  199. if(smalltalk.assert(false)){
  200. $3="alternative block";
  201. };
  202. smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[nil])]);
  203. if(! smalltalk.assert(false)){
  204. $4="alternative block";
  205. };
  206. smalltalk.send(self,"_assert_",[smalltalk.send($4,"__eq",["alternative block"])]);
  207. if(smalltalk.assert(false)){
  208. $5="alternative block";
  209. } else {
  210. $5="alternative block2";
  211. };
  212. smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",["alternative block2"])]);
  213. if(smalltalk.assert(false)){
  214. $6="alternative block2";
  215. } else {
  216. $6="alternative block";
  217. };
  218. smalltalk.send(self,"_assert_",[smalltalk.send($6,"__eq",["alternative block"])]);
  219. if(smalltalk.assert(true)){
  220. $7="alternative block";
  221. } else {
  222. $7="alternative block2";
  223. };
  224. smalltalk.send(self,"_assert_",[smalltalk.send($7,"__eq",["alternative block"])]);
  225. if(smalltalk.assert(true)){
  226. $8="alternative block2";
  227. } else {
  228. $8="alternative block";
  229. };
  230. smalltalk.send(self,"_assert_",[smalltalk.send($8,"__eq",["alternative block2"])]);
  231. return self}
  232. }),
  233. smalltalk.BooleanTest);
  234. smalltalk.addMethod(
  235. "_testLogic",
  236. smalltalk.method({
  237. selector: "testLogic",
  238. fn: function (){
  239. var self=this;
  240. var $1,$2,$3,$4;
  241. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[true])]);
  242. smalltalk.send(self,"_deny_",[smalltalk.send(true,"_&",[false])]);
  243. smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[true])]);
  244. $1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[false])]);
  245. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[true])]);
  246. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[false])]);
  247. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[true])]);
  248. $2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_|",[false])]);
  249. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[smalltalk.send((1),"__gt",[(0)])])]);
  250. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[false])]);
  251. $3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[smalltalk.send((1),"__gt",[(2)])])]);
  252. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[smalltalk.send((1),"__gt",[(0)])])]);
  253. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[false])]);
  254. $4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[smalltalk.send((1),"__gt",[(2)])])]);
  255. return self}
  256. }),
  257. smalltalk.BooleanTest);
  258. smalltalk.addMethod(
  259. "_testLogicKeywords",
  260. smalltalk.method({
  261. selector: "testLogicKeywords",
  262. fn: function (){
  263. var self=this;
  264. var $1,$2,$3,$4;
  265. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
  266. return true;
  267. })])]);
  268. smalltalk.send(self,"_deny_",[smalltalk.send(true,"_and_",[(function(){
  269. return false;
  270. })])]);
  271. smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
  272. return true;
  273. })])]);
  274. $1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
  275. return false;
  276. })])]);
  277. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
  278. return true;
  279. })])]);
  280. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
  281. return false;
  282. })])]);
  283. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
  284. return true;
  285. })])]);
  286. $2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_or_",[(function(){
  287. return false;
  288. })])]);
  289. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
  290. return smalltalk.send((1),"__gt",[(0)]);
  291. })])]);
  292. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
  293. return false;
  294. })])]);
  295. $3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
  296. return smalltalk.send((1),"__gt",[(2)]);
  297. })])]);
  298. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
  299. return smalltalk.send((1),"__gt",[(0)]);
  300. })])]);
  301. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
  302. return false;
  303. })])]);
  304. $4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
  305. return smalltalk.send((1),"__gt",[(2)]);
  306. })])]);
  307. return self}
  308. }),
  309. smalltalk.BooleanTest);
  310. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  311. smalltalk.addMethod(
  312. "_setUp",
  313. smalltalk.method({
  314. selector: "setUp",
  315. fn: function (){
  316. var self=this;
  317. self["@builder"]=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]);
  318. return self}
  319. }),
  320. smalltalk.ClassBuilderTest);
  321. smalltalk.addMethod(
  322. "_tearDown",
  323. smalltalk.method({
  324. selector: "tearDown",
  325. fn: function (){
  326. var self=this;
  327. if(($receiver = self["@theClass"]) == nil || $receiver == undefined){
  328. self["@theClass"];
  329. } else {
  330. smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_removeClass_",[self["@theClass"]]);
  331. self["@theClass"]=nil;
  332. self["@theClass"];
  333. };
  334. return self}
  335. }),
  336. smalltalk.ClassBuilderTest);
  337. smalltalk.addMethod(
  338. "_testClassCopy",
  339. smalltalk.method({
  340. selector: "testClassCopy",
  341. fn: function (){
  342. var self=this;
  343. self["@theClass"]=smalltalk.send(self["@builder"],"_copyClass_named_",[(smalltalk.ObjectMock || ObjectMock),"ObjectMock2"]);
  344. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_superclass",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_superclass",[])])]);
  345. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_instanceVariableNames",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_instanceVariableNames",[])])]);
  346. smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@theClass"],"_name",[]),"ObjectMock2"]);
  347. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_package",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_package",[])])]);
  348. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self["@theClass"],"_methodDictionary",[]),"_keys",[]),smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_methodDictionary",[]),"_keys",[])]);
  349. return self}
  350. }),
  351. smalltalk.ClassBuilderTest);
  352. smalltalk.addMethod(
  353. "_testInstanceVariableNames",
  354. smalltalk.method({
  355. selector: "testInstanceVariableNames",
  356. fn: function (){
  357. var self=this;
  358. smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@builder"],"_instanceVariableNamesFor_",[" hello world "]),["hello", "world"]]);
  359. return self}
  360. }),
  361. smalltalk.ClassBuilderTest);
  362. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  363. smalltalk.addMethod(
  364. "_assertSameContents_as_",
  365. smalltalk.method({
  366. selector: "assertSameContents:as:",
  367. fn: function (aCollection,anotherCollection){
  368. var self=this;
  369. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_size",[]),"__eq",[smalltalk.send(anotherCollection,"_size",[])])]);
  370. smalltalk.send(aCollection,"_do_",[(function(each){
  371. return smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_occurrencesOf_",[each]),"__eq",[smalltalk.send(anotherCollection,"_occurrencesOf_",[each])])]);
  372. })]);
  373. return self}
  374. }),
  375. smalltalk.CollectionTest);
  376. smalltalk.addMethod(
  377. "_collection",
  378. smalltalk.method({
  379. selector: "collection",
  380. fn: function (){
  381. var self=this;
  382. var $1;
  383. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[smalltalk.send(self,"_defaultValues",[])]);
  384. return $1;
  385. }
  386. }),
  387. smalltalk.CollectionTest);
  388. smalltalk.addMethod(
  389. "_collectionClass",
  390. smalltalk.method({
  391. selector: "collectionClass",
  392. fn: function (){
  393. var self=this;
  394. var $1;
  395. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_collectionClass",[]);
  396. return $1;
  397. }
  398. }),
  399. smalltalk.CollectionTest);
  400. smalltalk.addMethod(
  401. "_collectionWithDuplicates",
  402. smalltalk.method({
  403. selector: "collectionWithDuplicates",
  404. fn: function (){
  405. var self=this;
  406. var $1;
  407. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[["a", "b", "c", (1), (2), (1), "a"]]);
  408. return $1;
  409. }
  410. }),
  411. smalltalk.CollectionTest);
  412. smalltalk.addMethod(
  413. "_defaultValues",
  414. smalltalk.method({
  415. selector: "defaultValues",
  416. fn: function (){
  417. var self=this;
  418. return [(1), (2), (3), (-4)];
  419. }
  420. }),
  421. smalltalk.CollectionTest);
  422. smalltalk.addMethod(
  423. "_isCollectionReadOnly",
  424. smalltalk.method({
  425. selector: "isCollectionReadOnly",
  426. fn: function (){
  427. var self=this;
  428. return false;
  429. }
  430. }),
  431. smalltalk.CollectionTest);
  432. smalltalk.addMethod(
  433. "_testAsArray",
  434. smalltalk.method({
  435. selector: "testAsArray",
  436. fn: function (){
  437. var self=this;
  438. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asArray",[])]);
  439. return self}
  440. }),
  441. smalltalk.CollectionTest);
  442. smalltalk.addMethod(
  443. "_testAsOrderedCollection",
  444. smalltalk.method({
  445. selector: "testAsOrderedCollection",
  446. fn: function (){
  447. var self=this;
  448. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asOrderedCollection",[])]);
  449. return self}
  450. }),
  451. smalltalk.CollectionTest);
  452. smalltalk.addMethod(
  453. "_testAsSet",
  454. smalltalk.method({
  455. selector: "testAsSet",
  456. fn: function (){
  457. var self=this;
  458. var c;
  459. var set;
  460. c=smalltalk.send(self,"_collectionWithDuplicates",[]);
  461. set=smalltalk.send(c,"_asSet",[]);
  462. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(5)])]);
  463. smalltalk.send(c,"_do_",[(function(each){
  464. return smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[each])]);
  465. })]);
  466. return self}
  467. }),
  468. smalltalk.CollectionTest);
  469. smalltalk.addMethod(
  470. "_testCollect",
  471. smalltalk.method({
  472. selector: "testCollect",
  473. fn: function (){
  474. var self=this;
  475. var newCollection;
  476. newCollection=[(1), (2), (3), (4)];
  477. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  478. return smalltalk.send(each,"_abs",[]);
  479. })]),newCollection]);
  480. return self}
  481. }),
  482. smalltalk.CollectionTest);
  483. smalltalk.addMethod(
  484. "_testDetect",
  485. smalltalk.method({
  486. selector: "testDetect",
  487. fn: function (){
  488. var self=this;
  489. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  490. return smalltalk.send(each,"__lt",[(0)]);
  491. })]),"__eq",[(-4)])]);
  492. smalltalk.send(self,"_should_raise_",[(function(){
  493. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  494. return smalltalk.send(each,"__eq",[(6)]);
  495. })]);
  496. }),(smalltalk.Error || Error)]);
  497. return self}
  498. }),
  499. smalltalk.CollectionTest);
  500. smalltalk.addMethod(
  501. "_testDo",
  502. smalltalk.method({
  503. selector: "testDo",
  504. fn: function (){
  505. var self=this;
  506. var newCollection;
  507. newCollection=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  508. smalltalk.send(smalltalk.send(self,"_collection",[]),"_do_",[(function(each){
  509. return smalltalk.send(newCollection,"_add_",[each]);
  510. })]);
  511. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),newCollection]);
  512. return self}
  513. }),
  514. smalltalk.CollectionTest);
  515. smalltalk.addMethod(
  516. "_testIsEmpty",
  517. smalltalk.method({
  518. selector: "testIsEmpty",
  519. fn: function (){
  520. var self=this;
  521. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_isEmpty",[])]);
  522. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
  523. return self}
  524. }),
  525. smalltalk.CollectionTest);
  526. smalltalk.addMethod(
  527. "_testSelect",
  528. smalltalk.method({
  529. selector: "testSelect",
  530. fn: function (){
  531. var self=this;
  532. var newCollection;
  533. newCollection=[(2), (-4)];
  534. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  535. return smalltalk.send(each,"_even",[]);
  536. })]),newCollection]);
  537. return self}
  538. }),
  539. smalltalk.CollectionTest);
  540. smalltalk.addMethod(
  541. "_testSize",
  542. smalltalk.method({
  543. selector: "testSize",
  544. fn: function (){
  545. var self=this;
  546. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_size",[]),"__eq",[(0)])]);
  547. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__eq",[(4)])]);
  548. return self}
  549. }),
  550. smalltalk.CollectionTest);
  551. smalltalk.addMethod(
  552. "_collectionClass",
  553. smalltalk.method({
  554. selector: "collectionClass",
  555. fn: function (){
  556. var self=this;
  557. return nil;
  558. }
  559. }),
  560. smalltalk.CollectionTest.klass);
  561. smalltalk.addMethod(
  562. "_isAbstract",
  563. smalltalk.method({
  564. selector: "isAbstract",
  565. fn: function (){
  566. var self=this;
  567. var $1;
  568. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_isNil",[]);
  569. return $1;
  570. }
  571. }),
  572. smalltalk.CollectionTest.klass);
  573. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  574. smalltalk.addMethod(
  575. "_collection",
  576. smalltalk.method({
  577. selector: "collection",
  578. fn: function (){
  579. var self=this;
  580. var $1;
  581. $1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("a","__minus_gt",[(1)]),smalltalk.send("b","__minus_gt",[(2)]),smalltalk.send("c","__minus_gt",[(3)]),smalltalk.send("d","__minus_gt",[(-4)])]);
  582. return $1;
  583. }
  584. }),
  585. smalltalk.HashedCollectionTest);
  586. smalltalk.addMethod(
  587. "_collectionWithDuplicates",
  588. smalltalk.method({
  589. selector: "collectionWithDuplicates",
  590. fn: function (){
  591. var self=this;
  592. var $1;
  593. $1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("a","__minus_gt",[(1)]),smalltalk.send("b","__minus_gt",[(2)]),smalltalk.send("c","__minus_gt",[(3)]),smalltalk.send("d","__minus_gt",[(-4)]),smalltalk.send("e","__minus_gt",[(1)]),smalltalk.send("f","__minus_gt",[(2)]),smalltalk.send("g","__minus_gt",[(10)])]);
  594. return $1;
  595. }
  596. }),
  597. smalltalk.HashedCollectionTest);
  598. smalltalk.addMethod(
  599. "_collectionClass",
  600. smalltalk.method({
  601. selector: "collectionClass",
  602. fn: function (){
  603. var self=this;
  604. return (smalltalk.HashedCollection || HashedCollection);
  605. }
  606. }),
  607. smalltalk.HashedCollectionTest.klass);
  608. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  609. smalltalk.addMethod(
  610. "_collection",
  611. smalltalk.method({
  612. selector: "collection",
  613. fn: function (){
  614. var self=this;
  615. var $2,$3,$1;
  616. $2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  617. smalltalk.send($2,"_at_put_",[(1),(1)]);
  618. smalltalk.send($2,"_at_put_",["a",(2)]);
  619. smalltalk.send($2,"_at_put_",[true,(3)]);
  620. smalltalk.send($2,"_at_put_",[(4),(-4)]);
  621. $3=smalltalk.send($2,"_yourself",[]);
  622. $1=$3;
  623. return $1;
  624. }
  625. }),
  626. smalltalk.DictionaryTest);
  627. smalltalk.addMethod(
  628. "_collectionWithDuplicates",
  629. smalltalk.method({
  630. selector: "collectionWithDuplicates",
  631. fn: function (){
  632. var self=this;
  633. var $2,$3,$1;
  634. $2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  635. smalltalk.send($2,"_at_put_",[(1),(1)]);
  636. smalltalk.send($2,"_at_put_",["a",(2)]);
  637. smalltalk.send($2,"_at_put_",[true,(3)]);
  638. smalltalk.send($2,"_at_put_",[(4),(-4)]);
  639. smalltalk.send($2,"_at_put_",["b",(1)]);
  640. smalltalk.send($2,"_at_put_",[(3),(3)]);
  641. smalltalk.send($2,"_at_put_",[false,(12)]);
  642. $3=smalltalk.send($2,"_yourself",[]);
  643. $1=$3;
  644. return $1;
  645. }
  646. }),
  647. smalltalk.DictionaryTest);
  648. smalltalk.addMethod(
  649. "_testAccessing",
  650. smalltalk.method({
  651. selector: "testAccessing",
  652. fn: function (){
  653. var self=this;
  654. var d;
  655. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  656. smalltalk.send(d,"_at_put_",["hello","world"]);
  657. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",["hello"]),"__eq",["world"])]);
  658. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
  659. return nil;
  660. })]),"__eq",["world"])]);
  661. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["foo",(function(){
  662. return nil;
  663. })]),"__eq",["world"])]);
  664. smalltalk.send(d,"_at_put_",[(1),(2)]);
  665. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[(1)]),"__eq",[(2)])]);
  666. smalltalk.send(d,"_at_put_",[smalltalk.send((1),"__at",[(3)]),(3)]);
  667. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[smalltalk.send((1),"__at",[(3)])]),"__eq",[(3)])]);
  668. return self}
  669. }),
  670. smalltalk.DictionaryTest);
  671. smalltalk.addMethod(
  672. "_testDynamicDictionaries",
  673. smalltalk.method({
  674. selector: "testDynamicDictionaries",
  675. fn: function (){
  676. var self=this;
  677. 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)])])])]);
  678. return self}
  679. }),
  680. smalltalk.DictionaryTest);
  681. smalltalk.addMethod(
  682. "_testEquality",
  683. smalltalk.method({
  684. selector: "testEquality",
  685. fn: function (){
  686. var self=this;
  687. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  688. var d1;
  689. var d2;
  690. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]),"__eq",[smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[])])]);
  691. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  692. smalltalk.send($1,"_at_put_",[(1),(2)]);
  693. $2=smalltalk.send($1,"_yourself",[]);
  694. d1=$2;
  695. $3=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  696. smalltalk.send($3,"_at_put_",[(1),(2)]);
  697. $4=smalltalk.send($3,"_yourself",[]);
  698. d2=$4;
  699. smalltalk.send(self,"_assert_",[smalltalk.send(d1,"__eq",[d2])]);
  700. $5=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  701. smalltalk.send($5,"_at_put_",[(1),(3)]);
  702. $6=smalltalk.send($5,"_yourself",[]);
  703. d2=$6;
  704. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  705. $7=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  706. smalltalk.send($7,"_at_put_",[(2),(2)]);
  707. $8=smalltalk.send($7,"_yourself",[]);
  708. d2=$8;
  709. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  710. $9=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  711. smalltalk.send($9,"_at_put_",[(1),(2)]);
  712. smalltalk.send($9,"_at_put_",[(3),(4)]);
  713. $10=smalltalk.send($9,"_yourself",[]);
  714. d2=$10;
  715. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  716. return self}
  717. }),
  718. smalltalk.DictionaryTest);
  719. smalltalk.addMethod(
  720. "_testIfAbsent",
  721. smalltalk.method({
  722. selector: "testIfAbsent",
  723. fn: function (){
  724. var self=this;
  725. var d;
  726. var visited;
  727. visited=false;
  728. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  729. smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
  730. visited=true;
  731. return visited;
  732. })]);
  733. smalltalk.send(self,"_assert_",[visited]);
  734. return self}
  735. }),
  736. smalltalk.DictionaryTest);
  737. smalltalk.addMethod(
  738. "_testIfPresent",
  739. smalltalk.method({
  740. selector: "testIfPresent",
  741. fn: function (){
  742. var self=this;
  743. var d;
  744. var visited;
  745. var absent;
  746. visited=false;
  747. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  748. smalltalk.send(d,"_at_put_",["hello","world"]);
  749. smalltalk.send(d,"_at_ifPresent_",["hello",(function(value){
  750. visited=value;
  751. return visited;
  752. })]);
  753. smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
  754. absent=smalltalk.send(d,"_at_ifPresent_",["bye",(function(value){
  755. visited=value;
  756. return visited;
  757. })]);
  758. smalltalk.send(self,"_assert_",[smalltalk.send(absent,"_isNil",[])]);
  759. return self}
  760. }),
  761. smalltalk.DictionaryTest);
  762. smalltalk.addMethod(
  763. "_testIfPresentIfAbsent",
  764. smalltalk.method({
  765. selector: "testIfPresentIfAbsent",
  766. fn: function (){
  767. var self=this;
  768. var d;
  769. var visited;
  770. visited=false;
  771. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  772. smalltalk.send(d,"_at_put_",["hello","world"]);
  773. smalltalk.send(d,"_at_ifPresent_ifAbsent_",["hello",(function(value){
  774. visited=value;
  775. return visited;
  776. }),(function(){
  777. visited=true;
  778. return visited;
  779. })]);
  780. smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
  781. smalltalk.send(d,"_at_ifPresent_ifAbsent_",["buy",(function(value){
  782. visited=value;
  783. return visited;
  784. }),(function(){
  785. visited=true;
  786. return visited;
  787. })]);
  788. smalltalk.send(self,"_assert_",[visited]);
  789. return self}
  790. }),
  791. smalltalk.DictionaryTest);
  792. smalltalk.addMethod(
  793. "_testKeys",
  794. smalltalk.method({
  795. selector: "testKeys",
  796. fn: function (){
  797. var self=this;
  798. var d;
  799. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  800. smalltalk.send(d,"_at_put_",[(1),(2)]);
  801. smalltalk.send(d,"_at_put_",[(2),(3)]);
  802. smalltalk.send(d,"_at_put_",[(3),(4)]);
  803. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
  804. return self}
  805. }),
  806. smalltalk.DictionaryTest);
  807. smalltalk.addMethod(
  808. "_testPrintString",
  809. smalltalk.method({
  810. selector: "testPrintString",
  811. fn: function (){
  812. var self=this;
  813. var $1,$2;
  814. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  815. smalltalk.send($1,"_at_put_",["firstname","James"]);
  816. smalltalk.send($1,"_at_put_",["lastname","Bond"]);
  817. $2=smalltalk.send($1,"_printString",[]);
  818. smalltalk.send(self,"_assert_equals_",["a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2]);
  819. return self}
  820. }),
  821. smalltalk.DictionaryTest);
  822. smalltalk.addMethod(
  823. "_testRemoveKey",
  824. smalltalk.method({
  825. selector: "testRemoveKey",
  826. fn: function (){
  827. var self=this;
  828. var d;
  829. var key;
  830. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  831. smalltalk.send(d,"_at_put_",[(1),(2)]);
  832. smalltalk.send(d,"_at_put_",[(2),(3)]);
  833. smalltalk.send(d,"_at_put_",[(3),(4)]);
  834. key=(2);
  835. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
  836. smalltalk.send(d,"_removeKey_",[key]);
  837. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (3)]])]);
  838. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (4)]])]);
  839. smalltalk.send(self,"_deny_",[smalltalk.send(d,"_includesKey_",[(2)])]);
  840. return self}
  841. }),
  842. smalltalk.DictionaryTest);
  843. smalltalk.addMethod(
  844. "_testRemoveKeyIfAbsent",
  845. smalltalk.method({
  846. selector: "testRemoveKeyIfAbsent",
  847. fn: function (){
  848. var self=this;
  849. var d;
  850. var key;
  851. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  852. smalltalk.send(d,"_at_put_",[(1),(2)]);
  853. smalltalk.send(d,"_at_put_",[(2),(3)]);
  854. smalltalk.send(d,"_at_put_",[(3),(4)]);
  855. key=(2);
  856. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_",[key]),"__eq",[(3)])]);
  857. key=(3);
  858. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
  859. return (42);
  860. })]),"__eq",[(4)])]);
  861. key="why";
  862. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
  863. return (42);
  864. })]),"__eq",[(42)])]);
  865. return self}
  866. }),
  867. smalltalk.DictionaryTest);
  868. smalltalk.addMethod(
  869. "_testSize",
  870. smalltalk.method({
  871. selector: "testSize",
  872. fn: function (){
  873. var self=this;
  874. var d;
  875. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  876. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(0)])]);
  877. smalltalk.send(d,"_at_put_",[(1),(2)]);
  878. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(1)])]);
  879. smalltalk.send(d,"_at_put_",[(2),(3)]);
  880. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(2)])]);
  881. return self}
  882. }),
  883. smalltalk.DictionaryTest);
  884. smalltalk.addMethod(
  885. "_testValues",
  886. smalltalk.method({
  887. selector: "testValues",
  888. fn: function (){
  889. var self=this;
  890. var d;
  891. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  892. smalltalk.send(d,"_at_put_",[(1),(2)]);
  893. smalltalk.send(d,"_at_put_",[(2),(3)]);
  894. smalltalk.send(d,"_at_put_",[(3),(4)]);
  895. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (3), (4)]])]);
  896. return self}
  897. }),
  898. smalltalk.DictionaryTest);
  899. smalltalk.addMethod(
  900. "_collectionClass",
  901. smalltalk.method({
  902. selector: "collectionClass",
  903. fn: function (){
  904. var self=this;
  905. return (smalltalk.Dictionary || Dictionary);
  906. }
  907. }),
  908. smalltalk.DictionaryTest.klass);
  909. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  910. smalltalk.addMethod(
  911. "_testAt",
  912. smalltalk.method({
  913. selector: "testAt",
  914. fn: function (){
  915. var self=this;
  916. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(4)]),"__eq",[(-4)])]);
  917. smalltalk.send(self,"_should_raise_",[(function(){
  918. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(5)]);
  919. }),(smalltalk.Error || Error)]);
  920. return self}
  921. }),
  922. smalltalk.SequenceableCollectionTest);
  923. smalltalk.addMethod(
  924. "_testAtIfAbsent",
  925. smalltalk.method({
  926. selector: "testAtIfAbsent",
  927. fn: function (){
  928. var self=this;
  929. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_ifAbsent_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__plus",[(1)]),(function(){
  930. return "none";
  931. })]),"__eq",["none"])]);
  932. return self}
  933. }),
  934. smalltalk.SequenceableCollectionTest);
  935. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  936. smalltalk.addMethod(
  937. "_testAtIfAbsent",
  938. smalltalk.method({
  939. selector: "testAtIfAbsent",
  940. fn: function (){
  941. var self=this;
  942. var array;
  943. array=["hello", "world"];
  944. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(1)]),"hello"]);
  945. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(2)]),"world"]);
  946. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(2),(function(){
  947. return "not found";
  948. })]),"world"]);
  949. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(0),(function(){
  950. return "not found";
  951. })]),"not found"]);
  952. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(-10),(function(){
  953. return "not found";
  954. })]),"not found"]);
  955. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(3),(function(){
  956. return "not found";
  957. })]),"not found"]);
  958. return self}
  959. }),
  960. smalltalk.ArrayTest);
  961. smalltalk.addMethod(
  962. "_testFirstN",
  963. smalltalk.method({
  964. selector: "testFirstN",
  965. fn: function (){
  966. var self=this;
  967. smalltalk.send(self,"_assert_equals_",[[(1),(2),(3)],smalltalk.send([(1),(2),(3),(4),(5)],"_first_",[(3)])]);
  968. return self}
  969. }),
  970. smalltalk.ArrayTest);
  971. smalltalk.addMethod(
  972. "_testIfEmpty",
  973. smalltalk.method({
  974. selector: "testIfEmpty",
  975. fn: function (){
  976. var self=this;
  977. smalltalk.send(self,"_assert_equals_",["zork",smalltalk.send("","_ifEmpty_",[(function(){
  978. return "zork";
  979. })])]);
  980. return self}
  981. }),
  982. smalltalk.ArrayTest);
  983. smalltalk.addMethod(
  984. "_testPrintString",
  985. smalltalk.method({
  986. selector: "testPrintString",
  987. fn: function (){
  988. var self=this;
  989. var $1,$2;
  990. var array;
  991. array=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  992. smalltalk.send(self,"_assert_equals_",["a Array ()",smalltalk.send(array,"_printString",[])]);
  993. smalltalk.send(array,"_add_",[(1)]);
  994. $1=smalltalk.send(array,"_add_",[(3)]);
  995. smalltalk.send(self,"_assert_equals_",["a Array (1 3)",smalltalk.send(array,"_printString",[])]);
  996. smalltalk.send(array,"_add_",["foo"]);
  997. smalltalk.send(self,"_assert_equals_",["a Array (1 3 'foo')",smalltalk.send(array,"_printString",[])]);
  998. smalltalk.send(array,"_remove_",[(1)]);
  999. $2=smalltalk.send(array,"_remove_",[(3)]);
  1000. smalltalk.send(self,"_assert_equals_",["a Array ('foo')",smalltalk.send(array,"_printString",[])]);
  1001. smalltalk.send(array,"_addLast_",[(3)]);
  1002. smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3)",smalltalk.send(array,"_printString",[])]);
  1003. smalltalk.send(array,"_addLast_",[(3)]);
  1004. smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3 3)",smalltalk.send(array,"_printString",[])]);
  1005. return self}
  1006. }),
  1007. smalltalk.ArrayTest);
  1008. smalltalk.addMethod(
  1009. "_collectionClass",
  1010. smalltalk.method({
  1011. selector: "collectionClass",
  1012. fn: function (){
  1013. var self=this;
  1014. return (smalltalk.Array || Array);
  1015. }
  1016. }),
  1017. smalltalk.ArrayTest.klass);
  1018. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1019. smalltalk.addMethod(
  1020. "_collection",
  1021. smalltalk.method({
  1022. selector: "collection",
  1023. fn: function (){
  1024. var self=this;
  1025. return "hello";
  1026. }
  1027. }),
  1028. smalltalk.StringTest);
  1029. smalltalk.addMethod(
  1030. "_collectionWithDuplicates",
  1031. smalltalk.method({
  1032. selector: "collectionWithDuplicates",
  1033. fn: function (){
  1034. var self=this;
  1035. return "abbaerte";
  1036. }
  1037. }),
  1038. smalltalk.StringTest);
  1039. smalltalk.addMethod(
  1040. "_testAddRemove",
  1041. smalltalk.method({
  1042. selector: "testAddRemove",
  1043. fn: function (){
  1044. var self=this;
  1045. smalltalk.send(self,"_should_raise_",[(function(){
  1046. return smalltalk.send("hello","_add_",["a"]);
  1047. }),(smalltalk.Error || Error)]);
  1048. smalltalk.send(self,"_should_raise_",[(function(){
  1049. return smalltalk.send("hello","_remove_",["h"]);
  1050. }),(smalltalk.Error || Error)]);
  1051. return self}
  1052. }),
  1053. smalltalk.StringTest);
  1054. smalltalk.addMethod(
  1055. "_testAsArray",
  1056. smalltalk.method({
  1057. selector: "testAsArray",
  1058. fn: function (){
  1059. var self=this;
  1060. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_asArray",[]),"__eq",[["h", "e", "l", "l", "o"]])]);
  1061. return self}
  1062. }),
  1063. smalltalk.StringTest);
  1064. smalltalk.addMethod(
  1065. "_testAt",
  1066. smalltalk.method({
  1067. selector: "testAt",
  1068. fn: function (){
  1069. var self=this;
  1070. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(1)]),"__eq",["h"])]);
  1071. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(5)]),"__eq",["o"])]);
  1072. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_ifAbsent_",[(6),(function(){
  1073. return nil;
  1074. })]),"__eq",[nil])]);
  1075. return self}
  1076. }),
  1077. smalltalk.StringTest);
  1078. smalltalk.addMethod(
  1079. "_testAtPut",
  1080. smalltalk.method({
  1081. selector: "testAtPut",
  1082. fn: function (){
  1083. var self=this;
  1084. smalltalk.send(self,"_should_raise_",[(function(){
  1085. return smalltalk.send("hello","_at_put_",[(1),"a"]);
  1086. }),(smalltalk.Error || Error)]);
  1087. return self}
  1088. }),
  1089. smalltalk.StringTest);
  1090. smalltalk.addMethod(
  1091. "_testCollect",
  1092. smalltalk.method({
  1093. selector: "testCollect",
  1094. fn: function (){
  1095. var self=this;
  1096. var newCollection;
  1097. newCollection="hheelllloo";
  1098. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  1099. return smalltalk.send(each,"__comma",[each]);
  1100. })]),newCollection]);
  1101. return self}
  1102. }),
  1103. smalltalk.StringTest);
  1104. smalltalk.addMethod(
  1105. "_testCopyWithoutAll",
  1106. smalltalk.method({
  1107. selector: "testCopyWithoutAll",
  1108. fn: function (){
  1109. var self=this;
  1110. smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send("*hello* *world*","_copyWithoutAll_",["*"])]);
  1111. return self}
  1112. }),
  1113. smalltalk.StringTest);
  1114. smalltalk.addMethod(
  1115. "_testDetect",
  1116. smalltalk.method({
  1117. selector: "testDetect",
  1118. fn: function (){
  1119. var self=this;
  1120. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1121. return smalltalk.send(each,"__eq",["h"]);
  1122. })]),"__eq",["h"])]);
  1123. smalltalk.send(self,"_should_raise_",[(function(){
  1124. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1125. return smalltalk.send(each,"__eq",[(6)]);
  1126. })]);
  1127. }),(smalltalk.Error || Error)]);
  1128. return self}
  1129. }),
  1130. smalltalk.StringTest);
  1131. smalltalk.addMethod(
  1132. "_testEquality",
  1133. smalltalk.method({
  1134. selector: "testEquality",
  1135. fn: function (){
  1136. var self=this;
  1137. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",["hello"])]);
  1138. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",["world"])]);
  1139. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",[smalltalk.send("hello","_yourself",[])])]);
  1140. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq",["hello"])]);
  1141. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
  1142. return self}
  1143. }),
  1144. smalltalk.StringTest);
  1145. smalltalk.addMethod(
  1146. "_testIdentity",
  1147. smalltalk.method({
  1148. selector: "testIdentity",
  1149. fn: function (){
  1150. var self=this;
  1151. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",["hello"])]);
  1152. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq_eq",["world"])]);
  1153. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",[smalltalk.send("hello","_yourself",[])])]);
  1154. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq_eq",["hello"])]);
  1155. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[(0)])]);
  1156. return self}
  1157. }),
  1158. smalltalk.StringTest);
  1159. smalltalk.addMethod(
  1160. "_testIncludesSubString",
  1161. smalltalk.method({
  1162. selector: "testIncludesSubString",
  1163. fn: function (){
  1164. var self=this;
  1165. smalltalk.send(self,"_assert_",[smalltalk.send("amber","_includesSubString_",["ber"])]);
  1166. smalltalk.send(self,"_deny_",[smalltalk.send("amber","_includesSubString_",["zork"])]);
  1167. return self}
  1168. }),
  1169. smalltalk.StringTest);
  1170. smalltalk.addMethod(
  1171. "_testJoin",
  1172. smalltalk.method({
  1173. selector: "testJoin",
  1174. fn: function (){
  1175. var self=this;
  1176. smalltalk.send(self,"_assert_equals_",["hello,world",smalltalk.send(",","_join_",[["hello", "world"]])]);
  1177. return self}
  1178. }),
  1179. smalltalk.StringTest);
  1180. smalltalk.addMethod(
  1181. "_testSelect",
  1182. smalltalk.method({
  1183. selector: "testSelect",
  1184. fn: function (){
  1185. var self=this;
  1186. var newCollection;
  1187. newCollection="o";
  1188. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  1189. return smalltalk.send(each,"__eq",["o"]);
  1190. })]),newCollection]);
  1191. return self}
  1192. }),
  1193. smalltalk.StringTest);
  1194. smalltalk.addMethod(
  1195. "_testSize",
  1196. smalltalk.method({
  1197. selector: "testSize",
  1198. fn: function (){
  1199. var self=this;
  1200. smalltalk.send(self,"_assert_equals_",[smalltalk.send("smalltalk","_size",[]),(9)]);
  1201. smalltalk.send(self,"_assert_equals_",[smalltalk.send("","_size",[]),(0)]);
  1202. return self}
  1203. }),
  1204. smalltalk.StringTest);
  1205. smalltalk.addMethod(
  1206. "_testStreamContents",
  1207. smalltalk.method({
  1208. selector: "testStreamContents",
  1209. fn: function (){
  1210. var self=this;
  1211. var $1;
  1212. smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  1213. smalltalk.send(aStream,"_nextPutAll_",["hello"]);
  1214. smalltalk.send(aStream,"_space",[]);
  1215. $1=smalltalk.send(aStream,"_nextPutAll_",["world"]);
  1216. return $1;
  1217. })])]);
  1218. return self}
  1219. }),
  1220. smalltalk.StringTest);
  1221. smalltalk.addMethod(
  1222. "_collectionClass",
  1223. smalltalk.method({
  1224. selector: "collectionClass",
  1225. fn: function (){
  1226. var self=this;
  1227. return (smalltalk.String || String);
  1228. }
  1229. }),
  1230. smalltalk.StringTest.klass);
  1231. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1232. smalltalk.addMethod(
  1233. "_collection",
  1234. smalltalk.method({
  1235. selector: "collection",
  1236. fn: function (){
  1237. var self=this;
  1238. return smalltalk.symbolFor("hello");
  1239. }
  1240. }),
  1241. smalltalk.SymbolTest);
  1242. smalltalk.addMethod(
  1243. "_collectionWithDuplicates",
  1244. smalltalk.method({
  1245. selector: "collectionWithDuplicates",
  1246. fn: function (){
  1247. var self=this;
  1248. return smalltalk.symbolFor("phhaaarorra");
  1249. }
  1250. }),
  1251. smalltalk.SymbolTest);
  1252. smalltalk.addMethod(
  1253. "_testAsString",
  1254. smalltalk.method({
  1255. selector: "testAsString",
  1256. fn: function (){
  1257. var self=this;
  1258. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"hello"]);
  1259. return self}
  1260. }),
  1261. smalltalk.SymbolTest);
  1262. smalltalk.addMethod(
  1263. "_testAsSymbol",
  1264. smalltalk.method({
  1265. selector: "testAsSymbol",
  1266. fn: function (){
  1267. var self=this;
  1268. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_asSymbol",[])])]);
  1269. return self}
  1270. }),
  1271. smalltalk.SymbolTest);
  1272. smalltalk.addMethod(
  1273. "_testAt",
  1274. smalltalk.method({
  1275. selector: "testAt",
  1276. fn: function (){
  1277. var self=this;
  1278. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(1)]),"__eq",["h"])]);
  1279. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(5)]),"__eq",["o"])]);
  1280. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_ifAbsent_",[(6),(function(){
  1281. return nil;
  1282. })]),"__eq",[nil])]);
  1283. return self}
  1284. }),
  1285. smalltalk.SymbolTest);
  1286. smalltalk.addMethod(
  1287. "_testAtPut",
  1288. smalltalk.method({
  1289. selector: "testAtPut",
  1290. fn: function (){
  1291. var self=this;
  1292. smalltalk.send(self,"_should_raise_",[(function(){
  1293. return smalltalk.send("hello","_at_put_",[(1),"a"]);
  1294. }),(smalltalk.Error || Error)]);
  1295. return self}
  1296. }),
  1297. smalltalk.SymbolTest);
  1298. smalltalk.addMethod(
  1299. "_testCollect",
  1300. smalltalk.method({
  1301. selector: "testCollect",
  1302. fn: function (){
  1303. var self=this;
  1304. var newCollection;
  1305. newCollection=smalltalk.symbolFor("hheelllloo");
  1306. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  1307. return smalltalk.send(each,"__comma",[each]);
  1308. })]),newCollection]);
  1309. return self}
  1310. }),
  1311. smalltalk.SymbolTest);
  1312. smalltalk.addMethod(
  1313. "_testComparing",
  1314. smalltalk.method({
  1315. selector: "testComparing",
  1316. fn: function (){
  1317. var self=this;
  1318. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("aa")])]);
  1319. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("ba")])]);
  1320. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt",[smalltalk.symbolFor("ba")])]);
  1321. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt",[smalltalk.symbolFor("ba")])]);
  1322. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("aa")])]);
  1323. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("ba")])]);
  1324. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
  1325. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
  1326. return self}
  1327. }),
  1328. smalltalk.SymbolTest);
  1329. smalltalk.addMethod(
  1330. "_testCopying",
  1331. smalltalk.method({
  1332. selector: "testCopying",
  1333. fn: function (){
  1334. var self=this;
  1335. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_copy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1336. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_deepCopy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1337. return self}
  1338. }),
  1339. smalltalk.SymbolTest);
  1340. smalltalk.addMethod(
  1341. "_testDetect",
  1342. smalltalk.method({
  1343. selector: "testDetect",
  1344. fn: function (){
  1345. var self=this;
  1346. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1347. return smalltalk.send(each,"__eq",["h"]);
  1348. })]),"__eq",["h"])]);
  1349. smalltalk.send(self,"_should_raise_",[(function(){
  1350. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1351. return smalltalk.send(each,"__eq",["z"]);
  1352. })]);
  1353. }),(smalltalk.Error || Error)]);
  1354. return self}
  1355. }),
  1356. smalltalk.SymbolTest);
  1357. smalltalk.addMethod(
  1358. "_testEquality",
  1359. smalltalk.method({
  1360. selector: "testEquality",
  1361. fn: function (){
  1362. var self=this;
  1363. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("hello")])]);
  1364. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("world")])]);
  1365. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
  1366. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.symbolFor("hello")])]);
  1367. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",["hello"])]);
  1368. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",[smalltalk.symbolFor("hello")])]);
  1369. return self}
  1370. }),
  1371. smalltalk.SymbolTest);
  1372. smalltalk.addMethod(
  1373. "_testIdentity",
  1374. smalltalk.method({
  1375. selector: "testIdentity",
  1376. fn: function (){
  1377. var self=this;
  1378. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1379. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("world")])]);
  1380. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
  1381. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"_asSymbol",[])])]);
  1382. return self}
  1383. }),
  1384. smalltalk.SymbolTest);
  1385. smalltalk.addMethod(
  1386. "_testIsEmpty",
  1387. smalltalk.method({
  1388. selector: "testIsEmpty",
  1389. fn: function (){
  1390. var self=this;
  1391. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
  1392. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("","_asSymbol",[]),"_isEmpty",[])]);
  1393. return self}
  1394. }),
  1395. smalltalk.SymbolTest);
  1396. smalltalk.addMethod(
  1397. "_testIsSymbolIsString",
  1398. smalltalk.method({
  1399. selector: "testIsSymbolIsString",
  1400. fn: function (){
  1401. var self=this;
  1402. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isSymbol",[])]);
  1403. smalltalk.send(self,"_deny_",[smalltalk.send("hello","_isSymbol",[])]);
  1404. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isString",[])]);
  1405. smalltalk.send(self,"_assert_",[smalltalk.send("hello","_isString",[])]);
  1406. return self}
  1407. }),
  1408. smalltalk.SymbolTest);
  1409. smalltalk.addMethod(
  1410. "_testSelect",
  1411. smalltalk.method({
  1412. selector: "testSelect",
  1413. fn: function (){
  1414. var self=this;
  1415. var newCollection;
  1416. newCollection="o";
  1417. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  1418. return smalltalk.send(each,"__eq",["o"]);
  1419. })]),newCollection]);
  1420. return self}
  1421. }),
  1422. smalltalk.SymbolTest);
  1423. smalltalk.addMethod(
  1424. "_testSize",
  1425. smalltalk.method({
  1426. selector: "testSize",
  1427. fn: function (){
  1428. var self=this;
  1429. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("a"),"_size",[]),(1)]);
  1430. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("aaaaa"),"_size",[]),(5)]);
  1431. return self}
  1432. }),
  1433. smalltalk.SymbolTest);
  1434. smalltalk.addMethod(
  1435. "_collectionClass",
  1436. smalltalk.method({
  1437. selector: "collectionClass",
  1438. fn: function (){
  1439. var self=this;
  1440. return (smalltalk.Symbol || Symbol);
  1441. }
  1442. }),
  1443. smalltalk.SymbolTest.klass);
  1444. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1445. smalltalk.addMethod(
  1446. "_jsObject",
  1447. smalltalk.method({
  1448. selector: "jsObject",
  1449. fn: function (){
  1450. var self=this;
  1451. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  1452. ;
  1453. return self}
  1454. }),
  1455. smalltalk.JSObjectProxyTest);
  1456. smalltalk.addMethod(
  1457. "_testDNU",
  1458. smalltalk.method({
  1459. selector: "testDNU",
  1460. fn: function (){
  1461. var self=this;
  1462. smalltalk.send(self,"_should_raise_",[(function(){
  1463. return smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_foo",[]);
  1464. }),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1465. return self}
  1466. }),
  1467. smalltalk.JSObjectProxyTest);
  1468. smalltalk.addMethod(
  1469. "_testMessageSend",
  1470. smalltalk.method({
  1471. selector: "testMessageSend",
  1472. fn: function (){
  1473. var self=this;
  1474. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_a",[]),(1)]);
  1475. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_b",[]),(2)]);
  1476. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(3)]),(3)]);
  1477. return self}
  1478. }),
  1479. smalltalk.JSObjectProxyTest);
  1480. smalltalk.addMethod(
  1481. "_testMethodWithArguments",
  1482. smalltalk.method({
  1483. selector: "testMethodWithArguments",
  1484. fn: function (){
  1485. var self=this;
  1486. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send("body","_asJQuery",[]),"_hasClass_",["amber"])]);
  1487. smalltalk.send(smalltalk.send("body","_asJQuery",[]),"_addClass_",["amber"]);
  1488. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("body","_asJQuery",[]),"_hasClass_",["amber"])]);
  1489. smalltalk.send(smalltalk.send("body","_asJQuery",[]),"_removeClass_",["amber"]);
  1490. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send("body","_asJQuery",[]),"_hasClass_",["amber"])]);
  1491. return self}
  1492. }),
  1493. smalltalk.JSObjectProxyTest);
  1494. smalltalk.addMethod(
  1495. "_testPrinting",
  1496. smalltalk.method({
  1497. selector: "testPrinting",
  1498. fn: function (){
  1499. var self=this;
  1500. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_printString",[]),"__eq",["[object Object]"])]);
  1501. return self}
  1502. }),
  1503. smalltalk.JSObjectProxyTest);
  1504. smalltalk.addMethod(
  1505. "_testPropertyThatReturnsEmptyString",
  1506. smalltalk.method({
  1507. selector: "testPropertyThatReturnsEmptyString",
  1508. fn: function (){
  1509. var self=this;
  1510. document.location.hash = '';
  1511. ;
  1512. smalltalk.send(self,"_assert_equals_",["",smalltalk.send(smalltalk.send(document,"_location",[]),"_hash",[])]);
  1513. smalltalk.send(smalltalk.send(document,"_location",[]),"_hash_",["test"]);
  1514. smalltalk.send(self,"_assert_equals_",["#test",smalltalk.send(smalltalk.send(document,"_location",[]),"_hash",[])]);
  1515. return self}
  1516. }),
  1517. smalltalk.JSObjectProxyTest);
  1518. smalltalk.addMethod(
  1519. "_testYourself",
  1520. smalltalk.method({
  1521. selector: "testYourself",
  1522. fn: function (){
  1523. var self=this;
  1524. var $1,$2;
  1525. var body;
  1526. $1=smalltalk.send("body","_asJQuery",[]);
  1527. smalltalk.send($1,"_addClass_",["amber"]);
  1528. $2=smalltalk.send($1,"_yourself",[]);
  1529. body=$2;
  1530. smalltalk.send(self,"_assert_",[smalltalk.send(body,"_hasClass_",["amber"])]);
  1531. smalltalk.send(body,"_removeClass_",["amber"]);
  1532. smalltalk.send(self,"_deny_",[smalltalk.send(body,"_hasClass_",["amber"])]);
  1533. return self}
  1534. }),
  1535. smalltalk.JSObjectProxyTest);
  1536. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1537. smalltalk.addMethod(
  1538. "_testAbs",
  1539. smalltalk.method({
  1540. selector: "testAbs",
  1541. fn: function (){
  1542. var self=this;
  1543. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_abs",[]),"__eq",[(4)])]);
  1544. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-4),"_abs",[]),"__eq",[(4)])]);
  1545. return self}
  1546. }),
  1547. smalltalk.NumberTest);
  1548. smalltalk.addMethod(
  1549. "_testArithmetic",
  1550. smalltalk.method({
  1551. selector: "testArithmetic",
  1552. fn: function (){
  1553. var self=this;
  1554. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1.5),"__plus",[(1)]),"__eq",[(2.5)])]);
  1555. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((2),"__minus",[(1)]),"__eq",[(1)])]);
  1556. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-2),"__minus",[(1)]),"__eq",[(-3)])]);
  1557. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((12),"__slash",[(2)]),"__eq",[(6)])]);
  1558. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__star",[(4)]),"__eq",[(12)])]);
  1559. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((1),"__plus",[(2)]),"__star",[(3)]),"__eq",[(9)])]);
  1560. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__plus",[smalltalk.send((2),"__star",[(3)])]),"__eq",[(7)])]);
  1561. return self}
  1562. }),
  1563. smalltalk.NumberTest);
  1564. smalltalk.addMethod(
  1565. "_testComparison",
  1566. smalltalk.method({
  1567. selector: "testComparison",
  1568. fn: function (){
  1569. var self=this;
  1570. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt",[(2)])]);
  1571. smalltalk.send(self,"_assert_",[smalltalk.send((2),"__lt",[(3)])]);
  1572. smalltalk.send(self,"_deny_",[smalltalk.send((3),"__lt",[(2)])]);
  1573. smalltalk.send(self,"_deny_",[smalltalk.send((2),"__gt",[(3)])]);
  1574. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt_eq",[(3)])]);
  1575. smalltalk.send(self,"_assert_",[smalltalk.send((3.1),"__gt_eq",[(3)])]);
  1576. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3)])]);
  1577. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3.1)])]);
  1578. return self}
  1579. }),
  1580. smalltalk.NumberTest);
  1581. smalltalk.addMethod(
  1582. "_testCopying",
  1583. smalltalk.method({
  1584. selector: "testCopying",
  1585. fn: function (){
  1586. var self=this;
  1587. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_copy",[]),"__eq_eq",[(1)])]);
  1588. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_deepCopy",[]),"__eq_eq",[(1)])]);
  1589. return self}
  1590. }),
  1591. smalltalk.NumberTest);
  1592. smalltalk.addMethod(
  1593. "_testEquality",
  1594. smalltalk.method({
  1595. selector: "testEquality",
  1596. fn: function (){
  1597. var self=this;
  1598. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[(1)])]);
  1599. smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq",[(0)])]);
  1600. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq",[(0)])]);
  1601. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[(1)])]);
  1602. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[smalltalk.send((1),"_yourself",[])])]);
  1603. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[smalltalk.send((1),"_yourself",[])])]);
  1604. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
  1605. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
  1606. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
  1607. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[""])]);
  1608. return self}
  1609. }),
  1610. smalltalk.NumberTest);
  1611. smalltalk.addMethod(
  1612. "_testIdentity",
  1613. smalltalk.method({
  1614. selector: "testIdentity",
  1615. fn: function (){
  1616. var self=this;
  1617. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[(1)])]);
  1618. smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq_eq",[(0)])]);
  1619. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(0)])]);
  1620. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[(1)])]);
  1621. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
  1622. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
  1623. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(2)])]);
  1624. return self}
  1625. }),
  1626. smalltalk.NumberTest);
  1627. smalltalk.addMethod(
  1628. "_testMinMax",
  1629. smalltalk.method({
  1630. selector: "testMinMax",
  1631. fn: function (){
  1632. var self=this;
  1633. smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_max_",[(5)]),(5)]);
  1634. smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_min_",[(5)]),(2)]);
  1635. return self}
  1636. }),
  1637. smalltalk.NumberTest);
  1638. smalltalk.addMethod(
  1639. "_testNegated",
  1640. smalltalk.method({
  1641. selector: "testNegated",
  1642. fn: function (){
  1643. var self=this;
  1644. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_negated",[]),"__eq",[(-3)])]);
  1645. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-3),"_negated",[]),"__eq",[(3)])]);
  1646. return self}
  1647. }),
  1648. smalltalk.NumberTest);
  1649. smalltalk.addMethod(
  1650. "_testPrintShowingDecimalPlaces",
  1651. smalltalk.method({
  1652. selector: "testPrintShowingDecimalPlaces",
  1653. fn: function (){
  1654. var self=this;
  1655. smalltalk.send(self,"_assert_equals_",["23.00",smalltalk.send((23),"_printShowingDecimalPlaces_",[(2)])]);
  1656. smalltalk.send(self,"_assert_equals_",["23.57",smalltalk.send((23.5698),"_printShowingDecimalPlaces_",[(2)])]);
  1657. smalltalk.send(self,"_assert_equals_",["-234.56700",smalltalk.send(smalltalk.send((234.567),"_negated",[]),"_printShowingDecimalPlaces_",[(5)])]);
  1658. smalltalk.send(self,"_assert_equals_",["23",smalltalk.send((23.4567),"_printShowingDecimalPlaces_",[(0)])]);
  1659. smalltalk.send(self,"_assert_equals_",["24",smalltalk.send((23.5567),"_printShowingDecimalPlaces_",[(0)])]);
  1660. smalltalk.send(self,"_assert_equals_",["-23",smalltalk.send(smalltalk.send((23.4567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
  1661. smalltalk.send(self,"_assert_equals_",["-24",smalltalk.send(smalltalk.send((23.5567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
  1662. smalltalk.send(self,"_assert_equals_",["100000000.0",smalltalk.send((100000000),"_printShowingDecimalPlaces_",[(1)])]);
  1663. smalltalk.send(self,"_assert_equals_",["0.98000",smalltalk.send((0.98),"_printShowingDecimalPlaces_",[(5)])]);
  1664. smalltalk.send(self,"_assert_equals_",["-0.98",smalltalk.send(smalltalk.send((0.98),"_negated",[]),"_printShowingDecimalPlaces_",[(2)])]);
  1665. smalltalk.send(self,"_assert_equals_",["2.57",smalltalk.send((2.567),"_printShowingDecimalPlaces_",[(2)])]);
  1666. smalltalk.send(self,"_assert_equals_",["-2.57",smalltalk.send((-2.567),"_printShowingDecimalPlaces_",[(2)])]);
  1667. smalltalk.send(self,"_assert_equals_",["0.00",smalltalk.send((0),"_printShowingDecimalPlaces_",[(2)])]);
  1668. return self}
  1669. }),
  1670. smalltalk.NumberTest);
  1671. smalltalk.addMethod(
  1672. "_testRounded",
  1673. smalltalk.method({
  1674. selector: "testRounded",
  1675. fn: function (){
  1676. var self=this;
  1677. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_rounded",[]),"__eq",[(3)])]);
  1678. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_rounded",[]),"__eq",[(3)])]);
  1679. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_rounded",[]),"__eq",[(4)])]);
  1680. return self}
  1681. }),
  1682. smalltalk.NumberTest);
  1683. smalltalk.addMethod(
  1684. "_testSqrt",
  1685. smalltalk.method({
  1686. selector: "testSqrt",
  1687. fn: function (){
  1688. var self=this;
  1689. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_sqrt",[]),"__eq",[(2)])]);
  1690. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((16),"_sqrt",[]),"__eq",[(4)])]);
  1691. return self}
  1692. }),
  1693. smalltalk.NumberTest);
  1694. smalltalk.addMethod(
  1695. "_testSquared",
  1696. smalltalk.method({
  1697. selector: "testSquared",
  1698. fn: function (){
  1699. var self=this;
  1700. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_squared",[]),"__eq",[(16)])]);
  1701. return self}
  1702. }),
  1703. smalltalk.NumberTest);
  1704. smalltalk.addMethod(
  1705. "_testTimesRepeat",
  1706. smalltalk.method({
  1707. selector: "testTimesRepeat",
  1708. fn: function (){
  1709. var self=this;
  1710. var i;
  1711. i=(0);
  1712. smalltalk.send((0),"_timesRepeat_",[(function(){
  1713. i=smalltalk.send(i,"__plus",[(1)]);
  1714. return i;
  1715. })]);
  1716. smalltalk.send(self,"_assert_equals_",[i,(0)]);
  1717. smalltalk.send((5),"_timesRepeat_",[(function(){
  1718. i=smalltalk.send(i,"__plus",[(1)]);
  1719. return i;
  1720. })]);
  1721. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  1722. return self}
  1723. }),
  1724. smalltalk.NumberTest);
  1725. smalltalk.addMethod(
  1726. "_testTo",
  1727. smalltalk.method({
  1728. selector: "testTo",
  1729. fn: function (){
  1730. var self=this;
  1731. smalltalk.send(self,"_assert_equals_",[smalltalk.send((1),"_to_",[(5)]),[(1), (2), (3), (4), (5)]]);
  1732. return self}
  1733. }),
  1734. smalltalk.NumberTest);
  1735. smalltalk.addMethod(
  1736. "_testToBy",
  1737. smalltalk.method({
  1738. selector: "testToBy",
  1739. fn: function (){
  1740. var self=this;
  1741. smalltalk.send(self,"_assert_equals_",[smalltalk.send((0),"_to_by_",[(6),(2)]),[(0), (2), (4), (6)]]);
  1742. smalltalk.send(self,"_should_raise_",[(function(){
  1743. return smalltalk.send((1),"_to_by_",[(4),(0)]);
  1744. }),(smalltalk.Error || Error)]);
  1745. return self}
  1746. }),
  1747. smalltalk.NumberTest);
  1748. smalltalk.addMethod(
  1749. "_testTruncated",
  1750. smalltalk.method({
  1751. selector: "testTruncated",
  1752. fn: function (){
  1753. var self=this;
  1754. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_truncated",[]),"__eq",[(3)])]);
  1755. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_truncated",[]),"__eq",[(3)])]);
  1756. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_truncated",[]),"__eq",[(3)])]);
  1757. return self}
  1758. }),
  1759. smalltalk.NumberTest);
  1760. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1761. smalltalk.addMethod(
  1762. "_foo",
  1763. smalltalk.method({
  1764. selector: "foo",
  1765. fn: function (){
  1766. var self=this;
  1767. return self["@foo"];
  1768. }
  1769. }),
  1770. smalltalk.ObjectMock);
  1771. smalltalk.addMethod(
  1772. "_foo_",
  1773. smalltalk.method({
  1774. selector: "foo:",
  1775. fn: function (anObject){
  1776. var self=this;
  1777. self["@foo"]=anObject;
  1778. return self}
  1779. }),
  1780. smalltalk.ObjectMock);
  1781. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1782. smalltalk.addMethod(
  1783. "_testBasicAccess",
  1784. smalltalk.method({
  1785. selector: "testBasicAccess",
  1786. fn: function (){
  1787. var self=this;
  1788. var o;
  1789. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1790. smalltalk.send(o,"_basicAt_put_",["a",(1)]);
  1791. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["a"]),(1)]);
  1792. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["b"]),nil]);
  1793. return self}
  1794. }),
  1795. smalltalk.ObjectTest);
  1796. smalltalk.addMethod(
  1797. "_testBasicPerform",
  1798. smalltalk.method({
  1799. selector: "testBasicPerform",
  1800. fn: function (){
  1801. var self=this;
  1802. var o;
  1803. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1804. smalltalk.send(o,"_basicAt_put_",["func",(function(){
  1805. return "hello";
  1806. })]);
  1807. smalltalk.send(o,"_basicAt_put_",["func2",(function(a){
  1808. return smalltalk.send(a,"__plus",[(1)]);
  1809. })]);
  1810. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_",["func"]),"hello"]);
  1811. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_withArguments_",["func2",[(3)]]),(4)]);
  1812. return self}
  1813. }),
  1814. smalltalk.ObjectTest);
  1815. smalltalk.addMethod(
  1816. "_testDNU",
  1817. smalltalk.method({
  1818. selector: "testDNU",
  1819. fn: function (){
  1820. var self=this;
  1821. smalltalk.send(self,"_should_raise_",[(function(){
  1822. return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_foo",[]);
  1823. }),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1824. return self}
  1825. }),
  1826. smalltalk.ObjectTest);
  1827. smalltalk.addMethod(
  1828. "_testEquality",
  1829. smalltalk.method({
  1830. selector: "testEquality",
  1831. fn: function (){
  1832. var self=this;
  1833. var o;
  1834. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1835. smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
  1836. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[o])]);
  1837. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq",[o])]);
  1838. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[smalltalk.send(o,"_yourself",[])])]);
  1839. return self}
  1840. }),
  1841. smalltalk.ObjectTest);
  1842. smalltalk.addMethod(
  1843. "_testHalt",
  1844. smalltalk.method({
  1845. selector: "testHalt",
  1846. fn: function (){
  1847. var self=this;
  1848. smalltalk.send(self,"_should_raise_",[(function(){
  1849. return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_halt",[]);
  1850. }),(smalltalk.Error || Error)]);
  1851. return self}
  1852. }),
  1853. smalltalk.ObjectTest);
  1854. smalltalk.addMethod(
  1855. "_testIdentity",
  1856. smalltalk.method({
  1857. selector: "testIdentity",
  1858. fn: function (){
  1859. var self=this;
  1860. var o;
  1861. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1862. smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq_eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
  1863. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[o])]);
  1864. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq_eq",[o])]);
  1865. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[smalltalk.send(o,"_yourself",[])])]);
  1866. return self}
  1867. }),
  1868. smalltalk.ObjectTest);
  1869. smalltalk.addMethod(
  1870. "_testIfNil",
  1871. smalltalk.method({
  1872. selector: "testIfNil",
  1873. fn: function (){
  1874. var self=this;
  1875. var $2,$1,$4,$3,$6,$5;
  1876. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_isNil",[])]);
  1877. $2=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1878. if(($receiver = $2) == nil || $receiver == undefined){
  1879. $1=true;
  1880. } else {
  1881. $1=$2;
  1882. };
  1883. smalltalk.send(self,"_deny_",[smalltalk.send($1,"__eq",[true])]);
  1884. $4=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1885. if(($receiver = $4) == nil || $receiver == undefined){
  1886. $3=$4;
  1887. } else {
  1888. $3=true;
  1889. };
  1890. smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[true])]);
  1891. $6=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1892. if(($receiver = $6) == nil || $receiver == undefined){
  1893. $5=false;
  1894. } else {
  1895. $5=true;
  1896. };
  1897. smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",[true])]);
  1898. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_ifNotNil_ifNil_",[(function(){
  1899. return true;
  1900. }),(function(){
  1901. return false;
  1902. })]),"__eq",[true])]);
  1903. return self}
  1904. }),
  1905. smalltalk.ObjectTest);
  1906. smalltalk.addMethod(
  1907. "_testInstVars",
  1908. smalltalk.method({
  1909. selector: "testInstVars",
  1910. fn: function (){
  1911. var self=this;
  1912. var o;
  1913. o=smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_new",[]);
  1914. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),nil]);
  1915. smalltalk.send(o,"_instVarAt_put_",[smalltalk.symbolFor("foo"),(1)]);
  1916. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),(1)]);
  1917. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",["foo"]),(1)]);
  1918. return self}
  1919. }),
  1920. smalltalk.ObjectTest);
  1921. smalltalk.addMethod(
  1922. "_testNilUndefined",
  1923. smalltalk.method({
  1924. selector: "testNilUndefined",
  1925. fn: function (){
  1926. var self=this;
  1927. smalltalk.send(self,"_assert_",[smalltalk.send(nil,"__eq",[undefined])]);
  1928. return self}
  1929. }),
  1930. smalltalk.ObjectTest);
  1931. smalltalk.addMethod(
  1932. "_testYourself",
  1933. smalltalk.method({
  1934. selector: "testYourself",
  1935. fn: function (){
  1936. var self=this;
  1937. var o;
  1938. o=smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_new",[]);
  1939. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq_eq",[o])]);
  1940. return self}
  1941. }),
  1942. smalltalk.ObjectTest);
  1943. smalltalk.addMethod(
  1944. "_testidentityHash",
  1945. smalltalk.method({
  1946. selector: "testidentityHash",
  1947. fn: function (){
  1948. var self=this;
  1949. var o1;
  1950. var o2;
  1951. o1=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1952. o2=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1953. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o1,"_identityHash",[]),"__eq_eq",[smalltalk.send(o1,"_identityHash",[])])]);
  1954. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(o1,"_identityHash",[]),"__eq_eq",[smalltalk.send(o2,"_identityHash",[])])]);
  1955. return self}
  1956. }),
  1957. smalltalk.ObjectTest);
  1958. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1959. smalltalk.addMethod(
  1960. "_setUp",
  1961. smalltalk.method({
  1962. selector: "setUp",
  1963. fn: function (){
  1964. var self=this;
  1965. var $1,$2;
  1966. self["@backUpCommitPathJs"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs",[]);
  1967. self["@backUpCommitPathSt"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt",[]);
  1968. smalltalk.send((smalltalk.Package || Package),"_resetCommitPaths",[]);
  1969. self["@zorkPackage"]=smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_new",[]),"_name_",["Zork"]);
  1970. $1=smalltalk.send((smalltalk.Package || Package),"_new",[]);
  1971. smalltalk.send($1,"_name_",["Grul"]);
  1972. smalltalk.send($1,"_commitPathJs_",["server/grul/js"]);
  1973. smalltalk.send($1,"_commitPathSt_",["grul/st"]);
  1974. $2=smalltalk.send($1,"_yourself",[]);
  1975. self["@grulPackage"]=$2;
  1976. return self}
  1977. }),
  1978. smalltalk.PackageTest);
  1979. smalltalk.addMethod(
  1980. "_tearDown",
  1981. smalltalk.method({
  1982. selector: "tearDown",
  1983. fn: function (){
  1984. var self=this;
  1985. var $1;
  1986. smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",[self["@backUpCommitPathJs"]]);
  1987. $1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",[self["@backUpCommitPathSt"]]);
  1988. return self}
  1989. }),
  1990. smalltalk.PackageTest);
  1991. smalltalk.addMethod(
  1992. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1993. smalltalk.method({
  1994. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1995. fn: function (){
  1996. var self=this;
  1997. smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
  1998. return self}
  1999. }),
  2000. smalltalk.PackageTest);
  2001. smalltalk.addMethod(
  2002. "_testGrulCommitPathStShouldBeGrulSt",
  2003. smalltalk.method({
  2004. selector: "testGrulCommitPathStShouldBeGrulSt",
  2005. fn: function (){
  2006. var self=this;
  2007. smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
  2008. return self}
  2009. }),
  2010. smalltalk.PackageTest);
  2011. smalltalk.addMethod(
  2012. "_testZorkCommitPathJsShouldBeJs",
  2013. smalltalk.method({
  2014. selector: "testZorkCommitPathJsShouldBeJs",
  2015. fn: function (){
  2016. var self=this;
  2017. smalltalk.send(self,"_assert_equals_",["js",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
  2018. return self}
  2019. }),
  2020. smalltalk.PackageTest);
  2021. smalltalk.addMethod(
  2022. "_testZorkCommitPathStShouldBeSt",
  2023. smalltalk.method({
  2024. selector: "testZorkCommitPathStShouldBeSt",
  2025. fn: function (){
  2026. var self=this;
  2027. smalltalk.send(self,"_assert_equals_",["st",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
  2028. return self}
  2029. }),
  2030. smalltalk.PackageTest);
  2031. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2032. smalltalk.addMethod(
  2033. "_setUp",
  2034. smalltalk.method({
  2035. selector: "setUp",
  2036. fn: function (){
  2037. var self=this;
  2038. var $1;
  2039. smalltalk.send(self,"_setUp",[],smalltalk.PackageTest);
  2040. smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",["javascripts/"]);
  2041. $1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",["smalltalk/"]);
  2042. return self}
  2043. }),
  2044. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2045. smalltalk.addMethod(
  2046. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2047. smalltalk.method({
  2048. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2049. fn: function (){
  2050. var self=this;
  2051. smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
  2052. return self}
  2053. }),
  2054. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2055. smalltalk.addMethod(
  2056. "_testGrulCommitPathStShouldBeGrulSt",
  2057. smalltalk.method({
  2058. selector: "testGrulCommitPathStShouldBeGrulSt",
  2059. fn: function (){
  2060. var self=this;
  2061. smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
  2062. return self}
  2063. }),
  2064. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2065. smalltalk.addMethod(
  2066. "_testZorkCommitPathJsShouldBeJavascript",
  2067. smalltalk.method({
  2068. selector: "testZorkCommitPathJsShouldBeJavascript",
  2069. fn: function (){
  2070. var self=this;
  2071. smalltalk.send(self,"_assert_equals_",["javascripts/",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
  2072. return self}
  2073. }),
  2074. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2075. smalltalk.addMethod(
  2076. "_testZorkCommitPathStShouldBeSmalltalk",
  2077. smalltalk.method({
  2078. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2079. fn: function (){
  2080. var self=this;
  2081. smalltalk.send(self,"_assert_equals_",["smalltalk/",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
  2082. return self}
  2083. }),
  2084. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2085. smalltalk.addMethod(
  2086. "_shouldInheritSelectors",
  2087. smalltalk.method({
  2088. selector: "shouldInheritSelectors",
  2089. fn: function (){
  2090. var self=this;
  2091. return false;
  2092. }
  2093. }),
  2094. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2095. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2096. smalltalk.addMethod(
  2097. "_testAccessing",
  2098. smalltalk.method({
  2099. selector: "testAccessing",
  2100. fn: function (){
  2101. var self=this;
  2102. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_x",[]),(3)]);
  2103. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_y",[]),(4)]);
  2104. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_x_",[(3)]),"_x",[]),(3)]);
  2105. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_y_",[(4)]),"_y",[]),(4)]);
  2106. return self}
  2107. }),
  2108. smalltalk.PointTest);
  2109. smalltalk.addMethod(
  2110. "_testArithmetic",
  2111. smalltalk.method({
  2112. selector: "testArithmetic",
  2113. fn: function (){
  2114. var self=this;
  2115. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__star",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(9),(16)])]);
  2116. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__plus",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(6),(8)])]);
  2117. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__minus",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(0),(0)])]);
  2118. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((6),"__at",[(8)]),"__slash",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(2),(2)])]);
  2119. return self}
  2120. }),
  2121. smalltalk.PointTest);
  2122. smalltalk.addMethod(
  2123. "_testAt",
  2124. smalltalk.method({
  2125. selector: "testAt",
  2126. fn: function (){
  2127. var self=this;
  2128. smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)])]);
  2129. return self}
  2130. }),
  2131. smalltalk.PointTest);
  2132. smalltalk.addMethod(
  2133. "_testEgality",
  2134. smalltalk.method({
  2135. selector: "testEgality",
  2136. fn: function (){
  2137. var self=this;
  2138. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__eq",[smalltalk.send((3),"__at",[(4)])])]);
  2139. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((3),"__at",[(5)]),"__eq",[smalltalk.send((3),"__at",[(6)])])]);
  2140. return self}
  2141. }),
  2142. smalltalk.PointTest);
  2143. smalltalk.addMethod(
  2144. "_testTranslateBy",
  2145. smalltalk.method({
  2146. selector: "testTranslateBy",
  2147. fn: function (){
  2148. var self=this;
  2149. smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((0),"__at",[(1)])])]);
  2150. 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",[])])])]);
  2151. smalltalk.send(self,"_assert_equals_",[smalltalk.send((5),"__at",[(6)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((2),"__at",[(3)])])]);
  2152. 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)])])]);
  2153. return self}
  2154. }),
  2155. smalltalk.PointTest);
  2156. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2157. smalltalk.addMethod(
  2158. "_textNext",
  2159. smalltalk.method({
  2160. selector: "textNext",
  2161. fn: function (){
  2162. var self=this;
  2163. smalltalk.send((10000),"_timesRepeat_",[(function(){
  2164. var current;
  2165. var next;
  2166. next=smalltalk.send(smalltalk.send((smalltalk.Random || Random),"_new",[]),"_next",[]);
  2167. next;
  2168. smalltalk.send(self,"_assert_",[smalltalk.send(next,"__gt_eq",[(0)])]);
  2169. smalltalk.send(self,"_assert_",[smalltalk.send(next,"__lt",[(1)])]);
  2170. smalltalk.send(self,"_deny_",[smalltalk.send(current,"__eq",[next])]);
  2171. return smalltalk.send(next,"__eq",[current]);
  2172. })]);
  2173. return self}
  2174. }),
  2175. smalltalk.RandomTest);
  2176. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2177. smalltalk.addMethod(
  2178. "_testAddRemove",
  2179. smalltalk.method({
  2180. selector: "testAddRemove",
  2181. fn: function (){
  2182. var self=this;
  2183. var set;
  2184. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2185. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_isEmpty",[])]);
  2186. smalltalk.send(set,"_add_",[(3)]);
  2187. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(3)])]);
  2188. smalltalk.send(set,"_add_",[(5)]);
  2189. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(5)])]);
  2190. smalltalk.send(set,"_remove_",[(3)]);
  2191. smalltalk.send(self,"_deny_",[smalltalk.send(set,"_includes_",[(3)])]);
  2192. return self}
  2193. }),
  2194. smalltalk.SetTest);
  2195. smalltalk.addMethod(
  2196. "_testAt",
  2197. smalltalk.method({
  2198. selector: "testAt",
  2199. fn: function (){
  2200. var self=this;
  2201. smalltalk.send(self,"_should_raise_",[(function(){
  2202. return smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_at_put_",[(1),(2)]);
  2203. }),(smalltalk.Error || Error)]);
  2204. return self}
  2205. }),
  2206. smalltalk.SetTest);
  2207. smalltalk.addMethod(
  2208. "_testPrintString",
  2209. smalltalk.method({
  2210. selector: "testPrintString",
  2211. fn: function (){
  2212. var self=this;
  2213. var $1,$2;
  2214. var set;
  2215. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2216. smalltalk.send(self,"_assert_equals_",["a Set ()",smalltalk.send(set,"_printString",[])]);
  2217. smalltalk.send(set,"_add_",[(1)]);
  2218. $1=smalltalk.send(set,"_add_",[(3)]);
  2219. smalltalk.send(self,"_assert_equals_",["a Set (1 3)",smalltalk.send(set,"_printString",[])]);
  2220. smalltalk.send(set,"_add_",["foo"]);
  2221. smalltalk.send(self,"_assert_equals_",["a Set (1 3 'foo')",smalltalk.send(set,"_printString",[])]);
  2222. smalltalk.send(set,"_remove_",[(1)]);
  2223. $2=smalltalk.send(set,"_remove_",[(3)]);
  2224. smalltalk.send(self,"_assert_equals_",["a Set ('foo')",smalltalk.send(set,"_printString",[])]);
  2225. smalltalk.send(set,"_add_",[(3)]);
  2226. smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
  2227. smalltalk.send(set,"_add_",[(3)]);
  2228. smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
  2229. return self}
  2230. }),
  2231. smalltalk.SetTest);
  2232. smalltalk.addMethod(
  2233. "_testSize",
  2234. smalltalk.method({
  2235. selector: "testSize",
  2236. fn: function (){
  2237. var self=this;
  2238. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_size",[]),(0)]);
  2239. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (2), (3), (4)]]),"_size",[]),(4)]);
  2240. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (1), (1), (1)]]),"_size",[]),(1)]);
  2241. return self}
  2242. }),
  2243. smalltalk.SetTest);
  2244. smalltalk.addMethod(
  2245. "_testUnicity",
  2246. smalltalk.method({
  2247. selector: "testUnicity",
  2248. fn: function (){
  2249. var self=this;
  2250. var set;
  2251. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2252. smalltalk.send(set,"_add_",[(21)]);
  2253. smalltalk.send(set,"_add_",["hello"]);
  2254. smalltalk.send(set,"_add_",[(21)]);
  2255. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
  2256. smalltalk.send(set,"_add_",["hello"]);
  2257. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
  2258. smalltalk.send(self,"_assert_equals_",[smalltalk.send(set,"_asArray",[]),[(21), "hello"]]);
  2259. return self}
  2260. }),
  2261. smalltalk.SetTest);
  2262. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2263. smalltalk.addMethod(
  2264. "_testCopying",
  2265. smalltalk.method({
  2266. selector: "testCopying",
  2267. fn: function (){
  2268. var self=this;
  2269. smalltalk.send(self,"_assert_equals_",[smalltalk.send(nil,"_copy",[]),nil]);
  2270. return self}
  2271. }),
  2272. smalltalk.UndefinedTest);
  2273. smalltalk.addMethod(
  2274. "_testDeepCopy",
  2275. smalltalk.method({
  2276. selector: "testDeepCopy",
  2277. fn: function (){
  2278. var self=this;
  2279. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(nil,"_deepCopy",[]),"__eq",[nil])]);
  2280. return self}
  2281. }),
  2282. smalltalk.UndefinedTest);
  2283. smalltalk.addMethod(
  2284. "_testIfNil",
  2285. smalltalk.method({
  2286. selector: "testIfNil",
  2287. fn: function (){
  2288. var self=this;
  2289. var $1,$2,$3;
  2290. if(($receiver = nil) == nil || $receiver == undefined){
  2291. $1=true;
  2292. } else {
  2293. $1=nil;
  2294. };
  2295. smalltalk.send(self,"_assert_equals_",[$1,true]);
  2296. if(($receiver = nil) == nil || $receiver == undefined){
  2297. $2=nil;
  2298. } else {
  2299. $2=true;
  2300. };
  2301. smalltalk.send(self,"_deny_",[smalltalk.send($2,"__eq",[true])]);
  2302. if(($receiver = nil) == nil || $receiver == undefined){
  2303. $3=true;
  2304. } else {
  2305. $3=false;
  2306. };
  2307. smalltalk.send(self,"_assert_equals_",[$3,true]);
  2308. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(nil,"_ifNotNil_ifNil_",[(function(){
  2309. return true;
  2310. }),(function(){
  2311. return false;
  2312. })]),"__eq",[true])]);
  2313. return self}
  2314. }),
  2315. smalltalk.UndefinedTest);
  2316. smalltalk.addMethod(
  2317. "_testIsNil",
  2318. smalltalk.method({
  2319. selector: "testIsNil",
  2320. fn: function (){
  2321. var self=this;
  2322. smalltalk.send(self,"_assert_",[smalltalk.send(nil,"_isNil",[])]);
  2323. smalltalk.send(self,"_deny_",[smalltalk.send(nil,"_notNil",[])]);
  2324. return self}
  2325. }),
  2326. smalltalk.UndefinedTest);