1
0

Kernel-Tests.js 125 KB

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