Kernel-Tests.js 214 KB

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