Kernel-Tests.js 198 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736
  1. define("amber/Kernel-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  11. return smalltalk.withContext(function($ctx1) {
  12. self._shouldnt_raise_((function(){
  13. return smalltalk.withContext(function($ctx2) {
  14. return _st(_st((function(){
  15. return smalltalk.withContext(function($ctx3) {
  16. return _st(_st($Error())._new())._signal();
  17. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._valueWithInterval_((0)))._clearInterval();
  18. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  19. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  20. args: [],
  21. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  22. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  23. referencedClasses: ["Error"]
  24. }),
  25. smalltalk.BlockClosureTest);
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "testCanClearTimeout",
  29. category: 'tests',
  30. fn: function (){
  31. var self=this;
  32. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  33. return smalltalk.withContext(function($ctx1) {
  34. self._shouldnt_raise_((function(){
  35. return smalltalk.withContext(function($ctx2) {
  36. return _st(_st((function(){
  37. return smalltalk.withContext(function($ctx3) {
  38. return _st(_st($Error())._new())._signal();
  39. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._valueWithTimeout_((0)))._clearTimeout();
  40. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  41. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  42. args: [],
  43. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  44. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  45. referencedClasses: ["Error"]
  46. }),
  47. smalltalk.BlockClosureTest);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "testCompiledSource",
  51. category: 'tests',
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. self._assert_(_st(_st((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return (1).__plus((1));
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  59. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  60. args: [],
  61. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  62. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.BlockClosureTest);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "testCurrySelf",
  69. category: 'tests',
  70. fn: function (){
  71. var self=this;
  72. var curriedMethod,array;
  73. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  74. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  75. return smalltalk.withContext(function($ctx1) {
  76. curriedMethod=_st(_st((function(selfarg,x){
  77. return smalltalk.withContext(function($ctx2) {
  78. return _st(selfarg)._at_(x);
  79. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  80. array=[(3), (1), (4)];
  81. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  82. _st((function(){
  83. return smalltalk.withContext(function($ctx2) {
  84. return self._assert_equals_(_st(array)._foo_((2)),(1));
  85. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  86. return smalltalk.withContext(function($ctx2) {
  87. return _st($Array())._removeCompiledMethod_(curriedMethod);
  88. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  89. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  90. args: [],
  91. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array category: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  92. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"],
  93. referencedClasses: ["Array", "ClassBuilder"]
  94. }),
  95. smalltalk.BlockClosureTest);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "testEnsure",
  99. category: 'tests',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. self._assert_equals_(_st((function(){
  104. return smalltalk.withContext(function($ctx2) {
  105. return (3);
  106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  107. return smalltalk.withContext(function($ctx2) {
  108. return (4);
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  111. args: [],
  112. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  113. messageSends: ["assert:equals:", "ensure:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. smalltalk.method({
  119. selector: "testEnsureRaises",
  120. category: 'tests',
  121. fn: function (){
  122. var self=this;
  123. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  124. return smalltalk.withContext(function($ctx1) {
  125. self._should_raise_((function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. return _st((function(){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(_st($Error())._new())._signal();
  130. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  131. return smalltalk.withContext(function($ctx3) {
  132. return true;
  133. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  135. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  136. args: [],
  137. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  138. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  139. referencedClasses: ["Error"]
  140. }),
  141. smalltalk.BlockClosureTest);
  142. smalltalk.addMethod(
  143. smalltalk.method({
  144. selector: "testExceptionSemantics",
  145. category: 'tests',
  146. fn: function (){
  147. var self=this;
  148. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  149. return smalltalk.withContext(function($ctx1) {
  150. self._timeout_((100));
  151. _st(self._async_((function(){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st((function(){
  154. return smalltalk.withContext(function($ctx3) {
  155. self._assert_(true);
  156. _st($Error())._signal();
  157. self._deny_(true);
  158. return self._finished();
  159. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._on_do_($Error(),(function(ex){
  160. return smalltalk.withContext(function($ctx3) {
  161. return self._finished();
  162. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2)})}));
  163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  165. args: [],
  166. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"],
  168. referencedClasses: ["Error"]
  169. }),
  170. smalltalk.BlockClosureTest);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "testNewWithValues",
  174. category: 'tests',
  175. fn: function (){
  176. var self=this;
  177. return smalltalk.withContext(function($ctx1) {
  178. function theTestPrototype() {this.name = "theTestPrototype";}
  179. function theTestConstructor(arg1, arg2, arg3) {}
  180. theTestConstructor.prototype = new theTestPrototype;
  181. var theWrappedConstructor = _st(theTestConstructor);
  182. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  183. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  184. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  185. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  186. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  187. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  188. args: [],
  189. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  190. messageSends: [],
  191. referencedClasses: []
  192. }),
  193. smalltalk.BlockClosureTest);
  194. smalltalk.addMethod(
  195. smalltalk.method({
  196. selector: "testNumArgs",
  197. category: 'tests',
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. self._assert_equals_(_st((function(){
  202. return smalltalk.withContext(function($ctx2) {
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  204. self._assert_equals_(_st((function(a,b){
  205. return smalltalk.withContext(function($ctx2) {
  206. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  208. args: [],
  209. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  210. messageSends: ["assert:equals:", "numArgs"],
  211. referencedClasses: []
  212. }),
  213. smalltalk.BlockClosureTest);
  214. smalltalk.addMethod(
  215. smalltalk.method({
  216. selector: "testOnDo",
  217. category: 'tests',
  218. fn: function (){
  219. var self=this;
  220. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  221. return smalltalk.withContext(function($ctx1) {
  222. self._assert_(_st((function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st(_st($Error())._new())._signal();
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  226. return smalltalk.withContext(function($ctx2) {
  227. return true;
  228. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  229. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  230. args: [],
  231. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  232. messageSends: ["assert:", "on:do:", "signal", "new"],
  233. referencedClasses: ["Error"]
  234. }),
  235. smalltalk.BlockClosureTest);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "testValue",
  239. category: 'tests',
  240. fn: function (){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) {
  243. self._assert_equals_(_st((function(){
  244. return smalltalk.withContext(function($ctx2) {
  245. return (1).__plus((1));
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  247. self._assert_equals_(_st((function(x){
  248. return smalltalk.withContext(function($ctx2) {
  249. return _st(x).__plus((1));
  250. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  251. self._assert_equals_(_st((function(x,y){
  252. return smalltalk.withContext(function($ctx2) {
  253. return _st(x).__star(y);
  254. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  255. self._assert_equals_(_st((function(a,b,c){
  256. return smalltalk.withContext(function($ctx2) {
  257. return (1);
  258. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  259. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  260. args: [],
  261. 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",
  262. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  263. referencedClasses: []
  264. }),
  265. smalltalk.BlockClosureTest);
  266. smalltalk.addMethod(
  267. smalltalk.method({
  268. selector: "testValueWithPossibleArguments",
  269. category: 'tests',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) {
  273. self._assert_equals_(_st((function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return (1);
  276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  277. self._assert_equals_(_st((function(a){
  278. return smalltalk.withContext(function($ctx2) {
  279. return _st(a).__plus((4));
  280. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  281. self._assert_equals_(_st((function(a,b){
  282. return smalltalk.withContext(function($ctx2) {
  283. return _st(a).__plus(b);
  284. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  285. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  286. args: [],
  287. 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.",
  288. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  289. referencedClasses: []
  290. }),
  291. smalltalk.BlockClosureTest);
  292. smalltalk.addMethod(
  293. smalltalk.method({
  294. selector: "testWhileFalse",
  295. category: 'tests',
  296. fn: function (){
  297. var self=this;
  298. var i;
  299. return smalltalk.withContext(function($ctx1) {
  300. i=(0);
  301. _st((function(){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(i).__gt((5));
  304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  305. return smalltalk.withContext(function($ctx2) {
  306. i=_st(i).__plus((1));
  307. return i;
  308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  309. self._assert_equals_(i,(6));
  310. i=(0);
  311. _st((function(){
  312. return smalltalk.withContext(function($ctx2) {
  313. i=_st(i).__plus((1));
  314. i;
  315. return _st(i).__gt((5));
  316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  317. self._assert_equals_(i,(6));
  318. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  319. args: [],
  320. 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",
  321. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
  322. referencedClasses: []
  323. }),
  324. smalltalk.BlockClosureTest);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "testWhileTrue",
  328. category: 'tests',
  329. fn: function (){
  330. var self=this;
  331. var i;
  332. return smalltalk.withContext(function($ctx1) {
  333. i=(0);
  334. _st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(i).__lt((5));
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  338. return smalltalk.withContext(function($ctx2) {
  339. i=_st(i).__plus((1));
  340. return i;
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  342. self._assert_equals_(i,(5));
  343. i=(0);
  344. _st((function(){
  345. return smalltalk.withContext(function($ctx2) {
  346. i=_st(i).__plus((1));
  347. i;
  348. return _st(i).__lt((5));
  349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  350. self._assert_equals_(i,(5));
  351. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  352. args: [],
  353. 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",
  354. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
  355. referencedClasses: []
  356. }),
  357. smalltalk.BlockClosureTest);
  358. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  359. smalltalk.addMethod(
  360. smalltalk.method({
  361. selector: "testEquality",
  362. category: 'tests',
  363. fn: function (){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. self._deny_((0).__eq(false));
  367. self._deny_(false.__eq((0)));
  368. self._deny_("".__eq(false));
  369. self._deny_(false.__eq(""));
  370. self._assert_(true.__eq(true));
  371. self._deny_(false.__eq(true));
  372. self._deny_(true.__eq(false));
  373. self._assert_(false.__eq(false));
  374. self._assert_(_st(true._yourself()).__eq(true));
  375. self._assert_(_st(true._yourself()).__eq(true._yourself()));
  376. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  377. args: [],
  378. 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)",
  379. messageSends: ["deny:", "=", "assert:", "yourself"],
  380. referencedClasses: []
  381. }),
  382. smalltalk.BooleanTest);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "testIdentity",
  386. category: 'tests',
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. self._deny_((0).__eq_eq(false));
  391. self._deny_(false.__eq_eq((0)));
  392. self._deny_("".__eq_eq(false));
  393. self._deny_(false.__eq_eq(""));
  394. self._assert_(true.__eq_eq(true));
  395. self._deny_(false.__eq_eq(true));
  396. self._deny_(true.__eq_eq(false));
  397. self._assert_(false.__eq_eq(false));
  398. self._assert_(_st(true._yourself()).__eq_eq(true));
  399. self._assert_(_st(true._yourself()).__eq_eq(true._yourself()));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  401. args: [],
  402. 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",
  403. messageSends: ["deny:", "==", "assert:", "yourself"],
  404. referencedClasses: []
  405. }),
  406. smalltalk.BooleanTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testIfTrueIfFalse",
  410. category: 'tests',
  411. fn: function (){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  415. $1=self;
  416. if(smalltalk.assert(true)){
  417. $2="alternative block";
  418. };
  419. _st($1)._assert_equals_($2,"alternative block");
  420. $3=self;
  421. if(! smalltalk.assert(true)){
  422. $4="alternative block";
  423. };
  424. _st($3)._assert_equals_($4,nil);
  425. $5=self;
  426. if(smalltalk.assert(false)){
  427. $6="alternative block";
  428. };
  429. _st($5)._assert_equals_($6,nil);
  430. $7=self;
  431. if(! smalltalk.assert(false)){
  432. $8="alternative block";
  433. };
  434. _st($7)._assert_equals_($8,"alternative block");
  435. $9=self;
  436. if(smalltalk.assert(false)){
  437. $10="alternative block";
  438. } else {
  439. $10="alternative block2";
  440. };
  441. _st($9)._assert_equals_($10,"alternative block2");
  442. $11=self;
  443. if(smalltalk.assert(false)){
  444. $12="alternative block2";
  445. } else {
  446. $12="alternative block";
  447. };
  448. _st($11)._assert_equals_($12,"alternative block");
  449. $13=self;
  450. if(smalltalk.assert(true)){
  451. $14="alternative block";
  452. } else {
  453. $14="alternative block2";
  454. };
  455. _st($13)._assert_equals_($14,"alternative block");
  456. $15=self;
  457. if(smalltalk.assert(true)){
  458. $16="alternative block2";
  459. } else {
  460. $16="alternative block";
  461. };
  462. _st($15)._assert_equals_($16,"alternative block2");
  463. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  464. args: [],
  465. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: ['alternative block']) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block']) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block']) equals: nil.\x0a\x09self assert: (false ifFalse: ['alternative block']) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block2'.",
  466. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  467. referencedClasses: []
  468. }),
  469. smalltalk.BooleanTest);
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "testIfTrueIfFalseWithBoxing",
  473. category: 'tests',
  474. fn: function (){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) {
  477. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  478. $1=self;
  479. $3=true._yourself();
  480. if(smalltalk.assert($3)){
  481. $2="alternative block";
  482. };
  483. _st($1)._assert_equals_($2,"alternative block");
  484. $4=self;
  485. $6=true._yourself();
  486. if(! smalltalk.assert($6)){
  487. $5="alternative block";
  488. };
  489. _st($4)._assert_equals_($5,nil);
  490. $7=self;
  491. $9=false._yourself();
  492. if(smalltalk.assert($9)){
  493. $8="alternative block";
  494. };
  495. _st($7)._assert_equals_($8,nil);
  496. $10=self;
  497. $12=false._yourself();
  498. if(! smalltalk.assert($12)){
  499. $11="alternative block";
  500. };
  501. _st($10)._assert_equals_($11,"alternative block");
  502. $13=self;
  503. $15=false._yourself();
  504. if(smalltalk.assert($15)){
  505. $14="alternative block";
  506. } else {
  507. $14="alternative block2";
  508. };
  509. _st($13)._assert_equals_($14,"alternative block2");
  510. $16=self;
  511. $18=false._yourself();
  512. if(smalltalk.assert($18)){
  513. $17="alternative block2";
  514. } else {
  515. $17="alternative block";
  516. };
  517. _st($16)._assert_equals_($17,"alternative block");
  518. $19=self;
  519. $21=true._yourself();
  520. if(smalltalk.assert($21)){
  521. $20="alternative block";
  522. } else {
  523. $20="alternative block2";
  524. };
  525. _st($19)._assert_equals_($20,"alternative block");
  526. $22=self;
  527. $24=true._yourself();
  528. if(smalltalk.assert($24)){
  529. $23="alternative block2";
  530. } else {
  531. $23="alternative block";
  532. };
  533. _st($22)._assert_equals_($23,"alternative block2");
  534. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  535. args: [],
  536. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: ['alternative block']) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block']) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block']) equals: nil.\x0a\x09self assert: (false yourself ifFalse: ['alternative block']) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block2'.",
  537. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  538. referencedClasses: []
  539. }),
  540. smalltalk.BooleanTest);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "testLogic",
  544. category: 'tests',
  545. fn: function (){
  546. var self=this;
  547. return smalltalk.withContext(function($ctx1) {
  548. var $1,$2,$3,$4,$5,$6,$7,$8;
  549. $1=self;
  550. _st($1)._assert_(true.__and(true));
  551. _st($1)._deny_(true.__and(false));
  552. _st($1)._deny_(false.__and(true));
  553. $2=_st($1)._deny_(false.__and(false));
  554. $3=self;
  555. _st($3)._assert_(true.__or(true));
  556. _st($3)._assert_(true.__or(false));
  557. _st($3)._assert_(false.__or(true));
  558. $4=_st($3)._deny_(false.__or(false));
  559. $5=self;
  560. _st($5)._assert_(true.__and((1).__gt((0))));
  561. _st($5)._deny_(_st((1).__gt((0))).__and(false));
  562. $6=_st($5)._deny_(_st((1).__gt((0))).__and((1).__gt((2))));
  563. $7=self;
  564. _st($7)._assert_(false.__or((1).__gt((0))));
  565. _st($7)._assert_(_st((1).__gt((0))).__or(false));
  566. $8=_st($7)._assert_(_st((1).__gt((0))).__or((1).__gt((2))));
  567. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  568. args: [],
  569. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  570. messageSends: ["assert:", "&", "deny:", "|", ">"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.BooleanTest);
  574. smalltalk.addMethod(
  575. smalltalk.method({
  576. selector: "testLogicKeywords",
  577. category: 'tests',
  578. fn: function (){
  579. var self=this;
  580. return smalltalk.withContext(function($ctx1) {
  581. var $1,$2,$3,$4,$5,$6,$7,$8;
  582. $1=self;
  583. _st($1)._assert_(true._and_((function(){
  584. return smalltalk.withContext(function($ctx2) {
  585. return true;
  586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  587. _st($1)._deny_(true._and_((function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return false;
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  591. _st($1)._deny_(false._and_((function(){
  592. return smalltalk.withContext(function($ctx2) {
  593. return true;
  594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  595. $2=_st($1)._deny_(false._and_((function(){
  596. return smalltalk.withContext(function($ctx2) {
  597. return false;
  598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  599. $3=self;
  600. _st($3)._assert_(true._or_((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. return true;
  603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  604. _st($3)._assert_(true._or_((function(){
  605. return smalltalk.withContext(function($ctx2) {
  606. return false;
  607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  608. _st($3)._assert_(false._or_((function(){
  609. return smalltalk.withContext(function($ctx2) {
  610. return true;
  611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  612. $4=_st($3)._deny_(false._or_((function(){
  613. return smalltalk.withContext(function($ctx2) {
  614. return false;
  615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  616. $5=self;
  617. _st($5)._assert_(true._and_((function(){
  618. return smalltalk.withContext(function($ctx2) {
  619. return (1).__gt((0));
  620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  621. _st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  622. return smalltalk.withContext(function($ctx2) {
  623. return false;
  624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  625. $6=_st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  626. return smalltalk.withContext(function($ctx2) {
  627. return (1).__gt((2));
  628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  629. $7=self;
  630. _st($7)._assert_(false._or_((function(){
  631. return smalltalk.withContext(function($ctx2) {
  632. return (1).__gt((0));
  633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  634. _st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  635. return smalltalk.withContext(function($ctx2) {
  636. return false;
  637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  638. $8=_st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  639. return smalltalk.withContext(function($ctx2) {
  640. return (1).__gt((2));
  641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  642. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  643. args: [],
  644. source: "testLogicKeywords\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\x09\x09\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\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  645. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  646. referencedClasses: []
  647. }),
  648. smalltalk.BooleanTest);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "testNonBooleanError",
  652. category: 'tests',
  653. fn: function (){
  654. var self=this;
  655. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  656. return smalltalk.withContext(function($ctx1) {
  657. self._should_raise_((function(){
  658. return smalltalk.withContext(function($ctx2) {
  659. if(smalltalk.assert("")){
  660. } else {
  661. };
  662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$NonBooleanReceiver());
  663. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  664. args: [],
  665. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  666. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  667. referencedClasses: ["NonBooleanReceiver"]
  668. }),
  669. smalltalk.BooleanTest);
  670. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "setUp",
  674. category: 'running',
  675. fn: function (){
  676. var self=this;
  677. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  678. return smalltalk.withContext(function($ctx1) {
  679. self["@builder"]=_st($ClassBuilder())._new();
  680. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  681. args: [],
  682. source: "setUp\x0a\x09builder := ClassBuilder new",
  683. messageSends: ["new"],
  684. referencedClasses: ["ClassBuilder"]
  685. }),
  686. smalltalk.ClassBuilderTest);
  687. smalltalk.addMethod(
  688. smalltalk.method({
  689. selector: "tearDown",
  690. category: 'running',
  691. fn: function (){
  692. var self=this;
  693. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  694. return smalltalk.withContext(function($ctx1) {
  695. var $1;
  696. $1=self["@theClass"];
  697. if(($receiver = $1) == nil || $receiver == undefined){
  698. $1;
  699. } else {
  700. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  701. self["@theClass"]=nil;
  702. self["@theClass"];
  703. };
  704. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  705. args: [],
  706. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  707. messageSends: ["ifNotNil:", "removeClass:", "current"],
  708. referencedClasses: ["Smalltalk"]
  709. }),
  710. smalltalk.ClassBuilderTest);
  711. smalltalk.addMethod(
  712. smalltalk.method({
  713. selector: "testClassCopy",
  714. category: 'tests',
  715. fn: function (){
  716. var self=this;
  717. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  718. return smalltalk.withContext(function($ctx1) {
  719. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  720. self._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  721. self._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  722. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  723. self._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  724. self._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  725. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  726. args: [],
  727. 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",
  728. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  729. referencedClasses: ["ObjectMock"]
  730. }),
  731. smalltalk.ClassBuilderTest);
  732. smalltalk.addMethod(
  733. smalltalk.method({
  734. selector: "testClassMigration",
  735. category: 'tests',
  736. fn: function (){
  737. var self=this;
  738. var instance,oldClass;
  739. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  740. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  741. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  742. return smalltalk.withContext(function($ctx1) {
  743. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  744. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  745. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  746. self._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  747. self._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  748. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  749. self._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  750. self._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  751. self._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  752. self._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  753. self._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  754. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  755. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  756. args: [],
  757. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  758. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  759. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  760. }),
  761. smalltalk.ClassBuilderTest);
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "testClassMigrationWithClassInstanceVariables",
  765. category: 'tests',
  766. fn: function (){
  767. var self=this;
  768. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  769. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  770. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  771. return smalltalk.withContext(function($ctx1) {
  772. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  773. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  774. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  775. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  776. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  777. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  778. args: [],
  779. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  780. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  781. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  782. }),
  783. smalltalk.ClassBuilderTest);
  784. smalltalk.addMethod(
  785. smalltalk.method({
  786. selector: "testClassMigrationWithSubclasses",
  787. category: 'tests',
  788. fn: function (){
  789. var self=this;
  790. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  791. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  792. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  793. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  794. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  795. return smalltalk.withContext(function($ctx1) {
  796. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  797. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  798. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  799. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  800. self._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  801. self._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  802. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  803. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  804. return smalltalk.withContext(function($ctx2) {
  805. return _st(_st($Smalltalk())._current())._removeClass_(each);
  806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  807. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  808. args: [],
  809. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  810. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"],
  811. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  812. }),
  813. smalltalk.ClassBuilderTest);
  814. smalltalk.addMethod(
  815. smalltalk.method({
  816. selector: "testInstanceVariableNames",
  817. category: 'tests',
  818. fn: function (){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  822. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  823. args: [],
  824. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  825. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  826. referencedClasses: []
  827. }),
  828. smalltalk.ClassBuilderTest);
  829. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "assertSameContents:as:",
  833. category: 'convenience',
  834. fn: function (aCollection,anotherCollection){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) {
  837. self._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  838. _st(aCollection)._do_((function(each){
  839. return smalltalk.withContext(function($ctx2) {
  840. return self._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  842. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  843. args: ["aCollection", "anotherCollection"],
  844. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  845. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.CollectionTest);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "collection",
  852. category: 'accessing',
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  860. args: [],
  861. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  862. messageSends: ["withAll:", "defaultValues", "collectionClass"],
  863. referencedClasses: []
  864. }),
  865. smalltalk.CollectionTest);
  866. smalltalk.addMethod(
  867. smalltalk.method({
  868. selector: "collectionClass",
  869. category: 'accessing',
  870. fn: function (){
  871. var self=this;
  872. return smalltalk.withContext(function($ctx1) {
  873. var $1;
  874. $1=_st(self._class())._collectionClass();
  875. return $1;
  876. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  877. args: [],
  878. source: "collectionClass\x0a\x09^ self class collectionClass",
  879. messageSends: ["collectionClass", "class"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.CollectionTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "collectionWithDuplicates",
  886. category: 'accessing',
  887. fn: function (){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1;
  891. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  892. return $1;
  893. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  894. args: [],
  895. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  896. messageSends: ["withAll:", "collectionClass"],
  897. referencedClasses: []
  898. }),
  899. smalltalk.CollectionTest);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "defaultValues",
  903. category: 'accessing',
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) {
  907. var $1;
  908. $1=[(1), (2), (3), (-4)];
  909. return $1;
  910. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  911. args: [],
  912. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.CollectionTest);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "isCollectionReadOnly",
  920. category: 'testing',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. return false;
  925. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  926. args: [],
  927. source: "isCollectionReadOnly\x0a\x09^ false",
  928. messageSends: [],
  929. referencedClasses: []
  930. }),
  931. smalltalk.CollectionTest);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "testAsArray",
  935. category: 'tests',
  936. fn: function (){
  937. var self=this;
  938. return smalltalk.withContext(function($ctx1) {
  939. self._assertSameContents_as_(self._collection(),_st(self._collection())._asArray());
  940. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  941. args: [],
  942. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  943. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  944. referencedClasses: []
  945. }),
  946. smalltalk.CollectionTest);
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "testAsOrderedCollection",
  950. category: 'tests',
  951. fn: function (){
  952. var self=this;
  953. return smalltalk.withContext(function($ctx1) {
  954. self._assertSameContents_as_(self._collection(),_st(self._collection())._asOrderedCollection());
  955. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  956. args: [],
  957. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  958. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  959. referencedClasses: []
  960. }),
  961. smalltalk.CollectionTest);
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "testAsSet",
  965. category: 'tests',
  966. fn: function (){
  967. var self=this;
  968. var c,set;
  969. return smalltalk.withContext(function($ctx1) {
  970. c=self._collectionWithDuplicates();
  971. set=_st(c)._asSet();
  972. self._assert_equals_(_st(set)._size(),(5));
  973. _st(c)._do_((function(each){
  974. return smalltalk.withContext(function($ctx2) {
  975. return self._assert_(_st(set)._includes_(each));
  976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  977. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  978. args: [],
  979. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  980. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.CollectionTest);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "testCollect",
  987. category: 'tests',
  988. fn: function (){
  989. var self=this;
  990. var newCollection;
  991. return smalltalk.withContext(function($ctx1) {
  992. newCollection=[(1), (2), (3), (4)];
  993. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  994. return smalltalk.withContext(function($ctx2) {
  995. return _st(each)._abs();
  996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  997. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  998. args: [],
  999. 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",
  1000. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.CollectionTest);
  1004. smalltalk.addMethod(
  1005. smalltalk.method({
  1006. selector: "testDetect",
  1007. category: 'tests',
  1008. fn: function (){
  1009. var self=this;
  1010. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1011. return smalltalk.withContext(function($ctx1) {
  1012. self._assert_equals_(_st(self._collection())._detect_((function(each){
  1013. return smalltalk.withContext(function($ctx2) {
  1014. return _st(each).__lt((0));
  1015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  1016. self._should_raise_((function(){
  1017. return smalltalk.withContext(function($ctx2) {
  1018. return _st(self._collection())._detect_((function(each){
  1019. return smalltalk.withContext(function($ctx3) {
  1020. return _st(each).__eq((6));
  1021. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  1022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1023. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1024. args: [],
  1025. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1026. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="],
  1027. referencedClasses: ["Error"]
  1028. }),
  1029. smalltalk.CollectionTest);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "testDo",
  1033. category: 'tests',
  1034. fn: function (){
  1035. var self=this;
  1036. var newCollection;
  1037. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1038. return smalltalk.withContext(function($ctx1) {
  1039. newCollection=_st($OrderedCollection())._new();
  1040. _st(self._collection())._do_((function(each){
  1041. return smalltalk.withContext(function($ctx2) {
  1042. return _st(newCollection)._add_(each);
  1043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1044. self._assertSameContents_as_(self._collection(),newCollection);
  1045. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1046. args: [],
  1047. 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",
  1048. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
  1049. referencedClasses: ["OrderedCollection"]
  1050. }),
  1051. smalltalk.CollectionTest);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "testIsEmpty",
  1055. category: 'tests',
  1056. fn: function (){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) {
  1059. self._assert_(_st(_st(self._collectionClass())._new())._isEmpty());
  1060. self._deny_(_st(self._collection())._isEmpty());
  1061. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1062. args: [],
  1063. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1064. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1065. referencedClasses: []
  1066. }),
  1067. smalltalk.CollectionTest);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "testSelect",
  1071. category: 'tests',
  1072. fn: function (){
  1073. var self=this;
  1074. var newCollection;
  1075. return smalltalk.withContext(function($ctx1) {
  1076. newCollection=[(2), (-4)];
  1077. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1078. return smalltalk.withContext(function($ctx2) {
  1079. return _st(each)._even();
  1080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1081. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1082. args: [],
  1083. 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",
  1084. messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.CollectionTest);
  1088. smalltalk.addMethod(
  1089. smalltalk.method({
  1090. selector: "testSize",
  1091. category: 'tests',
  1092. fn: function (){
  1093. var self=this;
  1094. return smalltalk.withContext(function($ctx1) {
  1095. self._assert_equals_(_st(_st(self._collectionClass())._new())._size(),(0));
  1096. self._assert_equals_(_st(self._collection())._size(),(4));
  1097. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1098. args: [],
  1099. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1100. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1101. referencedClasses: []
  1102. }),
  1103. smalltalk.CollectionTest);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "collectionClass",
  1107. category: 'accessing',
  1108. fn: function (){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. return nil;
  1112. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1113. args: [],
  1114. source: "collectionClass\x0a\x09^ nil",
  1115. messageSends: [],
  1116. referencedClasses: []
  1117. }),
  1118. smalltalk.CollectionTest.klass);
  1119. smalltalk.addMethod(
  1120. smalltalk.method({
  1121. selector: "isAbstract",
  1122. category: 'testing',
  1123. fn: function (){
  1124. var self=this;
  1125. return smalltalk.withContext(function($ctx1) {
  1126. var $1;
  1127. $1=_st(self._collectionClass())._isNil();
  1128. return $1;
  1129. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1130. args: [],
  1131. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1132. messageSends: ["isNil", "collectionClass"],
  1133. referencedClasses: []
  1134. }),
  1135. smalltalk.CollectionTest.klass);
  1136. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1137. smalltalk.addMethod(
  1138. smalltalk.method({
  1139. selector: "testAt",
  1140. category: 'tests',
  1141. fn: function (){
  1142. var self=this;
  1143. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1144. return smalltalk.withContext(function($ctx1) {
  1145. self._assert_equals_(_st(self._collection())._at_((4)),(-4));
  1146. self._should_raise_((function(){
  1147. return smalltalk.withContext(function($ctx2) {
  1148. return _st(self._collection())._at_((5));
  1149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1150. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1151. args: [],
  1152. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1153. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1154. referencedClasses: ["Error"]
  1155. }),
  1156. smalltalk.IndexableCollectionTest);
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "testAtIfAbsent",
  1160. category: 'tests',
  1161. fn: function (){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. self._assert_equals_(_st(self._collection())._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1165. return smalltalk.withContext(function($ctx2) {
  1166. return "none";
  1167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  1168. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1169. args: [],
  1170. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1171. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"],
  1172. referencedClasses: []
  1173. }),
  1174. smalltalk.IndexableCollectionTest);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "testContains",
  1178. category: 'tests',
  1179. fn: function (){
  1180. var self=this;
  1181. var collection;
  1182. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1183. return smalltalk.withContext(function($ctx1) {
  1184. collection=self._collection();
  1185. self._assert_(_st(self._collection())._contains_((function(each){
  1186. return smalltalk.withContext(function($ctx2) {
  1187. return _st(each).__eq(_st(self._collection())._first());
  1188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1189. self._deny_(_st(self._collection())._contains_((function(each){
  1190. return smalltalk.withContext(function($ctx2) {
  1191. return _st(each).__eq(_st($Object())._new());
  1192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1193. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1194. args: [],
  1195. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1196. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1197. referencedClasses: ["Object"]
  1198. }),
  1199. smalltalk.IndexableCollectionTest);
  1200. smalltalk.addMethod(
  1201. smalltalk.method({
  1202. selector: "testIndexOf",
  1203. category: 'tests',
  1204. fn: function (){
  1205. var self=this;
  1206. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. self._assert_equals_(_st(self._collection())._indexOf_((2)),(2));
  1209. self._should_raise_((function(){
  1210. return smalltalk.withContext(function($ctx2) {
  1211. return _st(self._collection())._indexOf_((999));
  1212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1213. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1214. return smalltalk.withContext(function($ctx2) {
  1215. return "sentinel";
  1216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1217. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1218. args: [],
  1219. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1220. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1221. referencedClasses: ["Error"]
  1222. }),
  1223. smalltalk.IndexableCollectionTest);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "testWithIndexDo",
  1227. category: 'tests',
  1228. fn: function (){
  1229. var self=this;
  1230. var collection;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. collection=self._collection();
  1233. _st(self._collection())._withIndexDo_((function(each,index){
  1234. return smalltalk.withContext(function($ctx2) {
  1235. return self._assert_equals_(_st(collection)._at_(index),each);
  1236. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  1237. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1238. args: [],
  1239. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  1240. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1241. referencedClasses: []
  1242. }),
  1243. smalltalk.IndexableCollectionTest);
  1244. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1245. smalltalk.addMethod(
  1246. smalltalk.method({
  1247. selector: "collection",
  1248. category: 'accessing',
  1249. fn: function (){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $1;
  1253. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4))]);
  1254. return $1;
  1255. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1256. args: [],
  1257. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1258. messageSends: ["->"],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.HashedCollectionTest);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "collectionWithDuplicates",
  1265. category: 'accessing',
  1266. fn: function (){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. var $1;
  1270. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4)),"e".__minus_gt((1)),"f".__minus_gt((2)),"g".__minus_gt((10))]);
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1273. args: [],
  1274. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1275. messageSends: ["->"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.HashedCollectionTest);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "testAsDictionary",
  1282. category: 'tests',
  1283. fn: function (){
  1284. var self=this;
  1285. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1286. return smalltalk.withContext(function($ctx1) {
  1287. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1288. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1289. args: [],
  1290. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1291. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1292. referencedClasses: ["Dictionary"]
  1293. }),
  1294. smalltalk.HashedCollectionTest);
  1295. smalltalk.addMethod(
  1296. smalltalk.method({
  1297. selector: "testAt",
  1298. category: 'tests',
  1299. fn: function (){
  1300. var self=this;
  1301. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1302. return smalltalk.withContext(function($ctx1) {
  1303. self._assert_equals_(_st(self._collection())._at_("a"),(2));
  1304. self._should_raise_((function(){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return _st(self._collection())._at_((5));
  1307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1309. args: [],
  1310. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1311. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1312. referencedClasses: ["Error"]
  1313. }),
  1314. smalltalk.HashedCollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "testContains",
  1318. category: 'tests',
  1319. fn: function (){
  1320. var self=this;
  1321. var collection;
  1322. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1323. return smalltalk.withContext(function($ctx1) {
  1324. collection=self._collection();
  1325. self._assert_(_st(self._collection())._contains_((function(each){
  1326. return smalltalk.withContext(function($ctx2) {
  1327. return _st(each).__eq(_st(_st(self._collection())._values())._first());
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1329. self._deny_(_st(self._collection())._contains_((function(each){
  1330. return smalltalk.withContext(function($ctx2) {
  1331. return _st(each).__eq(_st($Object())._new());
  1332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1333. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1334. args: [],
  1335. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection values first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1336. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1337. referencedClasses: ["Object"]
  1338. }),
  1339. smalltalk.HashedCollectionTest);
  1340. smalltalk.addMethod(
  1341. smalltalk.method({
  1342. selector: "testFrom",
  1343. category: 'tests',
  1344. fn: function (){
  1345. var self=this;
  1346. var associations;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. associations=["a".__minus_gt((1)),"b".__minus_gt((2))];
  1349. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1350. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1351. args: [],
  1352. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  1353. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.HashedCollectionTest);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "testIndexOf",
  1360. category: 'tests',
  1361. fn: function (){
  1362. var self=this;
  1363. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1364. return smalltalk.withContext(function($ctx1) {
  1365. self._assert_equals_(_st(self._collection())._indexOf_((2)),"a");
  1366. self._should_raise_((function(){
  1367. return smalltalk.withContext(function($ctx2) {
  1368. return _st(self._collection())._indexOf_((999));
  1369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1370. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. return "sentinel";
  1373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1374. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1375. args: [],
  1376. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 'a'.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1377. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1378. referencedClasses: ["Error"]
  1379. }),
  1380. smalltalk.HashedCollectionTest);
  1381. smalltalk.addMethod(
  1382. smalltalk.method({
  1383. selector: "testNewFromPairs",
  1384. category: 'tests',
  1385. fn: function (){
  1386. var self=this;
  1387. var flattenedAssociations;
  1388. return smalltalk.withContext(function($ctx1) {
  1389. flattenedAssociations=["a",(1),"b",(2)];
  1390. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1391. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1392. args: [],
  1393. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  1394. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1395. referencedClasses: []
  1396. }),
  1397. smalltalk.HashedCollectionTest);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "collectionClass",
  1401. category: 'accessing',
  1402. fn: function (){
  1403. var self=this;
  1404. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1405. return smalltalk.withContext(function($ctx1) {
  1406. var $1;
  1407. $1=$HashedCollection();
  1408. return $1;
  1409. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1410. args: [],
  1411. source: "collectionClass\x0a\x09^ HashedCollection",
  1412. messageSends: [],
  1413. referencedClasses: ["HashedCollection"]
  1414. }),
  1415. smalltalk.HashedCollectionTest.klass);
  1416. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1417. smalltalk.addMethod(
  1418. smalltalk.method({
  1419. selector: "collection",
  1420. category: 'accessing',
  1421. fn: function (){
  1422. var self=this;
  1423. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1424. return smalltalk.withContext(function($ctx1) {
  1425. var $2,$3,$1;
  1426. $2=_st($Dictionary())._new();
  1427. _st($2)._at_put_((1),(1));
  1428. _st($2)._at_put_("a",(2));
  1429. _st($2)._at_put_(true,(3));
  1430. _st($2)._at_put_((4),(-4));
  1431. $3=_st($2)._yourself();
  1432. $1=$3;
  1433. return $1;
  1434. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1435. args: [],
  1436. 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",
  1437. messageSends: ["at:put:", "new", "yourself"],
  1438. referencedClasses: ["Dictionary"]
  1439. }),
  1440. smalltalk.DictionaryTest);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "collectionWithDuplicates",
  1444. category: 'accessing',
  1445. fn: function (){
  1446. var self=this;
  1447. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $2,$3,$1;
  1450. $2=_st($Dictionary())._new();
  1451. _st($2)._at_put_((1),(1));
  1452. _st($2)._at_put_("a",(2));
  1453. _st($2)._at_put_(true,(3));
  1454. _st($2)._at_put_((4),(-4));
  1455. _st($2)._at_put_("b",(1));
  1456. _st($2)._at_put_((3),(3));
  1457. _st($2)._at_put_(false,(12));
  1458. $3=_st($2)._yourself();
  1459. $1=$3;
  1460. return $1;
  1461. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1462. args: [],
  1463. 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",
  1464. messageSends: ["at:put:", "new", "yourself"],
  1465. referencedClasses: ["Dictionary"]
  1466. }),
  1467. smalltalk.DictionaryTest);
  1468. smalltalk.addMethod(
  1469. smalltalk.method({
  1470. selector: "testAccessing",
  1471. category: 'tests',
  1472. fn: function (){
  1473. var self=this;
  1474. var d;
  1475. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1476. return smalltalk.withContext(function($ctx1) {
  1477. d=_st($Dictionary())._new();
  1478. _st(d)._at_put_("hello","world");
  1479. self._assert_equals_(_st(d)._at_("hello"),"world");
  1480. self._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1481. return smalltalk.withContext(function($ctx2) {
  1482. return nil;
  1483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1484. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1485. return smalltalk.withContext(function($ctx2) {
  1486. return nil;
  1487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1488. self._assert_(_st(d)._includesKey_("hello"));
  1489. self._deny_(_st(d)._includesKey_("foo"));
  1490. _st(d)._at_put_((1),(2));
  1491. self._assert_equals_(_st(d)._at_((1)),(2));
  1492. _st(d)._at_put_((1).__at((3)),(3));
  1493. self._assert_equals_(_st(d)._at_((1).__at((3))),(3));
  1494. self._assert_(_st(d)._includesKey_((1).__at((3))));
  1495. self._deny_(_st(d)._includesKey_((3).__at((1))));
  1496. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1497. args: [],
  1498. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [nil]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  1499. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1500. referencedClasses: ["Dictionary"]
  1501. }),
  1502. smalltalk.DictionaryTest);
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "testAsHashedCollection",
  1506. category: 'tests',
  1507. fn: function (){
  1508. var self=this;
  1509. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1510. return smalltalk.withContext(function($ctx1) {
  1511. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  1512. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  1513. args: [],
  1514. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  1515. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  1516. referencedClasses: ["HashedCollection"]
  1517. }),
  1518. smalltalk.DictionaryTest);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "testDynamicDictionaries",
  1522. category: 'tests',
  1523. fn: function (){
  1524. var self=this;
  1525. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1526. return smalltalk.withContext(function($ctx1) {
  1527. self._assert_equals_(_st(smalltalk.HashedCollection._from_(["hello".__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1529. args: [],
  1530. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1531. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1532. referencedClasses: ["Dictionary"]
  1533. }),
  1534. smalltalk.DictionaryTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testEquality",
  1538. category: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var d1,d2;
  1542. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1543. return smalltalk.withContext(function($ctx1) {
  1544. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1545. self._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1546. $1=_st($Dictionary())._new();
  1547. _st($1)._at_put_((1),(2));
  1548. $2=_st($1)._yourself();
  1549. d1=$2;
  1550. $3=_st($Dictionary())._new();
  1551. _st($3)._at_put_((1),(2));
  1552. $4=_st($3)._yourself();
  1553. d2=$4;
  1554. self._assert_(_st(d1).__eq(d2));
  1555. $5=_st($Dictionary())._new();
  1556. _st($5)._at_put_((1),(3));
  1557. $6=_st($5)._yourself();
  1558. d2=$6;
  1559. self._deny_(_st(d1).__eq(d2));
  1560. $7=_st($Dictionary())._new();
  1561. _st($7)._at_put_((2),(2));
  1562. $8=_st($7)._yourself();
  1563. d2=$8;
  1564. self._deny_(_st(d1).__eq(d2));
  1565. $9=_st($Dictionary())._new();
  1566. _st($9)._at_put_((1),(2));
  1567. _st($9)._at_put_((3),(4));
  1568. $10=_st($9)._yourself();
  1569. d2=$10;
  1570. self._deny_(_st(d1).__eq(d2));
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1572. args: [],
  1573. 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.",
  1574. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1575. referencedClasses: ["Dictionary"]
  1576. }),
  1577. smalltalk.DictionaryTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testIfAbsent",
  1581. category: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var d,visited;
  1585. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1586. return smalltalk.withContext(function($ctx1) {
  1587. visited=false;
  1588. d=_st($Dictionary())._new();
  1589. _st(d)._at_ifAbsent_("hello",(function(){
  1590. return smalltalk.withContext(function($ctx2) {
  1591. visited=true;
  1592. return visited;
  1593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1594. self._assert_(visited);
  1595. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1596. args: [],
  1597. 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.",
  1598. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1599. referencedClasses: ["Dictionary"]
  1600. }),
  1601. smalltalk.DictionaryTest);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "testIfPresent",
  1605. category: 'tests',
  1606. fn: function (){
  1607. var self=this;
  1608. var d,visited,absent;
  1609. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1610. return smalltalk.withContext(function($ctx1) {
  1611. visited=false;
  1612. d=_st($Dictionary())._new();
  1613. _st(d)._at_put_("hello","world");
  1614. _st(d)._at_ifPresent_("hello",(function(value){
  1615. return smalltalk.withContext(function($ctx2) {
  1616. visited=value;
  1617. return visited;
  1618. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1619. self._assert_equals_(visited,"world");
  1620. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. visited=value;
  1623. return visited;
  1624. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1625. self._assert_(_st(absent)._isNil());
  1626. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1627. args: [],
  1628. 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 equals: 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  1629. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  1630. referencedClasses: ["Dictionary"]
  1631. }),
  1632. smalltalk.DictionaryTest);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "testIfPresentIfAbsent",
  1636. category: 'tests',
  1637. fn: function (){
  1638. var self=this;
  1639. var d,visited;
  1640. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1641. return smalltalk.withContext(function($ctx1) {
  1642. visited=false;
  1643. d=_st($Dictionary())._new();
  1644. _st(d)._at_put_("hello","world");
  1645. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1646. return smalltalk.withContext(function($ctx2) {
  1647. visited=value;
  1648. return visited;
  1649. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1650. return smalltalk.withContext(function($ctx2) {
  1651. visited=true;
  1652. return visited;
  1653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1654. self._assert_equals_(visited,"world");
  1655. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1656. return smalltalk.withContext(function($ctx2) {
  1657. visited=value;
  1658. return visited;
  1659. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1660. return smalltalk.withContext(function($ctx2) {
  1661. visited=true;
  1662. return visited;
  1663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1664. self._assert_(visited);
  1665. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1666. args: [],
  1667. 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 equals: 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1668. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  1669. referencedClasses: ["Dictionary"]
  1670. }),
  1671. smalltalk.DictionaryTest);
  1672. smalltalk.addMethod(
  1673. smalltalk.method({
  1674. selector: "testKeys",
  1675. category: 'tests',
  1676. fn: function (){
  1677. var self=this;
  1678. var d;
  1679. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1680. return smalltalk.withContext(function($ctx1) {
  1681. d=_st($Dictionary())._new();
  1682. _st(d)._at_put_((1),(2));
  1683. _st(d)._at_put_((2),(3));
  1684. _st(d)._at_put_((3),(4));
  1685. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1686. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1687. args: [],
  1688. 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 equals: #(1 2 3)",
  1689. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  1690. referencedClasses: ["Dictionary"]
  1691. }),
  1692. smalltalk.DictionaryTest);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "testPointKey",
  1696. category: 'tests',
  1697. fn: function (){
  1698. var self=this;
  1699. var d;
  1700. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1701. return smalltalk.withContext(function($ctx1) {
  1702. d=_st($Dictionary())._new();
  1703. _st(d)._at_put_((1).__at((1)),"foo");
  1704. self._assert_equals_(_st(d)._at_((1).__at((1))),"foo");
  1705. _st(d)._at_put_((1).__at((1)),"bar");
  1706. self._assert_equals_(_st(d)._at_((1).__at((1))),"bar");
  1707. _st(d)._removeKey_((1).__at((1)));
  1708. self._assert_equals_(_st(d)._at_ifAbsent_((1).__at((1)),(function(){
  1709. return smalltalk.withContext(function($ctx2) {
  1710. return "baz";
  1711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1712. self._deny_(_st(d)._includesKey_((1).__at((1))));
  1713. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1714. args: [],
  1715. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  1716. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  1717. referencedClasses: ["Dictionary"]
  1718. }),
  1719. smalltalk.DictionaryTest);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "testPrintString",
  1723. category: 'tests',
  1724. fn: function (){
  1725. var self=this;
  1726. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1727. return smalltalk.withContext(function($ctx1) {
  1728. var $1,$2;
  1729. $1=_st($Dictionary())._new();
  1730. _st($1)._at_put_("firstname","James");
  1731. _st($1)._at_put_("lastname","Bond");
  1732. $2=_st($1)._printString();
  1733. self._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1735. args: [],
  1736. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  1737. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1738. referencedClasses: ["Dictionary"]
  1739. }),
  1740. smalltalk.DictionaryTest);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "testRemoveKey",
  1744. category: 'tests',
  1745. fn: function (){
  1746. var self=this;
  1747. var d,key;
  1748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. d=_st($Dictionary())._new();
  1751. _st(d)._at_put_((1),(2));
  1752. _st(d)._at_put_((2),(3));
  1753. _st(d)._at_put_((3),(4));
  1754. key=(2);
  1755. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1756. _st(d)._removeKey_(key);
  1757. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1758. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  1759. self._deny_(_st(d)._includesKey_((2)));
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1761. args: [],
  1762. source: "testRemoveKey\x0a\x09| d key |\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\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  1763. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1764. referencedClasses: ["Dictionary"]
  1765. }),
  1766. smalltalk.DictionaryTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testRemoveKeyIfAbsent",
  1770. category: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. var d,key;
  1774. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1775. return smalltalk.withContext(function($ctx1) {
  1776. d=_st($Dictionary())._new();
  1777. _st(d)._at_put_((1),(2));
  1778. _st(d)._at_put_((2),(3));
  1779. _st(d)._at_put_((3),(4));
  1780. key=(2);
  1781. self._assert_equals_(_st(d)._removeKey_(key),(3));
  1782. key=(3);
  1783. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1784. return smalltalk.withContext(function($ctx2) {
  1785. return (42);
  1786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1787. key="why";
  1788. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return (42);
  1791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1792. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1793. args: [],
  1794. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\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\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [42]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [42] ) equals: 42.",
  1795. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  1796. referencedClasses: ["Dictionary"]
  1797. }),
  1798. smalltalk.DictionaryTest);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "testSize",
  1802. category: 'tests',
  1803. fn: function (){
  1804. var self=this;
  1805. var d;
  1806. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1807. return smalltalk.withContext(function($ctx1) {
  1808. d=_st($Dictionary())._new();
  1809. self._assert_equals_(_st(d)._size(),(0));
  1810. _st(d)._at_put_((1),(2));
  1811. self._assert_equals_(_st(d)._size(),(1));
  1812. _st(d)._at_put_((2),(3));
  1813. self._assert_equals_(_st(d)._size(),(2));
  1814. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1815. args: [],
  1816. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size equals: 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size equals: 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size equals: 2.",
  1817. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  1818. referencedClasses: ["Dictionary"]
  1819. }),
  1820. smalltalk.DictionaryTest);
  1821. smalltalk.addMethod(
  1822. smalltalk.method({
  1823. selector: "testValues",
  1824. category: 'tests',
  1825. fn: function (){
  1826. var self=this;
  1827. var d;
  1828. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1829. return smalltalk.withContext(function($ctx1) {
  1830. d=_st($Dictionary())._new();
  1831. _st(d)._at_put_((1),(2));
  1832. _st(d)._at_put_((2),(3));
  1833. _st(d)._at_put_((3),(4));
  1834. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1835. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1836. args: [],
  1837. 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 equals: #(2 3 4)",
  1838. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  1839. referencedClasses: ["Dictionary"]
  1840. }),
  1841. smalltalk.DictionaryTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "collectionClass",
  1845. category: 'accessing',
  1846. fn: function (){
  1847. var self=this;
  1848. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1849. return smalltalk.withContext(function($ctx1) {
  1850. var $1;
  1851. $1=$Dictionary();
  1852. return $1;
  1853. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1854. args: [],
  1855. source: "collectionClass\x0a\x09^ Dictionary",
  1856. messageSends: [],
  1857. referencedClasses: ["Dictionary"]
  1858. }),
  1859. smalltalk.DictionaryTest.klass);
  1860. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1861. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "testAtIfAbsent",
  1865. category: 'tests',
  1866. fn: function (){
  1867. var self=this;
  1868. var array;
  1869. return smalltalk.withContext(function($ctx1) {
  1870. array=["hello", "world"];
  1871. self._assert_equals_(_st(array)._at_((1)),"hello");
  1872. self._assert_equals_(_st(array)._at_((2)),"world");
  1873. self._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1874. return smalltalk.withContext(function($ctx2) {
  1875. return "not found";
  1876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1877. self._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return "not found";
  1880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1881. self._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1882. return smalltalk.withContext(function($ctx2) {
  1883. return "not found";
  1884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1885. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1886. return smalltalk.withContext(function($ctx2) {
  1887. return "not found";
  1888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1890. args: [],
  1891. 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'.",
  1892. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1893. referencedClasses: []
  1894. }),
  1895. smalltalk.ArrayTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testFirstN",
  1899. category: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. return smalltalk.withContext(function($ctx1) {
  1903. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1904. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1905. args: [],
  1906. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  1907. messageSends: ["assert:equals:", "first:"],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.ArrayTest);
  1911. smalltalk.addMethod(
  1912. smalltalk.method({
  1913. selector: "testIfEmpty",
  1914. category: 'tests',
  1915. fn: function (){
  1916. var self=this;
  1917. return smalltalk.withContext(function($ctx1) {
  1918. self._assert_equals_(""._ifEmpty_((function(){
  1919. return smalltalk.withContext(function($ctx2) {
  1920. return "zork";
  1921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1922. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1923. args: [],
  1924. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  1925. messageSends: ["assert:equals:", "ifEmpty:"],
  1926. referencedClasses: []
  1927. }),
  1928. smalltalk.ArrayTest);
  1929. smalltalk.addMethod(
  1930. smalltalk.method({
  1931. selector: "testPrintString",
  1932. category: 'tests',
  1933. fn: function (){
  1934. var self=this;
  1935. var array;
  1936. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1937. return smalltalk.withContext(function($ctx1) {
  1938. var $1,$2,$3,$4;
  1939. array=_st($Array())._new();
  1940. self._assert_equals_(_st(array)._printString(),"an Array ()");
  1941. $1=array;
  1942. _st($1)._add_((1));
  1943. $2=_st($1)._add_((3));
  1944. self._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1945. _st(array)._add_("foo");
  1946. self._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1947. $3=array;
  1948. _st($3)._remove_((1));
  1949. $4=_st($3)._remove_((3));
  1950. self._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1951. _st(array)._addLast_((3));
  1952. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1953. _st(array)._addLast_((3));
  1954. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1955. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1956. args: [],
  1957. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  1958. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1959. referencedClasses: ["Array"]
  1960. }),
  1961. smalltalk.ArrayTest);
  1962. smalltalk.addMethod(
  1963. smalltalk.method({
  1964. selector: "testRemoveFromTo",
  1965. category: 'tests',
  1966. fn: function (){
  1967. var self=this;
  1968. return smalltalk.withContext(function($ctx1) {
  1969. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((1),(3)),[(4)]);
  1970. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(3)),[(1), (4)]);
  1971. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  1972. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  1973. args: [],
  1974. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  1975. messageSends: ["assert:equals:", "removeFrom:to:"],
  1976. referencedClasses: []
  1977. }),
  1978. smalltalk.ArrayTest);
  1979. smalltalk.addMethod(
  1980. smalltalk.method({
  1981. selector: "testRemoveIndex",
  1982. category: 'tests',
  1983. fn: function (){
  1984. var self=this;
  1985. return smalltalk.withContext(function($ctx1) {
  1986. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((2)),[(1), (3), (4)]);
  1987. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((1)),[(2), (3), (4)]);
  1988. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  1989. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  1990. args: [],
  1991. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  1992. messageSends: ["assert:equals:", "removeIndex:"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.ArrayTest);
  1996. smalltalk.addMethod(
  1997. smalltalk.method({
  1998. selector: "collectionClass",
  1999. category: 'accessing',
  2000. fn: function (){
  2001. var self=this;
  2002. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2003. return smalltalk.withContext(function($ctx1) {
  2004. var $1;
  2005. $1=$Array();
  2006. return $1;
  2007. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2008. args: [],
  2009. source: "collectionClass\x0a\x09^ Array",
  2010. messageSends: [],
  2011. referencedClasses: ["Array"]
  2012. }),
  2013. smalltalk.ArrayTest.klass);
  2014. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "collection",
  2018. category: 'accessing',
  2019. fn: function (){
  2020. var self=this;
  2021. return smalltalk.withContext(function($ctx1) {
  2022. return "hello";
  2023. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2024. args: [],
  2025. source: "collection\x0a\x09^'hello'",
  2026. messageSends: [],
  2027. referencedClasses: []
  2028. }),
  2029. smalltalk.StringTest);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "collectionWithDuplicates",
  2033. category: 'accessing',
  2034. fn: function (){
  2035. var self=this;
  2036. return smalltalk.withContext(function($ctx1) {
  2037. return "abbaerte";
  2038. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2039. args: [],
  2040. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2041. messageSends: [],
  2042. referencedClasses: []
  2043. }),
  2044. smalltalk.StringTest);
  2045. smalltalk.addMethod(
  2046. smalltalk.method({
  2047. selector: "testAddRemove",
  2048. category: 'tests',
  2049. fn: function (){
  2050. var self=this;
  2051. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2052. return smalltalk.withContext(function($ctx1) {
  2053. self._should_raise_((function(){
  2054. return smalltalk.withContext(function($ctx2) {
  2055. return "hello"._add_("a");
  2056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2057. self._should_raise_((function(){
  2058. return smalltalk.withContext(function($ctx2) {
  2059. return "hello"._remove_("h");
  2060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2061. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2062. args: [],
  2063. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2064. messageSends: ["should:raise:", "add:", "remove:"],
  2065. referencedClasses: ["Error"]
  2066. }),
  2067. smalltalk.StringTest);
  2068. smalltalk.addMethod(
  2069. smalltalk.method({
  2070. selector: "testAsArray",
  2071. category: 'tests',
  2072. fn: function (){
  2073. var self=this;
  2074. return smalltalk.withContext(function($ctx1) {
  2075. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2076. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2077. args: [],
  2078. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2079. messageSends: ["assert:equals:", "asArray"],
  2080. referencedClasses: []
  2081. }),
  2082. smalltalk.StringTest);
  2083. smalltalk.addMethod(
  2084. smalltalk.method({
  2085. selector: "testAt",
  2086. category: 'tests',
  2087. fn: function (){
  2088. var self=this;
  2089. return smalltalk.withContext(function($ctx1) {
  2090. self._assert_equals_("hello"._at_((1)),"h");
  2091. self._assert_equals_("hello"._at_((5)),"o");
  2092. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2093. return smalltalk.withContext(function($ctx2) {
  2094. return nil;
  2095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2096. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2097. args: [],
  2098. source: "testAt\x0a\x09self assert: ('hello' at: 1) equals: 'h'.\x0a\x09self assert: ('hello' at: 5) equals: 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [nil]) equals: nil",
  2099. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2100. referencedClasses: []
  2101. }),
  2102. smalltalk.StringTest);
  2103. smalltalk.addMethod(
  2104. smalltalk.method({
  2105. selector: "testAtPut",
  2106. category: 'tests',
  2107. fn: function (){
  2108. var self=this;
  2109. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2110. return smalltalk.withContext(function($ctx1) {
  2111. self._should_raise_((function(){
  2112. return smalltalk.withContext(function($ctx2) {
  2113. return "hello"._at_put_((1),"a");
  2114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2115. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2116. args: [],
  2117. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2118. messageSends: ["should:raise:", "at:put:"],
  2119. referencedClasses: ["Error"]
  2120. }),
  2121. smalltalk.StringTest);
  2122. smalltalk.addMethod(
  2123. smalltalk.method({
  2124. selector: "testCollect",
  2125. category: 'tests',
  2126. fn: function (){
  2127. var self=this;
  2128. var newCollection;
  2129. return smalltalk.withContext(function($ctx1) {
  2130. newCollection="hheelllloo";
  2131. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  2132. return smalltalk.withContext(function($ctx2) {
  2133. return _st(each).__comma(each);
  2134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2135. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  2136. args: [],
  2137. 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",
  2138. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2139. referencedClasses: []
  2140. }),
  2141. smalltalk.StringTest);
  2142. smalltalk.addMethod(
  2143. smalltalk.method({
  2144. selector: "testCopyWithoutAll",
  2145. category: 'tests',
  2146. fn: function (){
  2147. var self=this;
  2148. return smalltalk.withContext(function($ctx1) {
  2149. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  2150. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  2151. args: [],
  2152. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  2153. messageSends: ["assert:equals:", "copyWithoutAll:"],
  2154. referencedClasses: []
  2155. }),
  2156. smalltalk.StringTest);
  2157. smalltalk.addMethod(
  2158. smalltalk.method({
  2159. selector: "testDetect",
  2160. category: 'tests',
  2161. fn: function (){
  2162. var self=this;
  2163. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2164. return smalltalk.withContext(function($ctx1) {
  2165. self._assert_equals_(_st(self._collection())._detect_((function(each){
  2166. return smalltalk.withContext(function($ctx2) {
  2167. return _st(each).__eq("h");
  2168. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  2169. self._should_raise_((function(){
  2170. return smalltalk.withContext(function($ctx2) {
  2171. return _st(self._collection())._detect_((function(each){
  2172. return smalltalk.withContext(function($ctx3) {
  2173. return _st(each).__eq((6));
  2174. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  2175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2176. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  2177. args: [],
  2178. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  2179. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  2180. referencedClasses: ["Error"]
  2181. }),
  2182. smalltalk.StringTest);
  2183. smalltalk.addMethod(
  2184. smalltalk.method({
  2185. selector: "testEquality",
  2186. category: 'tests',
  2187. fn: function (){
  2188. var self=this;
  2189. return smalltalk.withContext(function($ctx1) {
  2190. self._assert_equals_("hello","hello");
  2191. self._deny_("hello".__eq("world"));
  2192. self._deny_("hello".__eq([]._at_ifAbsent_((1),(function(){
  2193. return smalltalk.withContext(function($ctx2) {
  2194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))));
  2195. self._assert_equals_("hello","hello"._yourself());
  2196. self._assert_equals_("hello"._yourself(),"hello");
  2197. self._deny_("".__eq((0)));
  2198. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  2199. args: [],
  2200. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  2201. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  2202. referencedClasses: []
  2203. }),
  2204. smalltalk.StringTest);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "testIdentity",
  2208. category: 'tests',
  2209. fn: function (){
  2210. var self=this;
  2211. return smalltalk.withContext(function($ctx1) {
  2212. self._assert_("hello".__eq_eq("hello"));
  2213. self._deny_("hello".__eq_eq("world"));
  2214. self._assert_("hello".__eq_eq("hello"._yourself()));
  2215. self._assert_(_st("hello"._yourself()).__eq_eq("hello"));
  2216. self._deny_("".__eq_eq((0)));
  2217. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  2218. args: [],
  2219. 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",
  2220. messageSends: ["assert:", "==", "deny:", "yourself"],
  2221. referencedClasses: []
  2222. }),
  2223. smalltalk.StringTest);
  2224. smalltalk.addMethod(
  2225. smalltalk.method({
  2226. selector: "testIncludesSubString",
  2227. category: 'tests',
  2228. fn: function (){
  2229. var self=this;
  2230. return smalltalk.withContext(function($ctx1) {
  2231. self._assert_("amber"._includesSubString_("ber"));
  2232. self._deny_("amber"._includesSubString_("zork"));
  2233. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  2234. args: [],
  2235. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2236. messageSends: ["assert:", "includesSubString:", "deny:"],
  2237. referencedClasses: []
  2238. }),
  2239. smalltalk.StringTest);
  2240. smalltalk.addMethod(
  2241. smalltalk.method({
  2242. selector: "testIndexOf",
  2243. category: 'tests',
  2244. fn: function (){
  2245. var self=this;
  2246. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2247. return smalltalk.withContext(function($ctx1) {
  2248. self._assert_equals_(_st(self._collection())._indexOf_("e"),(2));
  2249. self._should_raise_((function(){
  2250. return smalltalk.withContext(function($ctx2) {
  2251. return _st(self._collection())._indexOf_((999));
  2252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2253. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  2254. return smalltalk.withContext(function($ctx2) {
  2255. return "sentinel";
  2256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  2257. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  2258. args: [],
  2259. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 'e') equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  2260. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2261. referencedClasses: ["Error"]
  2262. }),
  2263. smalltalk.StringTest);
  2264. smalltalk.addMethod(
  2265. smalltalk.method({
  2266. selector: "testJoin",
  2267. category: 'tests',
  2268. fn: function (){
  2269. var self=this;
  2270. return smalltalk.withContext(function($ctx1) {
  2271. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  2272. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  2273. args: [],
  2274. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2275. messageSends: ["assert:equals:", "join:"],
  2276. referencedClasses: []
  2277. }),
  2278. smalltalk.StringTest);
  2279. smalltalk.addMethod(
  2280. smalltalk.method({
  2281. selector: "testSelect",
  2282. category: 'tests',
  2283. fn: function (){
  2284. var self=this;
  2285. var newCollection;
  2286. return smalltalk.withContext(function($ctx1) {
  2287. newCollection="o";
  2288. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. return _st(each).__eq("o");
  2291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2292. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  2293. args: [],
  2294. 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",
  2295. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2296. referencedClasses: []
  2297. }),
  2298. smalltalk.StringTest);
  2299. smalltalk.addMethod(
  2300. smalltalk.method({
  2301. selector: "testSize",
  2302. category: 'tests',
  2303. fn: function (){
  2304. var self=this;
  2305. return smalltalk.withContext(function($ctx1) {
  2306. self._assert_equals_("smalltalk"._size(),(9));
  2307. self._assert_equals_(""._size(),(0));
  2308. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  2309. args: [],
  2310. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2311. messageSends: ["assert:equals:", "size"],
  2312. referencedClasses: []
  2313. }),
  2314. smalltalk.StringTest);
  2315. smalltalk.addMethod(
  2316. smalltalk.method({
  2317. selector: "testStreamContents",
  2318. category: 'tests',
  2319. fn: function (){
  2320. var self=this;
  2321. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2322. return smalltalk.withContext(function($ctx1) {
  2323. var $1,$2;
  2324. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. $1=aStream;
  2327. _st($1)._nextPutAll_("hello");
  2328. _st($1)._space();
  2329. $2=_st($1)._nextPutAll_("world");
  2330. return $2;
  2331. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  2332. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  2333. args: [],
  2334. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  2335. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2336. referencedClasses: ["String"]
  2337. }),
  2338. smalltalk.StringTest);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "collectionClass",
  2342. category: 'accessing',
  2343. fn: function (){
  2344. var self=this;
  2345. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2346. return smalltalk.withContext(function($ctx1) {
  2347. var $1;
  2348. $1=$String();
  2349. return $1;
  2350. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  2351. args: [],
  2352. source: "collectionClass\x0a\x09^ String",
  2353. messageSends: [],
  2354. referencedClasses: ["String"]
  2355. }),
  2356. smalltalk.StringTest.klass);
  2357. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2358. smalltalk.addMethod(
  2359. smalltalk.method({
  2360. selector: "testShow",
  2361. category: 'tests',
  2362. fn: function (){
  2363. var self=this;
  2364. var originalTranscript;
  2365. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2366. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  2367. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2368. return smalltalk.withContext(function($ctx1) {
  2369. originalTranscript=_st($Transcript())._current();
  2370. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  2371. self._shouldnt_raise_((function(){
  2372. return smalltalk.withContext(function($ctx2) {
  2373. return _st($Transcript())._show_("Hello console!");
  2374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2375. self._shouldnt_raise_((function(){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. return _st($Transcript())._show_(console);
  2378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2379. _st($Transcript())._register_(originalTranscript);
  2380. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  2381. args: [],
  2382. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  2383. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  2384. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  2385. }),
  2386. smalltalk.ConsoleTranscriptTest);
  2387. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2388. smalltalk.addMethod(
  2389. smalltalk.method({
  2390. selector: "jsObject",
  2391. category: 'accessing',
  2392. fn: function (){
  2393. var self=this;
  2394. return smalltalk.withContext(function($ctx1) {
  2395. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2396. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  2397. args: [],
  2398. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2399. messageSends: [],
  2400. referencedClasses: []
  2401. }),
  2402. smalltalk.JSObjectProxyTest);
  2403. smalltalk.addMethod(
  2404. smalltalk.method({
  2405. selector: "testAtIfAbsent",
  2406. category: 'tests',
  2407. fn: function (){
  2408. var self=this;
  2409. var testObject;
  2410. return smalltalk.withContext(function($ctx1) {
  2411. testObject=self._jsObject();
  2412. self._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. return "Property does not exist";
  2415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  2416. self._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2417. return smalltalk.withContext(function($ctx2) {
  2418. return "Property does not exist";
  2419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2420. self._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2421. return smalltalk.withContext(function($ctx2) {
  2422. return "Property does not exist";
  2423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  2424. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2425. return smalltalk.withContext(function($ctx2) {
  2426. return "Property does not exist";
  2427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2428. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2429. args: [],
  2430. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: ['Property does not exist']) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: ['Property does not exist']) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: ['Property does not exist']) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: ['Property does not exist']) equals: nil.",
  2431. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2432. referencedClasses: []
  2433. }),
  2434. smalltalk.JSObjectProxyTest);
  2435. smalltalk.addMethod(
  2436. smalltalk.method({
  2437. selector: "testAtIfPresent",
  2438. category: 'tests',
  2439. fn: function (){
  2440. var self=this;
  2441. var testObject;
  2442. return smalltalk.withContext(function($ctx1) {
  2443. testObject=self._jsObject();
  2444. self._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  2445. return smalltalk.withContext(function($ctx2) {
  2446. return "hello ".__comma(_st(x)._asString());
  2447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),nil);
  2448. self._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return "hello ".__comma(_st(x)._asString());
  2451. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2452. self._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  2453. return smalltalk.withContext(function($ctx2) {
  2454. return "hello ".__comma(_st(x)._asString());
  2455. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello 1");
  2456. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  2457. return smalltalk.withContext(function($ctx2) {
  2458. return "hello ".__comma(_st(x)._asString());
  2459. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2460. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2461. args: [],
  2462. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [:x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [:x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [:x | 'hello ',x asString ]) equals: 'hello nil'.",
  2463. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  2464. referencedClasses: []
  2465. }),
  2466. smalltalk.JSObjectProxyTest);
  2467. smalltalk.addMethod(
  2468. smalltalk.method({
  2469. selector: "testAtIfPresentIfAbsent",
  2470. category: 'tests',
  2471. fn: function (){
  2472. var self=this;
  2473. var testObject;
  2474. return smalltalk.withContext(function($ctx1) {
  2475. testObject=self._jsObject();
  2476. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  2477. return smalltalk.withContext(function($ctx2) {
  2478. return "hello ".__comma(_st(x)._asString());
  2479. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2480. return smalltalk.withContext(function($ctx2) {
  2481. return "not present";
  2482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not present");
  2483. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  2484. return smalltalk.withContext(function($ctx2) {
  2485. return "hello ".__comma(_st(x)._asString());
  2486. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return "not present";
  2489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2490. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  2491. return smalltalk.withContext(function($ctx2) {
  2492. return "hello ".__comma(_st(x)._asString());
  2493. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2494. return smalltalk.withContext(function($ctx2) {
  2495. return "not present";
  2496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello 1");
  2497. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  2498. return smalltalk.withContext(function($ctx2) {
  2499. return "hello ".__comma(_st(x)._asString());
  2500. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2501. return smalltalk.withContext(function($ctx2) {
  2502. return "not present";
  2503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2504. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2505. args: [],
  2506. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'hello nil'.",
  2507. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  2508. referencedClasses: []
  2509. }),
  2510. smalltalk.JSObjectProxyTest);
  2511. smalltalk.addMethod(
  2512. smalltalk.method({
  2513. selector: "testDNU",
  2514. category: 'tests',
  2515. fn: function (){
  2516. var self=this;
  2517. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2518. return smalltalk.withContext(function($ctx1) {
  2519. self._should_raise_((function(){
  2520. return smalltalk.withContext(function($ctx2) {
  2521. return _st(self._jsObject())._foo();
  2522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2523. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  2524. args: [],
  2525. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2526. messageSends: ["should:raise:", "foo", "jsObject"],
  2527. referencedClasses: ["MessageNotUnderstood"]
  2528. }),
  2529. smalltalk.JSObjectProxyTest);
  2530. smalltalk.addMethod(
  2531. smalltalk.method({
  2532. selector: "testMessageSend",
  2533. category: 'tests',
  2534. fn: function (){
  2535. var self=this;
  2536. return smalltalk.withContext(function($ctx1) {
  2537. self._assert_equals_(_st(self._jsObject())._a(),(1));
  2538. self._assert_equals_(_st(self._jsObject())._b(),(2));
  2539. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  2541. args: [],
  2542. 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",
  2543. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.JSObjectProxyTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testMethodWithArguments",
  2550. category: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. return smalltalk.withContext(function($ctx1) {
  2554. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  2555. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  2556. args: [],
  2557. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2558. messageSends: ["assert:equals:", "c:", "jsObject"],
  2559. referencedClasses: []
  2560. }),
  2561. smalltalk.JSObjectProxyTest);
  2562. smalltalk.addMethod(
  2563. smalltalk.method({
  2564. selector: "testPrinting",
  2565. category: 'tests',
  2566. fn: function (){
  2567. var self=this;
  2568. return smalltalk.withContext(function($ctx1) {
  2569. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  2570. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  2571. args: [],
  2572. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2573. messageSends: ["assert:equals:", "printString", "jsObject"],
  2574. referencedClasses: []
  2575. }),
  2576. smalltalk.JSObjectProxyTest);
  2577. smalltalk.addMethod(
  2578. smalltalk.method({
  2579. selector: "testPropertyThatReturnsEmptyString",
  2580. category: 'tests',
  2581. fn: function (){
  2582. var self=this;
  2583. var object;
  2584. return smalltalk.withContext(function($ctx1) {
  2585. object=self._jsObject();
  2586. self._assert_equals_(_st(object)._d(),"");
  2587. _st(object)._d_("hello");
  2588. self._assert_equals_(_st(object)._d(),"hello");
  2589. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  2590. args: [],
  2591. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  2592. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2593. referencedClasses: []
  2594. }),
  2595. smalltalk.JSObjectProxyTest);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "testPropertyThatReturnsUndefined",
  2599. category: 'tests',
  2600. fn: function (){
  2601. var self=this;
  2602. var object;
  2603. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2604. return smalltalk.withContext(function($ctx1) {
  2605. object=self._jsObject();
  2606. self._shouldnt_raise_((function(){
  2607. return smalltalk.withContext(function($ctx2) {
  2608. return _st(object)._e();
  2609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2610. self._assert_(_st(_st(object)._e())._isNil());
  2611. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2612. args: [],
  2613. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  2614. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2615. referencedClasses: ["MessageNotUnderstood"]
  2616. }),
  2617. smalltalk.JSObjectProxyTest);
  2618. smalltalk.addMethod(
  2619. smalltalk.method({
  2620. selector: "testValue",
  2621. category: 'tests',
  2622. fn: function (){
  2623. var self=this;
  2624. var testObject;
  2625. return smalltalk.withContext(function($ctx1) {
  2626. testObject=self._jsObject();
  2627. self._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2628. _st(testObject)._at_put_("value","aValue");
  2629. self._assert_equals_(_st(testObject)._value(),"aValue");
  2630. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2631. args: [],
  2632. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: testObject value printString equals: '[object Object]'.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  2633. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2634. referencedClasses: []
  2635. }),
  2636. smalltalk.JSObjectProxyTest);
  2637. smalltalk.addMethod(
  2638. smalltalk.method({
  2639. selector: "testYourself",
  2640. category: 'tests',
  2641. fn: function (){
  2642. var self=this;
  2643. var object;
  2644. return smalltalk.withContext(function($ctx1) {
  2645. var $1,$2;
  2646. $1=self._jsObject();
  2647. _st($1)._d_("test");
  2648. $2=_st($1)._yourself();
  2649. object=$2;
  2650. self._assert_equals_(_st(object)._d(),"test");
  2651. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2652. args: [],
  2653. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2654. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.JSObjectProxyTest);
  2658. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "testCatchingException",
  2662. category: 'tests',
  2663. fn: function (){
  2664. var self=this;
  2665. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2666. return smalltalk.withContext(function($ctx1) {
  2667. _st((function(){
  2668. return smalltalk.withContext(function($ctx2) {
  2669. return self._throwException();
  2670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  2671. return smalltalk.withContext(function($ctx2) {
  2672. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  2673. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2674. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2675. args: [],
  2676. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2677. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2678. referencedClasses: ["Error"]
  2679. }),
  2680. smalltalk.JavaScriptExceptionTest);
  2681. smalltalk.addMethod(
  2682. smalltalk.method({
  2683. selector: "testRaisingException",
  2684. category: 'tests',
  2685. fn: function (){
  2686. var self=this;
  2687. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2688. return smalltalk.withContext(function($ctx1) {
  2689. self._should_raise_((function(){
  2690. return smalltalk.withContext(function($ctx2) {
  2691. return self._throwException();
  2692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$JavaScriptException());
  2693. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2694. args: [],
  2695. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2696. messageSends: ["should:raise:", "throwException"],
  2697. referencedClasses: ["JavaScriptException"]
  2698. }),
  2699. smalltalk.JavaScriptExceptionTest);
  2700. smalltalk.addMethod(
  2701. smalltalk.method({
  2702. selector: "throwException",
  2703. category: 'helpers',
  2704. fn: function (){
  2705. var self=this;
  2706. return smalltalk.withContext(function($ctx1) {
  2707. throw 'test';
  2708. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2709. args: [],
  2710. source: "throwException\x0a\x09<throw 'test'>",
  2711. messageSends: [],
  2712. referencedClasses: []
  2713. }),
  2714. smalltalk.JavaScriptExceptionTest);
  2715. smalltalk.addClass('LegacyPackageHandlerTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2716. smalltalk.addMethod(
  2717. smalltalk.method({
  2718. selector: "setUp",
  2719. category: 'running',
  2720. fn: function (){
  2721. var self=this;
  2722. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2723. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2724. return smalltalk.withContext(function($ctx1) {
  2725. var $1,$2;
  2726. self["@backUpCommitPathJs"]=_st($LegacyPackageHandler())._defaultCommitPathJs();
  2727. self["@backUpCommitPathSt"]=_st($LegacyPackageHandler())._defaultCommitPathSt();
  2728. _st($LegacyPackageHandler())._resetCommitPaths();
  2729. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2730. $1=_st($Package())._new();
  2731. _st($1)._name_("Grul");
  2732. _st($1)._commitPathJs_("server/grul/js");
  2733. _st($1)._commitPathSt_("grul/st");
  2734. $2=_st($1)._yourself();
  2735. self["@grulPackage"]=$2;
  2736. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTest)})},
  2737. args: [],
  2738. source: "setUp\x0a\x09backUpCommitPathJs := LegacyPackageHandler defaultCommitPathJs.\x0a\x09backUpCommitPathSt := LegacyPackageHandler defaultCommitPathSt.\x0a\x0a\x09LegacyPackageHandler 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",
  2739. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  2740. referencedClasses: ["LegacyPackageHandler", "Package"]
  2741. }),
  2742. smalltalk.LegacyPackageHandlerTest);
  2743. smalltalk.addMethod(
  2744. smalltalk.method({
  2745. selector: "tearDown",
  2746. category: 'running',
  2747. fn: function (){
  2748. var self=this;
  2749. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2750. return smalltalk.withContext(function($ctx1) {
  2751. var $1,$2;
  2752. $1=$LegacyPackageHandler();
  2753. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2754. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2755. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.LegacyPackageHandlerTest)})},
  2756. args: [],
  2757. source: "tearDown\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  2758. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  2759. referencedClasses: ["LegacyPackageHandler"]
  2760. }),
  2761. smalltalk.LegacyPackageHandlerTest);
  2762. smalltalk.addMethod(
  2763. smalltalk.method({
  2764. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2765. category: 'tests',
  2766. fn: function (){
  2767. var self=this;
  2768. return smalltalk.withContext(function($ctx1) {
  2769. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2770. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2771. args: [],
  2772. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2773. messageSends: ["assert:equals:", "commitPathJs"],
  2774. referencedClasses: []
  2775. }),
  2776. smalltalk.LegacyPackageHandlerTest);
  2777. smalltalk.addMethod(
  2778. smalltalk.method({
  2779. selector: "testGrulCommitPathStShouldBeGrulSt",
  2780. category: 'tests',
  2781. fn: function (){
  2782. var self=this;
  2783. return smalltalk.withContext(function($ctx1) {
  2784. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2785. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2786. args: [],
  2787. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2788. messageSends: ["assert:equals:", "commitPathSt"],
  2789. referencedClasses: []
  2790. }),
  2791. smalltalk.LegacyPackageHandlerTest);
  2792. smalltalk.addMethod(
  2793. smalltalk.method({
  2794. selector: "testZorkCommitPathJsShouldBeJs",
  2795. category: 'tests',
  2796. fn: function (){
  2797. var self=this;
  2798. return smalltalk.withContext(function($ctx1) {
  2799. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2800. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2801. args: [],
  2802. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  2803. messageSends: ["assert:equals:", "commitPathJs"],
  2804. referencedClasses: []
  2805. }),
  2806. smalltalk.LegacyPackageHandlerTest);
  2807. smalltalk.addMethod(
  2808. smalltalk.method({
  2809. selector: "testZorkCommitPathStShouldBeSt",
  2810. category: 'tests',
  2811. fn: function (){
  2812. var self=this;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2815. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2816. args: [],
  2817. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  2818. messageSends: ["assert:equals:", "commitPathSt"],
  2819. referencedClasses: []
  2820. }),
  2821. smalltalk.LegacyPackageHandlerTest);
  2822. smalltalk.addClass('LegacyPackageHandlerTestWithDefaultsChanged', smalltalk.LegacyPackageHandlerTest, [], 'Kernel-Tests');
  2823. smalltalk.addMethod(
  2824. smalltalk.method({
  2825. selector: "setUp",
  2826. category: 'running',
  2827. fn: function (){
  2828. var self=this;
  2829. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2830. return smalltalk.withContext(function($ctx1) {
  2831. var $1,$2;
  2832. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.superclass.fn.prototype._setUp.apply(_st(self), []);
  2833. $1=$LegacyPackageHandler();
  2834. _st($1)._defaultCommitPathJs_("javascripts/");
  2835. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2836. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2837. args: [],
  2838. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  2839. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  2840. referencedClasses: ["LegacyPackageHandler"]
  2841. }),
  2842. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2843. smalltalk.addMethod(
  2844. smalltalk.method({
  2845. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2846. category: 'tests',
  2847. fn: function (){
  2848. var self=this;
  2849. return smalltalk.withContext(function($ctx1) {
  2850. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2851. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2852. args: [],
  2853. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2854. messageSends: ["assert:equals:", "commitPathJs"],
  2855. referencedClasses: []
  2856. }),
  2857. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2858. smalltalk.addMethod(
  2859. smalltalk.method({
  2860. selector: "testGrulCommitPathStShouldBeGrulSt",
  2861. category: 'tests',
  2862. fn: function (){
  2863. var self=this;
  2864. return smalltalk.withContext(function($ctx1) {
  2865. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2866. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2867. args: [],
  2868. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2869. messageSends: ["assert:equals:", "commitPathSt"],
  2870. referencedClasses: []
  2871. }),
  2872. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2873. smalltalk.addMethod(
  2874. smalltalk.method({
  2875. selector: "testZorkCommitPathJsShouldBeJavascript",
  2876. category: 'tests',
  2877. fn: function (){
  2878. var self=this;
  2879. return smalltalk.withContext(function($ctx1) {
  2880. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2881. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2882. args: [],
  2883. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  2884. messageSends: ["assert:equals:", "commitPathJs"],
  2885. referencedClasses: []
  2886. }),
  2887. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2888. smalltalk.addMethod(
  2889. smalltalk.method({
  2890. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2891. category: 'tests',
  2892. fn: function (){
  2893. var self=this;
  2894. return smalltalk.withContext(function($ctx1) {
  2895. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2896. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2897. args: [],
  2898. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  2899. messageSends: ["assert:equals:", "commitPathSt"],
  2900. referencedClasses: []
  2901. }),
  2902. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2903. smalltalk.addMethod(
  2904. smalltalk.method({
  2905. selector: "shouldInheritSelectors",
  2906. category: 'accessing',
  2907. fn: function (){
  2908. var self=this;
  2909. return smalltalk.withContext(function($ctx1) {
  2910. return false;
  2911. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass)})},
  2912. args: [],
  2913. source: "shouldInheritSelectors\x0a\x09^ false",
  2914. messageSends: [],
  2915. referencedClasses: []
  2916. }),
  2917. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass);
  2918. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2919. smalltalk.addMethod(
  2920. smalltalk.method({
  2921. selector: "testValue",
  2922. category: 'tests',
  2923. fn: function (){
  2924. var self=this;
  2925. var messageSend;
  2926. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2927. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2928. return smalltalk.withContext(function($ctx1) {
  2929. var $1,$2;
  2930. $1=_st($MessageSend())._new();
  2931. _st($1)._receiver_(_st($Object())._new());
  2932. _st($1)._selector_("asString");
  2933. $2=_st($1)._yourself();
  2934. messageSend=$2;
  2935. self._assert_equals_(_st(messageSend)._value(),"an Object");
  2936. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2937. args: [],
  2938. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  2939. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  2940. referencedClasses: ["Object", "MessageSend"]
  2941. }),
  2942. smalltalk.MessageSendTest);
  2943. smalltalk.addMethod(
  2944. smalltalk.method({
  2945. selector: "testValueWithArguments",
  2946. category: 'tests',
  2947. fn: function (){
  2948. var self=this;
  2949. var messageSend;
  2950. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2951. return smalltalk.withContext(function($ctx1) {
  2952. var $1,$2;
  2953. $1=_st($MessageSend())._new();
  2954. _st($1)._receiver_((2));
  2955. _st($1)._selector_("+");
  2956. $2=_st($1)._yourself();
  2957. messageSend=$2;
  2958. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  2959. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2960. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2961. args: [],
  2962. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  2963. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  2964. referencedClasses: ["MessageSend"]
  2965. }),
  2966. smalltalk.MessageSendTest);
  2967. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "testAbs",
  2971. category: 'tests',
  2972. fn: function (){
  2973. var self=this;
  2974. return smalltalk.withContext(function($ctx1) {
  2975. self._assert_equals_((4)._abs(),(4));
  2976. self._assert_equals_((-4)._abs(),(4));
  2977. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  2978. args: [],
  2979. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  2980. messageSends: ["assert:equals:", "abs"],
  2981. referencedClasses: []
  2982. }),
  2983. smalltalk.NumberTest);
  2984. smalltalk.addMethod(
  2985. smalltalk.method({
  2986. selector: "testArithmetic",
  2987. category: 'tests',
  2988. fn: function (){
  2989. var self=this;
  2990. return smalltalk.withContext(function($ctx1) {
  2991. self._assert_equals_((1.5).__plus((1)),(2.5));
  2992. self._assert_equals_((2).__minus((1)),(1));
  2993. self._assert_equals_((-2).__minus((1)),(-3));
  2994. self._assert_equals_((12).__slash((2)),(6));
  2995. self._assert_equals_((3).__star((4)),(12));
  2996. self._assert_equals_(_st((1).__plus((2))).__star((3)),(9));
  2997. self._assert_equals_((1).__plus((2).__star((3))),(7));
  2998. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  2999. args: [],
  3000. 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 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  3001. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  3002. referencedClasses: []
  3003. }),
  3004. smalltalk.NumberTest);
  3005. smalltalk.addMethod(
  3006. smalltalk.method({
  3007. selector: "testComparison",
  3008. category: 'tests',
  3009. fn: function (){
  3010. var self=this;
  3011. return smalltalk.withContext(function($ctx1) {
  3012. self._assert_((3).__gt((2)));
  3013. self._assert_((2).__lt((3)));
  3014. self._deny_((3).__lt((2)));
  3015. self._deny_((2).__gt((3)));
  3016. self._assert_((3).__gt_eq((3)));
  3017. self._assert_((3.1).__gt_eq((3)));
  3018. self._assert_((3).__lt_eq((3)));
  3019. self._assert_((3).__lt_eq((3.1)));
  3020. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  3021. args: [],
  3022. 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",
  3023. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  3024. referencedClasses: []
  3025. }),
  3026. smalltalk.NumberTest);
  3027. smalltalk.addMethod(
  3028. smalltalk.method({
  3029. selector: "testCopying",
  3030. category: 'tests',
  3031. fn: function (){
  3032. var self=this;
  3033. return smalltalk.withContext(function($ctx1) {
  3034. self._assert_(_st((1)._copy()).__eq_eq((1)));
  3035. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  3036. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  3037. args: [],
  3038. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  3039. messageSends: ["assert:", "==", "copy", "deepCopy"],
  3040. referencedClasses: []
  3041. }),
  3042. smalltalk.NumberTest);
  3043. smalltalk.addMethod(
  3044. smalltalk.method({
  3045. selector: "testEquality",
  3046. category: 'tests',
  3047. fn: function (){
  3048. var self=this;
  3049. return smalltalk.withContext(function($ctx1) {
  3050. self._assert_((1).__eq((1)));
  3051. self._assert_((0).__eq((0)));
  3052. self._deny_((1).__eq((0)));
  3053. self._assert_(_st((1)._yourself()).__eq((1)));
  3054. self._assert_((1).__eq((1)._yourself()));
  3055. self._assert_(_st((1)._yourself()).__eq((1)._yourself()));
  3056. self._deny_((0).__eq(false));
  3057. self._deny_(false.__eq((0)));
  3058. self._deny_("".__eq((0)));
  3059. self._deny_((0).__eq(""));
  3060. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  3061. args: [],
  3062. 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 = ''",
  3063. messageSends: ["assert:", "=", "deny:", "yourself"],
  3064. referencedClasses: []
  3065. }),
  3066. smalltalk.NumberTest);
  3067. smalltalk.addMethod(
  3068. smalltalk.method({
  3069. selector: "testHexNumbers",
  3070. category: 'tests',
  3071. fn: function (){
  3072. var self=this;
  3073. return smalltalk.withContext(function($ctx1) {
  3074. self._assert_equals_((9),(9));
  3075. self._assert_equals_((10)._truncated(),(10));
  3076. self._assert_equals_((11)._truncated(),(11));
  3077. self._assert_equals_((12)._truncated(),(12));
  3078. self._assert_equals_((13)._truncated(),(13));
  3079. self._assert_equals_((14)._truncated(),(14));
  3080. self._assert_equals_((15)._truncated(),(15));
  3081. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  3082. args: [],
  3083. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  3084. messageSends: ["assert:equals:", "truncated"],
  3085. referencedClasses: []
  3086. }),
  3087. smalltalk.NumberTest);
  3088. smalltalk.addMethod(
  3089. smalltalk.method({
  3090. selector: "testIdentity",
  3091. category: 'tests',
  3092. fn: function (){
  3093. var self=this;
  3094. return smalltalk.withContext(function($ctx1) {
  3095. self._assert_((1).__eq_eq((1)));
  3096. self._assert_((0).__eq_eq((0)));
  3097. self._deny_((1).__eq_eq((0)));
  3098. self._assert_(_st((1)._yourself()).__eq_eq((1)));
  3099. self._assert_((1).__eq_eq((1)._yourself()));
  3100. self._assert_(_st((1)._yourself()).__eq_eq((1)._yourself()));
  3101. self._deny_((1).__eq_eq((2)));
  3102. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  3103. args: [],
  3104. 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",
  3105. messageSends: ["assert:", "==", "deny:", "yourself"],
  3106. referencedClasses: []
  3107. }),
  3108. smalltalk.NumberTest);
  3109. smalltalk.addMethod(
  3110. smalltalk.method({
  3111. selector: "testInvalidHexNumbers",
  3112. category: 'tests',
  3113. fn: function (){
  3114. var self=this;
  3115. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3116. return smalltalk.withContext(function($ctx1) {
  3117. self._should_raise_((function(){
  3118. return smalltalk.withContext(function($ctx2) {
  3119. return (16)._rG();
  3120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3121. self._should_raise_((function(){
  3122. return smalltalk.withContext(function($ctx2) {
  3123. return (16)._rg();
  3124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3125. self._should_raise_((function(){
  3126. return smalltalk.withContext(function($ctx2) {
  3127. return (16)._rH();
  3128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3129. self._should_raise_((function(){
  3130. return smalltalk.withContext(function($ctx2) {
  3131. return (16)._rh();
  3132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3133. self._should_raise_((function(){
  3134. return smalltalk.withContext(function($ctx2) {
  3135. return (16)._rI();
  3136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3137. self._should_raise_((function(){
  3138. return smalltalk.withContext(function($ctx2) {
  3139. return (16)._ri();
  3140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3141. self._should_raise_((function(){
  3142. return smalltalk.withContext(function($ctx2) {
  3143. return (16)._rJ();
  3144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3145. self._should_raise_((function(){
  3146. return smalltalk.withContext(function($ctx2) {
  3147. return (16)._rj();
  3148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3149. self._should_raise_((function(){
  3150. return smalltalk.withContext(function($ctx2) {
  3151. return (16)._rK();
  3152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3153. self._should_raise_((function(){
  3154. return smalltalk.withContext(function($ctx2) {
  3155. return (16)._rk();
  3156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3157. self._should_raise_((function(){
  3158. return smalltalk.withContext(function($ctx2) {
  3159. return (16)._rL();
  3160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3161. self._should_raise_((function(){
  3162. return smalltalk.withContext(function($ctx2) {
  3163. return (16)._rl();
  3164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3165. self._should_raise_((function(){
  3166. return smalltalk.withContext(function($ctx2) {
  3167. return (16)._rM();
  3168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3169. self._should_raise_((function(){
  3170. return smalltalk.withContext(function($ctx2) {
  3171. return (16)._rm();
  3172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3173. self._should_raise_((function(){
  3174. return smalltalk.withContext(function($ctx2) {
  3175. return (16)._rN();
  3176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3177. self._should_raise_((function(){
  3178. return smalltalk.withContext(function($ctx2) {
  3179. return (16)._rn();
  3180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3181. self._should_raise_((function(){
  3182. return smalltalk.withContext(function($ctx2) {
  3183. return (16)._rO();
  3184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3185. self._should_raise_((function(){
  3186. return smalltalk.withContext(function($ctx2) {
  3187. return (16)._ro();
  3188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3189. self._should_raise_((function(){
  3190. return smalltalk.withContext(function($ctx2) {
  3191. return (16)._rP();
  3192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3193. self._should_raise_((function(){
  3194. return smalltalk.withContext(function($ctx2) {
  3195. return (16)._rp();
  3196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3197. self._should_raise_((function(){
  3198. return smalltalk.withContext(function($ctx2) {
  3199. return (16)._rQ();
  3200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3201. self._should_raise_((function(){
  3202. return smalltalk.withContext(function($ctx2) {
  3203. return (16)._rq();
  3204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3205. self._should_raise_((function(){
  3206. return smalltalk.withContext(function($ctx2) {
  3207. return (16)._rR();
  3208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3209. self._should_raise_((function(){
  3210. return smalltalk.withContext(function($ctx2) {
  3211. return (16)._rr();
  3212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3213. self._should_raise_((function(){
  3214. return smalltalk.withContext(function($ctx2) {
  3215. return (16)._rS();
  3216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3217. self._should_raise_((function(){
  3218. return smalltalk.withContext(function($ctx2) {
  3219. return (16)._rs();
  3220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3221. self._should_raise_((function(){
  3222. return smalltalk.withContext(function($ctx2) {
  3223. return (16)._rT();
  3224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3225. self._should_raise_((function(){
  3226. return smalltalk.withContext(function($ctx2) {
  3227. return (16)._rt();
  3228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3229. self._should_raise_((function(){
  3230. return smalltalk.withContext(function($ctx2) {
  3231. return (16)._rU();
  3232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3233. self._should_raise_((function(){
  3234. return smalltalk.withContext(function($ctx2) {
  3235. return (16)._ru();
  3236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3237. self._should_raise_((function(){
  3238. return smalltalk.withContext(function($ctx2) {
  3239. return (16)._rV();
  3240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3241. self._should_raise_((function(){
  3242. return smalltalk.withContext(function($ctx2) {
  3243. return (16)._rv();
  3244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3245. self._should_raise_((function(){
  3246. return smalltalk.withContext(function($ctx2) {
  3247. return (16)._rW();
  3248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3249. self._should_raise_((function(){
  3250. return smalltalk.withContext(function($ctx2) {
  3251. return (16)._rw();
  3252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3253. self._should_raise_((function(){
  3254. return smalltalk.withContext(function($ctx2) {
  3255. return (16)._rX();
  3256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3257. self._should_raise_((function(){
  3258. return smalltalk.withContext(function($ctx2) {
  3259. return (16)._rx();
  3260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3261. self._should_raise_((function(){
  3262. return smalltalk.withContext(function($ctx2) {
  3263. return (16)._rY();
  3264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3265. self._should_raise_((function(){
  3266. return smalltalk.withContext(function($ctx2) {
  3267. return (16)._ry();
  3268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3269. self._should_raise_((function(){
  3270. return smalltalk.withContext(function($ctx2) {
  3271. return (16)._rZ();
  3272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3273. self._should_raise_((function(){
  3274. return smalltalk.withContext(function($ctx2) {
  3275. return (16)._rz();
  3276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3277. self._should_raise_((function(){
  3278. return smalltalk.withContext(function($ctx2) {
  3279. return (11259375)._Z();
  3280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3281. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  3282. args: [],
  3283. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [16rG] raise: MessageNotUnderstood.\x0a\x09self should: [16rg] raise: MessageNotUnderstood.\x0a\x09self should: [16rH] raise: MessageNotUnderstood.\x0a\x09self should: [16rh] raise: MessageNotUnderstood.\x0a\x09self should: [16rI] raise: MessageNotUnderstood.\x0a\x09self should: [16ri] raise: MessageNotUnderstood.\x0a\x09self should: [16rJ] raise: MessageNotUnderstood.\x0a\x09self should: [16rj] raise: MessageNotUnderstood.\x0a\x09self should: [16rK] raise: MessageNotUnderstood.\x0a\x09self should: [16rk] raise: MessageNotUnderstood.\x0a\x09self should: [16rL] raise: MessageNotUnderstood.\x0a\x09self should: [16rl] raise: MessageNotUnderstood.\x0a\x09self should: [16rM] raise: MessageNotUnderstood.\x0a\x09self should: [16rm] raise: MessageNotUnderstood.\x0a\x09self should: [16rN] raise: MessageNotUnderstood.\x0a\x09self should: [16rn] raise: MessageNotUnderstood.\x0a\x09self should: [16rO] raise: MessageNotUnderstood.\x0a\x09self should: [16ro] raise: MessageNotUnderstood.\x0a\x09self should: [16rP] raise: MessageNotUnderstood.\x0a\x09self should: [16rp] raise: MessageNotUnderstood.\x0a\x09self should: [16rQ] raise: MessageNotUnderstood.\x0a\x09self should: [16rq] raise: MessageNotUnderstood.\x0a\x09self should: [16rR] raise: MessageNotUnderstood.\x0a\x09self should: [16rr] raise: MessageNotUnderstood.\x0a\x09self should: [16rS] raise: MessageNotUnderstood.\x0a\x09self should: [16rs] raise: MessageNotUnderstood.\x0a\x09self should: [16rT] raise: MessageNotUnderstood.\x0a\x09self should: [16rt] raise: MessageNotUnderstood.\x0a\x09self should: [16rU] raise: MessageNotUnderstood.\x0a\x09self should: [16ru] raise: MessageNotUnderstood.\x0a\x09self should: [16rV] raise: MessageNotUnderstood.\x0a\x09self should: [16rv] raise: MessageNotUnderstood.\x0a\x09self should: [16rW] raise: MessageNotUnderstood.\x0a\x09self should: [16rw] raise: MessageNotUnderstood.\x0a\x09self should: [16rX] raise: MessageNotUnderstood.\x0a\x09self should: [16rx] raise: MessageNotUnderstood.\x0a\x09self should: [16rY] raise: MessageNotUnderstood.\x0a\x09self should: [16ry] raise: MessageNotUnderstood.\x0a\x09self should: [16rZ] raise: MessageNotUnderstood.\x0a\x09self should: [16rz] raise: MessageNotUnderstood.\x0a\x09self should: [16rABcdEfZ] raise: MessageNotUnderstood.",
  3284. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"],
  3285. referencedClasses: ["MessageNotUnderstood"]
  3286. }),
  3287. smalltalk.NumberTest);
  3288. smalltalk.addMethod(
  3289. smalltalk.method({
  3290. selector: "testMinMax",
  3291. category: 'tests',
  3292. fn: function (){
  3293. var self=this;
  3294. return smalltalk.withContext(function($ctx1) {
  3295. self._assert_equals_((2)._max_((5)),(5));
  3296. self._assert_equals_((2)._min_((5)),(2));
  3297. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  3298. args: [],
  3299. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3300. messageSends: ["assert:equals:", "max:", "min:"],
  3301. referencedClasses: []
  3302. }),
  3303. smalltalk.NumberTest);
  3304. smalltalk.addMethod(
  3305. smalltalk.method({
  3306. selector: "testNegated",
  3307. category: 'tests',
  3308. fn: function (){
  3309. var self=this;
  3310. return smalltalk.withContext(function($ctx1) {
  3311. self._assert_equals_((3)._negated(),(-3));
  3312. self._assert_equals_((-3)._negated(),(3));
  3313. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  3314. args: [],
  3315. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3316. messageSends: ["assert:equals:", "negated"],
  3317. referencedClasses: []
  3318. }),
  3319. smalltalk.NumberTest);
  3320. smalltalk.addMethod(
  3321. smalltalk.method({
  3322. selector: "testPrintShowingDecimalPlaces",
  3323. category: 'tests',
  3324. fn: function (){
  3325. var self=this;
  3326. return smalltalk.withContext(function($ctx1) {
  3327. self._assert_equals_((23)._printShowingDecimalPlaces_((2)),"23.00");
  3328. self._assert_equals_((23.5698)._printShowingDecimalPlaces_((2)),"23.57");
  3329. self._assert_equals_(_st((234.567)._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3330. self._assert_equals_((23.4567)._printShowingDecimalPlaces_((0)),"23");
  3331. self._assert_equals_((23.5567)._printShowingDecimalPlaces_((0)),"24");
  3332. self._assert_equals_(_st((23.4567)._negated())._printShowingDecimalPlaces_((0)),"-23");
  3333. self._assert_equals_(_st((23.5567)._negated())._printShowingDecimalPlaces_((0)),"-24");
  3334. self._assert_equals_((100000000)._printShowingDecimalPlaces_((1)),"100000000.0");
  3335. self._assert_equals_((0.98)._printShowingDecimalPlaces_((5)),"0.98000");
  3336. self._assert_equals_(_st((0.98)._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3337. self._assert_equals_((2.567)._printShowingDecimalPlaces_((2)),"2.57");
  3338. self._assert_equals_((-2.567)._printShowingDecimalPlaces_((2)),"-2.57");
  3339. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  3340. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  3341. args: [],
  3342. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  3343. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3344. referencedClasses: []
  3345. }),
  3346. smalltalk.NumberTest);
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: "testRounded",
  3350. category: 'tests',
  3351. fn: function (){
  3352. var self=this;
  3353. return smalltalk.withContext(function($ctx1) {
  3354. self._assert_equals_((3)._rounded(),(3));
  3355. self._assert_equals_((3.212)._rounded(),(3));
  3356. self._assert_equals_((3.51)._rounded(),(4));
  3357. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  3358. args: [],
  3359. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  3360. messageSends: ["assert:equals:", "rounded"],
  3361. referencedClasses: []
  3362. }),
  3363. smalltalk.NumberTest);
  3364. smalltalk.addMethod(
  3365. smalltalk.method({
  3366. selector: "testSqrt",
  3367. category: 'tests',
  3368. fn: function (){
  3369. var self=this;
  3370. return smalltalk.withContext(function($ctx1) {
  3371. self._assert_equals_((4)._sqrt(),(2));
  3372. self._assert_equals_((16)._sqrt(),(4));
  3373. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  3374. args: [],
  3375. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3376. messageSends: ["assert:equals:", "sqrt"],
  3377. referencedClasses: []
  3378. }),
  3379. smalltalk.NumberTest);
  3380. smalltalk.addMethod(
  3381. smalltalk.method({
  3382. selector: "testSquared",
  3383. category: 'tests',
  3384. fn: function (){
  3385. var self=this;
  3386. return smalltalk.withContext(function($ctx1) {
  3387. self._assert_equals_((4)._squared(),(16));
  3388. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  3389. args: [],
  3390. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3391. messageSends: ["assert:equals:", "squared"],
  3392. referencedClasses: []
  3393. }),
  3394. smalltalk.NumberTest);
  3395. smalltalk.addMethod(
  3396. smalltalk.method({
  3397. selector: "testTimesRepeat",
  3398. category: 'tests',
  3399. fn: function (){
  3400. var self=this;
  3401. var i;
  3402. return smalltalk.withContext(function($ctx1) {
  3403. i=(0);
  3404. (0)._timesRepeat_((function(){
  3405. return smalltalk.withContext(function($ctx2) {
  3406. i=_st(i).__plus((1));
  3407. return i;
  3408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3409. self._assert_equals_(i,(0));
  3410. (5)._timesRepeat_((function(){
  3411. return smalltalk.withContext(function($ctx2) {
  3412. i=_st(i).__plus((1));
  3413. return i;
  3414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3415. self._assert_equals_(i,(5));
  3416. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  3417. args: [],
  3418. 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",
  3419. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3420. referencedClasses: []
  3421. }),
  3422. smalltalk.NumberTest);
  3423. smalltalk.addMethod(
  3424. smalltalk.method({
  3425. selector: "testTo",
  3426. category: 'tests',
  3427. fn: function (){
  3428. var self=this;
  3429. return smalltalk.withContext(function($ctx1) {
  3430. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  3431. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  3432. args: [],
  3433. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3434. messageSends: ["assert:equals:", "to:"],
  3435. referencedClasses: []
  3436. }),
  3437. smalltalk.NumberTest);
  3438. smalltalk.addMethod(
  3439. smalltalk.method({
  3440. selector: "testToBy",
  3441. category: 'tests',
  3442. fn: function (){
  3443. var self=this;
  3444. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3445. return smalltalk.withContext(function($ctx1) {
  3446. self._assert_equals_((0)._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3447. self._should_raise_((function(){
  3448. return smalltalk.withContext(function($ctx2) {
  3449. return (1)._to_by_((4),(0));
  3450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3451. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  3452. args: [],
  3453. 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",
  3454. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3455. referencedClasses: ["Error"]
  3456. }),
  3457. smalltalk.NumberTest);
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "testTruncated",
  3461. category: 'tests',
  3462. fn: function (){
  3463. var self=this;
  3464. return smalltalk.withContext(function($ctx1) {
  3465. self._assert_equals_((3)._truncated(),(3));
  3466. self._assert_equals_((3.212)._truncated(),(3));
  3467. self._assert_equals_((3.51)._truncated(),(3));
  3468. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  3469. args: [],
  3470. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  3471. messageSends: ["assert:equals:", "truncated"],
  3472. referencedClasses: []
  3473. }),
  3474. smalltalk.NumberTest);
  3475. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3476. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  3477. smalltalk.addMethod(
  3478. smalltalk.method({
  3479. selector: "foo",
  3480. category: 'not yet classified',
  3481. fn: function (){
  3482. var self=this;
  3483. return smalltalk.withContext(function($ctx1) {
  3484. var $1;
  3485. $1=self["@foo"];
  3486. return $1;
  3487. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  3488. args: [],
  3489. source: "foo\x0a\x09^foo",
  3490. messageSends: [],
  3491. referencedClasses: []
  3492. }),
  3493. smalltalk.ObjectMock);
  3494. smalltalk.addMethod(
  3495. smalltalk.method({
  3496. selector: "foo:",
  3497. category: 'not yet classified',
  3498. fn: function (anObject){
  3499. var self=this;
  3500. return smalltalk.withContext(function($ctx1) {
  3501. self["@foo"]=anObject;
  3502. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  3503. args: ["anObject"],
  3504. source: "foo: anObject\x0a\x09foo := anObject",
  3505. messageSends: [],
  3506. referencedClasses: []
  3507. }),
  3508. smalltalk.ObjectMock);
  3509. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3510. smalltalk.addMethod(
  3511. smalltalk.method({
  3512. selector: "notDefined",
  3513. category: 'tests',
  3514. fn: function (){
  3515. var self=this;
  3516. return smalltalk.withContext(function($ctx1) {
  3517. return undefined;;
  3518. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  3519. args: [],
  3520. source: "notDefined\x0a\x09<return undefined;>",
  3521. messageSends: [],
  3522. referencedClasses: []
  3523. }),
  3524. smalltalk.ObjectTest);
  3525. smalltalk.addMethod(
  3526. smalltalk.method({
  3527. selector: "testBasicAccess",
  3528. category: 'tests',
  3529. fn: function (){
  3530. var self=this;
  3531. var o;
  3532. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3533. return smalltalk.withContext(function($ctx1) {
  3534. o=_st($Object())._new();
  3535. _st(o)._basicAt_put_("a",(1));
  3536. self._assert_equals_(_st(o)._basicAt_("a"),(1));
  3537. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  3538. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  3539. args: [],
  3540. 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",
  3541. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  3542. referencedClasses: ["Object"]
  3543. }),
  3544. smalltalk.ObjectTest);
  3545. smalltalk.addMethod(
  3546. smalltalk.method({
  3547. selector: "testBasicPerform",
  3548. category: 'tests',
  3549. fn: function (){
  3550. var self=this;
  3551. var o;
  3552. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3553. return smalltalk.withContext(function($ctx1) {
  3554. o=_st($Object())._new();
  3555. _st(o)._basicAt_put_("func",(function(){
  3556. return smalltalk.withContext(function($ctx2) {
  3557. return "hello";
  3558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3559. _st(o)._basicAt_put_("func2",(function(a){
  3560. return smalltalk.withContext(function($ctx2) {
  3561. return _st(a).__plus((1));
  3562. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  3563. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  3564. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  3565. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  3566. args: [],
  3567. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: ['hello'].\x0a\x09o basicAt: 'func2' put: [:a | a + 1].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  3568. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  3569. referencedClasses: ["Object"]
  3570. }),
  3571. smalltalk.ObjectTest);
  3572. smalltalk.addMethod(
  3573. smalltalk.method({
  3574. selector: "testDNU",
  3575. category: 'tests',
  3576. fn: function (){
  3577. var self=this;
  3578. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3579. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3580. return smalltalk.withContext(function($ctx1) {
  3581. self._should_raise_((function(){
  3582. return smalltalk.withContext(function($ctx2) {
  3583. return _st(_st($Object())._new())._foo();
  3584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3585. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  3586. args: [],
  3587. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  3588. messageSends: ["should:raise:", "foo", "new"],
  3589. referencedClasses: ["Object", "MessageNotUnderstood"]
  3590. }),
  3591. smalltalk.ObjectTest);
  3592. smalltalk.addMethod(
  3593. smalltalk.method({
  3594. selector: "testEquality",
  3595. category: 'tests',
  3596. fn: function (){
  3597. var self=this;
  3598. var o;
  3599. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3600. return smalltalk.withContext(function($ctx1) {
  3601. o=_st($Object())._new();
  3602. self._deny_(_st(o).__eq(_st($Object())._new()));
  3603. self._assert_(_st(o).__eq(o));
  3604. self._assert_(_st(_st(o)._yourself()).__eq(o));
  3605. self._assert_(_st(o).__eq(_st(o)._yourself()));
  3606. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  3607. args: [],
  3608. 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)",
  3609. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  3610. referencedClasses: ["Object"]
  3611. }),
  3612. smalltalk.ObjectTest);
  3613. smalltalk.addMethod(
  3614. smalltalk.method({
  3615. selector: "testHalt",
  3616. category: 'tests',
  3617. fn: function (){
  3618. var self=this;
  3619. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3620. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3621. return smalltalk.withContext(function($ctx1) {
  3622. self._should_raise_((function(){
  3623. return smalltalk.withContext(function($ctx2) {
  3624. return _st(_st($Object())._new())._halt();
  3625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3626. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  3627. args: [],
  3628. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  3629. messageSends: ["should:raise:", "halt", "new"],
  3630. referencedClasses: ["Object", "Error"]
  3631. }),
  3632. smalltalk.ObjectTest);
  3633. smalltalk.addMethod(
  3634. smalltalk.method({
  3635. selector: "testIdentity",
  3636. category: 'tests',
  3637. fn: function (){
  3638. var self=this;
  3639. var o;
  3640. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3641. return smalltalk.withContext(function($ctx1) {
  3642. o=_st($Object())._new();
  3643. self._deny_(_st(o).__eq_eq(_st($Object())._new()));
  3644. self._assert_(_st(o).__eq_eq(o));
  3645. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3646. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  3647. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  3648. args: [],
  3649. 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",
  3650. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  3651. referencedClasses: ["Object"]
  3652. }),
  3653. smalltalk.ObjectTest);
  3654. smalltalk.addMethod(
  3655. smalltalk.method({
  3656. selector: "testIfNil",
  3657. category: 'tests',
  3658. fn: function (){
  3659. var self=this;
  3660. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3661. return smalltalk.withContext(function($ctx1) {
  3662. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  3663. self._deny_(_st(_st($Object())._new())._isNil());
  3664. $1=self;
  3665. $4=_st($Object())._new();
  3666. if(($receiver = $4) == nil || $receiver == undefined){
  3667. $3=true;
  3668. } else {
  3669. $3=$4;
  3670. };
  3671. $2=_st($3).__eq(true);
  3672. _st($1)._deny_($2);
  3673. $5=self;
  3674. $7=_st($Object())._new();
  3675. if(($receiver = $7) == nil || $receiver == undefined){
  3676. $6=$7;
  3677. } else {
  3678. $6=true;
  3679. };
  3680. _st($5)._assert_equals_($6,true);
  3681. $8=self;
  3682. $10=_st($Object())._new();
  3683. if(($receiver = $10) == nil || $receiver == undefined){
  3684. $9=false;
  3685. } else {
  3686. $9=true;
  3687. };
  3688. _st($8)._assert_equals_($9,true);
  3689. $11=self;
  3690. $13=_st($Object())._new();
  3691. if(($receiver = $13) == nil || $receiver == undefined){
  3692. $12=false;
  3693. } else {
  3694. $12=true;
  3695. };
  3696. _st($11)._assert_equals_($12,true);
  3697. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  3698. args: [],
  3699. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [false] ifNotNil: [true]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [true] ifNil: [false]) equals: true",
  3700. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3701. referencedClasses: ["Object"]
  3702. }),
  3703. smalltalk.ObjectTest);
  3704. smalltalk.addMethod(
  3705. smalltalk.method({
  3706. selector: "testInstVars",
  3707. category: 'tests',
  3708. fn: function (){
  3709. var self=this;
  3710. var o;
  3711. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  3712. return smalltalk.withContext(function($ctx1) {
  3713. o=_st($ObjectMock())._new();
  3714. self._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  3715. _st(o)._instVarAt_put_("foo",(1));
  3716. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3717. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3718. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  3719. args: [],
  3720. 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",
  3721. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  3722. referencedClasses: ["ObjectMock"]
  3723. }),
  3724. smalltalk.ObjectTest);
  3725. smalltalk.addMethod(
  3726. smalltalk.method({
  3727. selector: "testNilUndefined",
  3728. category: 'tests',
  3729. fn: function (){
  3730. var self=this;
  3731. return smalltalk.withContext(function($ctx1) {
  3732. self._assert_equals_(self._notDefined(),nil);
  3733. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  3734. args: [],
  3735. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  3736. messageSends: ["assert:equals:", "notDefined"],
  3737. referencedClasses: []
  3738. }),
  3739. smalltalk.ObjectTest);
  3740. smalltalk.addMethod(
  3741. smalltalk.method({
  3742. selector: "testYourself",
  3743. category: 'tests',
  3744. fn: function (){
  3745. var self=this;
  3746. var o;
  3747. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  3748. return smalltalk.withContext(function($ctx1) {
  3749. o=_st($ObjectMock())._new();
  3750. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3751. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  3752. args: [],
  3753. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  3754. messageSends: ["new", "assert:", "==", "yourself"],
  3755. referencedClasses: ["ObjectMock"]
  3756. }),
  3757. smalltalk.ObjectTest);
  3758. smalltalk.addMethod(
  3759. smalltalk.method({
  3760. selector: "testidentityHash",
  3761. category: 'tests',
  3762. fn: function (){
  3763. var self=this;
  3764. var o1,o2;
  3765. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3766. return smalltalk.withContext(function($ctx1) {
  3767. o1=_st($Object())._new();
  3768. o2=_st($Object())._new();
  3769. self._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  3770. self._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  3771. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  3772. args: [],
  3773. 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",
  3774. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  3775. referencedClasses: ["Object"]
  3776. }),
  3777. smalltalk.ObjectTest);
  3778. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3779. smalltalk.addMethod(
  3780. smalltalk.method({
  3781. selector: "testAccessing",
  3782. category: 'tests',
  3783. fn: function (){
  3784. var self=this;
  3785. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3786. return smalltalk.withContext(function($ctx1) {
  3787. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  3788. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  3789. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  3790. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  3791. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  3792. args: [],
  3793. 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",
  3794. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  3795. referencedClasses: ["Point"]
  3796. }),
  3797. smalltalk.PointTest);
  3798. smalltalk.addMethod(
  3799. smalltalk.method({
  3800. selector: "testArithmetic",
  3801. category: 'tests',
  3802. fn: function (){
  3803. var self=this;
  3804. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3805. return smalltalk.withContext(function($ctx1) {
  3806. self._assert_equals_(_st((3).__at((4))).__star((3).__at((4))),_st($Point())._x_y_((9),(16)));
  3807. self._assert_equals_(_st((3).__at((4))).__plus((3).__at((4))),_st($Point())._x_y_((6),(8)));
  3808. self._assert_equals_(_st((3).__at((4))).__minus((3).__at((4))),_st($Point())._x_y_((0),(0)));
  3809. self._assert_equals_(_st((6).__at((8))).__slash((3).__at((4))),_st($Point())._x_y_((2),(2)));
  3810. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  3811. args: [],
  3812. 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)",
  3813. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  3814. referencedClasses: ["Point"]
  3815. }),
  3816. smalltalk.PointTest);
  3817. smalltalk.addMethod(
  3818. smalltalk.method({
  3819. selector: "testAt",
  3820. category: 'tests',
  3821. fn: function (){
  3822. var self=this;
  3823. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3824. return smalltalk.withContext(function($ctx1) {
  3825. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  3826. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  3827. args: [],
  3828. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  3829. messageSends: ["assert:equals:", "@", "x:y:"],
  3830. referencedClasses: ["Point"]
  3831. }),
  3832. smalltalk.PointTest);
  3833. smalltalk.addMethod(
  3834. smalltalk.method({
  3835. selector: "testEgality",
  3836. category: 'tests',
  3837. fn: function (){
  3838. var self=this;
  3839. return smalltalk.withContext(function($ctx1) {
  3840. self._assert_(_st((3).__at((4))).__eq((3).__at((4))));
  3841. self._deny_(_st((3).__at((5))).__eq((3).__at((6))));
  3842. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  3843. args: [],
  3844. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  3845. messageSends: ["assert:", "=", "@", "deny:"],
  3846. referencedClasses: []
  3847. }),
  3848. smalltalk.PointTest);
  3849. smalltalk.addMethod(
  3850. smalltalk.method({
  3851. selector: "testTranslateBy",
  3852. category: 'tests',
  3853. fn: function (){
  3854. var self=this;
  3855. return smalltalk.withContext(function($ctx1) {
  3856. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1))),(3).__at((4)));
  3857. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1)._negated())),(3).__at((2)));
  3858. self._assert_equals_(_st((3).__at((3)))._translateBy_((2).__at((3))),(5).__at((6)));
  3859. self._assert_equals_(_st((3).__at((3)))._translateBy_(_st((3)._negated()).__at((0))),(0).__at((3)));
  3860. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  3861. args: [],
  3862. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  3863. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  3864. referencedClasses: []
  3865. }),
  3866. smalltalk.PointTest);
  3867. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3868. smalltalk.addMethod(
  3869. smalltalk.method({
  3870. selector: "textNext",
  3871. category: 'tests',
  3872. fn: function (){
  3873. var self=this;
  3874. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  3875. return smalltalk.withContext(function($ctx1) {
  3876. (10000)._timesRepeat_((function(){
  3877. var current,next;
  3878. return smalltalk.withContext(function($ctx2) {
  3879. next=_st(_st($Random())._new())._next();
  3880. next;
  3881. self._assert_(_st(next).__gt_eq((0)));
  3882. self._assert_(_st(next).__lt((1)));
  3883. self._deny_(_st(current).__eq(next));
  3884. return _st(next).__eq(current);
  3885. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  3886. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  3887. args: [],
  3888. 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]",
  3889. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  3890. referencedClasses: ["Random"]
  3891. }),
  3892. smalltalk.RandomTest);
  3893. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3894. smalltalk.addMethod(
  3895. smalltalk.method({
  3896. selector: "testAddRemove",
  3897. category: 'tests',
  3898. fn: function (){
  3899. var self=this;
  3900. var set;
  3901. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3902. return smalltalk.withContext(function($ctx1) {
  3903. set=_st($Set())._new();
  3904. self._assert_(_st(set)._isEmpty());
  3905. _st(set)._add_((3));
  3906. self._assert_(_st(set)._includes_((3)));
  3907. _st(set)._add_((5));
  3908. self._assert_(_st(set)._includes_((5)));
  3909. _st(set)._remove_((3));
  3910. self._deny_(_st(set)._includes_((3)));
  3911. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  3912. args: [],
  3913. 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)",
  3914. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  3915. referencedClasses: ["Set"]
  3916. }),
  3917. smalltalk.SetTest);
  3918. smalltalk.addMethod(
  3919. smalltalk.method({
  3920. selector: "testAt",
  3921. category: 'tests',
  3922. fn: function (){
  3923. var self=this;
  3924. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3925. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3926. return smalltalk.withContext(function($ctx1) {
  3927. self._should_raise_((function(){
  3928. return smalltalk.withContext(function($ctx2) {
  3929. return _st(_st($Set())._new())._at_put_((1),(2));
  3930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3931. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  3932. args: [],
  3933. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  3934. messageSends: ["should:raise:", "at:put:", "new"],
  3935. referencedClasses: ["Set", "Error"]
  3936. }),
  3937. smalltalk.SetTest);
  3938. smalltalk.addMethod(
  3939. smalltalk.method({
  3940. selector: "testCollect",
  3941. category: 'tests',
  3942. fn: function (){
  3943. var self=this;
  3944. return smalltalk.withContext(function($ctx1) {
  3945. self._assert_equals_(_st([(5), (6), (8)]._asSet())._collect_((function(x){
  3946. return smalltalk.withContext(function($ctx2) {
  3947. return _st(x).__backslash_backslash((3));
  3948. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),[(0), (2)]._asSet());
  3949. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  3950. args: [],
  3951. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  3952. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"],
  3953. referencedClasses: []
  3954. }),
  3955. smalltalk.SetTest);
  3956. smalltalk.addMethod(
  3957. smalltalk.method({
  3958. selector: "testComparing",
  3959. category: 'tests',
  3960. fn: function (){
  3961. var self=this;
  3962. return smalltalk.withContext(function($ctx1) {
  3963. self._assert_equals_([(0), (2)]._asSet(),[(0), (2)]._asSet());
  3964. self._assert_equals_([(2), (0)]._asSet(),[(0), (2)]._asSet());
  3965. self._deny_(_st([(0), (2), (3)]._asSet()).__eq([(0), (2)]._asSet()));
  3966. self._deny_(_st([(1), (2)]._asSet()).__eq([(0), (2)]._asSet()));
  3967. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  3968. args: [],
  3969. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  3970. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  3971. referencedClasses: []
  3972. }),
  3973. smalltalk.SetTest);
  3974. smalltalk.addMethod(
  3975. smalltalk.method({
  3976. selector: "testPrintString",
  3977. category: 'tests',
  3978. fn: function (){
  3979. var self=this;
  3980. var set;
  3981. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3982. return smalltalk.withContext(function($ctx1) {
  3983. var $1,$2,$3,$4;
  3984. set=_st($Set())._new();
  3985. self._assert_equals_(_st(set)._printString(),"a Set ()");
  3986. $1=set;
  3987. _st($1)._add_((1));
  3988. $2=_st($1)._add_((3));
  3989. self._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3990. _st(set)._add_("foo");
  3991. self._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3992. $3=set;
  3993. _st($3)._remove_((1));
  3994. $4=_st($3)._remove_((3));
  3995. self._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3996. _st(set)._add_((3));
  3997. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3998. _st(set)._add_((3));
  3999. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4000. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  4001. args: [],
  4002. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  4003. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  4004. referencedClasses: ["Set"]
  4005. }),
  4006. smalltalk.SetTest);
  4007. smalltalk.addMethod(
  4008. smalltalk.method({
  4009. selector: "testSize",
  4010. category: 'tests',
  4011. fn: function (){
  4012. var self=this;
  4013. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4014. return smalltalk.withContext(function($ctx1) {
  4015. self._assert_equals_(_st(_st($Set())._new())._size(),(0));
  4016. self._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  4017. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  4018. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  4019. args: [],
  4020. 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",
  4021. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  4022. referencedClasses: ["Set"]
  4023. }),
  4024. smalltalk.SetTest);
  4025. smalltalk.addMethod(
  4026. smalltalk.method({
  4027. selector: "testUnboxedObjects",
  4028. category: 'tests',
  4029. fn: function (){
  4030. var self=this;
  4031. return smalltalk.withContext(function($ctx1) {
  4032. self._assert_equals_(_st(_st(["foo"._yourself(),"foo"._yourself()])._asSet())._asArray(),["foo"]);
  4033. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  4034. args: [],
  4035. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  4036. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  4037. referencedClasses: []
  4038. }),
  4039. smalltalk.SetTest);
  4040. smalltalk.addMethod(
  4041. smalltalk.method({
  4042. selector: "testUnicity",
  4043. category: 'tests',
  4044. fn: function (){
  4045. var self=this;
  4046. var set;
  4047. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4048. return smalltalk.withContext(function($ctx1) {
  4049. set=_st($Set())._new();
  4050. _st(set)._add_((21));
  4051. _st(set)._add_("hello");
  4052. _st(set)._add_((21));
  4053. self._assert_equals_(_st(set)._size(),(2));
  4054. _st(set)._add_("hello");
  4055. self._assert_equals_(_st(set)._size(),(2));
  4056. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  4057. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  4058. args: [],
  4059. 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 equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  4060. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4061. referencedClasses: ["Set"]
  4062. }),
  4063. smalltalk.SetTest);
  4064. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4065. smalltalk.addMethod(
  4066. smalltalk.method({
  4067. selector: "collectionClass",
  4068. category: 'accessing',
  4069. fn: function (){
  4070. var self=this;
  4071. return smalltalk.withContext(function($ctx1) {
  4072. var $1;
  4073. $1=_st(self._class())._collectionClass();
  4074. return $1;
  4075. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  4076. args: [],
  4077. source: "collectionClass\x0a\x09^ self class collectionClass",
  4078. messageSends: ["collectionClass", "class"],
  4079. referencedClasses: []
  4080. }),
  4081. smalltalk.StreamTest);
  4082. smalltalk.addMethod(
  4083. smalltalk.method({
  4084. selector: "newCollection",
  4085. category: 'accessing',
  4086. fn: function (){
  4087. var self=this;
  4088. return smalltalk.withContext(function($ctx1) {
  4089. var $1;
  4090. $1=_st(self._collectionClass())._new();
  4091. return $1;
  4092. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  4093. args: [],
  4094. source: "newCollection\x0a\x09^ self collectionClass new",
  4095. messageSends: ["new", "collectionClass"],
  4096. referencedClasses: []
  4097. }),
  4098. smalltalk.StreamTest);
  4099. smalltalk.addMethod(
  4100. smalltalk.method({
  4101. selector: "newStream",
  4102. category: 'accessing',
  4103. fn: function (){
  4104. var self=this;
  4105. return smalltalk.withContext(function($ctx1) {
  4106. var $1;
  4107. $1=_st(_st(self._collectionClass())._new())._stream();
  4108. return $1;
  4109. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  4110. args: [],
  4111. source: "newStream\x0a\x09^ self collectionClass new stream",
  4112. messageSends: ["stream", "new", "collectionClass"],
  4113. referencedClasses: []
  4114. }),
  4115. smalltalk.StreamTest);
  4116. smalltalk.addMethod(
  4117. smalltalk.method({
  4118. selector: "testAtStartAtEnd",
  4119. category: 'tests',
  4120. fn: function (){
  4121. var self=this;
  4122. var stream;
  4123. return smalltalk.withContext(function($ctx1) {
  4124. stream=self._newStream();
  4125. self._assert_(_st(stream)._atStart());
  4126. self._assert_(_st(stream)._atEnd());
  4127. _st(stream)._nextPutAll_(self._newCollection());
  4128. self._assert_(_st(stream)._atEnd());
  4129. self._deny_(_st(stream)._atStart());
  4130. _st(stream)._position_((1));
  4131. self._deny_(_st(stream)._atEnd());
  4132. self._deny_(_st(stream)._atStart());
  4133. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  4134. args: [],
  4135. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  4136. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  4137. referencedClasses: []
  4138. }),
  4139. smalltalk.StreamTest);
  4140. smalltalk.addMethod(
  4141. smalltalk.method({
  4142. selector: "testContents",
  4143. category: 'tests',
  4144. fn: function (){
  4145. var self=this;
  4146. var stream;
  4147. return smalltalk.withContext(function($ctx1) {
  4148. stream=self._newStream();
  4149. _st(stream)._nextPutAll_(self._newCollection());
  4150. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  4151. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  4152. args: [],
  4153. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  4154. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  4155. referencedClasses: []
  4156. }),
  4157. smalltalk.StreamTest);
  4158. smalltalk.addMethod(
  4159. smalltalk.method({
  4160. selector: "testIsEmpty",
  4161. category: 'tests',
  4162. fn: function (){
  4163. var self=this;
  4164. var stream;
  4165. return smalltalk.withContext(function($ctx1) {
  4166. stream=self._newStream();
  4167. self._assert_(_st(stream)._isEmpty());
  4168. _st(stream)._nextPutAll_(self._newCollection());
  4169. self._deny_(_st(stream)._isEmpty());
  4170. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  4171. args: [],
  4172. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  4173. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.StreamTest);
  4177. smalltalk.addMethod(
  4178. smalltalk.method({
  4179. selector: "testPosition",
  4180. category: 'tests',
  4181. fn: function (){
  4182. var self=this;
  4183. var collection,stream;
  4184. return smalltalk.withContext(function($ctx1) {
  4185. collection=self._newCollection();
  4186. stream=self._newStream();
  4187. _st(stream)._nextPutAll_(collection);
  4188. self._assert_equals_(_st(stream)._position(),_st(collection)._size());
  4189. _st(stream)._position_((0));
  4190. self._assert_equals_(_st(stream)._position(),(0));
  4191. _st(stream)._next();
  4192. self._assert_equals_(_st(stream)._position(),(1));
  4193. _st(stream)._next();
  4194. self._assert_equals_(_st(stream)._position(),(2));
  4195. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  4196. args: [],
  4197. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  4198. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  4199. referencedClasses: []
  4200. }),
  4201. smalltalk.StreamTest);
  4202. smalltalk.addMethod(
  4203. smalltalk.method({
  4204. selector: "testReading",
  4205. category: 'tests',
  4206. fn: function (){
  4207. var self=this;
  4208. var stream,collection;
  4209. return smalltalk.withContext(function($ctx1) {
  4210. var $1,$2;
  4211. collection=self._newCollection();
  4212. stream=self._newStream();
  4213. $1=stream;
  4214. _st($1)._nextPutAll_(collection);
  4215. $2=_st($1)._position_((0));
  4216. _st(collection)._do_((function(each){
  4217. return smalltalk.withContext(function($ctx2) {
  4218. return self._assert_equals_(_st(stream)._next(),each);
  4219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4220. self._assert_(_st(_st(stream)._next())._isNil());
  4221. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4222. args: [],
  4223. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  4224. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  4225. referencedClasses: []
  4226. }),
  4227. smalltalk.StreamTest);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "testStreamContents",
  4231. category: 'tests',
  4232. fn: function (){
  4233. var self=this;
  4234. return smalltalk.withContext(function($ctx1) {
  4235. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  4236. args: [],
  4237. source: "testStreamContents",
  4238. messageSends: [],
  4239. referencedClasses: []
  4240. }),
  4241. smalltalk.StreamTest);
  4242. smalltalk.addMethod(
  4243. smalltalk.method({
  4244. selector: "testWrite",
  4245. category: 'tests',
  4246. fn: function (){
  4247. var self=this;
  4248. var stream,collection;
  4249. return smalltalk.withContext(function($ctx1) {
  4250. collection=self._newCollection();
  4251. stream=self._newStream();
  4252. _st(collection)._do_((function(each){
  4253. return smalltalk.withContext(function($ctx2) {
  4254. return _st(stream).__lt_lt(each);
  4255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4256. self._assert_equals_(_st(stream)._contents(),collection);
  4257. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4258. args: [],
  4259. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  4260. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  4261. referencedClasses: []
  4262. }),
  4263. smalltalk.StreamTest);
  4264. smalltalk.addMethod(
  4265. smalltalk.method({
  4266. selector: "testWriting",
  4267. category: 'tests',
  4268. fn: function (){
  4269. var self=this;
  4270. var stream,collection;
  4271. return smalltalk.withContext(function($ctx1) {
  4272. collection=self._newCollection();
  4273. stream=self._newStream();
  4274. _st(collection)._do_((function(each){
  4275. return smalltalk.withContext(function($ctx2) {
  4276. return _st(stream)._nextPut_(each);
  4277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4278. self._assert_equals_(_st(stream)._contents(),collection);
  4279. stream=self._newStream();
  4280. _st(stream)._nextPutAll_(collection);
  4281. self._assert_equals_(_st(stream)._contents(),collection);
  4282. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4283. args: [],
  4284. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  4285. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  4286. referencedClasses: []
  4287. }),
  4288. smalltalk.StreamTest);
  4289. smalltalk.addMethod(
  4290. smalltalk.method({
  4291. selector: "collectionClass",
  4292. category: 'accessing',
  4293. fn: function (){
  4294. var self=this;
  4295. return smalltalk.withContext(function($ctx1) {
  4296. return nil;
  4297. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  4298. args: [],
  4299. source: "collectionClass\x0a\x09^ nil",
  4300. messageSends: [],
  4301. referencedClasses: []
  4302. }),
  4303. smalltalk.StreamTest.klass);
  4304. smalltalk.addMethod(
  4305. smalltalk.method({
  4306. selector: "isAbstract",
  4307. category: 'testing',
  4308. fn: function (){
  4309. var self=this;
  4310. return smalltalk.withContext(function($ctx1) {
  4311. var $1;
  4312. $1=_st(self._collectionClass())._isNil();
  4313. return $1;
  4314. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  4315. args: [],
  4316. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  4317. messageSends: ["isNil", "collectionClass"],
  4318. referencedClasses: []
  4319. }),
  4320. smalltalk.StreamTest.klass);
  4321. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4322. smalltalk.addMethod(
  4323. smalltalk.method({
  4324. selector: "newCollection",
  4325. category: 'accessing',
  4326. fn: function (){
  4327. var self=this;
  4328. return smalltalk.withContext(function($ctx1) {
  4329. var $1;
  4330. $1=[true,(1),(3).__at((4)),"foo"];
  4331. return $1;
  4332. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  4333. args: [],
  4334. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  4335. messageSends: ["@"],
  4336. referencedClasses: []
  4337. }),
  4338. smalltalk.ArrayStreamTest);
  4339. smalltalk.addMethod(
  4340. smalltalk.method({
  4341. selector: "collectionClass",
  4342. category: 'accessing',
  4343. fn: function (){
  4344. var self=this;
  4345. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4346. return smalltalk.withContext(function($ctx1) {
  4347. var $1;
  4348. $1=$Array();
  4349. return $1;
  4350. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  4351. args: [],
  4352. source: "collectionClass\x0a\x09^ Array",
  4353. messageSends: [],
  4354. referencedClasses: ["Array"]
  4355. }),
  4356. smalltalk.ArrayStreamTest.klass);
  4357. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4358. smalltalk.addMethod(
  4359. smalltalk.method({
  4360. selector: "newCollection",
  4361. category: 'accessing',
  4362. fn: function (){
  4363. var self=this;
  4364. return smalltalk.withContext(function($ctx1) {
  4365. return "hello world";
  4366. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  4367. args: [],
  4368. source: "newCollection\x0a\x09^ 'hello world'",
  4369. messageSends: [],
  4370. referencedClasses: []
  4371. }),
  4372. smalltalk.StringStreamTest);
  4373. smalltalk.addMethod(
  4374. smalltalk.method({
  4375. selector: "collectionClass",
  4376. category: 'accessing',
  4377. fn: function (){
  4378. var self=this;
  4379. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4380. return smalltalk.withContext(function($ctx1) {
  4381. var $1;
  4382. $1=$String();
  4383. return $1;
  4384. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  4385. args: [],
  4386. source: "collectionClass\x0a\x09^ String",
  4387. messageSends: [],
  4388. referencedClasses: ["String"]
  4389. }),
  4390. smalltalk.StringStreamTest.klass);
  4391. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4392. smalltalk.addMethod(
  4393. smalltalk.method({
  4394. selector: "testCopying",
  4395. category: 'tests',
  4396. fn: function (){
  4397. var self=this;
  4398. return smalltalk.withContext(function($ctx1) {
  4399. self._assert_equals_(nil._copy(),nil);
  4400. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  4401. args: [],
  4402. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4403. messageSends: ["assert:equals:", "copy"],
  4404. referencedClasses: []
  4405. }),
  4406. smalltalk.UndefinedTest);
  4407. smalltalk.addMethod(
  4408. smalltalk.method({
  4409. selector: "testDeepCopy",
  4410. category: 'tests',
  4411. fn: function (){
  4412. var self=this;
  4413. return smalltalk.withContext(function($ctx1) {
  4414. self._assert_(_st(nil._deepCopy()).__eq(nil));
  4415. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  4416. args: [],
  4417. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4418. messageSends: ["assert:", "=", "deepCopy"],
  4419. referencedClasses: []
  4420. }),
  4421. smalltalk.UndefinedTest);
  4422. smalltalk.addMethod(
  4423. smalltalk.method({
  4424. selector: "testIfNil",
  4425. category: 'tests',
  4426. fn: function (){
  4427. var self=this;
  4428. return smalltalk.withContext(function($ctx1) {
  4429. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  4430. $1=self;
  4431. if(($receiver = nil) == nil || $receiver == undefined){
  4432. $2=true;
  4433. } else {
  4434. $2=nil;
  4435. };
  4436. _st($1)._assert_equals_($2,true);
  4437. $3=self;
  4438. if(($receiver = nil) == nil || $receiver == undefined){
  4439. $5=nil;
  4440. } else {
  4441. $5=true;
  4442. };
  4443. $4=_st($5).__eq(true);
  4444. _st($3)._deny_($4);
  4445. $6=self;
  4446. if(($receiver = nil) == nil || $receiver == undefined){
  4447. $7=true;
  4448. } else {
  4449. $7=false;
  4450. };
  4451. _st($6)._assert_equals_($7,true);
  4452. $8=self;
  4453. if(($receiver = nil) == nil || $receiver == undefined){
  4454. $10=false;
  4455. } else {
  4456. $10=true;
  4457. };
  4458. $9=_st($10).__eq(true);
  4459. _st($8)._deny_($9);
  4460. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  4461. args: [],
  4462. 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",
  4463. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4464. referencedClasses: []
  4465. }),
  4466. smalltalk.UndefinedTest);
  4467. smalltalk.addMethod(
  4468. smalltalk.method({
  4469. selector: "testIsNil",
  4470. category: 'tests',
  4471. fn: function (){
  4472. var self=this;
  4473. return smalltalk.withContext(function($ctx1) {
  4474. self._assert_(nil._isNil());
  4475. self._deny_(nil._notNil());
  4476. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  4477. args: [],
  4478. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4479. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4480. referencedClasses: []
  4481. }),
  4482. smalltalk.UndefinedTest);
  4483. });