Kernel-Tests.js 263 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983
  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. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. 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.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testCanClearInterval",
  43. category: 'tests',
  44. fn: function (){
  45. var self=this;
  46. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  47. return smalltalk.withContext(function($ctx1) {
  48. self._shouldnt_raise_((function(){
  49. return smalltalk.withContext(function($ctx2) {
  50. return _st(_st((function(){
  51. return smalltalk.withContext(function($ctx3) {
  52. return _st(_st($Error())._new())._signal();
  53. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  54. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  55. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  56. args: [],
  57. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  58. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  59. referencedClasses: ["Error"]
  60. }),
  61. smalltalk.BlockClosureTest);
  62. smalltalk.addMethod(
  63. smalltalk.method({
  64. selector: "testCanClearTimeout",
  65. category: 'tests',
  66. fn: function (){
  67. var self=this;
  68. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  69. return smalltalk.withContext(function($ctx1) {
  70. self._shouldnt_raise_((function(){
  71. return smalltalk.withContext(function($ctx2) {
  72. return _st(_st((function(){
  73. return smalltalk.withContext(function($ctx3) {
  74. return _st(_st($Error())._new())._signal();
  75. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  76. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  77. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  78. args: [],
  79. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  80. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  81. referencedClasses: ["Error"]
  82. }),
  83. smalltalk.BlockClosureTest);
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "testCompiledSource",
  87. category: 'tests',
  88. fn: function (){
  89. var self=this;
  90. return smalltalk.withContext(function($ctx1) {
  91. self._assert_(_st(_st((function(){
  92. return smalltalk.withContext(function($ctx2) {
  93. return (1).__plus((1));
  94. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  95. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  96. args: [],
  97. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  98. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  99. referencedClasses: []
  100. }),
  101. smalltalk.BlockClosureTest);
  102. smalltalk.addMethod(
  103. smalltalk.method({
  104. selector: "testCurrySelf",
  105. category: 'tests',
  106. fn: function (){
  107. var self=this;
  108. var curriedMethod,array;
  109. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  110. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  111. return smalltalk.withContext(function($ctx1) {
  112. curriedMethod=_st(_st((function(selfarg,x){
  113. return smalltalk.withContext(function($ctx2) {
  114. return _st(selfarg)._at_(x);
  115. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  116. array=[(3), (1), (4)];
  117. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  118. _st((function(){
  119. return smalltalk.withContext(function($ctx2) {
  120. return self._assert_equals_(_st(array)._foo_((2)),(1));
  121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  122. return smalltalk.withContext(function($ctx2) {
  123. return _st($Array())._removeCompiledMethod_(curriedMethod);
  124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  125. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  126. args: [],
  127. 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 ]",
  128. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  129. referencedClasses: ["ClassBuilder", "Array"]
  130. }),
  131. smalltalk.BlockClosureTest);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "testEnsure",
  135. category: 'tests',
  136. fn: function (){
  137. var self=this;
  138. return smalltalk.withContext(function($ctx1) {
  139. self._assert_equals_(_st((function(){
  140. return smalltalk.withContext(function($ctx2) {
  141. return (3);
  142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  143. return smalltalk.withContext(function($ctx2) {
  144. return (4);
  145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  146. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  147. args: [],
  148. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  149. messageSends: ["assert:equals:", "ensure:"],
  150. referencedClasses: []
  151. }),
  152. smalltalk.BlockClosureTest);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "testEnsureRaises",
  156. category: 'tests',
  157. fn: function (){
  158. var self=this;
  159. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  160. return smalltalk.withContext(function($ctx1) {
  161. self._should_raise_((function(){
  162. return smalltalk.withContext(function($ctx2) {
  163. return _st((function(){
  164. return smalltalk.withContext(function($ctx3) {
  165. return _st(_st($Error())._new())._signal();
  166. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  167. return smalltalk.withContext(function($ctx3) {
  168. return true;
  169. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  171. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  172. args: [],
  173. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  174. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  175. referencedClasses: ["Error"]
  176. }),
  177. smalltalk.BlockClosureTest);
  178. smalltalk.addMethod(
  179. smalltalk.method({
  180. selector: "testExceptionSemantics",
  181. category: 'tests',
  182. fn: function (){
  183. var self=this;
  184. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  185. return smalltalk.withContext(function($ctx1) {
  186. self._timeout_((100));
  187. _st(self._async_((function(){
  188. return smalltalk.withContext(function($ctx2) {
  189. return _st((function(){
  190. return smalltalk.withContext(function($ctx3) {
  191. self._assert_(true);
  192. _st($Error())._signal();
  193. self._deny_(true);
  194. return self._finished();
  195. $ctx3.sendIdx["finished"]=1;
  196. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  197. return smalltalk.withContext(function($ctx3) {
  198. return self._finished();
  199. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  201. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  202. args: [],
  203. 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",
  204. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  205. referencedClasses: ["Error"]
  206. }),
  207. smalltalk.BlockClosureTest);
  208. smalltalk.addMethod(
  209. smalltalk.method({
  210. selector: "testNewWithValues",
  211. category: 'tests',
  212. fn: function (){
  213. var self=this;
  214. return smalltalk.withContext(function($ctx1) {
  215. function theTestPrototype() {this.name = "theTestPrototype";}
  216. function theTestConstructor(arg1, arg2, arg3) {}
  217. theTestConstructor.prototype = new theTestPrototype;
  218. var theWrappedConstructor = _st(theTestConstructor);
  219. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  220. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  221. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  222. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  223. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  224. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  225. args: [],
  226. 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>",
  227. messageSends: [],
  228. referencedClasses: []
  229. }),
  230. smalltalk.BlockClosureTest);
  231. smalltalk.addMethod(
  232. smalltalk.method({
  233. selector: "testNumArgs",
  234. category: 'tests',
  235. fn: function (){
  236. var self=this;
  237. return smalltalk.withContext(function($ctx1) {
  238. var $1;
  239. $1=_st((function(){
  240. return smalltalk.withContext(function($ctx2) {
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  242. $ctx1.sendIdx["numArgs"]=1;
  243. self._assert_equals_($1,(0));
  244. $ctx1.sendIdx["assert:equals:"]=1;
  245. self._assert_equals_(_st((function(a,b){
  246. return smalltalk.withContext(function($ctx2) {
  247. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  248. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  249. args: [],
  250. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  251. messageSends: ["assert:equals:", "numArgs"],
  252. referencedClasses: []
  253. }),
  254. smalltalk.BlockClosureTest);
  255. smalltalk.addMethod(
  256. smalltalk.method({
  257. selector: "testOnDo",
  258. category: 'tests',
  259. fn: function (){
  260. var self=this;
  261. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  262. return smalltalk.withContext(function($ctx1) {
  263. self._assert_(_st((function(){
  264. return smalltalk.withContext(function($ctx2) {
  265. return _st(_st($Error())._new())._signal();
  266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  267. return smalltalk.withContext(function($ctx2) {
  268. return true;
  269. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  270. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  271. args: [],
  272. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  273. messageSends: ["assert:", "on:do:", "signal", "new"],
  274. referencedClasses: ["Error"]
  275. }),
  276. smalltalk.BlockClosureTest);
  277. smalltalk.addMethod(
  278. smalltalk.method({
  279. selector: "testValue",
  280. category: 'tests',
  281. fn: function (){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) {
  284. var $1;
  285. $1=_st((function(){
  286. return smalltalk.withContext(function($ctx2) {
  287. return (1).__plus((1));
  288. $ctx2.sendIdx["+"]=1;
  289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  290. $ctx1.sendIdx["value"]=1;
  291. self._assert_equals_($1,(2));
  292. $ctx1.sendIdx["assert:equals:"]=1;
  293. self._assert_equals_(_st((function(x){
  294. return smalltalk.withContext(function($ctx2) {
  295. return _st(x).__plus((1));
  296. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  297. $ctx1.sendIdx["assert:equals:"]=2;
  298. self._assert_equals_(_st((function(x,y){
  299. return smalltalk.withContext(function($ctx2) {
  300. return _st(x).__star(y);
  301. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  302. $ctx1.sendIdx["assert:equals:"]=3;
  303. self._assert_equals_(_st((function(a,b,c){
  304. return smalltalk.withContext(function($ctx2) {
  305. return (1);
  306. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  307. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  308. args: [],
  309. 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",
  310. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  311. referencedClasses: []
  312. }),
  313. smalltalk.BlockClosureTest);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "testValueWithPossibleArguments",
  317. category: 'tests',
  318. fn: function (){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) {
  321. var $1,$2;
  322. $1=_st((function(){
  323. return smalltalk.withContext(function($ctx2) {
  324. return (1);
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  326. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  327. self._assert_equals_($1,(1));
  328. $ctx1.sendIdx["assert:equals:"]=1;
  329. $2=_st((function(a){
  330. return smalltalk.withContext(function($ctx2) {
  331. return _st(a).__plus((4));
  332. $ctx2.sendIdx["+"]=1;
  333. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  334. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  335. self._assert_equals_($2,(7));
  336. $ctx1.sendIdx["assert:equals:"]=2;
  337. self._assert_equals_(_st((function(a,b){
  338. return smalltalk.withContext(function($ctx2) {
  339. return _st(a).__plus(b);
  340. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. 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.",
  344. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  345. referencedClasses: []
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testWhileFalse",
  351. category: 'tests',
  352. fn: function (){
  353. var self=this;
  354. var i;
  355. return smalltalk.withContext(function($ctx1) {
  356. i=(0);
  357. _st((function(){
  358. return smalltalk.withContext(function($ctx2) {
  359. return _st(i).__gt((5));
  360. $ctx2.sendIdx[">"]=1;
  361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  362. return smalltalk.withContext(function($ctx2) {
  363. i=_st(i).__plus((1));
  364. $ctx2.sendIdx["+"]=1;
  365. return i;
  366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  367. self._assert_equals_(i,(6));
  368. $ctx1.sendIdx["assert:equals:"]=1;
  369. i=(0);
  370. _st((function(){
  371. return smalltalk.withContext(function($ctx2) {
  372. i=_st(i).__plus((1));
  373. i;
  374. return _st(i).__gt((5));
  375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  376. self._assert_equals_(i,(6));
  377. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  378. args: [],
  379. 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",
  380. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  381. referencedClasses: []
  382. }),
  383. smalltalk.BlockClosureTest);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "testWhileTrue",
  387. category: 'tests',
  388. fn: function (){
  389. var self=this;
  390. var i;
  391. return smalltalk.withContext(function($ctx1) {
  392. i=(0);
  393. _st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return _st(i).__lt((5));
  396. $ctx2.sendIdx["<"]=1;
  397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  398. return smalltalk.withContext(function($ctx2) {
  399. i=_st(i).__plus((1));
  400. $ctx2.sendIdx["+"]=1;
  401. return i;
  402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  403. self._assert_equals_(i,(5));
  404. $ctx1.sendIdx["assert:equals:"]=1;
  405. i=(0);
  406. _st((function(){
  407. return smalltalk.withContext(function($ctx2) {
  408. i=_st(i).__plus((1));
  409. i;
  410. return _st(i).__lt((5));
  411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  412. self._assert_equals_(i,(5));
  413. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  414. args: [],
  415. 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",
  416. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  417. referencedClasses: []
  418. }),
  419. smalltalk.BlockClosureTest);
  420. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  421. smalltalk.addMethod(
  422. smalltalk.method({
  423. selector: "testEquality",
  424. category: 'tests',
  425. fn: function (){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) {
  428. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  429. $1=(0).__eq(false);
  430. $ctx1.sendIdx["="]=1;
  431. self._deny_($1);
  432. $ctx1.sendIdx["deny:"]=1;
  433. $2=false.__eq((0));
  434. $ctx1.sendIdx["="]=2;
  435. self._deny_($2);
  436. $ctx1.sendIdx["deny:"]=2;
  437. $3="".__eq(false);
  438. $ctx1.sendIdx["="]=3;
  439. self._deny_($3);
  440. $ctx1.sendIdx["deny:"]=3;
  441. $4=false.__eq("");
  442. $ctx1.sendIdx["="]=4;
  443. self._deny_($4);
  444. $ctx1.sendIdx["deny:"]=4;
  445. $5=true.__eq(true);
  446. $ctx1.sendIdx["="]=5;
  447. self._assert_($5);
  448. $ctx1.sendIdx["assert:"]=1;
  449. $6=false.__eq(true);
  450. $ctx1.sendIdx["="]=6;
  451. self._deny_($6);
  452. $ctx1.sendIdx["deny:"]=5;
  453. $7=true.__eq(false);
  454. $ctx1.sendIdx["="]=7;
  455. self._deny_($7);
  456. $8=false.__eq(false);
  457. $ctx1.sendIdx["="]=8;
  458. self._assert_($8);
  459. $ctx1.sendIdx["assert:"]=2;
  460. $10=true._yourself();
  461. $ctx1.sendIdx["yourself"]=1;
  462. $9=_st($10).__eq(true);
  463. $ctx1.sendIdx["="]=9;
  464. self._assert_($9);
  465. $ctx1.sendIdx["assert:"]=3;
  466. $12=true._yourself();
  467. $ctx1.sendIdx["yourself"]=2;
  468. $11=_st($12).__eq(true._yourself());
  469. self._assert_($11);
  470. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  471. args: [],
  472. 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)",
  473. messageSends: ["deny:", "=", "assert:", "yourself"],
  474. referencedClasses: []
  475. }),
  476. smalltalk.BooleanTest);
  477. smalltalk.addMethod(
  478. smalltalk.method({
  479. selector: "testIdentity",
  480. category: 'tests',
  481. fn: function (){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) {
  484. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  485. $1=(0).__eq_eq(false);
  486. $ctx1.sendIdx["=="]=1;
  487. self._deny_($1);
  488. $ctx1.sendIdx["deny:"]=1;
  489. $2=false.__eq_eq((0));
  490. $ctx1.sendIdx["=="]=2;
  491. self._deny_($2);
  492. $ctx1.sendIdx["deny:"]=2;
  493. $3="".__eq_eq(false);
  494. $ctx1.sendIdx["=="]=3;
  495. self._deny_($3);
  496. $ctx1.sendIdx["deny:"]=3;
  497. $4=false.__eq_eq("");
  498. $ctx1.sendIdx["=="]=4;
  499. self._deny_($4);
  500. $ctx1.sendIdx["deny:"]=4;
  501. $5=true.__eq_eq(true);
  502. $ctx1.sendIdx["=="]=5;
  503. self._assert_($5);
  504. $ctx1.sendIdx["assert:"]=1;
  505. $6=false.__eq_eq(true);
  506. $ctx1.sendIdx["=="]=6;
  507. self._deny_($6);
  508. $ctx1.sendIdx["deny:"]=5;
  509. $7=true.__eq_eq(false);
  510. $ctx1.sendIdx["=="]=7;
  511. self._deny_($7);
  512. $8=false.__eq_eq(false);
  513. $ctx1.sendIdx["=="]=8;
  514. self._assert_($8);
  515. $ctx1.sendIdx["assert:"]=2;
  516. $10=true._yourself();
  517. $ctx1.sendIdx["yourself"]=1;
  518. $9=_st($10).__eq_eq(true);
  519. $ctx1.sendIdx["=="]=9;
  520. self._assert_($9);
  521. $ctx1.sendIdx["assert:"]=3;
  522. $12=true._yourself();
  523. $ctx1.sendIdx["yourself"]=2;
  524. $11=_st($12).__eq_eq(true._yourself());
  525. self._assert_($11);
  526. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  527. args: [],
  528. 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",
  529. messageSends: ["deny:", "==", "assert:", "yourself"],
  530. referencedClasses: []
  531. }),
  532. smalltalk.BooleanTest);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "testIfTrueIfFalse",
  536. category: 'tests',
  537. fn: function (){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) {
  540. var $1,$2,$3,$4,$5,$6,$7,$8;
  541. if(smalltalk.assert(true)){
  542. $1="alternative block";
  543. };
  544. self._assert_equals_($1,"alternative block");
  545. $ctx1.sendIdx["assert:equals:"]=1;
  546. if(! smalltalk.assert(true)){
  547. $2="alternative block";
  548. };
  549. self._assert_equals_($2,nil);
  550. $ctx1.sendIdx["assert:equals:"]=2;
  551. if(smalltalk.assert(false)){
  552. $3="alternative block";
  553. };
  554. self._assert_equals_($3,nil);
  555. $ctx1.sendIdx["assert:equals:"]=3;
  556. if(! smalltalk.assert(false)){
  557. $4="alternative block";
  558. };
  559. self._assert_equals_($4,"alternative block");
  560. $ctx1.sendIdx["assert:equals:"]=4;
  561. if(smalltalk.assert(false)){
  562. $5="alternative block";
  563. } else {
  564. $5="alternative block2";
  565. };
  566. self._assert_equals_($5,"alternative block2");
  567. $ctx1.sendIdx["assert:equals:"]=5;
  568. if(smalltalk.assert(false)){
  569. $6="alternative block2";
  570. } else {
  571. $6="alternative block";
  572. };
  573. self._assert_equals_($6,"alternative block");
  574. $ctx1.sendIdx["assert:equals:"]=6;
  575. if(smalltalk.assert(true)){
  576. $7="alternative block";
  577. } else {
  578. $7="alternative block2";
  579. };
  580. self._assert_equals_($7,"alternative block");
  581. $ctx1.sendIdx["assert:equals:"]=7;
  582. if(smalltalk.assert(true)){
  583. $8="alternative block2";
  584. } else {
  585. $8="alternative block";
  586. };
  587. self._assert_equals_($8,"alternative block2");
  588. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  589. args: [],
  590. 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'.",
  591. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  592. referencedClasses: []
  593. }),
  594. smalltalk.BooleanTest);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "testIfTrueIfFalseWithBoxing",
  598. category: 'tests',
  599. fn: function (){
  600. var self=this;
  601. return smalltalk.withContext(function($ctx1) {
  602. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  603. $2=true._yourself();
  604. $ctx1.sendIdx["yourself"]=1;
  605. if(smalltalk.assert($2)){
  606. $1="alternative block";
  607. };
  608. self._assert_equals_($1,"alternative block");
  609. $ctx1.sendIdx["assert:equals:"]=1;
  610. $4=true._yourself();
  611. $ctx1.sendIdx["yourself"]=2;
  612. if(! smalltalk.assert($4)){
  613. $3="alternative block";
  614. };
  615. self._assert_equals_($3,nil);
  616. $ctx1.sendIdx["assert:equals:"]=2;
  617. $6=false._yourself();
  618. $ctx1.sendIdx["yourself"]=3;
  619. if(smalltalk.assert($6)){
  620. $5="alternative block";
  621. };
  622. self._assert_equals_($5,nil);
  623. $ctx1.sendIdx["assert:equals:"]=3;
  624. $8=false._yourself();
  625. $ctx1.sendIdx["yourself"]=4;
  626. if(! smalltalk.assert($8)){
  627. $7="alternative block";
  628. };
  629. self._assert_equals_($7,"alternative block");
  630. $ctx1.sendIdx["assert:equals:"]=4;
  631. $10=false._yourself();
  632. $ctx1.sendIdx["yourself"]=5;
  633. if(smalltalk.assert($10)){
  634. $9="alternative block";
  635. } else {
  636. $9="alternative block2";
  637. };
  638. self._assert_equals_($9,"alternative block2");
  639. $ctx1.sendIdx["assert:equals:"]=5;
  640. $12=false._yourself();
  641. $ctx1.sendIdx["yourself"]=6;
  642. if(smalltalk.assert($12)){
  643. $11="alternative block2";
  644. } else {
  645. $11="alternative block";
  646. };
  647. self._assert_equals_($11,"alternative block");
  648. $ctx1.sendIdx["assert:equals:"]=6;
  649. $14=true._yourself();
  650. $ctx1.sendIdx["yourself"]=7;
  651. if(smalltalk.assert($14)){
  652. $13="alternative block";
  653. } else {
  654. $13="alternative block2";
  655. };
  656. self._assert_equals_($13,"alternative block");
  657. $ctx1.sendIdx["assert:equals:"]=7;
  658. $16=true._yourself();
  659. if(smalltalk.assert($16)){
  660. $15="alternative block2";
  661. } else {
  662. $15="alternative block";
  663. };
  664. self._assert_equals_($15,"alternative block2");
  665. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  666. args: [],
  667. 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'.",
  668. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  669. referencedClasses: []
  670. }),
  671. smalltalk.BooleanTest);
  672. smalltalk.addMethod(
  673. smalltalk.method({
  674. selector: "testLogic",
  675. category: 'tests',
  676. fn: function (){
  677. var self=this;
  678. return smalltalk.withContext(function($ctx1) {
  679. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  680. $1=true.__and(true);
  681. $ctx1.sendIdx["&"]=1;
  682. self._assert_($1);
  683. $ctx1.sendIdx["assert:"]=1;
  684. $2=true.__and(false);
  685. $ctx1.sendIdx["&"]=2;
  686. self._deny_($2);
  687. $ctx1.sendIdx["deny:"]=1;
  688. $3=false.__and(true);
  689. $ctx1.sendIdx["&"]=3;
  690. self._deny_($3);
  691. $ctx1.sendIdx["deny:"]=2;
  692. $5=false.__and(false);
  693. $ctx1.sendIdx["&"]=4;
  694. $4=self._deny_($5);
  695. $ctx1.sendIdx["deny:"]=3;
  696. $6=true.__or(true);
  697. $ctx1.sendIdx["|"]=1;
  698. self._assert_($6);
  699. $ctx1.sendIdx["assert:"]=2;
  700. $7=true.__or(false);
  701. $ctx1.sendIdx["|"]=2;
  702. self._assert_($7);
  703. $ctx1.sendIdx["assert:"]=3;
  704. $8=false.__or(true);
  705. $ctx1.sendIdx["|"]=3;
  706. self._assert_($8);
  707. $ctx1.sendIdx["assert:"]=4;
  708. $10=false.__or(false);
  709. $ctx1.sendIdx["|"]=4;
  710. $9=self._deny_($10);
  711. $ctx1.sendIdx["deny:"]=4;
  712. $12=(1).__gt((0));
  713. $ctx1.sendIdx[">"]=1;
  714. $11=true.__and($12);
  715. $ctx1.sendIdx["&"]=5;
  716. self._assert_($11);
  717. $ctx1.sendIdx["assert:"]=5;
  718. $14=(1).__gt((0));
  719. $ctx1.sendIdx[">"]=2;
  720. $13=_st($14).__and(false);
  721. $ctx1.sendIdx["&"]=6;
  722. self._deny_($13);
  723. $ctx1.sendIdx["deny:"]=5;
  724. $17=(1).__gt((0));
  725. $ctx1.sendIdx[">"]=3;
  726. $18=(1).__gt((2));
  727. $ctx1.sendIdx[">"]=4;
  728. $16=_st($17).__and($18);
  729. $15=self._deny_($16);
  730. $20=(1).__gt((0));
  731. $ctx1.sendIdx[">"]=5;
  732. $19=false.__or($20);
  733. $ctx1.sendIdx["|"]=5;
  734. self._assert_($19);
  735. $ctx1.sendIdx["assert:"]=6;
  736. $22=(1).__gt((0));
  737. $ctx1.sendIdx[">"]=6;
  738. $21=_st($22).__or(false);
  739. $ctx1.sendIdx["|"]=6;
  740. self._assert_($21);
  741. $ctx1.sendIdx["assert:"]=7;
  742. $25=(1).__gt((0));
  743. $ctx1.sendIdx[">"]=7;
  744. $24=_st($25).__or((1).__gt((2)));
  745. $23=self._assert_($24);
  746. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  747. args: [],
  748. 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))",
  749. messageSends: ["assert:", "&", "deny:", "|", ">"],
  750. referencedClasses: []
  751. }),
  752. smalltalk.BooleanTest);
  753. smalltalk.addMethod(
  754. smalltalk.method({
  755. selector: "testLogicKeywords",
  756. category: 'tests',
  757. fn: function (){
  758. var self=this;
  759. return smalltalk.withContext(function($ctx1) {
  760. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  761. $1=true._and_((function(){
  762. return smalltalk.withContext(function($ctx2) {
  763. return true;
  764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  765. $ctx1.sendIdx["and:"]=1;
  766. self._assert_($1);
  767. $ctx1.sendIdx["assert:"]=1;
  768. $2=true._and_((function(){
  769. return smalltalk.withContext(function($ctx2) {
  770. return false;
  771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  772. $ctx1.sendIdx["and:"]=2;
  773. self._deny_($2);
  774. $ctx1.sendIdx["deny:"]=1;
  775. $3=false._and_((function(){
  776. return smalltalk.withContext(function($ctx2) {
  777. return true;
  778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  779. $ctx1.sendIdx["and:"]=3;
  780. self._deny_($3);
  781. $ctx1.sendIdx["deny:"]=2;
  782. $5=false._and_((function(){
  783. return smalltalk.withContext(function($ctx2) {
  784. return false;
  785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  786. $ctx1.sendIdx["and:"]=4;
  787. $4=self._deny_($5);
  788. $ctx1.sendIdx["deny:"]=3;
  789. $6=true._or_((function(){
  790. return smalltalk.withContext(function($ctx2) {
  791. return true;
  792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  793. $ctx1.sendIdx["or:"]=1;
  794. self._assert_($6);
  795. $ctx1.sendIdx["assert:"]=2;
  796. $7=true._or_((function(){
  797. return smalltalk.withContext(function($ctx2) {
  798. return false;
  799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  800. $ctx1.sendIdx["or:"]=2;
  801. self._assert_($7);
  802. $ctx1.sendIdx["assert:"]=3;
  803. $8=false._or_((function(){
  804. return smalltalk.withContext(function($ctx2) {
  805. return true;
  806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  807. $ctx1.sendIdx["or:"]=3;
  808. self._assert_($8);
  809. $ctx1.sendIdx["assert:"]=4;
  810. $10=false._or_((function(){
  811. return smalltalk.withContext(function($ctx2) {
  812. return false;
  813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  814. $ctx1.sendIdx["or:"]=4;
  815. $9=self._deny_($10);
  816. $ctx1.sendIdx["deny:"]=4;
  817. $11=true._and_((function(){
  818. return smalltalk.withContext(function($ctx2) {
  819. return (1).__gt((0));
  820. $ctx2.sendIdx[">"]=1;
  821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  822. $ctx1.sendIdx["and:"]=5;
  823. self._assert_($11);
  824. $ctx1.sendIdx["assert:"]=5;
  825. $13=(1).__gt((0));
  826. $ctx1.sendIdx[">"]=2;
  827. $12=_st($13)._and_((function(){
  828. return smalltalk.withContext(function($ctx2) {
  829. return false;
  830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  831. $ctx1.sendIdx["and:"]=6;
  832. self._deny_($12);
  833. $ctx1.sendIdx["deny:"]=5;
  834. $16=(1).__gt((0));
  835. $ctx1.sendIdx[">"]=3;
  836. $15=_st($16)._and_((function(){
  837. return smalltalk.withContext(function($ctx2) {
  838. return (1).__gt((2));
  839. $ctx2.sendIdx[">"]=4;
  840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  841. $14=self._deny_($15);
  842. $17=false._or_((function(){
  843. return smalltalk.withContext(function($ctx2) {
  844. return (1).__gt((0));
  845. $ctx2.sendIdx[">"]=5;
  846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  847. $ctx1.sendIdx["or:"]=5;
  848. self._assert_($17);
  849. $ctx1.sendIdx["assert:"]=6;
  850. $19=(1).__gt((0));
  851. $ctx1.sendIdx[">"]=6;
  852. $18=_st($19)._or_((function(){
  853. return smalltalk.withContext(function($ctx2) {
  854. return false;
  855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  856. $ctx1.sendIdx["or:"]=6;
  857. self._assert_($18);
  858. $ctx1.sendIdx["assert:"]=7;
  859. $22=(1).__gt((0));
  860. $ctx1.sendIdx[">"]=7;
  861. $21=_st($22)._or_((function(){
  862. return smalltalk.withContext(function($ctx2) {
  863. return (1).__gt((2));
  864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  865. $20=self._assert_($21);
  866. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  867. args: [],
  868. 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 ])",
  869. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  870. referencedClasses: []
  871. }),
  872. smalltalk.BooleanTest);
  873. smalltalk.addMethod(
  874. smalltalk.method({
  875. selector: "testNonBooleanError",
  876. category: 'tests',
  877. fn: function (){
  878. var self=this;
  879. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  880. return smalltalk.withContext(function($ctx1) {
  881. self._should_raise_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. if(smalltalk.assert("")){
  884. } else {
  885. };
  886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  887. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  888. args: [],
  889. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  890. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  891. referencedClasses: ["NonBooleanReceiver"]
  892. }),
  893. smalltalk.BooleanTest);
  894. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  895. smalltalk.addMethod(
  896. smalltalk.method({
  897. selector: "setUp",
  898. category: 'running',
  899. fn: function (){
  900. var self=this;
  901. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  902. return smalltalk.withContext(function($ctx1) {
  903. self["@builder"]=_st($ClassBuilder())._new();
  904. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  905. args: [],
  906. source: "setUp\x0a\x09builder := ClassBuilder new",
  907. messageSends: ["new"],
  908. referencedClasses: ["ClassBuilder"]
  909. }),
  910. smalltalk.ClassBuilderTest);
  911. smalltalk.addMethod(
  912. smalltalk.method({
  913. selector: "tearDown",
  914. category: 'running',
  915. fn: function (){
  916. var self=this;
  917. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  918. return smalltalk.withContext(function($ctx1) {
  919. var $1;
  920. $1=self["@theClass"];
  921. if(($receiver = $1) == nil || $receiver == null){
  922. $1;
  923. } else {
  924. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  925. self["@theClass"]=nil;
  926. self["@theClass"];
  927. };
  928. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  929. args: [],
  930. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  931. messageSends: ["ifNotNil:", "removeClass:", "current"],
  932. referencedClasses: ["Smalltalk"]
  933. }),
  934. smalltalk.ClassBuilderTest);
  935. smalltalk.addMethod(
  936. smalltalk.method({
  937. selector: "testClassCopy",
  938. category: 'tests',
  939. fn: function (){
  940. var self=this;
  941. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  942. return smalltalk.withContext(function($ctx1) {
  943. var $2,$1,$4,$3,$6,$5,$8,$7;
  944. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  945. $2=_st(self["@theClass"])._superclass();
  946. $ctx1.sendIdx["superclass"]=1;
  947. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  948. $ctx1.sendIdx["=="]=1;
  949. self._assert_($1);
  950. $ctx1.sendIdx["assert:"]=1;
  951. $4=_st(self["@theClass"])._instanceVariableNames();
  952. $ctx1.sendIdx["instanceVariableNames"]=1;
  953. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  954. $ctx1.sendIdx["=="]=2;
  955. self._assert_($3);
  956. $ctx1.sendIdx["assert:"]=2;
  957. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  958. $ctx1.sendIdx["assert:equals:"]=1;
  959. $6=_st(self["@theClass"])._package();
  960. $ctx1.sendIdx["package"]=1;
  961. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  962. self._assert_($5);
  963. $8=_st(self["@theClass"])._methodDictionary();
  964. $ctx1.sendIdx["methodDictionary"]=1;
  965. $7=_st($8)._keys();
  966. $ctx1.sendIdx["keys"]=1;
  967. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  968. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  969. args: [],
  970. 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",
  971. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  972. referencedClasses: ["ObjectMock"]
  973. }),
  974. smalltalk.ClassBuilderTest);
  975. smalltalk.addMethod(
  976. smalltalk.method({
  977. selector: "testClassMigration",
  978. category: 'tests',
  979. fn: function (){
  980. var self=this;
  981. var instance,oldClass;
  982. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  983. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  984. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  985. return smalltalk.withContext(function($ctx1) {
  986. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  987. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  988. $2=_st($Smalltalk())._current();
  989. $ctx1.sendIdx["current"]=1;
  990. $1=_st($2)._at_("ObjectMock2");
  991. $ctx1.sendIdx["at:"]=1;
  992. instance=_st($1)._new();
  993. $4=_st($Smalltalk())._current();
  994. $ctx1.sendIdx["current"]=2;
  995. $3=_st($4)._at_("ObjectMock2");
  996. $ctx1.sendIdx["at:"]=2;
  997. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  998. $5=_st(oldClass).__eq_eq($ObjectMock2());
  999. $ctx1.sendIdx["=="]=1;
  1000. self._deny_($5);
  1001. $ctx1.sendIdx["deny:"]=1;
  1002. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1003. $ctx1.sendIdx["=="]=2;
  1004. self._assert_($6);
  1005. $ctx1.sendIdx["assert:"]=1;
  1006. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1007. $ctx1.sendIdx["assert:"]=2;
  1008. $7=_st($ObjectMock2())._selectors();
  1009. $ctx1.sendIdx["selectors"]=1;
  1010. self._assert_equals_($7,_st(oldClass)._selectors());
  1011. $ctx1.sendIdx["assert:equals:"]=1;
  1012. $8=_st($ObjectMock2())._comment();
  1013. $ctx1.sendIdx["comment"]=1;
  1014. self._assert_equals_($8,_st(oldClass)._comment());
  1015. $ctx1.sendIdx["assert:equals:"]=2;
  1016. $9=_st(_st($ObjectMock2())._package())._name();
  1017. $ctx1.sendIdx["name"]=1;
  1018. self._assert_equals_($9,"Kernel-Tests");
  1019. $11=_st(instance)._class();
  1020. $ctx1.sendIdx["class"]=1;
  1021. $10=_st($11).__eq_eq($ObjectMock2());
  1022. self._deny_($10);
  1023. $14=_st($Smalltalk())._current();
  1024. $ctx1.sendIdx["current"]=3;
  1025. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1026. $12=_st($13)._isNil();
  1027. self._assert_($12);
  1028. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1029. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1030. args: [],
  1031. 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",
  1032. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1033. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1034. }),
  1035. smalltalk.ClassBuilderTest);
  1036. smalltalk.addMethod(
  1037. smalltalk.method({
  1038. selector: "testClassMigrationWithClassInstanceVariables",
  1039. category: 'tests',
  1040. fn: function (){
  1041. var self=this;
  1042. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1043. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1044. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1045. return smalltalk.withContext(function($ctx1) {
  1046. var $1,$3,$2;
  1047. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1048. $1=_st($ObjectMock2())._class();
  1049. $ctx1.sendIdx["class"]=1;
  1050. _st($1)._instanceVariableNames_("foo bar");
  1051. $3=_st($Smalltalk())._current();
  1052. $ctx1.sendIdx["current"]=1;
  1053. $2=_st($3)._at_("ObjectMock2");
  1054. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1055. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1056. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1057. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1058. args: [],
  1059. 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",
  1060. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1061. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1062. }),
  1063. smalltalk.ClassBuilderTest);
  1064. smalltalk.addMethod(
  1065. smalltalk.method({
  1066. selector: "testClassMigrationWithSubclasses",
  1067. category: 'tests',
  1068. fn: function (){
  1069. var self=this;
  1070. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1071. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1072. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1073. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1074. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1075. return smalltalk.withContext(function($ctx1) {
  1076. var $2,$1,$4,$3,$6,$5;
  1077. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1078. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1079. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1080. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1081. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1082. $2=_st($Smalltalk())._current();
  1083. $ctx1.sendIdx["current"]=1;
  1084. $1=_st($2)._at_("ObjectMock2");
  1085. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1086. $4=_st($ObjectMock())._subclasses();
  1087. $ctx1.sendIdx["subclasses"]=1;
  1088. $3=_st($4)._includes_($ObjectMock2());
  1089. $ctx1.sendIdx["includes:"]=1;
  1090. self._assert_($3);
  1091. $ctx1.sendIdx["assert:"]=1;
  1092. $6=_st($ObjectMock2())._subclasses();
  1093. $ctx1.sendIdx["subclasses"]=2;
  1094. $5=_st($6)._includes_($ObjectMock3());
  1095. $ctx1.sendIdx["includes:"]=2;
  1096. self._assert_($5);
  1097. $ctx1.sendIdx["assert:"]=2;
  1098. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1099. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1100. return smalltalk.withContext(function($ctx2) {
  1101. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1103. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1104. args: [],
  1105. 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 ]",
  1106. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1107. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1108. }),
  1109. smalltalk.ClassBuilderTest);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "testInstanceVariableNames",
  1113. category: 'tests',
  1114. fn: function (){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) {
  1117. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1118. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1119. args: [],
  1120. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1121. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1122. referencedClasses: []
  1123. }),
  1124. smalltalk.ClassBuilderTest);
  1125. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "assertSameContents:as:",
  1129. category: 'convenience',
  1130. fn: function (aCollection,anotherCollection){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) {
  1133. var $2,$1,$4,$3;
  1134. $2=_st(aCollection)._size();
  1135. $ctx1.sendIdx["size"]=1;
  1136. $1=_st($2).__eq(_st(anotherCollection)._size());
  1137. $ctx1.sendIdx["="]=1;
  1138. self._assert_($1);
  1139. $ctx1.sendIdx["assert:"]=1;
  1140. _st(aCollection)._do_((function(each){
  1141. return smalltalk.withContext(function($ctx2) {
  1142. $4=_st(aCollection)._occurrencesOf_(each);
  1143. $ctx2.sendIdx["occurrencesOf:"]=1;
  1144. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1145. return self._assert_($3);
  1146. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1147. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1148. args: ["aCollection", "anotherCollection"],
  1149. 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)) ]",
  1150. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1151. referencedClasses: []
  1152. }),
  1153. smalltalk.CollectionTest);
  1154. smalltalk.addMethod(
  1155. smalltalk.method({
  1156. selector: "collection",
  1157. category: 'accessing',
  1158. fn: function (){
  1159. var self=this;
  1160. return smalltalk.withContext(function($ctx1) {
  1161. var $1;
  1162. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  1163. return $1;
  1164. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1165. args: [],
  1166. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  1167. messageSends: ["withAll:", "collectionClass", "defaultValues"],
  1168. referencedClasses: []
  1169. }),
  1170. smalltalk.CollectionTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "collectionClass",
  1174. category: 'accessing',
  1175. fn: function (){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. var $1;
  1179. $1=_st(self._class())._collectionClass();
  1180. return $1;
  1181. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1182. args: [],
  1183. source: "collectionClass\x0a\x09^ self class collectionClass",
  1184. messageSends: ["collectionClass", "class"],
  1185. referencedClasses: []
  1186. }),
  1187. smalltalk.CollectionTest);
  1188. smalltalk.addMethod(
  1189. smalltalk.method({
  1190. selector: "collectionWithDuplicates",
  1191. category: 'accessing',
  1192. fn: function (){
  1193. var self=this;
  1194. return smalltalk.withContext(function($ctx1) {
  1195. var $1;
  1196. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  1197. return $1;
  1198. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1199. args: [],
  1200. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  1201. messageSends: ["withAll:", "collectionClass"],
  1202. referencedClasses: []
  1203. }),
  1204. smalltalk.CollectionTest);
  1205. smalltalk.addMethod(
  1206. smalltalk.method({
  1207. selector: "defaultValues",
  1208. category: 'accessing',
  1209. fn: function (){
  1210. var self=this;
  1211. return smalltalk.withContext(function($ctx1) {
  1212. var $1;
  1213. $1=[(1), (2), (3), (-4)];
  1214. return $1;
  1215. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  1216. args: [],
  1217. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  1218. messageSends: [],
  1219. referencedClasses: []
  1220. }),
  1221. smalltalk.CollectionTest);
  1222. smalltalk.addMethod(
  1223. smalltalk.method({
  1224. selector: "isCollectionReadOnly",
  1225. category: 'testing',
  1226. fn: function (){
  1227. var self=this;
  1228. return smalltalk.withContext(function($ctx1) {
  1229. return false;
  1230. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1231. args: [],
  1232. source: "isCollectionReadOnly\x0a\x09^ false",
  1233. messageSends: [],
  1234. referencedClasses: []
  1235. }),
  1236. smalltalk.CollectionTest);
  1237. smalltalk.addMethod(
  1238. smalltalk.method({
  1239. selector: "testAsArray",
  1240. category: 'tests',
  1241. fn: function (){
  1242. var self=this;
  1243. return smalltalk.withContext(function($ctx1) {
  1244. var $1;
  1245. $1=self._collection();
  1246. $ctx1.sendIdx["collection"]=1;
  1247. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1248. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1249. args: [],
  1250. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1251. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1252. referencedClasses: []
  1253. }),
  1254. smalltalk.CollectionTest);
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "testAsOrderedCollection",
  1258. category: 'tests',
  1259. fn: function (){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $1;
  1263. $1=self._collection();
  1264. $ctx1.sendIdx["collection"]=1;
  1265. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1266. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1267. args: [],
  1268. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1269. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1270. referencedClasses: []
  1271. }),
  1272. smalltalk.CollectionTest);
  1273. smalltalk.addMethod(
  1274. smalltalk.method({
  1275. selector: "testAsSet",
  1276. category: 'tests',
  1277. fn: function (){
  1278. var self=this;
  1279. var c,set;
  1280. return smalltalk.withContext(function($ctx1) {
  1281. c=self._collectionWithDuplicates();
  1282. set=_st(c)._asSet();
  1283. self._assert_equals_(_st(set)._size(),(5));
  1284. _st(c)._do_((function(each){
  1285. return smalltalk.withContext(function($ctx2) {
  1286. return self._assert_(_st(set)._includes_(each));
  1287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1288. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1289. args: [],
  1290. 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) ]",
  1291. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1292. referencedClasses: []
  1293. }),
  1294. smalltalk.CollectionTest);
  1295. smalltalk.addMethod(
  1296. smalltalk.method({
  1297. selector: "testCollect",
  1298. category: 'tests',
  1299. fn: function (){
  1300. var self=this;
  1301. var newCollection;
  1302. return smalltalk.withContext(function($ctx1) {
  1303. newCollection=[(1), (2), (3), (4)];
  1304. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return _st(each)._abs();
  1307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1309. args: [],
  1310. 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",
  1311. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1312. referencedClasses: []
  1313. }),
  1314. smalltalk.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "testDetect",
  1318. category: 'tests',
  1319. fn: function (){
  1320. var self=this;
  1321. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1322. return smalltalk.withContext(function($ctx1) {
  1323. var $2,$1;
  1324. $2=self._collection();
  1325. $ctx1.sendIdx["collection"]=1;
  1326. $1=_st($2)._detect_((function(each){
  1327. return smalltalk.withContext(function($ctx2) {
  1328. return _st(each).__lt((0));
  1329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1330. $ctx1.sendIdx["detect:"]=1;
  1331. self._assert_equals_($1,(-4));
  1332. self._should_raise_((function(){
  1333. return smalltalk.withContext(function($ctx2) {
  1334. return _st(self._collection())._detect_((function(each){
  1335. return smalltalk.withContext(function($ctx3) {
  1336. return _st(each).__eq((6));
  1337. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1339. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1340. args: [],
  1341. 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",
  1342. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1343. referencedClasses: ["Error"]
  1344. }),
  1345. smalltalk.CollectionTest);
  1346. smalltalk.addMethod(
  1347. smalltalk.method({
  1348. selector: "testDo",
  1349. category: 'tests',
  1350. fn: function (){
  1351. var self=this;
  1352. var newCollection;
  1353. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1354. return smalltalk.withContext(function($ctx1) {
  1355. var $1;
  1356. newCollection=_st($OrderedCollection())._new();
  1357. $1=self._collection();
  1358. $ctx1.sendIdx["collection"]=1;
  1359. _st($1)._do_((function(each){
  1360. return smalltalk.withContext(function($ctx2) {
  1361. return _st(newCollection)._add_(each);
  1362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1363. self._assertSameContents_as_(self._collection(),newCollection);
  1364. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1365. args: [],
  1366. 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",
  1367. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1368. referencedClasses: ["OrderedCollection"]
  1369. }),
  1370. smalltalk.CollectionTest);
  1371. smalltalk.addMethod(
  1372. smalltalk.method({
  1373. selector: "testIsEmpty",
  1374. category: 'tests',
  1375. fn: function (){
  1376. var self=this;
  1377. return smalltalk.withContext(function($ctx1) {
  1378. var $1;
  1379. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1380. $ctx1.sendIdx["isEmpty"]=1;
  1381. self._assert_($1);
  1382. self._deny_(_st(self._collection())._isEmpty());
  1383. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1384. args: [],
  1385. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1386. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1387. referencedClasses: []
  1388. }),
  1389. smalltalk.CollectionTest);
  1390. smalltalk.addMethod(
  1391. smalltalk.method({
  1392. selector: "testSelect",
  1393. category: 'tests',
  1394. fn: function (){
  1395. var self=this;
  1396. var newCollection;
  1397. return smalltalk.withContext(function($ctx1) {
  1398. newCollection=[(2), (-4)];
  1399. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1400. return smalltalk.withContext(function($ctx2) {
  1401. return _st(each)._even();
  1402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1403. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1404. args: [],
  1405. 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",
  1406. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1407. referencedClasses: []
  1408. }),
  1409. smalltalk.CollectionTest);
  1410. smalltalk.addMethod(
  1411. smalltalk.method({
  1412. selector: "testSize",
  1413. category: 'tests',
  1414. fn: function (){
  1415. var self=this;
  1416. return smalltalk.withContext(function($ctx1) {
  1417. var $1;
  1418. $1=_st(_st(self._collectionClass())._new())._size();
  1419. $ctx1.sendIdx["size"]=1;
  1420. self._assert_equals_($1,(0));
  1421. $ctx1.sendIdx["assert:equals:"]=1;
  1422. self._assert_equals_(_st(self._collection())._size(),(4));
  1423. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1424. args: [],
  1425. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1426. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1427. referencedClasses: []
  1428. }),
  1429. smalltalk.CollectionTest);
  1430. smalltalk.addMethod(
  1431. smalltalk.method({
  1432. selector: "collectionClass",
  1433. category: 'accessing',
  1434. fn: function (){
  1435. var self=this;
  1436. return smalltalk.withContext(function($ctx1) {
  1437. return nil;
  1438. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1439. args: [],
  1440. source: "collectionClass\x0a\x09^ nil",
  1441. messageSends: [],
  1442. referencedClasses: []
  1443. }),
  1444. smalltalk.CollectionTest.klass);
  1445. smalltalk.addMethod(
  1446. smalltalk.method({
  1447. selector: "isAbstract",
  1448. category: 'testing',
  1449. fn: function (){
  1450. var self=this;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. $1=_st(self._collectionClass())._isNil();
  1454. return $1;
  1455. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1456. args: [],
  1457. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1458. messageSends: ["isNil", "collectionClass"],
  1459. referencedClasses: []
  1460. }),
  1461. smalltalk.CollectionTest.klass);
  1462. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1463. smalltalk.addMethod(
  1464. smalltalk.method({
  1465. selector: "testAt",
  1466. category: 'tests',
  1467. fn: function (){
  1468. var self=this;
  1469. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1470. return smalltalk.withContext(function($ctx1) {
  1471. var $2,$1;
  1472. $2=self._collection();
  1473. $ctx1.sendIdx["collection"]=1;
  1474. $1=_st($2)._at_((4));
  1475. $ctx1.sendIdx["at:"]=1;
  1476. self._assert_equals_($1,(-4));
  1477. self._should_raise_((function(){
  1478. return smalltalk.withContext(function($ctx2) {
  1479. return _st(self._collection())._at_((5));
  1480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1481. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1482. args: [],
  1483. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1484. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1485. referencedClasses: ["Error"]
  1486. }),
  1487. smalltalk.IndexableCollectionTest);
  1488. smalltalk.addMethod(
  1489. smalltalk.method({
  1490. selector: "testAtIfAbsent",
  1491. category: 'tests',
  1492. fn: function (){
  1493. var self=this;
  1494. return smalltalk.withContext(function($ctx1) {
  1495. var $2,$1;
  1496. $2=self._collection();
  1497. $ctx1.sendIdx["collection"]=1;
  1498. $1=_st($2)._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1499. return smalltalk.withContext(function($ctx2) {
  1500. return "none";
  1501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1502. self._assert_equals_($1,"none");
  1503. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1504. args: [],
  1505. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1506. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1507. referencedClasses: []
  1508. }),
  1509. smalltalk.IndexableCollectionTest);
  1510. smalltalk.addMethod(
  1511. smalltalk.method({
  1512. selector: "testContains",
  1513. category: 'tests',
  1514. fn: function (){
  1515. var self=this;
  1516. var collection;
  1517. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1518. return smalltalk.withContext(function($ctx1) {
  1519. var $2,$4,$3,$1;
  1520. collection=self._collection();
  1521. $ctx1.sendIdx["collection"]=1;
  1522. $2=self._collection();
  1523. $ctx1.sendIdx["collection"]=2;
  1524. $1=_st($2)._contains_((function(each){
  1525. return smalltalk.withContext(function($ctx2) {
  1526. $4=self._collection();
  1527. $ctx2.sendIdx["collection"]=3;
  1528. $3=_st($4)._first();
  1529. return _st(each).__eq($3);
  1530. $ctx2.sendIdx["="]=1;
  1531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1532. $ctx1.sendIdx["contains:"]=1;
  1533. self._assert_($1);
  1534. self._deny_(_st(self._collection())._contains_((function(each){
  1535. return smalltalk.withContext(function($ctx2) {
  1536. return _st(each).__eq(_st($Object())._new());
  1537. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1538. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1539. args: [],
  1540. 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 ])",
  1541. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1542. referencedClasses: ["Object"]
  1543. }),
  1544. smalltalk.IndexableCollectionTest);
  1545. smalltalk.addMethod(
  1546. smalltalk.method({
  1547. selector: "testIndexOf",
  1548. category: 'tests',
  1549. fn: function (){
  1550. var self=this;
  1551. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1552. return smalltalk.withContext(function($ctx1) {
  1553. var $2,$1,$3;
  1554. $2=self._collection();
  1555. $ctx1.sendIdx["collection"]=1;
  1556. $1=_st($2)._indexOf_((2));
  1557. $ctx1.sendIdx["indexOf:"]=1;
  1558. self._assert_equals_($1,(2));
  1559. $ctx1.sendIdx["assert:equals:"]=1;
  1560. self._should_raise_((function(){
  1561. return smalltalk.withContext(function($ctx2) {
  1562. $3=self._collection();
  1563. $ctx2.sendIdx["collection"]=2;
  1564. return _st($3)._indexOf_((999));
  1565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1566. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1567. return smalltalk.withContext(function($ctx2) {
  1568. return "sentinel";
  1569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1570. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1571. args: [],
  1572. 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'",
  1573. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1574. referencedClasses: ["Error"]
  1575. }),
  1576. smalltalk.IndexableCollectionTest);
  1577. smalltalk.addMethod(
  1578. smalltalk.method({
  1579. selector: "testWithIndexDo",
  1580. category: 'tests',
  1581. fn: function (){
  1582. var self=this;
  1583. var collection;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. collection=self._collection();
  1586. $ctx1.sendIdx["collection"]=1;
  1587. _st(self._collection())._withIndexDo_((function(each,index){
  1588. return smalltalk.withContext(function($ctx2) {
  1589. return self._assert_equals_(_st(collection)._at_(index),each);
  1590. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1591. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1592. args: [],
  1593. 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 ]",
  1594. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1595. referencedClasses: []
  1596. }),
  1597. smalltalk.IndexableCollectionTest);
  1598. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1599. smalltalk.addMethod(
  1600. smalltalk.method({
  1601. selector: "collection",
  1602. category: 'accessing',
  1603. fn: function (){
  1604. var self=this;
  1605. return smalltalk.withContext(function($ctx1) {
  1606. var $2,$3,$4,$1;
  1607. $2="b".__minus_gt((1));
  1608. $ctx1.sendIdx["->"]=1;
  1609. $3="a".__minus_gt((2));
  1610. $ctx1.sendIdx["->"]=2;
  1611. $4="c".__minus_gt((3));
  1612. $ctx1.sendIdx["->"]=3;
  1613. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  1614. return $1;
  1615. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1616. args: [],
  1617. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1618. messageSends: ["->"],
  1619. referencedClasses: []
  1620. }),
  1621. smalltalk.HashedCollectionTest);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "collectionWithDuplicates",
  1625. category: 'accessing',
  1626. fn: function (){
  1627. var self=this;
  1628. return smalltalk.withContext(function($ctx1) {
  1629. var $2,$3,$4,$5,$6,$7,$1;
  1630. $2="b".__minus_gt((1));
  1631. $ctx1.sendIdx["->"]=1;
  1632. $3="a".__minus_gt((2));
  1633. $ctx1.sendIdx["->"]=2;
  1634. $4="c".__minus_gt((3));
  1635. $ctx1.sendIdx["->"]=3;
  1636. $5="d".__minus_gt((-4));
  1637. $ctx1.sendIdx["->"]=4;
  1638. $6="e".__minus_gt((1));
  1639. $ctx1.sendIdx["->"]=5;
  1640. $7="f".__minus_gt((2));
  1641. $ctx1.sendIdx["->"]=6;
  1642. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  1643. return $1;
  1644. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1645. args: [],
  1646. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1647. messageSends: ["->"],
  1648. referencedClasses: []
  1649. }),
  1650. smalltalk.HashedCollectionTest);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "testAsDictionary",
  1654. category: 'tests',
  1655. fn: function (){
  1656. var self=this;
  1657. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1658. return smalltalk.withContext(function($ctx1) {
  1659. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1660. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1661. args: [],
  1662. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1663. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1664. referencedClasses: ["Dictionary"]
  1665. }),
  1666. smalltalk.HashedCollectionTest);
  1667. smalltalk.addMethod(
  1668. smalltalk.method({
  1669. selector: "testAt",
  1670. category: 'tests',
  1671. fn: function (){
  1672. var self=this;
  1673. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1674. return smalltalk.withContext(function($ctx1) {
  1675. var $2,$1;
  1676. $2=self._collection();
  1677. $ctx1.sendIdx["collection"]=1;
  1678. $1=_st($2)._at_("a");
  1679. $ctx1.sendIdx["at:"]=1;
  1680. self._assert_equals_($1,(2));
  1681. self._should_raise_((function(){
  1682. return smalltalk.withContext(function($ctx2) {
  1683. return _st(self._collection())._at_((5));
  1684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1685. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1686. args: [],
  1687. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1688. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1689. referencedClasses: ["Error"]
  1690. }),
  1691. smalltalk.HashedCollectionTest);
  1692. smalltalk.addMethod(
  1693. smalltalk.method({
  1694. selector: "testContains",
  1695. category: 'tests',
  1696. fn: function (){
  1697. var self=this;
  1698. var collection;
  1699. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1700. return smalltalk.withContext(function($ctx1) {
  1701. var $2,$5,$4,$3,$1;
  1702. collection=self._collection();
  1703. $ctx1.sendIdx["collection"]=1;
  1704. $2=self._collection();
  1705. $ctx1.sendIdx["collection"]=2;
  1706. $1=_st($2)._contains_((function(each){
  1707. return smalltalk.withContext(function($ctx2) {
  1708. $5=self._collection();
  1709. $ctx2.sendIdx["collection"]=3;
  1710. $4=_st($5)._values();
  1711. $3=_st($4)._first();
  1712. return _st(each).__eq($3);
  1713. $ctx2.sendIdx["="]=1;
  1714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1715. $ctx1.sendIdx["contains:"]=1;
  1716. self._assert_($1);
  1717. self._deny_(_st(self._collection())._contains_((function(each){
  1718. return smalltalk.withContext(function($ctx2) {
  1719. return _st(each).__eq(_st($Object())._new());
  1720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1721. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1722. args: [],
  1723. 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 ])",
  1724. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1725. referencedClasses: ["Object"]
  1726. }),
  1727. smalltalk.HashedCollectionTest);
  1728. smalltalk.addMethod(
  1729. smalltalk.method({
  1730. selector: "testFrom",
  1731. category: 'tests',
  1732. fn: function (){
  1733. var self=this;
  1734. var associations;
  1735. return smalltalk.withContext(function($ctx1) {
  1736. var $1,$2,$3,$5,$4;
  1737. $1="a".__minus_gt((1));
  1738. $ctx1.sendIdx["->"]=1;
  1739. $2="b".__minus_gt((2));
  1740. $ctx1.sendIdx["->"]=2;
  1741. associations=[$1,$2];
  1742. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1743. $5="a".__minus_gt((1));
  1744. $ctx1.sendIdx["->"]=3;
  1745. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  1746. self._assertSameContents_as_($3,$4);
  1747. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1748. args: [],
  1749. 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 }.",
  1750. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1751. referencedClasses: []
  1752. }),
  1753. smalltalk.HashedCollectionTest);
  1754. smalltalk.addMethod(
  1755. smalltalk.method({
  1756. selector: "testIndexOf",
  1757. category: 'tests',
  1758. fn: function (){
  1759. var self=this;
  1760. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1761. return smalltalk.withContext(function($ctx1) {
  1762. var $2,$1,$3;
  1763. $2=self._collection();
  1764. $ctx1.sendIdx["collection"]=1;
  1765. $1=_st($2)._indexOf_((2));
  1766. $ctx1.sendIdx["indexOf:"]=1;
  1767. self._assert_equals_($1,"a");
  1768. $ctx1.sendIdx["assert:equals:"]=1;
  1769. self._should_raise_((function(){
  1770. return smalltalk.withContext(function($ctx2) {
  1771. $3=self._collection();
  1772. $ctx2.sendIdx["collection"]=2;
  1773. return _st($3)._indexOf_((999));
  1774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1775. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1776. return smalltalk.withContext(function($ctx2) {
  1777. return "sentinel";
  1778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1779. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1780. args: [],
  1781. 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'",
  1782. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1783. referencedClasses: ["Error"]
  1784. }),
  1785. smalltalk.HashedCollectionTest);
  1786. smalltalk.addMethod(
  1787. smalltalk.method({
  1788. selector: "testNewFromPairs",
  1789. category: 'tests',
  1790. fn: function (){
  1791. var self=this;
  1792. var flattenedAssociations;
  1793. return smalltalk.withContext(function($ctx1) {
  1794. var $1,$3,$2;
  1795. flattenedAssociations=["a",(1),"b",(2)];
  1796. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  1797. $3="a".__minus_gt((1));
  1798. $ctx1.sendIdx["->"]=1;
  1799. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  1800. self._assertSameContents_as_($1,$2);
  1801. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1802. args: [],
  1803. 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 }.",
  1804. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1805. referencedClasses: []
  1806. }),
  1807. smalltalk.HashedCollectionTest);
  1808. smalltalk.addMethod(
  1809. smalltalk.method({
  1810. selector: "collectionClass",
  1811. category: 'accessing',
  1812. fn: function (){
  1813. var self=this;
  1814. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1815. return smalltalk.withContext(function($ctx1) {
  1816. return $HashedCollection();
  1817. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1818. args: [],
  1819. source: "collectionClass\x0a\x09^ HashedCollection",
  1820. messageSends: [],
  1821. referencedClasses: ["HashedCollection"]
  1822. }),
  1823. smalltalk.HashedCollectionTest.klass);
  1824. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1825. smalltalk.addMethod(
  1826. smalltalk.method({
  1827. selector: "collection",
  1828. category: 'accessing',
  1829. fn: function (){
  1830. var self=this;
  1831. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1832. return smalltalk.withContext(function($ctx1) {
  1833. var $2,$3,$1;
  1834. $2=_st($Dictionary())._new();
  1835. _st($2)._at_put_((1),(1));
  1836. $ctx1.sendIdx["at:put:"]=1;
  1837. _st($2)._at_put_("a",(2));
  1838. $ctx1.sendIdx["at:put:"]=2;
  1839. _st($2)._at_put_(true,(3));
  1840. $ctx1.sendIdx["at:put:"]=3;
  1841. _st($2)._at_put_((4),(-4));
  1842. $3=_st($2)._yourself();
  1843. $1=$3;
  1844. return $1;
  1845. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1846. args: [],
  1847. 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",
  1848. messageSends: ["at:put:", "new", "yourself"],
  1849. referencedClasses: ["Dictionary"]
  1850. }),
  1851. smalltalk.DictionaryTest);
  1852. smalltalk.addMethod(
  1853. smalltalk.method({
  1854. selector: "collectionWithDuplicates",
  1855. category: 'accessing',
  1856. fn: function (){
  1857. var self=this;
  1858. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1859. return smalltalk.withContext(function($ctx1) {
  1860. var $2,$3,$1;
  1861. $2=_st($Dictionary())._new();
  1862. _st($2)._at_put_((1),(1));
  1863. $ctx1.sendIdx["at:put:"]=1;
  1864. _st($2)._at_put_("a",(2));
  1865. $ctx1.sendIdx["at:put:"]=2;
  1866. _st($2)._at_put_(true,(3));
  1867. $ctx1.sendIdx["at:put:"]=3;
  1868. _st($2)._at_put_((4),(-4));
  1869. $ctx1.sendIdx["at:put:"]=4;
  1870. _st($2)._at_put_("b",(1));
  1871. $ctx1.sendIdx["at:put:"]=5;
  1872. _st($2)._at_put_((3),(3));
  1873. $ctx1.sendIdx["at:put:"]=6;
  1874. _st($2)._at_put_(false,(12));
  1875. $3=_st($2)._yourself();
  1876. $1=$3;
  1877. return $1;
  1878. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1879. args: [],
  1880. 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",
  1881. messageSends: ["at:put:", "new", "yourself"],
  1882. referencedClasses: ["Dictionary"]
  1883. }),
  1884. smalltalk.DictionaryTest);
  1885. smalltalk.addMethod(
  1886. smalltalk.method({
  1887. selector: "testAccessing",
  1888. category: 'tests',
  1889. fn: function (){
  1890. var self=this;
  1891. var d;
  1892. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1893. return smalltalk.withContext(function($ctx1) {
  1894. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  1895. d=_st($Dictionary())._new();
  1896. _st(d)._at_put_("hello","world");
  1897. $ctx1.sendIdx["at:put:"]=1;
  1898. $1=_st(d)._at_("hello");
  1899. $ctx1.sendIdx["at:"]=1;
  1900. self._assert_equals_($1,"world");
  1901. $ctx1.sendIdx["assert:equals:"]=1;
  1902. $2=_st(d)._at_ifAbsent_("hello",(function(){
  1903. return smalltalk.withContext(function($ctx2) {
  1904. return nil;
  1905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1906. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1907. self._assert_equals_($2,"world");
  1908. $ctx1.sendIdx["assert:equals:"]=2;
  1909. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1910. return smalltalk.withContext(function($ctx2) {
  1911. return nil;
  1912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  1913. $ctx1.sendIdx["deny:"]=1;
  1914. $3=_st(d)._includesKey_("hello");
  1915. $ctx1.sendIdx["includesKey:"]=1;
  1916. self._assert_($3);
  1917. $ctx1.sendIdx["assert:"]=1;
  1918. $4=_st(d)._includesKey_("foo");
  1919. $ctx1.sendIdx["includesKey:"]=2;
  1920. self._deny_($4);
  1921. $ctx1.sendIdx["deny:"]=2;
  1922. _st(d)._at_put_((1),(2));
  1923. $ctx1.sendIdx["at:put:"]=2;
  1924. $5=_st(d)._at_((1));
  1925. $ctx1.sendIdx["at:"]=2;
  1926. self._assert_equals_($5,(2));
  1927. $ctx1.sendIdx["assert:equals:"]=3;
  1928. $6=d;
  1929. $7=(1).__at((3));
  1930. $ctx1.sendIdx["@"]=1;
  1931. _st($6)._at_put_($7,(3));
  1932. $9=d;
  1933. $10=(1).__at((3));
  1934. $ctx1.sendIdx["@"]=2;
  1935. $8=_st($9)._at_($10);
  1936. self._assert_equals_($8,(3));
  1937. $12=d;
  1938. $13=(1).__at((3));
  1939. $ctx1.sendIdx["@"]=3;
  1940. $11=_st($12)._includesKey_($13);
  1941. $ctx1.sendIdx["includesKey:"]=3;
  1942. self._assert_($11);
  1943. self._deny_(_st(d)._includesKey_((3).__at((1))));
  1944. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1945. args: [],
  1946. 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)",
  1947. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1948. referencedClasses: ["Dictionary"]
  1949. }),
  1950. smalltalk.DictionaryTest);
  1951. smalltalk.addMethod(
  1952. smalltalk.method({
  1953. selector: "testAsHashedCollection",
  1954. category: 'tests',
  1955. fn: function (){
  1956. var self=this;
  1957. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1958. return smalltalk.withContext(function($ctx1) {
  1959. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  1960. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  1961. args: [],
  1962. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  1963. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  1964. referencedClasses: ["HashedCollection"]
  1965. }),
  1966. smalltalk.DictionaryTest);
  1967. smalltalk.addMethod(
  1968. smalltalk.method({
  1969. selector: "testDynamicDictionaries",
  1970. category: 'tests',
  1971. fn: function (){
  1972. var self=this;
  1973. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1974. return smalltalk.withContext(function($ctx1) {
  1975. var $3,$2,$1;
  1976. $3="hello".__minus_gt((1));
  1977. $ctx1.sendIdx["->"]=1;
  1978. $2=smalltalk.HashedCollection._from_([$3]);
  1979. $1=_st($2)._asDictionary();
  1980. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  1981. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1982. args: [],
  1983. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1984. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1985. referencedClasses: ["Dictionary"]
  1986. }),
  1987. smalltalk.DictionaryTest);
  1988. smalltalk.addMethod(
  1989. smalltalk.method({
  1990. selector: "testEquality",
  1991. category: 'tests',
  1992. fn: function (){
  1993. var self=this;
  1994. var d1,d2;
  1995. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1996. return smalltalk.withContext(function($ctx1) {
  1997. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  1998. $2=_st($Dictionary())._new();
  1999. $ctx1.sendIdx["new"]=1;
  2000. $3=_st($Dictionary())._new();
  2001. $ctx1.sendIdx["new"]=2;
  2002. $1=_st($2).__eq($3);
  2003. $ctx1.sendIdx["="]=1;
  2004. self._assert_($1);
  2005. $ctx1.sendIdx["assert:"]=1;
  2006. $4=_st($Dictionary())._new();
  2007. $ctx1.sendIdx["new"]=3;
  2008. _st($4)._at_put_((1),(2));
  2009. $ctx1.sendIdx["at:put:"]=1;
  2010. $5=_st($4)._yourself();
  2011. $ctx1.sendIdx["yourself"]=1;
  2012. d1=$5;
  2013. $6=_st($Dictionary())._new();
  2014. $ctx1.sendIdx["new"]=4;
  2015. _st($6)._at_put_((1),(2));
  2016. $ctx1.sendIdx["at:put:"]=2;
  2017. $7=_st($6)._yourself();
  2018. $ctx1.sendIdx["yourself"]=2;
  2019. d2=$7;
  2020. $8=_st(d1).__eq(d2);
  2021. $ctx1.sendIdx["="]=2;
  2022. self._assert_($8);
  2023. $9=_st($Dictionary())._new();
  2024. $ctx1.sendIdx["new"]=5;
  2025. _st($9)._at_put_((1),(3));
  2026. $ctx1.sendIdx["at:put:"]=3;
  2027. $10=_st($9)._yourself();
  2028. $ctx1.sendIdx["yourself"]=3;
  2029. d2=$10;
  2030. $11=_st(d1).__eq(d2);
  2031. $ctx1.sendIdx["="]=3;
  2032. self._deny_($11);
  2033. $ctx1.sendIdx["deny:"]=1;
  2034. $12=_st($Dictionary())._new();
  2035. $ctx1.sendIdx["new"]=6;
  2036. _st($12)._at_put_((2),(2));
  2037. $ctx1.sendIdx["at:put:"]=4;
  2038. $13=_st($12)._yourself();
  2039. $ctx1.sendIdx["yourself"]=4;
  2040. d2=$13;
  2041. $14=_st(d1).__eq(d2);
  2042. $ctx1.sendIdx["="]=4;
  2043. self._deny_($14);
  2044. $ctx1.sendIdx["deny:"]=2;
  2045. $15=_st($Dictionary())._new();
  2046. _st($15)._at_put_((1),(2));
  2047. $ctx1.sendIdx["at:put:"]=5;
  2048. _st($15)._at_put_((3),(4));
  2049. $16=_st($15)._yourself();
  2050. d2=$16;
  2051. self._deny_(_st(d1).__eq(d2));
  2052. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2053. args: [],
  2054. 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.",
  2055. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2056. referencedClasses: ["Dictionary"]
  2057. }),
  2058. smalltalk.DictionaryTest);
  2059. smalltalk.addMethod(
  2060. smalltalk.method({
  2061. selector: "testIfAbsent",
  2062. category: 'tests',
  2063. fn: function (){
  2064. var self=this;
  2065. var d,visited;
  2066. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2067. return smalltalk.withContext(function($ctx1) {
  2068. visited=false;
  2069. d=_st($Dictionary())._new();
  2070. _st(d)._at_ifAbsent_("hello",(function(){
  2071. return smalltalk.withContext(function($ctx2) {
  2072. visited=true;
  2073. return visited;
  2074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2075. self._assert_(visited);
  2076. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2077. args: [],
  2078. 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.",
  2079. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2080. referencedClasses: ["Dictionary"]
  2081. }),
  2082. smalltalk.DictionaryTest);
  2083. smalltalk.addMethod(
  2084. smalltalk.method({
  2085. selector: "testIfPresent",
  2086. category: 'tests',
  2087. fn: function (){
  2088. var self=this;
  2089. var d,visited,absent;
  2090. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2091. return smalltalk.withContext(function($ctx1) {
  2092. visited=false;
  2093. d=_st($Dictionary())._new();
  2094. _st(d)._at_put_("hello","world");
  2095. _st(d)._at_ifPresent_("hello",(function(value){
  2096. return smalltalk.withContext(function($ctx2) {
  2097. visited=value;
  2098. return visited;
  2099. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2100. $ctx1.sendIdx["at:ifPresent:"]=1;
  2101. self._assert_equals_(visited,"world");
  2102. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2103. return smalltalk.withContext(function($ctx2) {
  2104. visited=value;
  2105. return visited;
  2106. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2107. self._assert_(_st(absent)._isNil());
  2108. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2109. args: [],
  2110. 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.",
  2111. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2112. referencedClasses: ["Dictionary"]
  2113. }),
  2114. smalltalk.DictionaryTest);
  2115. smalltalk.addMethod(
  2116. smalltalk.method({
  2117. selector: "testIfPresentIfAbsent",
  2118. category: 'tests',
  2119. fn: function (){
  2120. var self=this;
  2121. var d,visited;
  2122. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2123. return smalltalk.withContext(function($ctx1) {
  2124. visited=false;
  2125. d=_st($Dictionary())._new();
  2126. _st(d)._at_put_("hello","world");
  2127. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2128. return smalltalk.withContext(function($ctx2) {
  2129. visited=value;
  2130. return visited;
  2131. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2132. return smalltalk.withContext(function($ctx2) {
  2133. visited=true;
  2134. return visited;
  2135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2136. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2137. self._assert_equals_(visited,"world");
  2138. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2139. return smalltalk.withContext(function($ctx2) {
  2140. visited=value;
  2141. return visited;
  2142. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2143. return smalltalk.withContext(function($ctx2) {
  2144. visited=true;
  2145. return visited;
  2146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2147. self._assert_(visited);
  2148. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2149. args: [],
  2150. 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.",
  2151. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2152. referencedClasses: ["Dictionary"]
  2153. }),
  2154. smalltalk.DictionaryTest);
  2155. smalltalk.addMethod(
  2156. smalltalk.method({
  2157. selector: "testKeys",
  2158. category: 'tests',
  2159. fn: function (){
  2160. var self=this;
  2161. var d;
  2162. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2163. return smalltalk.withContext(function($ctx1) {
  2164. d=_st($Dictionary())._new();
  2165. _st(d)._at_put_((1),(2));
  2166. $ctx1.sendIdx["at:put:"]=1;
  2167. _st(d)._at_put_((2),(3));
  2168. $ctx1.sendIdx["at:put:"]=2;
  2169. _st(d)._at_put_((3),(4));
  2170. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2171. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2172. args: [],
  2173. 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)",
  2174. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2175. referencedClasses: ["Dictionary"]
  2176. }),
  2177. smalltalk.DictionaryTest);
  2178. smalltalk.addMethod(
  2179. smalltalk.method({
  2180. selector: "testPointKey",
  2181. category: 'tests',
  2182. fn: function (){
  2183. var self=this;
  2184. var d;
  2185. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2186. return smalltalk.withContext(function($ctx1) {
  2187. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2188. d=_st($Dictionary())._new();
  2189. $1=d;
  2190. $2=(1).__at((1));
  2191. $ctx1.sendIdx["@"]=1;
  2192. _st($1)._at_put_($2,"foo");
  2193. $ctx1.sendIdx["at:put:"]=1;
  2194. $4=d;
  2195. $5=(1).__at((1));
  2196. $ctx1.sendIdx["@"]=2;
  2197. $3=_st($4)._at_($5);
  2198. $ctx1.sendIdx["at:"]=1;
  2199. self._assert_equals_($3,"foo");
  2200. $ctx1.sendIdx["assert:equals:"]=1;
  2201. $6=d;
  2202. $7=(1).__at((1));
  2203. $ctx1.sendIdx["@"]=3;
  2204. _st($6)._at_put_($7,"bar");
  2205. $9=d;
  2206. $10=(1).__at((1));
  2207. $ctx1.sendIdx["@"]=4;
  2208. $8=_st($9)._at_($10);
  2209. self._assert_equals_($8,"bar");
  2210. $ctx1.sendIdx["assert:equals:"]=2;
  2211. $11=d;
  2212. $12=(1).__at((1));
  2213. $ctx1.sendIdx["@"]=5;
  2214. _st($11)._removeKey_($12);
  2215. $14=d;
  2216. $15=(1).__at((1));
  2217. $ctx1.sendIdx["@"]=6;
  2218. $13=_st($14)._at_ifAbsent_($15,(function(){
  2219. return smalltalk.withContext(function($ctx2) {
  2220. return "baz";
  2221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2222. self._assert_equals_($13,"baz");
  2223. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2224. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2225. args: [],
  2226. 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)",
  2227. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2228. referencedClasses: ["Dictionary"]
  2229. }),
  2230. smalltalk.DictionaryTest);
  2231. smalltalk.addMethod(
  2232. smalltalk.method({
  2233. selector: "testPrintString",
  2234. category: 'tests',
  2235. fn: function (){
  2236. var self=this;
  2237. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2238. return smalltalk.withContext(function($ctx1) {
  2239. var $2,$3,$1;
  2240. $2=_st($Dictionary())._new();
  2241. _st($2)._at_put_("firstname","James");
  2242. $ctx1.sendIdx["at:put:"]=1;
  2243. _st($2)._at_put_("lastname","Bond");
  2244. $3=_st($2)._printString();
  2245. $1=$3;
  2246. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2247. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2248. args: [],
  2249. 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'')'",
  2250. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2251. referencedClasses: ["Dictionary"]
  2252. }),
  2253. smalltalk.DictionaryTest);
  2254. smalltalk.addMethod(
  2255. smalltalk.method({
  2256. selector: "testRemoveKey",
  2257. category: 'tests',
  2258. fn: function (){
  2259. var self=this;
  2260. var d,key;
  2261. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2262. return smalltalk.withContext(function($ctx1) {
  2263. var $1;
  2264. d=_st($Dictionary())._new();
  2265. _st(d)._at_put_((1),(2));
  2266. $ctx1.sendIdx["at:put:"]=1;
  2267. _st(d)._at_put_((2),(3));
  2268. $ctx1.sendIdx["at:put:"]=2;
  2269. _st(d)._at_put_((3),(4));
  2270. key=(2);
  2271. $1=_st(d)._keys();
  2272. $ctx1.sendIdx["keys"]=1;
  2273. self._assert_equals_($1,[(1), (2), (3)]);
  2274. $ctx1.sendIdx["assert:equals:"]=1;
  2275. _st(d)._removeKey_(key);
  2276. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  2277. $ctx1.sendIdx["assert:equals:"]=2;
  2278. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2279. self._deny_(_st(d)._includesKey_((2)));
  2280. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2281. args: [],
  2282. 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)",
  2283. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2284. referencedClasses: ["Dictionary"]
  2285. }),
  2286. smalltalk.DictionaryTest);
  2287. smalltalk.addMethod(
  2288. smalltalk.method({
  2289. selector: "testRemoveKeyIfAbsent",
  2290. category: 'tests',
  2291. fn: function (){
  2292. var self=this;
  2293. var d,key;
  2294. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2295. return smalltalk.withContext(function($ctx1) {
  2296. var $1;
  2297. d=_st($Dictionary())._new();
  2298. _st(d)._at_put_((1),(2));
  2299. $ctx1.sendIdx["at:put:"]=1;
  2300. _st(d)._at_put_((2),(3));
  2301. $ctx1.sendIdx["at:put:"]=2;
  2302. _st(d)._at_put_((3),(4));
  2303. key=(2);
  2304. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2305. $ctx1.sendIdx["assert:equals:"]=1;
  2306. key=(3);
  2307. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2308. return smalltalk.withContext(function($ctx2) {
  2309. return (42);
  2310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2311. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2312. self._assert_equals_($1,(4));
  2313. $ctx1.sendIdx["assert:equals:"]=2;
  2314. key="why";
  2315. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  2316. return smalltalk.withContext(function($ctx2) {
  2317. return (42);
  2318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  2319. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2320. args: [],
  2321. 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.",
  2322. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2323. referencedClasses: ["Dictionary"]
  2324. }),
  2325. smalltalk.DictionaryTest);
  2326. smalltalk.addMethod(
  2327. smalltalk.method({
  2328. selector: "testSize",
  2329. category: 'tests',
  2330. fn: function (){
  2331. var self=this;
  2332. var d;
  2333. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2334. return smalltalk.withContext(function($ctx1) {
  2335. var $1,$2;
  2336. d=_st($Dictionary())._new();
  2337. $1=_st(d)._size();
  2338. $ctx1.sendIdx["size"]=1;
  2339. self._assert_equals_($1,(0));
  2340. $ctx1.sendIdx["assert:equals:"]=1;
  2341. _st(d)._at_put_((1),(2));
  2342. $ctx1.sendIdx["at:put:"]=1;
  2343. $2=_st(d)._size();
  2344. $ctx1.sendIdx["size"]=2;
  2345. self._assert_equals_($2,(1));
  2346. $ctx1.sendIdx["assert:equals:"]=2;
  2347. _st(d)._at_put_((2),(3));
  2348. self._assert_equals_(_st(d)._size(),(2));
  2349. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2350. args: [],
  2351. 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.",
  2352. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2353. referencedClasses: ["Dictionary"]
  2354. }),
  2355. smalltalk.DictionaryTest);
  2356. smalltalk.addMethod(
  2357. smalltalk.method({
  2358. selector: "testValues",
  2359. category: 'tests',
  2360. fn: function (){
  2361. var self=this;
  2362. var d;
  2363. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2364. return smalltalk.withContext(function($ctx1) {
  2365. d=_st($Dictionary())._new();
  2366. _st(d)._at_put_((1),(2));
  2367. $ctx1.sendIdx["at:put:"]=1;
  2368. _st(d)._at_put_((2),(3));
  2369. $ctx1.sendIdx["at:put:"]=2;
  2370. _st(d)._at_put_((3),(4));
  2371. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2372. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2373. args: [],
  2374. 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)",
  2375. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2376. referencedClasses: ["Dictionary"]
  2377. }),
  2378. smalltalk.DictionaryTest);
  2379. smalltalk.addMethod(
  2380. smalltalk.method({
  2381. selector: "collectionClass",
  2382. category: 'accessing',
  2383. fn: function (){
  2384. var self=this;
  2385. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2386. return smalltalk.withContext(function($ctx1) {
  2387. return $Dictionary();
  2388. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2389. args: [],
  2390. source: "collectionClass\x0a\x09^ Dictionary",
  2391. messageSends: [],
  2392. referencedClasses: ["Dictionary"]
  2393. }),
  2394. smalltalk.DictionaryTest.klass);
  2395. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2396. smalltalk.addMethod(
  2397. smalltalk.method({
  2398. selector: "testFirst",
  2399. category: 'tests',
  2400. fn: function (){
  2401. var self=this;
  2402. return smalltalk.withContext(function($ctx1) {
  2403. var $2,$1;
  2404. $2=self._collection();
  2405. $ctx1.sendIdx["collection"]=1;
  2406. $1=_st($2)._first();
  2407. self._assert_equals_($1,_st(self._collection())._at_((1)));
  2408. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2409. args: [],
  2410. source: "testFirst\x0a\x09self assert: (self collection first) equals: (self collection at: 1)",
  2411. messageSends: ["assert:equals:", "first", "collection", "at:"],
  2412. referencedClasses: []
  2413. }),
  2414. smalltalk.SequenceableCollectionTest);
  2415. smalltalk.addMethod(
  2416. smalltalk.method({
  2417. selector: "testFourth",
  2418. category: 'tests',
  2419. fn: function (){
  2420. var self=this;
  2421. return smalltalk.withContext(function($ctx1) {
  2422. var $2,$1;
  2423. $2=self._collection();
  2424. $ctx1.sendIdx["collection"]=1;
  2425. $1=_st($2)._fourth();
  2426. self._assert_equals_($1,_st(self._collection())._at_((4)));
  2427. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2428. args: [],
  2429. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2430. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2431. referencedClasses: []
  2432. }),
  2433. smalltalk.SequenceableCollectionTest);
  2434. smalltalk.addMethod(
  2435. smalltalk.method({
  2436. selector: "testLast",
  2437. category: 'tests',
  2438. fn: function (){
  2439. var self=this;
  2440. return smalltalk.withContext(function($ctx1) {
  2441. var $2,$1,$4,$3;
  2442. $2=self._collection();
  2443. $ctx1.sendIdx["collection"]=1;
  2444. $1=_st($2)._last();
  2445. $4=self._collection();
  2446. $ctx1.sendIdx["collection"]=2;
  2447. $3=_st($4)._at_(_st(self._collection())._size());
  2448. self._assert_equals_($1,$3);
  2449. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2450. args: [],
  2451. source: "testLast\x0a\x09self assert: (self collection last) equals: (self collection at: self collection size)",
  2452. messageSends: ["assert:equals:", "last", "collection", "at:", "size"],
  2453. referencedClasses: []
  2454. }),
  2455. smalltalk.SequenceableCollectionTest);
  2456. smalltalk.addMethod(
  2457. smalltalk.method({
  2458. selector: "testSecond",
  2459. category: 'tests',
  2460. fn: function (){
  2461. var self=this;
  2462. return smalltalk.withContext(function($ctx1) {
  2463. var $2,$1;
  2464. $2=self._collection();
  2465. $ctx1.sendIdx["collection"]=1;
  2466. $1=_st($2)._second();
  2467. self._assert_equals_($1,_st(self._collection())._at_((2)));
  2468. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2469. args: [],
  2470. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2471. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2472. referencedClasses: []
  2473. }),
  2474. smalltalk.SequenceableCollectionTest);
  2475. smalltalk.addMethod(
  2476. smalltalk.method({
  2477. selector: "testThird",
  2478. category: 'tests',
  2479. fn: function (){
  2480. var self=this;
  2481. return smalltalk.withContext(function($ctx1) {
  2482. var $2,$1;
  2483. $2=self._collection();
  2484. $ctx1.sendIdx["collection"]=1;
  2485. $1=_st($2)._third();
  2486. self._assert_equals_($1,_st(self._collection())._at_((3)));
  2487. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2488. args: [],
  2489. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2490. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2491. referencedClasses: []
  2492. }),
  2493. smalltalk.SequenceableCollectionTest);
  2494. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2495. smalltalk.addMethod(
  2496. smalltalk.method({
  2497. selector: "testAdd",
  2498. category: 'tests',
  2499. fn: function (){
  2500. var self=this;
  2501. var array;
  2502. return smalltalk.withContext(function($ctx1) {
  2503. array=self._collection();
  2504. _st(array)._add_((6));
  2505. self._assert_equals_(_st(array)._last(),(6));
  2506. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2507. args: [],
  2508. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  2509. messageSends: ["collection", "add:", "assert:equals:", "last"],
  2510. referencedClasses: []
  2511. }),
  2512. smalltalk.ArrayTest);
  2513. smalltalk.addMethod(
  2514. smalltalk.method({
  2515. selector: "testAddFirst",
  2516. category: 'tests',
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.withContext(function($ctx1) {
  2520. var $1,$2;
  2521. $1=self._collection();
  2522. _st($1)._addFirst_((0));
  2523. $2=_st($1)._yourself();
  2524. self._assert_equals_(_st($2)._first(),(0));
  2525. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2526. args: [],
  2527. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  2528. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  2529. referencedClasses: []
  2530. }),
  2531. smalltalk.ArrayTest);
  2532. smalltalk.addMethod(
  2533. smalltalk.method({
  2534. selector: "testAtIfAbsent",
  2535. category: 'tests',
  2536. fn: function (){
  2537. var self=this;
  2538. var array;
  2539. return smalltalk.withContext(function($ctx1) {
  2540. var $1,$2,$3,$4;
  2541. array=["hello", "world"];
  2542. $1=_st(array)._at_((1));
  2543. $ctx1.sendIdx["at:"]=1;
  2544. self._assert_equals_($1,"hello");
  2545. $ctx1.sendIdx["assert:equals:"]=1;
  2546. self._assert_equals_(_st(array)._at_((2)),"world");
  2547. $ctx1.sendIdx["assert:equals:"]=2;
  2548. $2=_st(array)._at_ifAbsent_((2),(function(){
  2549. return smalltalk.withContext(function($ctx2) {
  2550. return "not found";
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2552. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2553. self._assert_equals_($2,"world");
  2554. $ctx1.sendIdx["assert:equals:"]=3;
  2555. $3=_st(array)._at_ifAbsent_((0),(function(){
  2556. return smalltalk.withContext(function($ctx2) {
  2557. return "not found";
  2558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2559. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2560. self._assert_equals_($3,"not found");
  2561. $ctx1.sendIdx["assert:equals:"]=4;
  2562. $4=_st(array)._at_ifAbsent_((-10),(function(){
  2563. return smalltalk.withContext(function($ctx2) {
  2564. return "not found";
  2565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2566. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2567. self._assert_equals_($4,"not found");
  2568. $ctx1.sendIdx["assert:equals:"]=5;
  2569. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  2570. return smalltalk.withContext(function($ctx2) {
  2571. return "not found";
  2572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"not found");
  2573. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2574. args: [],
  2575. 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'.",
  2576. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2577. referencedClasses: []
  2578. }),
  2579. smalltalk.ArrayTest);
  2580. smalltalk.addMethod(
  2581. smalltalk.method({
  2582. selector: "testFirstN",
  2583. category: 'tests',
  2584. fn: function (){
  2585. var self=this;
  2586. return smalltalk.withContext(function($ctx1) {
  2587. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2588. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2589. args: [],
  2590. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2591. messageSends: ["assert:equals:", "first:"],
  2592. referencedClasses: []
  2593. }),
  2594. smalltalk.ArrayTest);
  2595. smalltalk.addMethod(
  2596. smalltalk.method({
  2597. selector: "testIfEmpty",
  2598. category: 'tests',
  2599. fn: function (){
  2600. var self=this;
  2601. return smalltalk.withContext(function($ctx1) {
  2602. self._assert_equals_(""._ifEmpty_((function(){
  2603. return smalltalk.withContext(function($ctx2) {
  2604. return "zork";
  2605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2606. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2607. args: [],
  2608. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: [ 'zork' ] ) equals: 'zork'",
  2609. messageSends: ["assert:equals:", "ifEmpty:"],
  2610. referencedClasses: []
  2611. }),
  2612. smalltalk.ArrayTest);
  2613. smalltalk.addMethod(
  2614. smalltalk.method({
  2615. selector: "testPrintString",
  2616. category: 'tests',
  2617. fn: function (){
  2618. var self=this;
  2619. var array;
  2620. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2621. return smalltalk.withContext(function($ctx1) {
  2622. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  2623. array=_st($Array())._new();
  2624. $1=_st(array)._printString();
  2625. $ctx1.sendIdx["printString"]=1;
  2626. self._assert_equals_($1,"an Array ()");
  2627. $ctx1.sendIdx["assert:equals:"]=1;
  2628. $2=array;
  2629. _st($2)._add_((1));
  2630. $ctx1.sendIdx["add:"]=1;
  2631. $3=_st($2)._add_((3));
  2632. $ctx1.sendIdx["add:"]=2;
  2633. $4=_st(array)._printString();
  2634. $ctx1.sendIdx["printString"]=2;
  2635. self._assert_equals_($4,"an Array (1 3)");
  2636. $ctx1.sendIdx["assert:equals:"]=2;
  2637. _st(array)._add_("foo");
  2638. $5=_st(array)._printString();
  2639. $ctx1.sendIdx["printString"]=3;
  2640. self._assert_equals_($5,"an Array (1 3 'foo')");
  2641. $ctx1.sendIdx["assert:equals:"]=3;
  2642. $6=array;
  2643. _st($6)._remove_((1));
  2644. $ctx1.sendIdx["remove:"]=1;
  2645. $7=_st($6)._remove_((3));
  2646. $8=_st(array)._printString();
  2647. $ctx1.sendIdx["printString"]=4;
  2648. self._assert_equals_($8,"an Array ('foo')");
  2649. $ctx1.sendIdx["assert:equals:"]=4;
  2650. _st(array)._addLast_((3));
  2651. $ctx1.sendIdx["addLast:"]=1;
  2652. $9=_st(array)._printString();
  2653. $ctx1.sendIdx["printString"]=5;
  2654. self._assert_equals_($9,"an Array ('foo' 3)");
  2655. $ctx1.sendIdx["assert:equals:"]=5;
  2656. _st(array)._addLast_((3));
  2657. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  2658. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2659. args: [],
  2660. 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)'.",
  2661. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2662. referencedClasses: ["Array"]
  2663. }),
  2664. smalltalk.ArrayTest);
  2665. smalltalk.addMethod(
  2666. smalltalk.method({
  2667. selector: "testRemove",
  2668. category: 'tests',
  2669. fn: function (){
  2670. var self=this;
  2671. var array;
  2672. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2673. return smalltalk.withContext(function($ctx1) {
  2674. array=[(1), (2), (3), (4), (5)];
  2675. _st(array)._remove_((3));
  2676. $ctx1.sendIdx["remove:"]=1;
  2677. self._assert_equals_(array,[(1), (2), (4), (5)]);
  2678. self._should_raise_((function(){
  2679. return smalltalk.withContext(function($ctx2) {
  2680. return _st(array)._remove_((3));
  2681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2682. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  2683. args: [],
  2684. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  2685. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  2686. referencedClasses: ["Error"]
  2687. }),
  2688. smalltalk.ArrayTest);
  2689. smalltalk.addMethod(
  2690. smalltalk.method({
  2691. selector: "testRemoveFromTo",
  2692. category: 'tests',
  2693. fn: function (){
  2694. var self=this;
  2695. return smalltalk.withContext(function($ctx1) {
  2696. var $1,$2;
  2697. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2698. $ctx1.sendIdx["removeFrom:to:"]=1;
  2699. self._assert_equals_($1,[(4)]);
  2700. $ctx1.sendIdx["assert:equals:"]=1;
  2701. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2702. $ctx1.sendIdx["removeFrom:to:"]=2;
  2703. self._assert_equals_($2,[(1), (4)]);
  2704. $ctx1.sendIdx["assert:equals:"]=2;
  2705. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  2706. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2707. args: [],
  2708. 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)",
  2709. messageSends: ["assert:equals:", "removeFrom:to:"],
  2710. referencedClasses: []
  2711. }),
  2712. smalltalk.ArrayTest);
  2713. smalltalk.addMethod(
  2714. smalltalk.method({
  2715. selector: "testRemoveIndex",
  2716. category: 'tests',
  2717. fn: function (){
  2718. var self=this;
  2719. return smalltalk.withContext(function($ctx1) {
  2720. var $1,$2;
  2721. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  2722. $ctx1.sendIdx["removeIndex:"]=1;
  2723. self._assert_equals_($1,[(1), (3), (4)]);
  2724. $ctx1.sendIdx["assert:equals:"]=1;
  2725. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  2726. $ctx1.sendIdx["removeIndex:"]=2;
  2727. self._assert_equals_($2,[(2), (3), (4)]);
  2728. $ctx1.sendIdx["assert:equals:"]=2;
  2729. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  2730. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2731. args: [],
  2732. 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: #()",
  2733. messageSends: ["assert:equals:", "removeIndex:"],
  2734. referencedClasses: []
  2735. }),
  2736. smalltalk.ArrayTest);
  2737. smalltalk.addMethod(
  2738. smalltalk.method({
  2739. selector: "testRemoveLast",
  2740. category: 'tests',
  2741. fn: function (){
  2742. var self=this;
  2743. var array;
  2744. return smalltalk.withContext(function($ctx1) {
  2745. array=[(1), (2)];
  2746. _st(array)._removeLast();
  2747. self._assert_equals_(_st(array)._last(),(1));
  2748. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  2749. args: [],
  2750. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  2751. messageSends: ["removeLast", "assert:equals:", "last"],
  2752. referencedClasses: []
  2753. }),
  2754. smalltalk.ArrayTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testReversed",
  2758. category: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. var array;
  2762. return smalltalk.withContext(function($ctx1) {
  2763. array=[(5), (4), (3), (2), (1)];
  2764. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  2765. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  2766. args: [],
  2767. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  2768. messageSends: ["assert:equals:", "reversed"],
  2769. referencedClasses: []
  2770. }),
  2771. smalltalk.ArrayTest);
  2772. smalltalk.addMethod(
  2773. smalltalk.method({
  2774. selector: "testSort",
  2775. category: 'tests',
  2776. fn: function (){
  2777. var self=this;
  2778. var array;
  2779. return smalltalk.withContext(function($ctx1) {
  2780. array=[(3), (1), (4), (5), (2)];
  2781. _st(array)._sort();
  2782. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  2783. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  2784. args: [],
  2785. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  2786. messageSends: ["sort", "assert:equals:"],
  2787. referencedClasses: []
  2788. }),
  2789. smalltalk.ArrayTest);
  2790. smalltalk.addMethod(
  2791. smalltalk.method({
  2792. selector: "collectionClass",
  2793. category: 'accessing',
  2794. fn: function (){
  2795. var self=this;
  2796. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2797. return smalltalk.withContext(function($ctx1) {
  2798. return $Array();
  2799. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2800. args: [],
  2801. source: "collectionClass\x0a\x09^ Array",
  2802. messageSends: [],
  2803. referencedClasses: ["Array"]
  2804. }),
  2805. smalltalk.ArrayTest.klass);
  2806. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2807. smalltalk.addMethod(
  2808. smalltalk.method({
  2809. selector: "collection",
  2810. category: 'accessing',
  2811. fn: function (){
  2812. var self=this;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. return "hello";
  2815. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2816. args: [],
  2817. source: "collection\x0a\x09^ 'hello'",
  2818. messageSends: [],
  2819. referencedClasses: []
  2820. }),
  2821. smalltalk.StringTest);
  2822. smalltalk.addMethod(
  2823. smalltalk.method({
  2824. selector: "collectionWithDuplicates",
  2825. category: 'accessing',
  2826. fn: function (){
  2827. var self=this;
  2828. return smalltalk.withContext(function($ctx1) {
  2829. return "abbaerte";
  2830. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2831. args: [],
  2832. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2833. messageSends: [],
  2834. referencedClasses: []
  2835. }),
  2836. smalltalk.StringTest);
  2837. smalltalk.addMethod(
  2838. smalltalk.method({
  2839. selector: "testAddRemove",
  2840. category: 'tests',
  2841. fn: function (){
  2842. var self=this;
  2843. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2844. return smalltalk.withContext(function($ctx1) {
  2845. self._should_raise_((function(){
  2846. return smalltalk.withContext(function($ctx2) {
  2847. return "hello"._add_("a");
  2848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2849. $ctx1.sendIdx["should:raise:"]=1;
  2850. self._should_raise_((function(){
  2851. return smalltalk.withContext(function($ctx2) {
  2852. return "hello"._remove_("h");
  2853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2854. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2855. args: [],
  2856. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  2857. messageSends: ["should:raise:", "add:", "remove:"],
  2858. referencedClasses: ["Error"]
  2859. }),
  2860. smalltalk.StringTest);
  2861. smalltalk.addMethod(
  2862. smalltalk.method({
  2863. selector: "testAsArray",
  2864. category: 'tests',
  2865. fn: function (){
  2866. var self=this;
  2867. return smalltalk.withContext(function($ctx1) {
  2868. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2869. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2870. args: [],
  2871. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2872. messageSends: ["assert:equals:", "asArray"],
  2873. referencedClasses: []
  2874. }),
  2875. smalltalk.StringTest);
  2876. smalltalk.addMethod(
  2877. smalltalk.method({
  2878. selector: "testAsLowerCase",
  2879. category: 'tests',
  2880. fn: function (){
  2881. var self=this;
  2882. return smalltalk.withContext(function($ctx1) {
  2883. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  2884. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  2885. args: [],
  2886. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  2887. messageSends: ["assert:equals:", "asLowercase"],
  2888. referencedClasses: []
  2889. }),
  2890. smalltalk.StringTest);
  2891. smalltalk.addMethod(
  2892. smalltalk.method({
  2893. selector: "testAsNumber",
  2894. category: 'tests',
  2895. fn: function (){
  2896. var self=this;
  2897. return smalltalk.withContext(function($ctx1) {
  2898. var $1,$2;
  2899. $1="3"._asNumber();
  2900. $ctx1.sendIdx["asNumber"]=1;
  2901. self._assert_equals_($1,(3));
  2902. $ctx1.sendIdx["assert:equals:"]=1;
  2903. $2="-3"._asNumber();
  2904. $ctx1.sendIdx["asNumber"]=2;
  2905. self._assert_equals_($2,(-3));
  2906. $ctx1.sendIdx["assert:equals:"]=2;
  2907. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  2908. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  2909. args: [],
  2910. 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.",
  2911. messageSends: ["assert:equals:", "asNumber"],
  2912. referencedClasses: []
  2913. }),
  2914. smalltalk.StringTest);
  2915. smalltalk.addMethod(
  2916. smalltalk.method({
  2917. selector: "testAsUpperCase",
  2918. category: 'tests',
  2919. fn: function (){
  2920. var self=this;
  2921. return smalltalk.withContext(function($ctx1) {
  2922. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  2923. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  2924. args: [],
  2925. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  2926. messageSends: ["assert:equals:", "asUppercase"],
  2927. referencedClasses: []
  2928. }),
  2929. smalltalk.StringTest);
  2930. smalltalk.addMethod(
  2931. smalltalk.method({
  2932. selector: "testAsciiValue",
  2933. category: 'tests',
  2934. fn: function (){
  2935. var self=this;
  2936. var characterA,characterU;
  2937. return smalltalk.withContext(function($ctx1) {
  2938. var $1;
  2939. characterA="A";
  2940. characterU="U";
  2941. $1=_st(characterA)._asciiValue();
  2942. $ctx1.sendIdx["asciiValue"]=1;
  2943. self._assert_equals_($1,(65));
  2944. $ctx1.sendIdx["assert:equals:"]=1;
  2945. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  2946. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  2947. args: [],
  2948. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  2949. messageSends: ["assert:equals:", "asciiValue"],
  2950. referencedClasses: []
  2951. }),
  2952. smalltalk.StringTest);
  2953. smalltalk.addMethod(
  2954. smalltalk.method({
  2955. selector: "testAt",
  2956. category: 'tests',
  2957. fn: function (){
  2958. var self=this;
  2959. return smalltalk.withContext(function($ctx1) {
  2960. var $1;
  2961. $1="hello"._at_((1));
  2962. $ctx1.sendIdx["at:"]=1;
  2963. self._assert_equals_($1,"h");
  2964. $ctx1.sendIdx["assert:equals:"]=1;
  2965. self._assert_equals_("hello"._at_((5)),"o");
  2966. $ctx1.sendIdx["assert:equals:"]=2;
  2967. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2968. return smalltalk.withContext(function($ctx2) {
  2969. return nil;
  2970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  2971. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2972. args: [],
  2973. 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",
  2974. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2975. referencedClasses: []
  2976. }),
  2977. smalltalk.StringTest);
  2978. smalltalk.addMethod(
  2979. smalltalk.method({
  2980. selector: "testAtPut",
  2981. category: 'tests',
  2982. fn: function (){
  2983. var self=this;
  2984. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2985. return smalltalk.withContext(function($ctx1) {
  2986. self._should_raise_((function(){
  2987. return smalltalk.withContext(function($ctx2) {
  2988. return "hello"._at_put_((1),"a");
  2989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2990. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2991. args: [],
  2992. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  2993. messageSends: ["should:raise:", "at:put:"],
  2994. referencedClasses: ["Error"]
  2995. }),
  2996. smalltalk.StringTest);
  2997. smalltalk.addMethod(
  2998. smalltalk.method({
  2999. selector: "testCapitalized",
  3000. category: 'tests',
  3001. fn: function (){
  3002. var self=this;
  3003. return smalltalk.withContext(function($ctx1) {
  3004. var $1,$2,$3;
  3005. $1="test"._capitalized();
  3006. $ctx1.sendIdx["capitalized"]=1;
  3007. self._assert_equals_($1,"Test");
  3008. $ctx1.sendIdx["assert:equals:"]=1;
  3009. $2="Test"._capitalized();
  3010. $ctx1.sendIdx["capitalized"]=2;
  3011. self._assert_equals_($2,"Test");
  3012. $ctx1.sendIdx["assert:equals:"]=2;
  3013. self._assert_equals_(""._capitalized(),"");
  3014. $ctx1.sendIdx["assert:equals:"]=3;
  3015. $3="Test"._isCapitalized();
  3016. $ctx1.sendIdx["isCapitalized"]=1;
  3017. self._assert_equals_($3,true);
  3018. $ctx1.sendIdx["assert:equals:"]=4;
  3019. self._assert_equals_("test"._isCapitalized(),false);
  3020. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3021. args: [],
  3022. 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.",
  3023. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3024. referencedClasses: []
  3025. }),
  3026. smalltalk.StringTest);
  3027. smalltalk.addMethod(
  3028. smalltalk.method({
  3029. selector: "testCharCodeAt",
  3030. category: 'tests',
  3031. fn: function (){
  3032. var self=this;
  3033. return smalltalk.withContext(function($ctx1) {
  3034. var $1,$2,$3,$4,$5;
  3035. $1="jackie"._charCodeAt_((1));
  3036. $ctx1.sendIdx["charCodeAt:"]=1;
  3037. self._assert_equals_($1,(106));
  3038. $ctx1.sendIdx["assert:equals:"]=1;
  3039. $2="jackie"._charCodeAt_((2));
  3040. $ctx1.sendIdx["charCodeAt:"]=2;
  3041. self._assert_equals_($2,(97));
  3042. $ctx1.sendIdx["assert:equals:"]=2;
  3043. $3="jackie"._charCodeAt_((3));
  3044. $ctx1.sendIdx["charCodeAt:"]=3;
  3045. self._assert_equals_($3,(99));
  3046. $ctx1.sendIdx["assert:equals:"]=3;
  3047. $4="jackie"._charCodeAt_((4));
  3048. $ctx1.sendIdx["charCodeAt:"]=4;
  3049. self._assert_equals_($4,(107));
  3050. $ctx1.sendIdx["assert:equals:"]=4;
  3051. $5="jackie"._charCodeAt_((5));
  3052. $ctx1.sendIdx["charCodeAt:"]=5;
  3053. self._assert_equals_($5,(105));
  3054. $ctx1.sendIdx["assert:equals:"]=5;
  3055. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3056. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3057. args: [],
  3058. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  3059. messageSends: ["assert:equals:", "charCodeAt:"],
  3060. referencedClasses: []
  3061. }),
  3062. smalltalk.StringTest);
  3063. smalltalk.addMethod(
  3064. smalltalk.method({
  3065. selector: "testCollect",
  3066. category: 'tests',
  3067. fn: function (){
  3068. var self=this;
  3069. var newCollection;
  3070. return smalltalk.withContext(function($ctx1) {
  3071. newCollection="hheelllloo";
  3072. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3073. return smalltalk.withContext(function($ctx2) {
  3074. return _st(each).__comma(each);
  3075. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3076. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3077. args: [],
  3078. 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",
  3079. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3080. referencedClasses: []
  3081. }),
  3082. smalltalk.StringTest);
  3083. smalltalk.addMethod(
  3084. smalltalk.method({
  3085. selector: "testCopyFromTo",
  3086. category: 'tests',
  3087. fn: function (){
  3088. var self=this;
  3089. return smalltalk.withContext(function($ctx1) {
  3090. var $1;
  3091. $1="jackie"._copyFrom_to_((1),(3));
  3092. $ctx1.sendIdx["copyFrom:to:"]=1;
  3093. self._assert_equals_($1,"jac");
  3094. $ctx1.sendIdx["assert:equals:"]=1;
  3095. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3096. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3097. args: [],
  3098. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3099. messageSends: ["assert:equals:", "copyFrom:to:"],
  3100. referencedClasses: []
  3101. }),
  3102. smalltalk.StringTest);
  3103. smalltalk.addMethod(
  3104. smalltalk.method({
  3105. selector: "testCopyWithoutAll",
  3106. category: 'tests',
  3107. fn: function (){
  3108. var self=this;
  3109. return smalltalk.withContext(function($ctx1) {
  3110. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3111. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3112. args: [],
  3113. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3114. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3115. referencedClasses: []
  3116. }),
  3117. smalltalk.StringTest);
  3118. smalltalk.addMethod(
  3119. smalltalk.method({
  3120. selector: "testDetect",
  3121. category: 'tests',
  3122. fn: function (){
  3123. var self=this;
  3124. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3125. return smalltalk.withContext(function($ctx1) {
  3126. var $2,$1;
  3127. $2=self._collection();
  3128. $ctx1.sendIdx["collection"]=1;
  3129. $1=_st($2)._detect_((function(each){
  3130. return smalltalk.withContext(function($ctx2) {
  3131. return _st(each).__eq("h");
  3132. $ctx2.sendIdx["="]=1;
  3133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3134. $ctx1.sendIdx["detect:"]=1;
  3135. self._assert_equals_($1,"h");
  3136. self._should_raise_((function(){
  3137. return smalltalk.withContext(function($ctx2) {
  3138. return _st(self._collection())._detect_((function(each){
  3139. return smalltalk.withContext(function($ctx3) {
  3140. return _st(each).__eq((6));
  3141. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3143. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3144. args: [],
  3145. 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",
  3146. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3147. referencedClasses: ["Error"]
  3148. }),
  3149. smalltalk.StringTest);
  3150. smalltalk.addMethod(
  3151. smalltalk.method({
  3152. selector: "testEquality",
  3153. category: 'tests',
  3154. fn: function (){
  3155. var self=this;
  3156. return smalltalk.withContext(function($ctx1) {
  3157. var $1,$2,$3;
  3158. self._assert_equals_("hello","hello");
  3159. $ctx1.sendIdx["assert:equals:"]=1;
  3160. $1="hello".__eq("world");
  3161. $ctx1.sendIdx["="]=1;
  3162. self._deny_($1);
  3163. $ctx1.sendIdx["deny:"]=1;
  3164. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3165. return smalltalk.withContext(function($ctx2) {
  3166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3167. $ctx1.sendIdx["="]=2;
  3168. self._deny_($2);
  3169. $ctx1.sendIdx["deny:"]=2;
  3170. $3="hello"._yourself();
  3171. $ctx1.sendIdx["yourself"]=1;
  3172. self._assert_equals_("hello",$3);
  3173. $ctx1.sendIdx["assert:equals:"]=2;
  3174. self._assert_equals_("hello"._yourself(),"hello");
  3175. self._deny_("".__eq((0)));
  3176. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3177. args: [],
  3178. 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",
  3179. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3180. referencedClasses: []
  3181. }),
  3182. smalltalk.StringTest);
  3183. smalltalk.addMethod(
  3184. smalltalk.method({
  3185. selector: "testIdentity",
  3186. category: 'tests',
  3187. fn: function (){
  3188. var self=this;
  3189. return smalltalk.withContext(function($ctx1) {
  3190. var $1,$2,$4,$3,$5;
  3191. $1="hello".__eq_eq("hello");
  3192. $ctx1.sendIdx["=="]=1;
  3193. self._assert_($1);
  3194. $ctx1.sendIdx["assert:"]=1;
  3195. $2="hello".__eq_eq("world");
  3196. $ctx1.sendIdx["=="]=2;
  3197. self._deny_($2);
  3198. $ctx1.sendIdx["deny:"]=1;
  3199. $4="hello"._yourself();
  3200. $ctx1.sendIdx["yourself"]=1;
  3201. $3="hello".__eq_eq($4);
  3202. $ctx1.sendIdx["=="]=3;
  3203. self._assert_($3);
  3204. $ctx1.sendIdx["assert:"]=2;
  3205. $5=_st("hello"._yourself()).__eq_eq("hello");
  3206. $ctx1.sendIdx["=="]=4;
  3207. self._assert_($5);
  3208. self._deny_("".__eq_eq((0)));
  3209. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3210. args: [],
  3211. 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",
  3212. messageSends: ["assert:", "==", "deny:", "yourself"],
  3213. referencedClasses: []
  3214. }),
  3215. smalltalk.StringTest);
  3216. smalltalk.addMethod(
  3217. smalltalk.method({
  3218. selector: "testIdentityHash",
  3219. category: 'tests',
  3220. fn: function (){
  3221. var self=this;
  3222. return smalltalk.withContext(function($ctx1) {
  3223. var $1,$2,$4,$3;
  3224. $1="foo"._identityHash();
  3225. $ctx1.sendIdx["identityHash"]=1;
  3226. $2="foo"._identityHash();
  3227. $ctx1.sendIdx["identityHash"]=2;
  3228. self._assert_equals_($1,$2);
  3229. $4="foo"._identityHash();
  3230. $ctx1.sendIdx["identityHash"]=3;
  3231. $3=_st($4).__eq("bar"._identityHash());
  3232. self._deny_($3);
  3233. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3234. args: [],
  3235. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3236. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3237. referencedClasses: []
  3238. }),
  3239. smalltalk.StringTest);
  3240. smalltalk.addMethod(
  3241. smalltalk.method({
  3242. selector: "testIncludesSubString",
  3243. category: 'tests',
  3244. fn: function (){
  3245. var self=this;
  3246. return smalltalk.withContext(function($ctx1) {
  3247. var $1;
  3248. $1="amber"._includesSubString_("ber");
  3249. $ctx1.sendIdx["includesSubString:"]=1;
  3250. self._assert_($1);
  3251. self._deny_("amber"._includesSubString_("zork"));
  3252. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3253. args: [],
  3254. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3255. messageSends: ["assert:", "includesSubString:", "deny:"],
  3256. referencedClasses: []
  3257. }),
  3258. smalltalk.StringTest);
  3259. smalltalk.addMethod(
  3260. smalltalk.method({
  3261. selector: "testIndexOf",
  3262. category: 'tests',
  3263. fn: function (){
  3264. var self=this;
  3265. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3266. return smalltalk.withContext(function($ctx1) {
  3267. var $2,$1,$3;
  3268. $2=self._collection();
  3269. $ctx1.sendIdx["collection"]=1;
  3270. $1=_st($2)._indexOf_("e");
  3271. $ctx1.sendIdx["indexOf:"]=1;
  3272. self._assert_equals_($1,(2));
  3273. $ctx1.sendIdx["assert:equals:"]=1;
  3274. self._should_raise_((function(){
  3275. return smalltalk.withContext(function($ctx2) {
  3276. $3=self._collection();
  3277. $ctx2.sendIdx["collection"]=2;
  3278. return _st($3)._indexOf_((999));
  3279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3280. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  3281. return smalltalk.withContext(function($ctx2) {
  3282. return "sentinel";
  3283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  3284. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3285. args: [],
  3286. 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'",
  3287. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3288. referencedClasses: ["Error"]
  3289. }),
  3290. smalltalk.StringTest);
  3291. smalltalk.addMethod(
  3292. smalltalk.method({
  3293. selector: "testIsVowel",
  3294. category: 'tests',
  3295. fn: function (){
  3296. var self=this;
  3297. var vowel,consonant;
  3298. return smalltalk.withContext(function($ctx1) {
  3299. var $1;
  3300. vowel="u";
  3301. consonant="z";
  3302. $1=_st(vowel)._isVowel();
  3303. $ctx1.sendIdx["isVowel"]=1;
  3304. self._assert_equals_($1,true);
  3305. $ctx1.sendIdx["assert:equals:"]=1;
  3306. self._assert_equals_(_st(consonant)._isVowel(),false);
  3307. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3308. args: [],
  3309. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  3310. messageSends: ["assert:equals:", "isVowel"],
  3311. referencedClasses: []
  3312. }),
  3313. smalltalk.StringTest);
  3314. smalltalk.addMethod(
  3315. smalltalk.method({
  3316. selector: "testJoin",
  3317. category: 'tests',
  3318. fn: function (){
  3319. var self=this;
  3320. return smalltalk.withContext(function($ctx1) {
  3321. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3322. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3323. args: [],
  3324. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3325. messageSends: ["assert:equals:", "join:"],
  3326. referencedClasses: []
  3327. }),
  3328. smalltalk.StringTest);
  3329. smalltalk.addMethod(
  3330. smalltalk.method({
  3331. selector: "testReversed",
  3332. category: 'tests',
  3333. fn: function (){
  3334. var self=this;
  3335. return smalltalk.withContext(function($ctx1) {
  3336. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3337. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3338. args: [],
  3339. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3340. messageSends: ["assert:equals:", "reversed"],
  3341. referencedClasses: []
  3342. }),
  3343. smalltalk.StringTest);
  3344. smalltalk.addMethod(
  3345. smalltalk.method({
  3346. selector: "testSelect",
  3347. category: 'tests',
  3348. fn: function (){
  3349. var self=this;
  3350. var newCollection;
  3351. return smalltalk.withContext(function($ctx1) {
  3352. newCollection="o";
  3353. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3354. return smalltalk.withContext(function($ctx2) {
  3355. return _st(each).__eq("o");
  3356. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3357. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3358. args: [],
  3359. 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",
  3360. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3361. referencedClasses: []
  3362. }),
  3363. smalltalk.StringTest);
  3364. smalltalk.addMethod(
  3365. smalltalk.method({
  3366. selector: "testSize",
  3367. category: 'tests',
  3368. fn: function (){
  3369. var self=this;
  3370. return smalltalk.withContext(function($ctx1) {
  3371. var $1;
  3372. $1="smalltalk"._size();
  3373. $ctx1.sendIdx["size"]=1;
  3374. self._assert_equals_($1,(9));
  3375. $ctx1.sendIdx["assert:equals:"]=1;
  3376. self._assert_equals_(""._size(),(0));
  3377. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3378. args: [],
  3379. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3380. messageSends: ["assert:equals:", "size"],
  3381. referencedClasses: []
  3382. }),
  3383. smalltalk.StringTest);
  3384. smalltalk.addMethod(
  3385. smalltalk.method({
  3386. selector: "testStreamContents",
  3387. category: 'tests',
  3388. fn: function (){
  3389. var self=this;
  3390. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3391. return smalltalk.withContext(function($ctx1) {
  3392. var $1;
  3393. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3394. return smalltalk.withContext(function($ctx2) {
  3395. _st(aStream)._nextPutAll_("hello");
  3396. $ctx2.sendIdx["nextPutAll:"]=1;
  3397. _st(aStream)._space();
  3398. $1=_st(aStream)._nextPutAll_("world");
  3399. return $1;
  3400. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3401. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3402. args: [],
  3403. 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'",
  3404. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3405. referencedClasses: ["String"]
  3406. }),
  3407. smalltalk.StringTest);
  3408. smalltalk.addMethod(
  3409. smalltalk.method({
  3410. selector: "testSubStrings",
  3411. category: 'tests',
  3412. fn: function (){
  3413. var self=this;
  3414. return smalltalk.withContext(function($ctx1) {
  3415. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3416. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3417. args: [],
  3418. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3419. messageSends: ["assert:equals:", "subStrings:"],
  3420. referencedClasses: []
  3421. }),
  3422. smalltalk.StringTest);
  3423. smalltalk.addMethod(
  3424. smalltalk.method({
  3425. selector: "testTrim",
  3426. category: 'tests',
  3427. fn: function (){
  3428. var self=this;
  3429. return smalltalk.withContext(function($ctx1) {
  3430. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3431. $ctx1.sendIdx["assert:equals:"]=1;
  3432. self._assert_equals_("jackie "._trimRight(),"jackie");
  3433. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3434. args: [],
  3435. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3436. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3437. referencedClasses: []
  3438. }),
  3439. smalltalk.StringTest);
  3440. smalltalk.addMethod(
  3441. smalltalk.method({
  3442. selector: "collectionClass",
  3443. category: 'accessing',
  3444. fn: function (){
  3445. var self=this;
  3446. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3447. return smalltalk.withContext(function($ctx1) {
  3448. return $String();
  3449. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3450. args: [],
  3451. source: "collectionClass\x0a\x09^ String",
  3452. messageSends: [],
  3453. referencedClasses: ["String"]
  3454. }),
  3455. smalltalk.StringTest.klass);
  3456. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3457. smalltalk.addMethod(
  3458. smalltalk.method({
  3459. selector: "testShow",
  3460. category: 'tests',
  3461. fn: function (){
  3462. var self=this;
  3463. var originalTranscript;
  3464. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3465. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3466. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3467. return smalltalk.withContext(function($ctx1) {
  3468. originalTranscript=_st($Transcript())._current();
  3469. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3470. $ctx1.sendIdx["register:"]=1;
  3471. self._shouldnt_raise_((function(){
  3472. return smalltalk.withContext(function($ctx2) {
  3473. return _st($Transcript())._show_("Hello console!");
  3474. $ctx2.sendIdx["show:"]=1;
  3475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3476. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3477. self._shouldnt_raise_((function(){
  3478. return smalltalk.withContext(function($ctx2) {
  3479. return _st($Transcript())._show_(console);
  3480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3481. _st($Transcript())._register_(originalTranscript);
  3482. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3483. args: [],
  3484. 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.",
  3485. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3486. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3487. }),
  3488. smalltalk.ConsoleTranscriptTest);
  3489. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3490. smalltalk.addMethod(
  3491. smalltalk.method({
  3492. selector: "jsObject",
  3493. category: 'accessing',
  3494. fn: function (){
  3495. var self=this;
  3496. return smalltalk.withContext(function($ctx1) {
  3497. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3498. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3499. args: [],
  3500. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3501. messageSends: [],
  3502. referencedClasses: []
  3503. }),
  3504. smalltalk.JSObjectProxyTest);
  3505. smalltalk.addMethod(
  3506. smalltalk.method({
  3507. selector: "testAtIfAbsent",
  3508. category: 'tests',
  3509. fn: function (){
  3510. var self=this;
  3511. var testObject;
  3512. return smalltalk.withContext(function($ctx1) {
  3513. var $1,$2,$3;
  3514. testObject=self._jsObject();
  3515. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  3516. return smalltalk.withContext(function($ctx2) {
  3517. return "Property does not exist";
  3518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3519. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3520. self._assert_equals_($1,"Property does not exist");
  3521. $ctx1.sendIdx["assert:equals:"]=1;
  3522. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  3523. return smalltalk.withContext(function($ctx2) {
  3524. return "Property does not exist";
  3525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3526. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3527. self._assert_equals_($2,nil);
  3528. $ctx1.sendIdx["assert:equals:"]=2;
  3529. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  3530. return smalltalk.withContext(function($ctx2) {
  3531. return "Property does not exist";
  3532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3533. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3534. self._assert_equals_($3,(1));
  3535. $ctx1.sendIdx["assert:equals:"]=3;
  3536. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  3537. return smalltalk.withContext(function($ctx2) {
  3538. return "Property does not exist";
  3539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  3540. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3541. args: [],
  3542. 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.",
  3543. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3544. referencedClasses: []
  3545. }),
  3546. smalltalk.JSObjectProxyTest);
  3547. smalltalk.addMethod(
  3548. smalltalk.method({
  3549. selector: "testAtIfPresent",
  3550. category: 'tests',
  3551. fn: function (){
  3552. var self=this;
  3553. var testObject;
  3554. return smalltalk.withContext(function($ctx1) {
  3555. var $2,$1,$4,$3,$6,$5;
  3556. testObject=self._jsObject();
  3557. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  3558. return smalltalk.withContext(function($ctx2) {
  3559. $2=_st(x)._asString();
  3560. $ctx2.sendIdx["asString"]=1;
  3561. return "hello ".__comma($2);
  3562. $ctx2.sendIdx[","]=1;
  3563. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3564. $ctx1.sendIdx["at:ifPresent:"]=1;
  3565. self._assert_equals_($1,nil);
  3566. $ctx1.sendIdx["assert:equals:"]=1;
  3567. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  3568. return smalltalk.withContext(function($ctx2) {
  3569. $4=_st(x)._asString();
  3570. $ctx2.sendIdx["asString"]=2;
  3571. return "hello ".__comma($4);
  3572. $ctx2.sendIdx[","]=2;
  3573. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3574. $ctx1.sendIdx["at:ifPresent:"]=2;
  3575. self._assert_equals_($3,"hello nil");
  3576. $ctx1.sendIdx["assert:equals:"]=2;
  3577. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  3578. return smalltalk.withContext(function($ctx2) {
  3579. $6=_st(x)._asString();
  3580. $ctx2.sendIdx["asString"]=3;
  3581. return "hello ".__comma($6);
  3582. $ctx2.sendIdx[","]=3;
  3583. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3584. $ctx1.sendIdx["at:ifPresent:"]=3;
  3585. self._assert_equals_($5,"hello 1");
  3586. $ctx1.sendIdx["assert:equals:"]=3;
  3587. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  3588. return smalltalk.withContext(function($ctx2) {
  3589. return "hello ".__comma(_st(x)._asString());
  3590. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  3591. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3592. args: [],
  3593. 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'.",
  3594. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3595. referencedClasses: []
  3596. }),
  3597. smalltalk.JSObjectProxyTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "testAtIfPresentIfAbsent",
  3601. category: 'tests',
  3602. fn: function (){
  3603. var self=this;
  3604. var testObject;
  3605. return smalltalk.withContext(function($ctx1) {
  3606. var $2,$1,$4,$3,$6,$5;
  3607. testObject=self._jsObject();
  3608. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3609. return smalltalk.withContext(function($ctx2) {
  3610. $2=_st(x)._asString();
  3611. $ctx2.sendIdx["asString"]=1;
  3612. return "hello ".__comma($2);
  3613. $ctx2.sendIdx[","]=1;
  3614. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3615. return smalltalk.withContext(function($ctx2) {
  3616. return "not present";
  3617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3618. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3619. self._assert_equals_($1,"not present");
  3620. $ctx1.sendIdx["assert:equals:"]=1;
  3621. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3622. return smalltalk.withContext(function($ctx2) {
  3623. $4=_st(x)._asString();
  3624. $ctx2.sendIdx["asString"]=2;
  3625. return "hello ".__comma($4);
  3626. $ctx2.sendIdx[","]=2;
  3627. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3628. return smalltalk.withContext(function($ctx2) {
  3629. return "not present";
  3630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3631. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3632. self._assert_equals_($3,"hello nil");
  3633. $ctx1.sendIdx["assert:equals:"]=2;
  3634. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3635. return smalltalk.withContext(function($ctx2) {
  3636. $6=_st(x)._asString();
  3637. $ctx2.sendIdx["asString"]=3;
  3638. return "hello ".__comma($6);
  3639. $ctx2.sendIdx[","]=3;
  3640. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3641. return smalltalk.withContext(function($ctx2) {
  3642. return "not present";
  3643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3644. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3645. self._assert_equals_($5,"hello 1");
  3646. $ctx1.sendIdx["assert:equals:"]=3;
  3647. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3648. return smalltalk.withContext(function($ctx2) {
  3649. return "hello ".__comma(_st(x)._asString());
  3650. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3651. return smalltalk.withContext(function($ctx2) {
  3652. return "not present";
  3653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  3654. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3655. args: [],
  3656. 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'.",
  3657. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3658. referencedClasses: []
  3659. }),
  3660. smalltalk.JSObjectProxyTest);
  3661. smalltalk.addMethod(
  3662. smalltalk.method({
  3663. selector: "testDNU",
  3664. category: 'tests',
  3665. fn: function (){
  3666. var self=this;
  3667. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3668. return smalltalk.withContext(function($ctx1) {
  3669. self._should_raise_((function(){
  3670. return smalltalk.withContext(function($ctx2) {
  3671. return _st(self._jsObject())._foo();
  3672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3673. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3674. args: [],
  3675. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  3676. messageSends: ["should:raise:", "foo", "jsObject"],
  3677. referencedClasses: ["MessageNotUnderstood"]
  3678. }),
  3679. smalltalk.JSObjectProxyTest);
  3680. smalltalk.addMethod(
  3681. smalltalk.method({
  3682. selector: "testMessageSend",
  3683. category: 'tests',
  3684. fn: function (){
  3685. var self=this;
  3686. return smalltalk.withContext(function($ctx1) {
  3687. var $2,$1,$4,$3;
  3688. $2=self._jsObject();
  3689. $ctx1.sendIdx["jsObject"]=1;
  3690. $1=_st($2)._a();
  3691. self._assert_equals_($1,(1));
  3692. $ctx1.sendIdx["assert:equals:"]=1;
  3693. $4=self._jsObject();
  3694. $ctx1.sendIdx["jsObject"]=2;
  3695. $3=_st($4)._b();
  3696. self._assert_equals_($3,(2));
  3697. $ctx1.sendIdx["assert:equals:"]=2;
  3698. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  3699. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3700. args: [],
  3701. 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",
  3702. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3703. referencedClasses: []
  3704. }),
  3705. smalltalk.JSObjectProxyTest);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "testMethodWithArguments",
  3709. category: 'tests',
  3710. fn: function (){
  3711. var self=this;
  3712. return smalltalk.withContext(function($ctx1) {
  3713. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3714. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3715. args: [],
  3716. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3717. messageSends: ["assert:equals:", "c:", "jsObject"],
  3718. referencedClasses: []
  3719. }),
  3720. smalltalk.JSObjectProxyTest);
  3721. smalltalk.addMethod(
  3722. smalltalk.method({
  3723. selector: "testPrinting",
  3724. category: 'tests',
  3725. fn: function (){
  3726. var self=this;
  3727. return smalltalk.withContext(function($ctx1) {
  3728. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  3729. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  3730. args: [],
  3731. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  3732. messageSends: ["assert:equals:", "printString", "jsObject"],
  3733. referencedClasses: []
  3734. }),
  3735. smalltalk.JSObjectProxyTest);
  3736. smalltalk.addMethod(
  3737. smalltalk.method({
  3738. selector: "testPropertyThatReturnsEmptyString",
  3739. category: 'tests',
  3740. fn: function (){
  3741. var self=this;
  3742. var object;
  3743. return smalltalk.withContext(function($ctx1) {
  3744. var $1;
  3745. object=self._jsObject();
  3746. $1=_st(object)._d();
  3747. $ctx1.sendIdx["d"]=1;
  3748. self._assert_equals_($1,"");
  3749. $ctx1.sendIdx["assert:equals:"]=1;
  3750. _st(object)._d_("hello");
  3751. self._assert_equals_(_st(object)._d(),"hello");
  3752. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  3753. args: [],
  3754. 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'",
  3755. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  3756. referencedClasses: []
  3757. }),
  3758. smalltalk.JSObjectProxyTest);
  3759. smalltalk.addMethod(
  3760. smalltalk.method({
  3761. selector: "testPropertyThatReturnsUndefined",
  3762. category: 'tests',
  3763. fn: function (){
  3764. var self=this;
  3765. var object;
  3766. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3767. return smalltalk.withContext(function($ctx1) {
  3768. object=self._jsObject();
  3769. self._shouldnt_raise_((function(){
  3770. return smalltalk.withContext(function($ctx2) {
  3771. return _st(object)._e();
  3772. $ctx2.sendIdx["e"]=1;
  3773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3774. self._assert_(_st(_st(object)._e())._isNil());
  3775. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  3776. args: [],
  3777. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  3778. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  3779. referencedClasses: ["MessageNotUnderstood"]
  3780. }),
  3781. smalltalk.JSObjectProxyTest);
  3782. smalltalk.addMethod(
  3783. smalltalk.method({
  3784. selector: "testValue",
  3785. category: 'tests',
  3786. fn: function (){
  3787. var self=this;
  3788. var testObject;
  3789. return smalltalk.withContext(function($ctx1) {
  3790. var $2,$1;
  3791. testObject=self._jsObject();
  3792. $2=_st(testObject)._value();
  3793. $ctx1.sendIdx["value"]=1;
  3794. $1=_st($2)._printString();
  3795. self._assert_equals_($1,"[object Object]");
  3796. $ctx1.sendIdx["assert:equals:"]=1;
  3797. _st(testObject)._at_put_("value","aValue");
  3798. self._assert_equals_(_st(testObject)._value(),"aValue");
  3799. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3800. args: [],
  3801. 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'",
  3802. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  3803. referencedClasses: []
  3804. }),
  3805. smalltalk.JSObjectProxyTest);
  3806. smalltalk.addMethod(
  3807. smalltalk.method({
  3808. selector: "testYourself",
  3809. category: 'tests',
  3810. fn: function (){
  3811. var self=this;
  3812. var object;
  3813. return smalltalk.withContext(function($ctx1) {
  3814. var $1,$2;
  3815. $1=self._jsObject();
  3816. _st($1)._d_("test");
  3817. $2=_st($1)._yourself();
  3818. object=$2;
  3819. self._assert_equals_(_st(object)._d(),"test");
  3820. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  3821. args: [],
  3822. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  3823. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  3824. referencedClasses: []
  3825. }),
  3826. smalltalk.JSObjectProxyTest);
  3827. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3828. smalltalk.addMethod(
  3829. smalltalk.method({
  3830. selector: "testCatchingException",
  3831. category: 'tests',
  3832. fn: function (){
  3833. var self=this;
  3834. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3835. return smalltalk.withContext(function($ctx1) {
  3836. _st((function(){
  3837. return smalltalk.withContext(function($ctx2) {
  3838. return self._throwException();
  3839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  3840. return smalltalk.withContext(function($ctx2) {
  3841. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  3842. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  3843. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  3844. args: [],
  3845. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  3846. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  3847. referencedClasses: ["Error"]
  3848. }),
  3849. smalltalk.JavaScriptExceptionTest);
  3850. smalltalk.addMethod(
  3851. smalltalk.method({
  3852. selector: "testRaisingException",
  3853. category: 'tests',
  3854. fn: function (){
  3855. var self=this;
  3856. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3857. return smalltalk.withContext(function($ctx1) {
  3858. self._should_raise_((function(){
  3859. return smalltalk.withContext(function($ctx2) {
  3860. return self._throwException();
  3861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  3862. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  3863. args: [],
  3864. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  3865. messageSends: ["should:raise:", "throwException"],
  3866. referencedClasses: ["JavaScriptException"]
  3867. }),
  3868. smalltalk.JavaScriptExceptionTest);
  3869. smalltalk.addMethod(
  3870. smalltalk.method({
  3871. selector: "throwException",
  3872. category: 'helpers',
  3873. fn: function (){
  3874. var self=this;
  3875. return smalltalk.withContext(function($ctx1) {
  3876. throw 'test';
  3877. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  3878. args: [],
  3879. source: "throwException\x0a\x09<throw 'test'>",
  3880. messageSends: [],
  3881. referencedClasses: []
  3882. }),
  3883. smalltalk.JavaScriptExceptionTest);
  3884. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3885. smalltalk.addMethod(
  3886. smalltalk.method({
  3887. selector: "testValue",
  3888. category: 'tests',
  3889. fn: function (){
  3890. var self=this;
  3891. var messageSend;
  3892. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  3893. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3894. return smalltalk.withContext(function($ctx1) {
  3895. var $1,$2;
  3896. $1=_st($MessageSend())._new();
  3897. $ctx1.sendIdx["new"]=1;
  3898. _st($1)._receiver_(_st($Object())._new());
  3899. _st($1)._selector_("asString");
  3900. $2=_st($1)._yourself();
  3901. messageSend=$2;
  3902. self._assert_equals_(_st(messageSend)._value(),"an Object");
  3903. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  3904. args: [],
  3905. 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'",
  3906. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  3907. referencedClasses: ["MessageSend", "Object"]
  3908. }),
  3909. smalltalk.MessageSendTest);
  3910. smalltalk.addMethod(
  3911. smalltalk.method({
  3912. selector: "testValueWithArguments",
  3913. category: 'tests',
  3914. fn: function (){
  3915. var self=this;
  3916. var messageSend;
  3917. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  3918. return smalltalk.withContext(function($ctx1) {
  3919. var $1,$2;
  3920. $1=_st($MessageSend())._new();
  3921. _st($1)._receiver_((2));
  3922. _st($1)._selector_("+");
  3923. $2=_st($1)._yourself();
  3924. messageSend=$2;
  3925. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  3926. $ctx1.sendIdx["assert:equals:"]=1;
  3927. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  3928. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  3929. args: [],
  3930. 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",
  3931. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  3932. referencedClasses: ["MessageSend"]
  3933. }),
  3934. smalltalk.MessageSendTest);
  3935. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  3936. smalltalk.addMethod(
  3937. smalltalk.method({
  3938. selector: "codeGeneratorClass",
  3939. category: 'accessing',
  3940. fn: function (){
  3941. var self=this;
  3942. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  3943. return smalltalk.withContext(function($ctx1) {
  3944. return $CodeGenerator();
  3945. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  3946. args: [],
  3947. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  3948. messageSends: [],
  3949. referencedClasses: ["CodeGenerator"]
  3950. }),
  3951. smalltalk.MethodInheritanceTest);
  3952. smalltalk.addMethod(
  3953. smalltalk.method({
  3954. selector: "compiler",
  3955. category: 'factory',
  3956. fn: function (){
  3957. var self=this;
  3958. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  3959. return smalltalk.withContext(function($ctx1) {
  3960. var $2,$3,$1;
  3961. $2=_st($Compiler())._new();
  3962. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  3963. $3=_st($2)._yourself();
  3964. $1=$3;
  3965. return $1;
  3966. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  3967. args: [],
  3968. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  3969. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  3970. referencedClasses: ["Compiler"]
  3971. }),
  3972. smalltalk.MethodInheritanceTest);
  3973. smalltalk.addMethod(
  3974. smalltalk.method({
  3975. selector: "deinstallBottom",
  3976. category: 'testing',
  3977. fn: function (){
  3978. var self=this;
  3979. return smalltalk.withContext(function($ctx1) {
  3980. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  3981. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  3982. args: [],
  3983. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  3984. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  3985. referencedClasses: []
  3986. }),
  3987. smalltalk.MethodInheritanceTest);
  3988. smalltalk.addMethod(
  3989. smalltalk.method({
  3990. selector: "deinstallMiddle",
  3991. category: 'testing',
  3992. fn: function (){
  3993. var self=this;
  3994. return smalltalk.withContext(function($ctx1) {
  3995. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  3996. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  3997. args: [],
  3998. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  3999. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4000. referencedClasses: []
  4001. }),
  4002. smalltalk.MethodInheritanceTest);
  4003. smalltalk.addMethod(
  4004. smalltalk.method({
  4005. selector: "deinstallTop",
  4006. category: 'testing',
  4007. fn: function (){
  4008. var self=this;
  4009. return smalltalk.withContext(function($ctx1) {
  4010. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4011. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4012. args: [],
  4013. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4014. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4015. referencedClasses: []
  4016. }),
  4017. smalltalk.MethodInheritanceTest);
  4018. smalltalk.addMethod(
  4019. smalltalk.method({
  4020. selector: "installBottom:",
  4021. category: 'testing',
  4022. fn: function (aString){
  4023. var self=this;
  4024. return smalltalk.withContext(function($ctx1) {
  4025. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  4026. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4027. args: ["aString"],
  4028. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  4029. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  4030. referencedClasses: []
  4031. }),
  4032. smalltalk.MethodInheritanceTest);
  4033. smalltalk.addMethod(
  4034. smalltalk.method({
  4035. selector: "installMiddle:",
  4036. category: 'testing',
  4037. fn: function (aString){
  4038. var self=this;
  4039. return smalltalk.withContext(function($ctx1) {
  4040. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  4041. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4042. args: ["aString"],
  4043. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  4044. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  4045. referencedClasses: []
  4046. }),
  4047. smalltalk.MethodInheritanceTest);
  4048. smalltalk.addMethod(
  4049. smalltalk.method({
  4050. selector: "installTop:",
  4051. category: 'testing',
  4052. fn: function (aString){
  4053. var self=this;
  4054. return smalltalk.withContext(function($ctx1) {
  4055. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  4056. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4057. args: ["aString"],
  4058. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  4059. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  4060. referencedClasses: []
  4061. }),
  4062. smalltalk.MethodInheritanceTest);
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "setUp",
  4066. category: 'initialization',
  4067. fn: function (){
  4068. var self=this;
  4069. return smalltalk.withContext(function($ctx1) {
  4070. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4071. $ctx1.sendIdx["new"]=1;
  4072. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4073. $ctx1.sendIdx["new"]=2;
  4074. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4075. self["@method"]=nil;
  4076. self["@performBlock"]=(function(){
  4077. return smalltalk.withContext(function($ctx2) {
  4078. return self._error_("performBlock not initialized");
  4079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4080. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4081. args: [],
  4082. 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' ]",
  4083. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4084. referencedClasses: []
  4085. }),
  4086. smalltalk.MethodInheritanceTest);
  4087. smalltalk.addMethod(
  4088. smalltalk.method({
  4089. selector: "shouldMNU",
  4090. category: 'testing',
  4091. fn: function (){
  4092. var self=this;
  4093. return smalltalk.withContext(function($ctx1) {
  4094. self._shouldMNUTop();
  4095. self._shouldMNUMiddle();
  4096. self._shouldMNUBottom();
  4097. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4098. args: [],
  4099. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4100. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4101. referencedClasses: []
  4102. }),
  4103. smalltalk.MethodInheritanceTest);
  4104. smalltalk.addMethod(
  4105. smalltalk.method({
  4106. selector: "shouldMNUBottom",
  4107. category: 'testing',
  4108. fn: function (){
  4109. var self=this;
  4110. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4111. return smalltalk.withContext(function($ctx1) {
  4112. self._should_raise_((function(){
  4113. return smalltalk.withContext(function($ctx2) {
  4114. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4116. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4117. args: [],
  4118. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4119. messageSends: ["should:raise:", "value:"],
  4120. referencedClasses: ["MessageNotUnderstood"]
  4121. }),
  4122. smalltalk.MethodInheritanceTest);
  4123. smalltalk.addMethod(
  4124. smalltalk.method({
  4125. selector: "shouldMNUMiddle",
  4126. category: 'testing',
  4127. fn: function (){
  4128. var self=this;
  4129. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4130. return smalltalk.withContext(function($ctx1) {
  4131. self._should_raise_((function(){
  4132. return smalltalk.withContext(function($ctx2) {
  4133. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4135. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4136. args: [],
  4137. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4138. messageSends: ["should:raise:", "value:"],
  4139. referencedClasses: ["MessageNotUnderstood"]
  4140. }),
  4141. smalltalk.MethodInheritanceTest);
  4142. smalltalk.addMethod(
  4143. smalltalk.method({
  4144. selector: "shouldMNUTop",
  4145. category: 'testing',
  4146. fn: function (){
  4147. var self=this;
  4148. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4149. return smalltalk.withContext(function($ctx1) {
  4150. self._should_raise_((function(){
  4151. return smalltalk.withContext(function($ctx2) {
  4152. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4154. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4155. args: [],
  4156. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4157. messageSends: ["should:raise:", "value:"],
  4158. referencedClasses: ["MessageNotUnderstood"]
  4159. }),
  4160. smalltalk.MethodInheritanceTest);
  4161. smalltalk.addMethod(
  4162. smalltalk.method({
  4163. selector: "shouldReturn:",
  4164. category: 'testing',
  4165. fn: function (anObject){
  4166. var self=this;
  4167. var result;
  4168. return smalltalk.withContext(function($ctx1) {
  4169. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4170. $ctx1.sendIdx["value:"]=1;
  4171. self._assert_equals_(["top",anObject],["top",result]);
  4172. $ctx1.sendIdx["assert:equals:"]=1;
  4173. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4174. $ctx1.sendIdx["value:"]=2;
  4175. self._assert_equals_(["middle",anObject],["middle",result]);
  4176. $ctx1.sendIdx["assert:equals:"]=2;
  4177. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4178. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4179. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4180. args: ["anObject"],
  4181. 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 }",
  4182. messageSends: ["value:", "assert:equals:"],
  4183. referencedClasses: []
  4184. }),
  4185. smalltalk.MethodInheritanceTest);
  4186. smalltalk.addMethod(
  4187. smalltalk.method({
  4188. selector: "shouldReturn:and:and:",
  4189. category: 'testing',
  4190. fn: function (anObject,anObject2,anObject3){
  4191. var self=this;
  4192. var result;
  4193. return smalltalk.withContext(function($ctx1) {
  4194. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4195. $ctx1.sendIdx["value:"]=1;
  4196. self._assert_equals_(["top",anObject],["top",result]);
  4197. $ctx1.sendIdx["assert:equals:"]=1;
  4198. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4199. $ctx1.sendIdx["value:"]=2;
  4200. self._assert_equals_(["middle",anObject2],["middle",result]);
  4201. $ctx1.sendIdx["assert:equals:"]=2;
  4202. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4203. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4204. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4205. args: ["anObject", "anObject2", "anObject3"],
  4206. 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 }",
  4207. messageSends: ["value:", "assert:equals:"],
  4208. referencedClasses: []
  4209. }),
  4210. smalltalk.MethodInheritanceTest);
  4211. smalltalk.addMethod(
  4212. smalltalk.method({
  4213. selector: "targetClassBottom",
  4214. category: 'accessing',
  4215. fn: function (){
  4216. var self=this;
  4217. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4218. return smalltalk.withContext(function($ctx1) {
  4219. return $JavaScriptException();
  4220. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4221. args: [],
  4222. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4223. messageSends: [],
  4224. referencedClasses: ["JavaScriptException"]
  4225. }),
  4226. smalltalk.MethodInheritanceTest);
  4227. smalltalk.addMethod(
  4228. smalltalk.method({
  4229. selector: "targetClassMiddle",
  4230. category: 'accessing',
  4231. fn: function (){
  4232. var self=this;
  4233. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4234. return smalltalk.withContext(function($ctx1) {
  4235. return $Error();
  4236. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4237. args: [],
  4238. source: "targetClassMiddle\x0a\x09^ Error",
  4239. messageSends: [],
  4240. referencedClasses: ["Error"]
  4241. }),
  4242. smalltalk.MethodInheritanceTest);
  4243. smalltalk.addMethod(
  4244. smalltalk.method({
  4245. selector: "targetClassTop",
  4246. category: 'accessing',
  4247. fn: function (){
  4248. var self=this;
  4249. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4250. return smalltalk.withContext(function($ctx1) {
  4251. return $Object();
  4252. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4253. args: [],
  4254. source: "targetClassTop\x0a\x09^ Object",
  4255. messageSends: [],
  4256. referencedClasses: ["Object"]
  4257. }),
  4258. smalltalk.MethodInheritanceTest);
  4259. smalltalk.addMethod(
  4260. smalltalk.method({
  4261. selector: "tearDown",
  4262. category: 'initialization',
  4263. fn: function (){
  4264. var self=this;
  4265. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4266. return smalltalk.withContext(function($ctx1) {
  4267. _st((function(){
  4268. return smalltalk.withContext(function($ctx2) {
  4269. return self._deinstallTop();
  4270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4271. return smalltalk.withContext(function($ctx2) {
  4272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4273. $ctx1.sendIdx["on:do:"]=1;
  4274. _st((function(){
  4275. return smalltalk.withContext(function($ctx2) {
  4276. return self._deinstallMiddle();
  4277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4278. return smalltalk.withContext(function($ctx2) {
  4279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4280. $ctx1.sendIdx["on:do:"]=2;
  4281. _st((function(){
  4282. return smalltalk.withContext(function($ctx2) {
  4283. return self._deinstallBottom();
  4284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4285. return smalltalk.withContext(function($ctx2) {
  4286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4287. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4288. args: [],
  4289. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  4290. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4291. referencedClasses: ["Error"]
  4292. }),
  4293. smalltalk.MethodInheritanceTest);
  4294. smalltalk.addMethod(
  4295. smalltalk.method({
  4296. selector: "testMNU11",
  4297. category: 'tests',
  4298. fn: function (){
  4299. var self=this;
  4300. return smalltalk.withContext(function($ctx1) {
  4301. self["@performBlock"]=(function(x){
  4302. return smalltalk.withContext(function($ctx2) {
  4303. return _st(x)._foo();
  4304. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4305. self._shouldMNU();
  4306. $ctx1.sendIdx["shouldMNU"]=1;
  4307. self._installTop_("foo ^ false");
  4308. $ctx1.sendIdx["installTop:"]=1;
  4309. self._installTop_("foo ^ true");
  4310. self._deinstallTop();
  4311. self._shouldMNU();
  4312. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4313. args: [],
  4314. 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",
  4315. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4316. referencedClasses: []
  4317. }),
  4318. smalltalk.MethodInheritanceTest);
  4319. smalltalk.addMethod(
  4320. smalltalk.method({
  4321. selector: "testMNU22",
  4322. category: 'tests',
  4323. fn: function (){
  4324. var self=this;
  4325. return smalltalk.withContext(function($ctx1) {
  4326. self["@performBlock"]=(function(x){
  4327. return smalltalk.withContext(function($ctx2) {
  4328. return _st(x)._foo();
  4329. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4330. self._shouldMNU();
  4331. $ctx1.sendIdx["shouldMNU"]=1;
  4332. self._installMiddle_("foo ^ false");
  4333. $ctx1.sendIdx["installMiddle:"]=1;
  4334. self._installMiddle_("foo ^ true");
  4335. self._deinstallMiddle();
  4336. self._shouldMNU();
  4337. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4338. args: [],
  4339. 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",
  4340. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4341. referencedClasses: []
  4342. }),
  4343. smalltalk.MethodInheritanceTest);
  4344. smalltalk.addMethod(
  4345. smalltalk.method({
  4346. selector: "testReturns1",
  4347. category: 'tests',
  4348. fn: function (){
  4349. var self=this;
  4350. return smalltalk.withContext(function($ctx1) {
  4351. self["@performBlock"]=(function(x){
  4352. return smalltalk.withContext(function($ctx2) {
  4353. return _st(x)._foo();
  4354. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4355. self._installTop_("foo ^ false");
  4356. $ctx1.sendIdx["installTop:"]=1;
  4357. self._shouldReturn_(false);
  4358. $ctx1.sendIdx["shouldReturn:"]=1;
  4359. self._installTop_("foo ^ true");
  4360. self._shouldReturn_(true);
  4361. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4362. args: [],
  4363. 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",
  4364. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4365. referencedClasses: []
  4366. }),
  4367. smalltalk.MethodInheritanceTest);
  4368. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4369. smalltalk.addMethod(
  4370. smalltalk.method({
  4371. selector: "testAbs",
  4372. category: 'tests',
  4373. fn: function (){
  4374. var self=this;
  4375. return smalltalk.withContext(function($ctx1) {
  4376. var $1;
  4377. $1=(4)._abs();
  4378. $ctx1.sendIdx["abs"]=1;
  4379. self._assert_equals_($1,(4));
  4380. $ctx1.sendIdx["assert:equals:"]=1;
  4381. self._assert_equals_((-4)._abs(),(4));
  4382. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4383. args: [],
  4384. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4385. messageSends: ["assert:equals:", "abs"],
  4386. referencedClasses: []
  4387. }),
  4388. smalltalk.NumberTest);
  4389. smalltalk.addMethod(
  4390. smalltalk.method({
  4391. selector: "testArithmetic",
  4392. category: 'tests',
  4393. fn: function (){
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) {
  4396. var $1,$2,$3,$5,$4;
  4397. $1=(1.5).__plus((1));
  4398. $ctx1.sendIdx["+"]=1;
  4399. self._assert_equals_($1,(2.5));
  4400. $ctx1.sendIdx["assert:equals:"]=1;
  4401. $2=(2).__minus((1));
  4402. $ctx1.sendIdx["-"]=1;
  4403. self._assert_equals_($2,(1));
  4404. $ctx1.sendIdx["assert:equals:"]=2;
  4405. self._assert_equals_((-2).__minus((1)),(-3));
  4406. $ctx1.sendIdx["assert:equals:"]=3;
  4407. self._assert_equals_((12).__slash((2)),(6));
  4408. $ctx1.sendIdx["assert:equals:"]=4;
  4409. $3=(3).__star((4));
  4410. $ctx1.sendIdx["*"]=1;
  4411. self._assert_equals_($3,(12));
  4412. $ctx1.sendIdx["assert:equals:"]=5;
  4413. self._assert_equals_((7).__slash_slash((2)),(3));
  4414. $ctx1.sendIdx["assert:equals:"]=6;
  4415. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4416. $ctx1.sendIdx["assert:equals:"]=7;
  4417. $5=(1).__plus((2));
  4418. $ctx1.sendIdx["+"]=2;
  4419. $4=_st($5).__star((3));
  4420. $ctx1.sendIdx["*"]=2;
  4421. self._assert_equals_($4,(9));
  4422. $ctx1.sendIdx["assert:equals:"]=8;
  4423. self._assert_equals_((1).__plus((2).__star((3))),(7));
  4424. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4425. args: [],
  4426. 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\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\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",
  4427. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4428. referencedClasses: []
  4429. }),
  4430. smalltalk.NumberTest);
  4431. smalltalk.addMethod(
  4432. smalltalk.method({
  4433. selector: "testAsNumber",
  4434. category: 'tests',
  4435. fn: function (){
  4436. var self=this;
  4437. return smalltalk.withContext(function($ctx1) {
  4438. self._assert_equals_((3)._asNumber(),(3));
  4439. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4440. args: [],
  4441. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4442. messageSends: ["assert:equals:", "asNumber"],
  4443. referencedClasses: []
  4444. }),
  4445. smalltalk.NumberTest);
  4446. smalltalk.addMethod(
  4447. smalltalk.method({
  4448. selector: "testCeiling",
  4449. category: 'tests',
  4450. fn: function (){
  4451. var self=this;
  4452. return smalltalk.withContext(function($ctx1) {
  4453. var $1,$2;
  4454. $1=(1.2)._ceiling();
  4455. $ctx1.sendIdx["ceiling"]=1;
  4456. self._assert_equals_($1,(2));
  4457. $ctx1.sendIdx["assert:equals:"]=1;
  4458. $2=(-1.2)._ceiling();
  4459. $ctx1.sendIdx["ceiling"]=2;
  4460. self._assert_equals_($2,(-1));
  4461. $ctx1.sendIdx["assert:equals:"]=2;
  4462. self._assert_equals_((1)._ceiling(),(1));
  4463. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4464. args: [],
  4465. 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.",
  4466. messageSends: ["assert:equals:", "ceiling"],
  4467. referencedClasses: []
  4468. }),
  4469. smalltalk.NumberTest);
  4470. smalltalk.addMethod(
  4471. smalltalk.method({
  4472. selector: "testComparison",
  4473. category: 'tests',
  4474. fn: function (){
  4475. var self=this;
  4476. return smalltalk.withContext(function($ctx1) {
  4477. var $1,$2,$3,$4;
  4478. $1=(3).__gt((2));
  4479. $ctx1.sendIdx[">"]=1;
  4480. self._assert_($1);
  4481. $ctx1.sendIdx["assert:"]=1;
  4482. $2=(2).__lt((3));
  4483. $ctx1.sendIdx["<"]=1;
  4484. self._assert_($2);
  4485. $ctx1.sendIdx["assert:"]=2;
  4486. self._deny_((3).__lt((2)));
  4487. $ctx1.sendIdx["deny:"]=1;
  4488. self._deny_((2).__gt((3)));
  4489. $3=(3).__gt_eq((3));
  4490. $ctx1.sendIdx[">="]=1;
  4491. self._assert_($3);
  4492. $ctx1.sendIdx["assert:"]=3;
  4493. self._assert_((3.1).__gt_eq((3)));
  4494. $ctx1.sendIdx["assert:"]=4;
  4495. $4=(3).__lt_eq((3));
  4496. $ctx1.sendIdx["<="]=1;
  4497. self._assert_($4);
  4498. $ctx1.sendIdx["assert:"]=5;
  4499. self._assert_((3).__lt_eq((3.1)));
  4500. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4501. args: [],
  4502. 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",
  4503. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4504. referencedClasses: []
  4505. }),
  4506. smalltalk.NumberTest);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "testCopying",
  4510. category: 'tests',
  4511. fn: function (){
  4512. var self=this;
  4513. return smalltalk.withContext(function($ctx1) {
  4514. var $1;
  4515. $1=_st((1)._copy()).__eq_eq((1));
  4516. $ctx1.sendIdx["=="]=1;
  4517. self._assert_($1);
  4518. $ctx1.sendIdx["assert:"]=1;
  4519. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  4520. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4521. args: [],
  4522. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4523. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4524. referencedClasses: []
  4525. }),
  4526. smalltalk.NumberTest);
  4527. smalltalk.addMethod(
  4528. smalltalk.method({
  4529. selector: "testEquality",
  4530. category: 'tests',
  4531. fn: function (){
  4532. var self=this;
  4533. return smalltalk.withContext(function($ctx1) {
  4534. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  4535. $1=(1).__eq((1));
  4536. $ctx1.sendIdx["="]=1;
  4537. self._assert_($1);
  4538. $ctx1.sendIdx["assert:"]=1;
  4539. $2=(0).__eq((0));
  4540. $ctx1.sendIdx["="]=2;
  4541. self._assert_($2);
  4542. $ctx1.sendIdx["assert:"]=2;
  4543. $3=(1).__eq((0));
  4544. $ctx1.sendIdx["="]=3;
  4545. self._deny_($3);
  4546. $ctx1.sendIdx["deny:"]=1;
  4547. $5=(1)._yourself();
  4548. $ctx1.sendIdx["yourself"]=1;
  4549. $4=_st($5).__eq((1));
  4550. $ctx1.sendIdx["="]=4;
  4551. self._assert_($4);
  4552. $ctx1.sendIdx["assert:"]=3;
  4553. $7=(1)._yourself();
  4554. $ctx1.sendIdx["yourself"]=2;
  4555. $6=(1).__eq($7);
  4556. $ctx1.sendIdx["="]=5;
  4557. self._assert_($6);
  4558. $ctx1.sendIdx["assert:"]=4;
  4559. $9=(1)._yourself();
  4560. $ctx1.sendIdx["yourself"]=3;
  4561. $8=_st($9).__eq((1)._yourself());
  4562. $ctx1.sendIdx["="]=6;
  4563. self._assert_($8);
  4564. $10=(0).__eq(false);
  4565. $ctx1.sendIdx["="]=7;
  4566. self._deny_($10);
  4567. $ctx1.sendIdx["deny:"]=2;
  4568. $11=false.__eq((0));
  4569. $ctx1.sendIdx["="]=8;
  4570. self._deny_($11);
  4571. $ctx1.sendIdx["deny:"]=3;
  4572. $12="".__eq((0));
  4573. $ctx1.sendIdx["="]=9;
  4574. self._deny_($12);
  4575. $ctx1.sendIdx["deny:"]=4;
  4576. self._deny_((0).__eq(""));
  4577. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4578. args: [],
  4579. 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 = ''",
  4580. messageSends: ["assert:", "=", "deny:", "yourself"],
  4581. referencedClasses: []
  4582. }),
  4583. smalltalk.NumberTest);
  4584. smalltalk.addMethod(
  4585. smalltalk.method({
  4586. selector: "testFloor",
  4587. category: 'tests',
  4588. fn: function (){
  4589. var self=this;
  4590. return smalltalk.withContext(function($ctx1) {
  4591. var $1,$2;
  4592. $1=(1.2)._floor();
  4593. $ctx1.sendIdx["floor"]=1;
  4594. self._assert_equals_($1,(1));
  4595. $ctx1.sendIdx["assert:equals:"]=1;
  4596. $2=(-1.2)._floor();
  4597. $ctx1.sendIdx["floor"]=2;
  4598. self._assert_equals_($2,(-2));
  4599. $ctx1.sendIdx["assert:equals:"]=2;
  4600. self._assert_equals_((1)._floor(),(1));
  4601. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4602. args: [],
  4603. 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.",
  4604. messageSends: ["assert:equals:", "floor"],
  4605. referencedClasses: []
  4606. }),
  4607. smalltalk.NumberTest);
  4608. smalltalk.addMethod(
  4609. smalltalk.method({
  4610. selector: "testHexNumbers",
  4611. category: 'tests',
  4612. fn: function (){
  4613. var self=this;
  4614. return smalltalk.withContext(function($ctx1) {
  4615. var $1,$2,$3,$4,$5;
  4616. self._assert_equals_((9),(9));
  4617. $ctx1.sendIdx["assert:equals:"]=1;
  4618. $1=(10)._truncated();
  4619. $ctx1.sendIdx["truncated"]=1;
  4620. self._assert_equals_($1,(10));
  4621. $ctx1.sendIdx["assert:equals:"]=2;
  4622. $2=(11)._truncated();
  4623. $ctx1.sendIdx["truncated"]=2;
  4624. self._assert_equals_($2,(11));
  4625. $ctx1.sendIdx["assert:equals:"]=3;
  4626. $3=(12)._truncated();
  4627. $ctx1.sendIdx["truncated"]=3;
  4628. self._assert_equals_($3,(12));
  4629. $ctx1.sendIdx["assert:equals:"]=4;
  4630. $4=(13)._truncated();
  4631. $ctx1.sendIdx["truncated"]=4;
  4632. self._assert_equals_($4,(13));
  4633. $ctx1.sendIdx["assert:equals:"]=5;
  4634. $5=(14)._truncated();
  4635. $ctx1.sendIdx["truncated"]=5;
  4636. self._assert_equals_($5,(14));
  4637. $ctx1.sendIdx["assert:equals:"]=6;
  4638. self._assert_equals_((15)._truncated(),(15));
  4639. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4640. args: [],
  4641. 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",
  4642. messageSends: ["assert:equals:", "truncated"],
  4643. referencedClasses: []
  4644. }),
  4645. smalltalk.NumberTest);
  4646. smalltalk.addMethod(
  4647. smalltalk.method({
  4648. selector: "testIdentity",
  4649. category: 'tests',
  4650. fn: function (){
  4651. var self=this;
  4652. return smalltalk.withContext(function($ctx1) {
  4653. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  4654. $1=(1).__eq_eq((1));
  4655. $ctx1.sendIdx["=="]=1;
  4656. self._assert_($1);
  4657. $ctx1.sendIdx["assert:"]=1;
  4658. $2=(0).__eq_eq((0));
  4659. $ctx1.sendIdx["=="]=2;
  4660. self._assert_($2);
  4661. $ctx1.sendIdx["assert:"]=2;
  4662. $3=(1).__eq_eq((0));
  4663. $ctx1.sendIdx["=="]=3;
  4664. self._deny_($3);
  4665. $ctx1.sendIdx["deny:"]=1;
  4666. $5=(1)._yourself();
  4667. $ctx1.sendIdx["yourself"]=1;
  4668. $4=_st($5).__eq_eq((1));
  4669. $ctx1.sendIdx["=="]=4;
  4670. self._assert_($4);
  4671. $ctx1.sendIdx["assert:"]=3;
  4672. $7=(1)._yourself();
  4673. $ctx1.sendIdx["yourself"]=2;
  4674. $6=(1).__eq_eq($7);
  4675. $ctx1.sendIdx["=="]=5;
  4676. self._assert_($6);
  4677. $ctx1.sendIdx["assert:"]=4;
  4678. $9=(1)._yourself();
  4679. $ctx1.sendIdx["yourself"]=3;
  4680. $8=_st($9).__eq_eq((1)._yourself());
  4681. $ctx1.sendIdx["=="]=6;
  4682. self._assert_($8);
  4683. self._deny_((1).__eq_eq((2)));
  4684. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4685. args: [],
  4686. 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",
  4687. messageSends: ["assert:", "==", "deny:", "yourself"],
  4688. referencedClasses: []
  4689. }),
  4690. smalltalk.NumberTest);
  4691. smalltalk.addMethod(
  4692. smalltalk.method({
  4693. selector: "testInvalidHexNumbers",
  4694. category: 'tests',
  4695. fn: function (){
  4696. var self=this;
  4697. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4698. return smalltalk.withContext(function($ctx1) {
  4699. self._should_raise_((function(){
  4700. return smalltalk.withContext(function($ctx2) {
  4701. return (16)._rG();
  4702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4703. $ctx1.sendIdx["should:raise:"]=1;
  4704. self._should_raise_((function(){
  4705. return smalltalk.withContext(function($ctx2) {
  4706. return (16)._rg();
  4707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4708. $ctx1.sendIdx["should:raise:"]=2;
  4709. self._should_raise_((function(){
  4710. return smalltalk.withContext(function($ctx2) {
  4711. return (16)._rH();
  4712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4713. $ctx1.sendIdx["should:raise:"]=3;
  4714. self._should_raise_((function(){
  4715. return smalltalk.withContext(function($ctx2) {
  4716. return (16)._rh();
  4717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4718. $ctx1.sendIdx["should:raise:"]=4;
  4719. self._should_raise_((function(){
  4720. return smalltalk.withContext(function($ctx2) {
  4721. return (16)._rI();
  4722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4723. $ctx1.sendIdx["should:raise:"]=5;
  4724. self._should_raise_((function(){
  4725. return smalltalk.withContext(function($ctx2) {
  4726. return (16)._ri();
  4727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4728. $ctx1.sendIdx["should:raise:"]=6;
  4729. self._should_raise_((function(){
  4730. return smalltalk.withContext(function($ctx2) {
  4731. return (16)._rJ();
  4732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4733. $ctx1.sendIdx["should:raise:"]=7;
  4734. self._should_raise_((function(){
  4735. return smalltalk.withContext(function($ctx2) {
  4736. return (16)._rj();
  4737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4738. $ctx1.sendIdx["should:raise:"]=8;
  4739. self._should_raise_((function(){
  4740. return smalltalk.withContext(function($ctx2) {
  4741. return (16)._rK();
  4742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4743. $ctx1.sendIdx["should:raise:"]=9;
  4744. self._should_raise_((function(){
  4745. return smalltalk.withContext(function($ctx2) {
  4746. return (16)._rk();
  4747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  4748. $ctx1.sendIdx["should:raise:"]=10;
  4749. self._should_raise_((function(){
  4750. return smalltalk.withContext(function($ctx2) {
  4751. return (16)._rL();
  4752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  4753. $ctx1.sendIdx["should:raise:"]=11;
  4754. self._should_raise_((function(){
  4755. return smalltalk.withContext(function($ctx2) {
  4756. return (16)._rl();
  4757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  4758. $ctx1.sendIdx["should:raise:"]=12;
  4759. self._should_raise_((function(){
  4760. return smalltalk.withContext(function($ctx2) {
  4761. return (16)._rM();
  4762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  4763. $ctx1.sendIdx["should:raise:"]=13;
  4764. self._should_raise_((function(){
  4765. return smalltalk.withContext(function($ctx2) {
  4766. return (16)._rm();
  4767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  4768. $ctx1.sendIdx["should:raise:"]=14;
  4769. self._should_raise_((function(){
  4770. return smalltalk.withContext(function($ctx2) {
  4771. return (16)._rN();
  4772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  4773. $ctx1.sendIdx["should:raise:"]=15;
  4774. self._should_raise_((function(){
  4775. return smalltalk.withContext(function($ctx2) {
  4776. return (16)._rn();
  4777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  4778. $ctx1.sendIdx["should:raise:"]=16;
  4779. self._should_raise_((function(){
  4780. return smalltalk.withContext(function($ctx2) {
  4781. return (16)._rO();
  4782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  4783. $ctx1.sendIdx["should:raise:"]=17;
  4784. self._should_raise_((function(){
  4785. return smalltalk.withContext(function($ctx2) {
  4786. return (16)._ro();
  4787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  4788. $ctx1.sendIdx["should:raise:"]=18;
  4789. self._should_raise_((function(){
  4790. return smalltalk.withContext(function($ctx2) {
  4791. return (16)._rP();
  4792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  4793. $ctx1.sendIdx["should:raise:"]=19;
  4794. self._should_raise_((function(){
  4795. return smalltalk.withContext(function($ctx2) {
  4796. return (16)._rp();
  4797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  4798. $ctx1.sendIdx["should:raise:"]=20;
  4799. self._should_raise_((function(){
  4800. return smalltalk.withContext(function($ctx2) {
  4801. return (16)._rQ();
  4802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  4803. $ctx1.sendIdx["should:raise:"]=21;
  4804. self._should_raise_((function(){
  4805. return smalltalk.withContext(function($ctx2) {
  4806. return (16)._rq();
  4807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  4808. $ctx1.sendIdx["should:raise:"]=22;
  4809. self._should_raise_((function(){
  4810. return smalltalk.withContext(function($ctx2) {
  4811. return (16)._rR();
  4812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  4813. $ctx1.sendIdx["should:raise:"]=23;
  4814. self._should_raise_((function(){
  4815. return smalltalk.withContext(function($ctx2) {
  4816. return (16)._rr();
  4817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  4818. $ctx1.sendIdx["should:raise:"]=24;
  4819. self._should_raise_((function(){
  4820. return smalltalk.withContext(function($ctx2) {
  4821. return (16)._rS();
  4822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  4823. $ctx1.sendIdx["should:raise:"]=25;
  4824. self._should_raise_((function(){
  4825. return smalltalk.withContext(function($ctx2) {
  4826. return (16)._rs();
  4827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  4828. $ctx1.sendIdx["should:raise:"]=26;
  4829. self._should_raise_((function(){
  4830. return smalltalk.withContext(function($ctx2) {
  4831. return (16)._rT();
  4832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  4833. $ctx1.sendIdx["should:raise:"]=27;
  4834. self._should_raise_((function(){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. return (16)._rt();
  4837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  4838. $ctx1.sendIdx["should:raise:"]=28;
  4839. self._should_raise_((function(){
  4840. return smalltalk.withContext(function($ctx2) {
  4841. return (16)._rU();
  4842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  4843. $ctx1.sendIdx["should:raise:"]=29;
  4844. self._should_raise_((function(){
  4845. return smalltalk.withContext(function($ctx2) {
  4846. return (16)._ru();
  4847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  4848. $ctx1.sendIdx["should:raise:"]=30;
  4849. self._should_raise_((function(){
  4850. return smalltalk.withContext(function($ctx2) {
  4851. return (16)._rV();
  4852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  4853. $ctx1.sendIdx["should:raise:"]=31;
  4854. self._should_raise_((function(){
  4855. return smalltalk.withContext(function($ctx2) {
  4856. return (16)._rv();
  4857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  4858. $ctx1.sendIdx["should:raise:"]=32;
  4859. self._should_raise_((function(){
  4860. return smalltalk.withContext(function($ctx2) {
  4861. return (16)._rW();
  4862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  4863. $ctx1.sendIdx["should:raise:"]=33;
  4864. self._should_raise_((function(){
  4865. return smalltalk.withContext(function($ctx2) {
  4866. return (16)._rw();
  4867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  4868. $ctx1.sendIdx["should:raise:"]=34;
  4869. self._should_raise_((function(){
  4870. return smalltalk.withContext(function($ctx2) {
  4871. return (16)._rX();
  4872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  4873. $ctx1.sendIdx["should:raise:"]=35;
  4874. self._should_raise_((function(){
  4875. return smalltalk.withContext(function($ctx2) {
  4876. return (16)._rx();
  4877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  4878. $ctx1.sendIdx["should:raise:"]=36;
  4879. self._should_raise_((function(){
  4880. return smalltalk.withContext(function($ctx2) {
  4881. return (16)._rY();
  4882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  4883. $ctx1.sendIdx["should:raise:"]=37;
  4884. self._should_raise_((function(){
  4885. return smalltalk.withContext(function($ctx2) {
  4886. return (16)._ry();
  4887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  4888. $ctx1.sendIdx["should:raise:"]=38;
  4889. self._should_raise_((function(){
  4890. return smalltalk.withContext(function($ctx2) {
  4891. return (16)._rZ();
  4892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  4893. $ctx1.sendIdx["should:raise:"]=39;
  4894. self._should_raise_((function(){
  4895. return smalltalk.withContext(function($ctx2) {
  4896. return (16)._rz();
  4897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  4898. $ctx1.sendIdx["should:raise:"]=40;
  4899. self._should_raise_((function(){
  4900. return smalltalk.withContext(function($ctx2) {
  4901. return (11259375)._Z();
  4902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  4903. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  4904. args: [],
  4905. 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.",
  4906. 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"],
  4907. referencedClasses: ["MessageNotUnderstood"]
  4908. }),
  4909. smalltalk.NumberTest);
  4910. smalltalk.addMethod(
  4911. smalltalk.method({
  4912. selector: "testLog",
  4913. category: 'tests',
  4914. fn: function (){
  4915. var self=this;
  4916. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  4917. return smalltalk.withContext(function($ctx1) {
  4918. self._assert_equals_((10000)._log(),(4));
  4919. $ctx1.sendIdx["assert:equals:"]=1;
  4920. self._assert_equals_((512)._log_((2)),(9));
  4921. $ctx1.sendIdx["assert:equals:"]=2;
  4922. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  4923. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  4924. args: [],
  4925. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  4926. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  4927. referencedClasses: ["Number"]
  4928. }),
  4929. smalltalk.NumberTest);
  4930. smalltalk.addMethod(
  4931. smalltalk.method({
  4932. selector: "testMinMax",
  4933. category: 'tests',
  4934. fn: function (){
  4935. var self=this;
  4936. return smalltalk.withContext(function($ctx1) {
  4937. self._assert_equals_((2)._max_((5)),(5));
  4938. $ctx1.sendIdx["assert:equals:"]=1;
  4939. self._assert_equals_((2)._min_((5)),(2));
  4940. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  4941. args: [],
  4942. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  4943. messageSends: ["assert:equals:", "max:", "min:"],
  4944. referencedClasses: []
  4945. }),
  4946. smalltalk.NumberTest);
  4947. smalltalk.addMethod(
  4948. smalltalk.method({
  4949. selector: "testNegated",
  4950. category: 'tests',
  4951. fn: function (){
  4952. var self=this;
  4953. return smalltalk.withContext(function($ctx1) {
  4954. var $1;
  4955. $1=(3)._negated();
  4956. $ctx1.sendIdx["negated"]=1;
  4957. self._assert_equals_($1,(-3));
  4958. $ctx1.sendIdx["assert:equals:"]=1;
  4959. self._assert_equals_((-3)._negated(),(3));
  4960. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  4961. args: [],
  4962. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  4963. messageSends: ["assert:equals:", "negated"],
  4964. referencedClasses: []
  4965. }),
  4966. smalltalk.NumberTest);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "testPrintShowingDecimalPlaces",
  4970. category: 'tests',
  4971. fn: function (){
  4972. var self=this;
  4973. return smalltalk.withContext(function($ctx1) {
  4974. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  4975. $1=(23)._printShowingDecimalPlaces_((2));
  4976. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  4977. self._assert_equals_($1,"23.00");
  4978. $ctx1.sendIdx["assert:equals:"]=1;
  4979. $2=(23.5698)._printShowingDecimalPlaces_((2));
  4980. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  4981. self._assert_equals_($2,"23.57");
  4982. $ctx1.sendIdx["assert:equals:"]=2;
  4983. $4=(234.567)._negated();
  4984. $ctx1.sendIdx["negated"]=1;
  4985. $3=_st($4)._printShowingDecimalPlaces_((5));
  4986. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  4987. self._assert_equals_($3,"-234.56700");
  4988. $ctx1.sendIdx["assert:equals:"]=3;
  4989. $5=(23.4567)._printShowingDecimalPlaces_((0));
  4990. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  4991. self._assert_equals_($5,"23");
  4992. $ctx1.sendIdx["assert:equals:"]=4;
  4993. $6=(23.5567)._printShowingDecimalPlaces_((0));
  4994. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  4995. self._assert_equals_($6,"24");
  4996. $ctx1.sendIdx["assert:equals:"]=5;
  4997. $8=(23.4567)._negated();
  4998. $ctx1.sendIdx["negated"]=2;
  4999. $7=_st($8)._printShowingDecimalPlaces_((0));
  5000. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5001. self._assert_equals_($7,"-23");
  5002. $ctx1.sendIdx["assert:equals:"]=6;
  5003. $10=(23.5567)._negated();
  5004. $ctx1.sendIdx["negated"]=3;
  5005. $9=_st($10)._printShowingDecimalPlaces_((0));
  5006. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5007. self._assert_equals_($9,"-24");
  5008. $ctx1.sendIdx["assert:equals:"]=7;
  5009. $11=(100000000)._printShowingDecimalPlaces_((1));
  5010. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5011. self._assert_equals_($11,"100000000.0");
  5012. $ctx1.sendIdx["assert:equals:"]=8;
  5013. $12=(0.98)._printShowingDecimalPlaces_((5));
  5014. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5015. self._assert_equals_($12,"0.98000");
  5016. $ctx1.sendIdx["assert:equals:"]=9;
  5017. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5018. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5019. self._assert_equals_($13,"-0.98");
  5020. $ctx1.sendIdx["assert:equals:"]=10;
  5021. $14=(2.567)._printShowingDecimalPlaces_((2));
  5022. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5023. self._assert_equals_($14,"2.57");
  5024. $ctx1.sendIdx["assert:equals:"]=11;
  5025. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5026. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5027. self._assert_equals_($15,"-2.57");
  5028. $ctx1.sendIdx["assert:equals:"]=12;
  5029. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5030. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5031. args: [],
  5032. 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'.",
  5033. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5034. referencedClasses: []
  5035. }),
  5036. smalltalk.NumberTest);
  5037. smalltalk.addMethod(
  5038. smalltalk.method({
  5039. selector: "testRaisedTo",
  5040. category: 'tests',
  5041. fn: function (){
  5042. var self=this;
  5043. return smalltalk.withContext(function($ctx1) {
  5044. var $1,$2,$3;
  5045. $1=(2)._raisedTo_((4));
  5046. $ctx1.sendIdx["raisedTo:"]=1;
  5047. self._assert_equals_($1,(16));
  5048. $ctx1.sendIdx["assert:equals:"]=1;
  5049. $2=(2)._raisedTo_((0));
  5050. $ctx1.sendIdx["raisedTo:"]=2;
  5051. self._assert_equals_($2,(1));
  5052. $ctx1.sendIdx["assert:equals:"]=2;
  5053. $3=(2)._raisedTo_((-3));
  5054. $ctx1.sendIdx["raisedTo:"]=3;
  5055. self._assert_equals_($3,(0.125));
  5056. $ctx1.sendIdx["assert:equals:"]=3;
  5057. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5058. $ctx1.sendIdx["assert:equals:"]=4;
  5059. self._assert_equals_((2).__star_star((4)),(16));
  5060. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5061. args: [],
  5062. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  5063. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5064. referencedClasses: []
  5065. }),
  5066. smalltalk.NumberTest);
  5067. smalltalk.addMethod(
  5068. smalltalk.method({
  5069. selector: "testRounded",
  5070. category: 'tests',
  5071. fn: function (){
  5072. var self=this;
  5073. return smalltalk.withContext(function($ctx1) {
  5074. var $1,$2;
  5075. $1=(3)._rounded();
  5076. $ctx1.sendIdx["rounded"]=1;
  5077. self._assert_equals_($1,(3));
  5078. $ctx1.sendIdx["assert:equals:"]=1;
  5079. $2=(3.212)._rounded();
  5080. $ctx1.sendIdx["rounded"]=2;
  5081. self._assert_equals_($2,(3));
  5082. $ctx1.sendIdx["assert:equals:"]=2;
  5083. self._assert_equals_((3.51)._rounded(),(4));
  5084. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5085. args: [],
  5086. 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",
  5087. messageSends: ["assert:equals:", "rounded"],
  5088. referencedClasses: []
  5089. }),
  5090. smalltalk.NumberTest);
  5091. smalltalk.addMethod(
  5092. smalltalk.method({
  5093. selector: "testSign",
  5094. category: 'tests',
  5095. fn: function (){
  5096. var self=this;
  5097. return smalltalk.withContext(function($ctx1) {
  5098. var $1,$2;
  5099. $1=(5)._sign();
  5100. $ctx1.sendIdx["sign"]=1;
  5101. self._assert_equals_($1,(1));
  5102. $ctx1.sendIdx["assert:equals:"]=1;
  5103. $2=(0)._sign();
  5104. $ctx1.sendIdx["sign"]=2;
  5105. self._assert_equals_($2,(0));
  5106. $ctx1.sendIdx["assert:equals:"]=2;
  5107. self._assert_equals_((-1.4)._sign(),(-1));
  5108. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5109. args: [],
  5110. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5111. messageSends: ["assert:equals:", "sign"],
  5112. referencedClasses: []
  5113. }),
  5114. smalltalk.NumberTest);
  5115. smalltalk.addMethod(
  5116. smalltalk.method({
  5117. selector: "testSqrt",
  5118. category: 'tests',
  5119. fn: function (){
  5120. var self=this;
  5121. return smalltalk.withContext(function($ctx1) {
  5122. var $1;
  5123. $1=(4)._sqrt();
  5124. $ctx1.sendIdx["sqrt"]=1;
  5125. self._assert_equals_($1,(2));
  5126. $ctx1.sendIdx["assert:equals:"]=1;
  5127. self._assert_equals_((16)._sqrt(),(4));
  5128. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5129. args: [],
  5130. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5131. messageSends: ["assert:equals:", "sqrt"],
  5132. referencedClasses: []
  5133. }),
  5134. smalltalk.NumberTest);
  5135. smalltalk.addMethod(
  5136. smalltalk.method({
  5137. selector: "testSquared",
  5138. category: 'tests',
  5139. fn: function (){
  5140. var self=this;
  5141. return smalltalk.withContext(function($ctx1) {
  5142. self._assert_equals_((4)._squared(),(16));
  5143. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5144. args: [],
  5145. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5146. messageSends: ["assert:equals:", "squared"],
  5147. referencedClasses: []
  5148. }),
  5149. smalltalk.NumberTest);
  5150. smalltalk.addMethod(
  5151. smalltalk.method({
  5152. selector: "testTimesRepeat",
  5153. category: 'tests',
  5154. fn: function (){
  5155. var self=this;
  5156. var i;
  5157. return smalltalk.withContext(function($ctx1) {
  5158. i=(0);
  5159. (0)._timesRepeat_((function(){
  5160. return smalltalk.withContext(function($ctx2) {
  5161. i=_st(i).__plus((1));
  5162. $ctx2.sendIdx["+"]=1;
  5163. return i;
  5164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5165. $ctx1.sendIdx["timesRepeat:"]=1;
  5166. self._assert_equals_(i,(0));
  5167. $ctx1.sendIdx["assert:equals:"]=1;
  5168. (5)._timesRepeat_((function(){
  5169. return smalltalk.withContext(function($ctx2) {
  5170. i=_st(i).__plus((1));
  5171. return i;
  5172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5173. self._assert_equals_(i,(5));
  5174. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5175. args: [],
  5176. 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",
  5177. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5178. referencedClasses: []
  5179. }),
  5180. smalltalk.NumberTest);
  5181. smalltalk.addMethod(
  5182. smalltalk.method({
  5183. selector: "testTo",
  5184. category: 'tests',
  5185. fn: function (){
  5186. var self=this;
  5187. return smalltalk.withContext(function($ctx1) {
  5188. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5189. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5190. args: [],
  5191. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5192. messageSends: ["assert:equals:", "to:"],
  5193. referencedClasses: []
  5194. }),
  5195. smalltalk.NumberTest);
  5196. smalltalk.addMethod(
  5197. smalltalk.method({
  5198. selector: "testToBy",
  5199. category: 'tests',
  5200. fn: function (){
  5201. var self=this;
  5202. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5203. return smalltalk.withContext(function($ctx1) {
  5204. var $1;
  5205. $1=(0)._to_by_((6),(2));
  5206. $ctx1.sendIdx["to:by:"]=1;
  5207. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5208. self._should_raise_((function(){
  5209. return smalltalk.withContext(function($ctx2) {
  5210. return (1)._to_by_((4),(0));
  5211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5212. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5213. args: [],
  5214. 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",
  5215. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5216. referencedClasses: ["Error"]
  5217. }),
  5218. smalltalk.NumberTest);
  5219. smalltalk.addMethod(
  5220. smalltalk.method({
  5221. selector: "testTrigonometry",
  5222. category: 'tests',
  5223. fn: function (){
  5224. var self=this;
  5225. return smalltalk.withContext(function($ctx1) {
  5226. self._assert_equals_((0)._cos(),(1));
  5227. $ctx1.sendIdx["assert:equals:"]=1;
  5228. self._assert_equals_((0)._sin(),(0));
  5229. $ctx1.sendIdx["assert:equals:"]=2;
  5230. self._assert_equals_((0)._tan(),(0));
  5231. $ctx1.sendIdx["assert:equals:"]=3;
  5232. self._assert_equals_((1)._arcCos(),(0));
  5233. $ctx1.sendIdx["assert:equals:"]=4;
  5234. self._assert_equals_((0)._arcSin(),(0));
  5235. $ctx1.sendIdx["assert:equals:"]=5;
  5236. self._assert_equals_((0)._arcTan(),(0));
  5237. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5238. args: [],
  5239. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  5240. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5241. referencedClasses: []
  5242. }),
  5243. smalltalk.NumberTest);
  5244. smalltalk.addMethod(
  5245. smalltalk.method({
  5246. selector: "testTruncated",
  5247. category: 'tests',
  5248. fn: function (){
  5249. var self=this;
  5250. return smalltalk.withContext(function($ctx1) {
  5251. var $1,$2;
  5252. $1=(3)._truncated();
  5253. $ctx1.sendIdx["truncated"]=1;
  5254. self._assert_equals_($1,(3));
  5255. $ctx1.sendIdx["assert:equals:"]=1;
  5256. $2=(3.212)._truncated();
  5257. $ctx1.sendIdx["truncated"]=2;
  5258. self._assert_equals_($2,(3));
  5259. $ctx1.sendIdx["assert:equals:"]=2;
  5260. self._assert_equals_((3.51)._truncated(),(3));
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5262. args: [],
  5263. 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",
  5264. messageSends: ["assert:equals:", "truncated"],
  5265. referencedClasses: []
  5266. }),
  5267. smalltalk.NumberTest);
  5268. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5269. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5270. smalltalk.addMethod(
  5271. smalltalk.method({
  5272. selector: "foo",
  5273. category: 'not yet classified',
  5274. fn: function (){
  5275. var self=this;
  5276. return smalltalk.withContext(function($ctx1) {
  5277. var $1;
  5278. $1=self["@foo"];
  5279. return $1;
  5280. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5281. args: [],
  5282. source: "foo\x0a\x09^ foo",
  5283. messageSends: [],
  5284. referencedClasses: []
  5285. }),
  5286. smalltalk.ObjectMock);
  5287. smalltalk.addMethod(
  5288. smalltalk.method({
  5289. selector: "foo:",
  5290. category: 'not yet classified',
  5291. fn: function (anObject){
  5292. var self=this;
  5293. return smalltalk.withContext(function($ctx1) {
  5294. self["@foo"]=anObject;
  5295. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5296. args: ["anObject"],
  5297. source: "foo: anObject\x0a\x09foo := anObject",
  5298. messageSends: [],
  5299. referencedClasses: []
  5300. }),
  5301. smalltalk.ObjectMock);
  5302. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5303. smalltalk.addMethod(
  5304. smalltalk.method({
  5305. selector: "notDefined",
  5306. category: 'tests',
  5307. fn: function (){
  5308. var self=this;
  5309. return smalltalk.withContext(function($ctx1) {
  5310. return void 0;;
  5311. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5312. args: [],
  5313. source: "notDefined\x0a\x09<return void 0;>",
  5314. messageSends: [],
  5315. referencedClasses: []
  5316. }),
  5317. smalltalk.ObjectTest);
  5318. smalltalk.addMethod(
  5319. smalltalk.method({
  5320. selector: "testBasicAccess",
  5321. category: 'tests',
  5322. fn: function (){
  5323. var self=this;
  5324. var o;
  5325. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5326. return smalltalk.withContext(function($ctx1) {
  5327. var $1;
  5328. o=_st($Object())._new();
  5329. _st(o)._basicAt_put_("a",(1));
  5330. $1=_st(o)._basicAt_("a");
  5331. $ctx1.sendIdx["basicAt:"]=1;
  5332. self._assert_equals_($1,(1));
  5333. $ctx1.sendIdx["assert:equals:"]=1;
  5334. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  5335. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5336. args: [],
  5337. 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",
  5338. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5339. referencedClasses: ["Object"]
  5340. }),
  5341. smalltalk.ObjectTest);
  5342. smalltalk.addMethod(
  5343. smalltalk.method({
  5344. selector: "testBasicPerform",
  5345. category: 'tests',
  5346. fn: function (){
  5347. var self=this;
  5348. var o;
  5349. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5350. return smalltalk.withContext(function($ctx1) {
  5351. o=_st($Object())._new();
  5352. _st(o)._basicAt_put_("func",(function(){
  5353. return smalltalk.withContext(function($ctx2) {
  5354. return "hello";
  5355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5356. $ctx1.sendIdx["basicAt:put:"]=1;
  5357. _st(o)._basicAt_put_("func2",(function(a){
  5358. return smalltalk.withContext(function($ctx2) {
  5359. return _st(a).__plus((1));
  5360. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5361. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5362. $ctx1.sendIdx["assert:equals:"]=1;
  5363. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5364. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5365. args: [],
  5366. 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",
  5367. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5368. referencedClasses: ["Object"]
  5369. }),
  5370. smalltalk.ObjectTest);
  5371. smalltalk.addMethod(
  5372. smalltalk.method({
  5373. selector: "testDNU",
  5374. category: 'tests',
  5375. fn: function (){
  5376. var self=this;
  5377. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5378. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5379. return smalltalk.withContext(function($ctx1) {
  5380. self._should_raise_((function(){
  5381. return smalltalk.withContext(function($ctx2) {
  5382. return _st(_st($Object())._new())._foo();
  5383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5384. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5385. args: [],
  5386. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  5387. messageSends: ["should:raise:", "foo", "new"],
  5388. referencedClasses: ["Object", "MessageNotUnderstood"]
  5389. }),
  5390. smalltalk.ObjectTest);
  5391. smalltalk.addMethod(
  5392. smalltalk.method({
  5393. selector: "testEquality",
  5394. category: 'tests',
  5395. fn: function (){
  5396. var self=this;
  5397. var o;
  5398. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5399. return smalltalk.withContext(function($ctx1) {
  5400. var $1,$2,$4,$3;
  5401. o=_st($Object())._new();
  5402. $ctx1.sendIdx["new"]=1;
  5403. $1=_st(o).__eq(_st($Object())._new());
  5404. $ctx1.sendIdx["="]=1;
  5405. self._deny_($1);
  5406. $2=_st(o).__eq(o);
  5407. $ctx1.sendIdx["="]=2;
  5408. self._assert_($2);
  5409. $ctx1.sendIdx["assert:"]=1;
  5410. $4=_st(o)._yourself();
  5411. $ctx1.sendIdx["yourself"]=1;
  5412. $3=_st($4).__eq(o);
  5413. $ctx1.sendIdx["="]=3;
  5414. self._assert_($3);
  5415. $ctx1.sendIdx["assert:"]=2;
  5416. self._assert_(_st(o).__eq(_st(o)._yourself()));
  5417. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5418. args: [],
  5419. 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)",
  5420. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5421. referencedClasses: ["Object"]
  5422. }),
  5423. smalltalk.ObjectTest);
  5424. smalltalk.addMethod(
  5425. smalltalk.method({
  5426. selector: "testHalt",
  5427. category: 'tests',
  5428. fn: function (){
  5429. var self=this;
  5430. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5431. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5432. return smalltalk.withContext(function($ctx1) {
  5433. self._should_raise_((function(){
  5434. return smalltalk.withContext(function($ctx2) {
  5435. return _st(_st($Object())._new())._halt();
  5436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5437. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5438. args: [],
  5439. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  5440. messageSends: ["should:raise:", "halt", "new"],
  5441. referencedClasses: ["Object", "Error"]
  5442. }),
  5443. smalltalk.ObjectTest);
  5444. smalltalk.addMethod(
  5445. smalltalk.method({
  5446. selector: "testIdentity",
  5447. category: 'tests',
  5448. fn: function (){
  5449. var self=this;
  5450. var o;
  5451. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5452. return smalltalk.withContext(function($ctx1) {
  5453. var $1,$2,$4,$3;
  5454. o=_st($Object())._new();
  5455. $ctx1.sendIdx["new"]=1;
  5456. $1=_st(o).__eq_eq(_st($Object())._new());
  5457. $ctx1.sendIdx["=="]=1;
  5458. self._deny_($1);
  5459. $2=_st(o).__eq_eq(o);
  5460. $ctx1.sendIdx["=="]=2;
  5461. self._assert_($2);
  5462. $ctx1.sendIdx["assert:"]=1;
  5463. $4=_st(o)._yourself();
  5464. $ctx1.sendIdx["yourself"]=1;
  5465. $3=_st($4).__eq_eq(o);
  5466. $ctx1.sendIdx["=="]=3;
  5467. self._assert_($3);
  5468. $ctx1.sendIdx["assert:"]=2;
  5469. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  5470. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5471. args: [],
  5472. 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",
  5473. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5474. referencedClasses: ["Object"]
  5475. }),
  5476. smalltalk.ObjectTest);
  5477. smalltalk.addMethod(
  5478. smalltalk.method({
  5479. selector: "testIfNil",
  5480. category: 'tests',
  5481. fn: function (){
  5482. var self=this;
  5483. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5484. return smalltalk.withContext(function($ctx1) {
  5485. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  5486. $2=_st($Object())._new();
  5487. $ctx1.sendIdx["new"]=1;
  5488. $1=_st($2)._isNil();
  5489. self._deny_($1);
  5490. $ctx1.sendIdx["deny:"]=1;
  5491. $5=_st($Object())._new();
  5492. $ctx1.sendIdx["new"]=2;
  5493. if(($receiver = $5) == nil || $receiver == null){
  5494. $4=true;
  5495. } else {
  5496. $4=$5;
  5497. };
  5498. $3=_st($4).__eq(true);
  5499. self._deny_($3);
  5500. $7=_st($Object())._new();
  5501. $ctx1.sendIdx["new"]=3;
  5502. if(($receiver = $7) == nil || $receiver == null){
  5503. $6=$7;
  5504. } else {
  5505. $6=true;
  5506. };
  5507. self._assert_equals_($6,true);
  5508. $ctx1.sendIdx["assert:equals:"]=1;
  5509. $9=_st($Object())._new();
  5510. $ctx1.sendIdx["new"]=4;
  5511. if(($receiver = $9) == nil || $receiver == null){
  5512. $8=false;
  5513. } else {
  5514. $8=true;
  5515. };
  5516. self._assert_equals_($8,true);
  5517. $ctx1.sendIdx["assert:equals:"]=2;
  5518. $11=_st($Object())._new();
  5519. if(($receiver = $11) == nil || $receiver == null){
  5520. $10=false;
  5521. } else {
  5522. $10=true;
  5523. };
  5524. self._assert_equals_($10,true);
  5525. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5526. args: [],
  5527. 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",
  5528. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5529. referencedClasses: ["Object"]
  5530. }),
  5531. smalltalk.ObjectTest);
  5532. smalltalk.addMethod(
  5533. smalltalk.method({
  5534. selector: "testInstVars",
  5535. category: 'tests',
  5536. fn: function (){
  5537. var self=this;
  5538. var o;
  5539. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5540. return smalltalk.withContext(function($ctx1) {
  5541. var $1,$2;
  5542. o=_st($ObjectMock())._new();
  5543. $1=_st(o)._instVarAt_("foo");
  5544. $ctx1.sendIdx["instVarAt:"]=1;
  5545. self._assert_equals_($1,nil);
  5546. $ctx1.sendIdx["assert:equals:"]=1;
  5547. _st(o)._instVarAt_put_("foo",(1));
  5548. $2=_st(o)._instVarAt_("foo");
  5549. $ctx1.sendIdx["instVarAt:"]=2;
  5550. self._assert_equals_($2,(1));
  5551. $ctx1.sendIdx["assert:equals:"]=2;
  5552. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  5553. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5554. args: [],
  5555. 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",
  5556. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5557. referencedClasses: ["ObjectMock"]
  5558. }),
  5559. smalltalk.ObjectTest);
  5560. smalltalk.addMethod(
  5561. smalltalk.method({
  5562. selector: "testNilUndefined",
  5563. category: 'tests',
  5564. fn: function (){
  5565. var self=this;
  5566. return smalltalk.withContext(function($ctx1) {
  5567. self._assert_equals_(self._notDefined(),nil);
  5568. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5569. args: [],
  5570. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5571. messageSends: ["assert:equals:", "notDefined"],
  5572. referencedClasses: []
  5573. }),
  5574. smalltalk.ObjectTest);
  5575. smalltalk.addMethod(
  5576. smalltalk.method({
  5577. selector: "testYourself",
  5578. category: 'tests',
  5579. fn: function (){
  5580. var self=this;
  5581. var o;
  5582. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5583. return smalltalk.withContext(function($ctx1) {
  5584. o=_st($ObjectMock())._new();
  5585. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5586. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5587. args: [],
  5588. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5589. messageSends: ["new", "assert:", "==", "yourself"],
  5590. referencedClasses: ["ObjectMock"]
  5591. }),
  5592. smalltalk.ObjectTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "testidentityHash",
  5596. category: 'tests',
  5597. fn: function (){
  5598. var self=this;
  5599. var o1,o2;
  5600. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5601. return smalltalk.withContext(function($ctx1) {
  5602. var $2,$3,$1,$5,$4;
  5603. o1=_st($Object())._new();
  5604. $ctx1.sendIdx["new"]=1;
  5605. o2=_st($Object())._new();
  5606. $2=_st(o1)._identityHash();
  5607. $ctx1.sendIdx["identityHash"]=1;
  5608. $3=_st(o1)._identityHash();
  5609. $ctx1.sendIdx["identityHash"]=2;
  5610. $1=_st($2).__eq_eq($3);
  5611. $ctx1.sendIdx["=="]=1;
  5612. self._assert_($1);
  5613. $5=_st(o1)._identityHash();
  5614. $ctx1.sendIdx["identityHash"]=3;
  5615. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  5616. self._deny_($4);
  5617. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5618. args: [],
  5619. 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",
  5620. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5621. referencedClasses: ["Object"]
  5622. }),
  5623. smalltalk.ObjectTest);
  5624. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5625. smalltalk.addMethod(
  5626. smalltalk.method({
  5627. selector: "testAccessing",
  5628. category: 'tests',
  5629. fn: function (){
  5630. var self=this;
  5631. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5632. return smalltalk.withContext(function($ctx1) {
  5633. var $2,$1,$3,$6,$5,$4;
  5634. $2=_st($Point())._x_y_((3),(4));
  5635. $ctx1.sendIdx["x:y:"]=1;
  5636. $1=_st($2)._x();
  5637. $ctx1.sendIdx["x"]=1;
  5638. self._assert_equals_($1,(3));
  5639. $ctx1.sendIdx["assert:equals:"]=1;
  5640. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  5641. $ctx1.sendIdx["y"]=1;
  5642. self._assert_equals_($3,(4));
  5643. $ctx1.sendIdx["assert:equals:"]=2;
  5644. $6=_st($Point())._new();
  5645. $ctx1.sendIdx["new"]=1;
  5646. $5=_st($6)._x_((3));
  5647. $4=_st($5)._x();
  5648. self._assert_equals_($4,(3));
  5649. $ctx1.sendIdx["assert:equals:"]=3;
  5650. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  5651. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5652. args: [],
  5653. 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",
  5654. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5655. referencedClasses: ["Point"]
  5656. }),
  5657. smalltalk.PointTest);
  5658. smalltalk.addMethod(
  5659. smalltalk.method({
  5660. selector: "testArithmetic",
  5661. category: 'tests',
  5662. fn: function (){
  5663. var self=this;
  5664. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5665. return smalltalk.withContext(function($ctx1) {
  5666. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  5667. $2=(3).__at((4));
  5668. $ctx1.sendIdx["@"]=1;
  5669. $3=(3).__at((4));
  5670. $ctx1.sendIdx["@"]=2;
  5671. $1=_st($2).__star($3);
  5672. $4=_st($Point())._x_y_((9),(16));
  5673. $ctx1.sendIdx["x:y:"]=1;
  5674. self._assert_equals_($1,$4);
  5675. $ctx1.sendIdx["assert:equals:"]=1;
  5676. $6=(3).__at((4));
  5677. $ctx1.sendIdx["@"]=3;
  5678. $7=(3).__at((4));
  5679. $ctx1.sendIdx["@"]=4;
  5680. $5=_st($6).__plus($7);
  5681. $8=_st($Point())._x_y_((6),(8));
  5682. $ctx1.sendIdx["x:y:"]=2;
  5683. self._assert_equals_($5,$8);
  5684. $ctx1.sendIdx["assert:equals:"]=2;
  5685. $10=(3).__at((4));
  5686. $ctx1.sendIdx["@"]=5;
  5687. $11=(3).__at((4));
  5688. $ctx1.sendIdx["@"]=6;
  5689. $9=_st($10).__minus($11);
  5690. $12=_st($Point())._x_y_((0),(0));
  5691. $ctx1.sendIdx["x:y:"]=3;
  5692. self._assert_equals_($9,$12);
  5693. $ctx1.sendIdx["assert:equals:"]=3;
  5694. $14=(6).__at((8));
  5695. $ctx1.sendIdx["@"]=7;
  5696. $13=_st($14).__slash((3).__at((4)));
  5697. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  5698. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5699. args: [],
  5700. 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)",
  5701. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5702. referencedClasses: ["Point"]
  5703. }),
  5704. smalltalk.PointTest);
  5705. smalltalk.addMethod(
  5706. smalltalk.method({
  5707. selector: "testAt",
  5708. category: 'tests',
  5709. fn: function (){
  5710. var self=this;
  5711. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5712. return smalltalk.withContext(function($ctx1) {
  5713. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5714. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5715. args: [],
  5716. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5717. messageSends: ["assert:equals:", "@", "x:y:"],
  5718. referencedClasses: ["Point"]
  5719. }),
  5720. smalltalk.PointTest);
  5721. smalltalk.addMethod(
  5722. smalltalk.method({
  5723. selector: "testEgality",
  5724. category: 'tests',
  5725. fn: function (){
  5726. var self=this;
  5727. return smalltalk.withContext(function($ctx1) {
  5728. var $2,$3,$1,$5,$4;
  5729. $2=(3).__at((4));
  5730. $ctx1.sendIdx["@"]=1;
  5731. $3=(3).__at((4));
  5732. $ctx1.sendIdx["@"]=2;
  5733. $1=_st($2).__eq($3);
  5734. $ctx1.sendIdx["="]=1;
  5735. self._assert_($1);
  5736. $5=(3).__at((5));
  5737. $ctx1.sendIdx["@"]=3;
  5738. $4=_st($5).__eq((3).__at((6)));
  5739. self._deny_($4);
  5740. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5741. args: [],
  5742. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5743. messageSends: ["assert:", "=", "@", "deny:"],
  5744. referencedClasses: []
  5745. }),
  5746. smalltalk.PointTest);
  5747. smalltalk.addMethod(
  5748. smalltalk.method({
  5749. selector: "testNew",
  5750. category: 'tests',
  5751. fn: function (){
  5752. var self=this;
  5753. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5754. return smalltalk.withContext(function($ctx1) {
  5755. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  5756. $3=_st($Point())._new();
  5757. $ctx1.sendIdx["new"]=1;
  5758. $2=_st($3)._x_((3));
  5759. $ctx1.sendIdx["x:"]=1;
  5760. $1=_st($2)._y();
  5761. $ctx1.sendIdx["y"]=1;
  5762. self._assert_equals_($1,nil);
  5763. $ctx1.sendIdx["assert:equals:"]=1;
  5764. $7=_st($Point())._new();
  5765. $ctx1.sendIdx["new"]=2;
  5766. $6=_st($7)._x_((3));
  5767. $5=_st($6)._x();
  5768. $ctx1.sendIdx["x"]=1;
  5769. $4=_st($5).__eq((0));
  5770. $ctx1.sendIdx["="]=1;
  5771. self._deny_($4);
  5772. $ctx1.sendIdx["deny:"]=1;
  5773. $10=_st($Point())._new();
  5774. $ctx1.sendIdx["new"]=3;
  5775. $9=_st($10)._y_((4));
  5776. $ctx1.sendIdx["y:"]=1;
  5777. $8=_st($9)._x();
  5778. self._assert_equals_($8,nil);
  5779. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  5780. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  5781. args: [],
  5782. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  5783. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  5784. referencedClasses: ["Point"]
  5785. }),
  5786. smalltalk.PointTest);
  5787. smalltalk.addMethod(
  5788. smalltalk.method({
  5789. selector: "testTranslateBy",
  5790. category: 'tests',
  5791. fn: function (){
  5792. var self=this;
  5793. return smalltalk.withContext(function($ctx1) {
  5794. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  5795. $2=(3).__at((3));
  5796. $ctx1.sendIdx["@"]=1;
  5797. $3=(0).__at((1));
  5798. $ctx1.sendIdx["@"]=2;
  5799. $1=_st($2)._translateBy_($3);
  5800. $ctx1.sendIdx["translateBy:"]=1;
  5801. $4=(3).__at((4));
  5802. $ctx1.sendIdx["@"]=3;
  5803. self._assert_equals_($1,$4);
  5804. $ctx1.sendIdx["assert:equals:"]=1;
  5805. $6=(3).__at((3));
  5806. $ctx1.sendIdx["@"]=4;
  5807. $8=(1)._negated();
  5808. $ctx1.sendIdx["negated"]=1;
  5809. $7=(0).__at($8);
  5810. $ctx1.sendIdx["@"]=5;
  5811. $5=_st($6)._translateBy_($7);
  5812. $ctx1.sendIdx["translateBy:"]=2;
  5813. $9=(3).__at((2));
  5814. $ctx1.sendIdx["@"]=6;
  5815. self._assert_equals_($5,$9);
  5816. $ctx1.sendIdx["assert:equals:"]=2;
  5817. $11=(3).__at((3));
  5818. $ctx1.sendIdx["@"]=7;
  5819. $12=(2).__at((3));
  5820. $ctx1.sendIdx["@"]=8;
  5821. $10=_st($11)._translateBy_($12);
  5822. $ctx1.sendIdx["translateBy:"]=3;
  5823. $13=(5).__at((6));
  5824. $ctx1.sendIdx["@"]=9;
  5825. self._assert_equals_($10,$13);
  5826. $ctx1.sendIdx["assert:equals:"]=3;
  5827. $15=(3).__at((3));
  5828. $ctx1.sendIdx["@"]=10;
  5829. $16=_st((3)._negated()).__at((0));
  5830. $ctx1.sendIdx["@"]=11;
  5831. $14=_st($15)._translateBy_($16);
  5832. self._assert_equals_($14,(0).__at((3)));
  5833. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  5834. args: [],
  5835. 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.",
  5836. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  5837. referencedClasses: []
  5838. }),
  5839. smalltalk.PointTest);
  5840. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5841. smalltalk.addMethod(
  5842. smalltalk.method({
  5843. selector: "testNextIfAbsent",
  5844. category: 'tests',
  5845. fn: function (){
  5846. var self=this;
  5847. var queue;
  5848. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  5849. return smalltalk.withContext(function($ctx1) {
  5850. var $2,$1;
  5851. queue=_st($Queue())._new();
  5852. _st(queue)._nextPut_("index1");
  5853. $2=_st(queue)._nextIfAbsent_("empty");
  5854. $ctx1.sendIdx["nextIfAbsent:"]=1;
  5855. $1=_st($2).__eq("index1");
  5856. $ctx1.sendIdx["="]=1;
  5857. self._assert_($1);
  5858. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  5859. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  5860. args: [],
  5861. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  5862. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  5863. referencedClasses: ["Queue"]
  5864. }),
  5865. smalltalk.QueueTest);
  5866. smalltalk.addMethod(
  5867. smalltalk.method({
  5868. selector: "testQueueNext",
  5869. category: 'tests',
  5870. fn: function (){
  5871. var self=this;
  5872. var queue;
  5873. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  5874. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5875. return smalltalk.withContext(function($ctx1) {
  5876. var $1,$2,$4,$3,$6,$5;
  5877. queue=_st($Queue())._new();
  5878. $1=queue;
  5879. _st($1)._nextPut_("index1");
  5880. $ctx1.sendIdx["nextPut:"]=1;
  5881. $2=_st($1)._nextPut_("index2");
  5882. $4=_st(queue)._next();
  5883. $ctx1.sendIdx["next"]=1;
  5884. $3=_st($4).__eq("index1");
  5885. $ctx1.sendIdx["="]=1;
  5886. self._assert_($3);
  5887. $6=_st(queue)._next();
  5888. $ctx1.sendIdx["next"]=2;
  5889. $5=_st($6).__eq("index");
  5890. self._deny_($5);
  5891. self._should_raise_((function(){
  5892. return smalltalk.withContext(function($ctx2) {
  5893. return _st(queue)._next();
  5894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5895. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  5896. args: [],
  5897. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  5898. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  5899. referencedClasses: ["Queue", "Error"]
  5900. }),
  5901. smalltalk.QueueTest);
  5902. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5903. smalltalk.addMethod(
  5904. smalltalk.method({
  5905. selector: "testAtRandomNumber",
  5906. category: 'tests',
  5907. fn: function (){
  5908. var self=this;
  5909. var val;
  5910. return smalltalk.withContext(function($ctx1) {
  5911. (100)._timesRepeat_((function(){
  5912. return smalltalk.withContext(function($ctx2) {
  5913. val=(10)._atRandom();
  5914. val;
  5915. self._assert_(_st(val).__gt((0)));
  5916. $ctx2.sendIdx["assert:"]=1;
  5917. return self._assert_(_st(val).__lt((11)));
  5918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5919. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  5920. args: [],
  5921. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  5922. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  5923. referencedClasses: []
  5924. }),
  5925. smalltalk.RandomTest);
  5926. smalltalk.addMethod(
  5927. smalltalk.method({
  5928. selector: "testAtRandomSequenceableCollection",
  5929. category: 'tests',
  5930. fn: function (){
  5931. var self=this;
  5932. var val;
  5933. return smalltalk.withContext(function($ctx1) {
  5934. var $3,$4,$2,$1;
  5935. (100)._timesRepeat_((function(){
  5936. return smalltalk.withContext(function($ctx2) {
  5937. val="abc"._atRandom();
  5938. val;
  5939. $3=_st(val).__eq("a");
  5940. $ctx2.sendIdx["="]=1;
  5941. $4=_st(val).__eq("b");
  5942. $ctx2.sendIdx["="]=2;
  5943. $2=_st($3).__or($4);
  5944. $1=_st($2).__or(_st(val).__eq("c"));
  5945. $ctx2.sendIdx["|"]=1;
  5946. return self._assert_($1);
  5947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5948. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  5949. args: [],
  5950. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  5951. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  5952. referencedClasses: []
  5953. }),
  5954. smalltalk.RandomTest);
  5955. smalltalk.addMethod(
  5956. smalltalk.method({
  5957. selector: "textNext",
  5958. category: 'tests',
  5959. fn: function (){
  5960. var self=this;
  5961. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  5962. return smalltalk.withContext(function($ctx1) {
  5963. var $1;
  5964. (10000)._timesRepeat_((function(){
  5965. var current,next;
  5966. return smalltalk.withContext(function($ctx2) {
  5967. next=_st(_st($Random())._new())._next();
  5968. next;
  5969. self._assert_(_st(next).__gt_eq((0)));
  5970. $ctx2.sendIdx["assert:"]=1;
  5971. self._assert_(_st(next).__lt((1)));
  5972. $1=_st(current).__eq(next);
  5973. $ctx2.sendIdx["="]=1;
  5974. self._deny_($1);
  5975. return _st(next).__eq(current);
  5976. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  5977. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  5978. args: [],
  5979. 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 ]",
  5980. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  5981. referencedClasses: ["Random"]
  5982. }),
  5983. smalltalk.RandomTest);
  5984. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5985. smalltalk.addMethod(
  5986. smalltalk.method({
  5987. selector: "testAddRemove",
  5988. category: 'tests',
  5989. fn: function (){
  5990. var self=this;
  5991. var set;
  5992. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5993. return smalltalk.withContext(function($ctx1) {
  5994. var $1,$2;
  5995. set=_st($Set())._new();
  5996. self._assert_(_st(set)._isEmpty());
  5997. $ctx1.sendIdx["assert:"]=1;
  5998. _st(set)._add_((3));
  5999. $ctx1.sendIdx["add:"]=1;
  6000. $1=_st(set)._includes_((3));
  6001. $ctx1.sendIdx["includes:"]=1;
  6002. self._assert_($1);
  6003. $ctx1.sendIdx["assert:"]=2;
  6004. _st(set)._add_((5));
  6005. $2=_st(set)._includes_((5));
  6006. $ctx1.sendIdx["includes:"]=2;
  6007. self._assert_($2);
  6008. _st(set)._remove_((3));
  6009. self._deny_(_st(set)._includes_((3)));
  6010. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6011. args: [],
  6012. 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)",
  6013. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6014. referencedClasses: ["Set"]
  6015. }),
  6016. smalltalk.SetTest);
  6017. smalltalk.addMethod(
  6018. smalltalk.method({
  6019. selector: "testAt",
  6020. category: 'tests',
  6021. fn: function (){
  6022. var self=this;
  6023. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6024. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6025. return smalltalk.withContext(function($ctx1) {
  6026. self._should_raise_((function(){
  6027. return smalltalk.withContext(function($ctx2) {
  6028. return _st(_st($Set())._new())._at_put_((1),(2));
  6029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6030. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6031. args: [],
  6032. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6033. messageSends: ["should:raise:", "at:put:", "new"],
  6034. referencedClasses: ["Set", "Error"]
  6035. }),
  6036. smalltalk.SetTest);
  6037. smalltalk.addMethod(
  6038. smalltalk.method({
  6039. selector: "testCollect",
  6040. category: 'tests',
  6041. fn: function (){
  6042. var self=this;
  6043. return smalltalk.withContext(function($ctx1) {
  6044. var $2,$1;
  6045. $2=[(5), (6), (8)]._asSet();
  6046. $ctx1.sendIdx["asSet"]=1;
  6047. $1=_st($2)._collect_((function(x){
  6048. return smalltalk.withContext(function($ctx2) {
  6049. return _st(x).__backslash_backslash((3));
  6050. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6051. self._assert_equals_($1,[(0), (2)]._asSet());
  6052. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6053. args: [],
  6054. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6055. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6056. referencedClasses: []
  6057. }),
  6058. smalltalk.SetTest);
  6059. smalltalk.addMethod(
  6060. smalltalk.method({
  6061. selector: "testComparing",
  6062. category: 'tests',
  6063. fn: function (){
  6064. var self=this;
  6065. return smalltalk.withContext(function($ctx1) {
  6066. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6067. $1=[(0), (2)]._asSet();
  6068. $ctx1.sendIdx["asSet"]=1;
  6069. $2=[(0), (2)]._asSet();
  6070. $ctx1.sendIdx["asSet"]=2;
  6071. self._assert_equals_($1,$2);
  6072. $ctx1.sendIdx["assert:equals:"]=1;
  6073. $3=[(2), (0)]._asSet();
  6074. $ctx1.sendIdx["asSet"]=3;
  6075. $4=[(0), (2)]._asSet();
  6076. $ctx1.sendIdx["asSet"]=4;
  6077. self._assert_equals_($3,$4);
  6078. $6=[(0), (2), (3)]._asSet();
  6079. $ctx1.sendIdx["asSet"]=5;
  6080. $7=[(0), (2)]._asSet();
  6081. $ctx1.sendIdx["asSet"]=6;
  6082. $5=_st($6).__eq($7);
  6083. $ctx1.sendIdx["="]=1;
  6084. self._deny_($5);
  6085. $ctx1.sendIdx["deny:"]=1;
  6086. $9=[(1), (2)]._asSet();
  6087. $ctx1.sendIdx["asSet"]=7;
  6088. $8=_st($9).__eq([(0), (2)]._asSet());
  6089. self._deny_($8);
  6090. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6091. args: [],
  6092. 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",
  6093. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6094. referencedClasses: []
  6095. }),
  6096. smalltalk.SetTest);
  6097. smalltalk.addMethod(
  6098. smalltalk.method({
  6099. selector: "testPrintString",
  6100. category: 'tests',
  6101. fn: function (){
  6102. var self=this;
  6103. var set;
  6104. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6105. return smalltalk.withContext(function($ctx1) {
  6106. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  6107. set=_st($Set())._new();
  6108. $1=_st(set)._printString();
  6109. $ctx1.sendIdx["printString"]=1;
  6110. self._assert_equals_($1,"a Set ()");
  6111. $ctx1.sendIdx["assert:equals:"]=1;
  6112. $2=set;
  6113. _st($2)._add_((1));
  6114. $ctx1.sendIdx["add:"]=1;
  6115. $3=_st($2)._add_((3));
  6116. $ctx1.sendIdx["add:"]=2;
  6117. $4=_st(set)._printString();
  6118. $ctx1.sendIdx["printString"]=2;
  6119. self._assert_equals_($4,"a Set (1 3)");
  6120. $ctx1.sendIdx["assert:equals:"]=2;
  6121. _st(set)._add_("foo");
  6122. $ctx1.sendIdx["add:"]=3;
  6123. $5=_st(set)._printString();
  6124. $ctx1.sendIdx["printString"]=3;
  6125. self._assert_equals_($5,"a Set (1 3 'foo')");
  6126. $ctx1.sendIdx["assert:equals:"]=3;
  6127. $6=set;
  6128. _st($6)._remove_((1));
  6129. $ctx1.sendIdx["remove:"]=1;
  6130. $7=_st($6)._remove_((3));
  6131. $8=_st(set)._printString();
  6132. $ctx1.sendIdx["printString"]=4;
  6133. self._assert_equals_($8,"a Set ('foo')");
  6134. $ctx1.sendIdx["assert:equals:"]=4;
  6135. _st(set)._add_((3));
  6136. $ctx1.sendIdx["add:"]=4;
  6137. $9=_st(set)._printString();
  6138. $ctx1.sendIdx["printString"]=5;
  6139. self._assert_equals_($9,"a Set ('foo' 3)");
  6140. $ctx1.sendIdx["assert:equals:"]=5;
  6141. _st(set)._add_((3));
  6142. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6143. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6144. args: [],
  6145. 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)'",
  6146. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6147. referencedClasses: ["Set"]
  6148. }),
  6149. smalltalk.SetTest);
  6150. smalltalk.addMethod(
  6151. smalltalk.method({
  6152. selector: "testSize",
  6153. category: 'tests',
  6154. fn: function (){
  6155. var self=this;
  6156. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6157. return smalltalk.withContext(function($ctx1) {
  6158. var $1,$3,$2;
  6159. $1=_st(_st($Set())._new())._size();
  6160. $ctx1.sendIdx["size"]=1;
  6161. self._assert_equals_($1,(0));
  6162. $ctx1.sendIdx["assert:equals:"]=1;
  6163. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6164. $ctx1.sendIdx["withAll:"]=1;
  6165. $2=_st($3)._size();
  6166. $ctx1.sendIdx["size"]=2;
  6167. self._assert_equals_($2,(4));
  6168. $ctx1.sendIdx["assert:equals:"]=2;
  6169. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6170. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6171. args: [],
  6172. 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",
  6173. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6174. referencedClasses: ["Set"]
  6175. }),
  6176. smalltalk.SetTest);
  6177. smalltalk.addMethod(
  6178. smalltalk.method({
  6179. selector: "testUnboxedObjects",
  6180. category: 'tests',
  6181. fn: function (){
  6182. var self=this;
  6183. return smalltalk.withContext(function($ctx1) {
  6184. var $4,$3,$2,$1;
  6185. $4="foo"._yourself();
  6186. $ctx1.sendIdx["yourself"]=1;
  6187. $3=[$4,"foo"._yourself()];
  6188. $2=_st($3)._asSet();
  6189. $1=_st($2)._asArray();
  6190. self._assert_equals_($1,["foo"]);
  6191. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6192. args: [],
  6193. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6194. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6195. referencedClasses: []
  6196. }),
  6197. smalltalk.SetTest);
  6198. smalltalk.addMethod(
  6199. smalltalk.method({
  6200. selector: "testUnicity",
  6201. category: 'tests',
  6202. fn: function (){
  6203. var self=this;
  6204. var set;
  6205. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6206. return smalltalk.withContext(function($ctx1) {
  6207. var $1;
  6208. set=_st($Set())._new();
  6209. _st(set)._add_((21));
  6210. $ctx1.sendIdx["add:"]=1;
  6211. _st(set)._add_("hello");
  6212. $ctx1.sendIdx["add:"]=2;
  6213. _st(set)._add_((21));
  6214. $ctx1.sendIdx["add:"]=3;
  6215. $1=_st(set)._size();
  6216. $ctx1.sendIdx["size"]=1;
  6217. self._assert_equals_($1,(2));
  6218. $ctx1.sendIdx["assert:equals:"]=1;
  6219. _st(set)._add_("hello");
  6220. self._assert_equals_(_st(set)._size(),(2));
  6221. $ctx1.sendIdx["assert:equals:"]=2;
  6222. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6223. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6224. args: [],
  6225. 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')",
  6226. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6227. referencedClasses: ["Set"]
  6228. }),
  6229. smalltalk.SetTest);
  6230. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6231. smalltalk.addMethod(
  6232. smalltalk.method({
  6233. selector: "collectionClass",
  6234. category: 'accessing',
  6235. fn: function (){
  6236. var self=this;
  6237. return smalltalk.withContext(function($ctx1) {
  6238. var $1;
  6239. $1=_st(self._class())._collectionClass();
  6240. return $1;
  6241. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6242. args: [],
  6243. source: "collectionClass\x0a\x09^ self class collectionClass",
  6244. messageSends: ["collectionClass", "class"],
  6245. referencedClasses: []
  6246. }),
  6247. smalltalk.StreamTest);
  6248. smalltalk.addMethod(
  6249. smalltalk.method({
  6250. selector: "newCollection",
  6251. category: 'accessing',
  6252. fn: function (){
  6253. var self=this;
  6254. return smalltalk.withContext(function($ctx1) {
  6255. var $1;
  6256. $1=_st(self._collectionClass())._new();
  6257. return $1;
  6258. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6259. args: [],
  6260. source: "newCollection\x0a\x09^ self collectionClass new",
  6261. messageSends: ["new", "collectionClass"],
  6262. referencedClasses: []
  6263. }),
  6264. smalltalk.StreamTest);
  6265. smalltalk.addMethod(
  6266. smalltalk.method({
  6267. selector: "newStream",
  6268. category: 'accessing',
  6269. fn: function (){
  6270. var self=this;
  6271. return smalltalk.withContext(function($ctx1) {
  6272. var $1;
  6273. $1=_st(_st(self._collectionClass())._new())._stream();
  6274. return $1;
  6275. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6276. args: [],
  6277. source: "newStream\x0a\x09^ self collectionClass new stream",
  6278. messageSends: ["stream", "new", "collectionClass"],
  6279. referencedClasses: []
  6280. }),
  6281. smalltalk.StreamTest);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "testAtStartAtEnd",
  6285. category: 'tests',
  6286. fn: function (){
  6287. var self=this;
  6288. var stream;
  6289. return smalltalk.withContext(function($ctx1) {
  6290. var $1,$2,$3,$4;
  6291. stream=self._newStream();
  6292. $1=_st(stream)._atStart();
  6293. $ctx1.sendIdx["atStart"]=1;
  6294. self._assert_($1);
  6295. $ctx1.sendIdx["assert:"]=1;
  6296. $2=_st(stream)._atEnd();
  6297. $ctx1.sendIdx["atEnd"]=1;
  6298. self._assert_($2);
  6299. $ctx1.sendIdx["assert:"]=2;
  6300. _st(stream)._nextPutAll_(self._newCollection());
  6301. $3=_st(stream)._atEnd();
  6302. $ctx1.sendIdx["atEnd"]=2;
  6303. self._assert_($3);
  6304. $4=_st(stream)._atStart();
  6305. $ctx1.sendIdx["atStart"]=2;
  6306. self._deny_($4);
  6307. $ctx1.sendIdx["deny:"]=1;
  6308. _st(stream)._position_((1));
  6309. self._deny_(_st(stream)._atEnd());
  6310. $ctx1.sendIdx["deny:"]=2;
  6311. self._deny_(_st(stream)._atStart());
  6312. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6313. args: [],
  6314. 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",
  6315. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6316. referencedClasses: []
  6317. }),
  6318. smalltalk.StreamTest);
  6319. smalltalk.addMethod(
  6320. smalltalk.method({
  6321. selector: "testContents",
  6322. category: 'tests',
  6323. fn: function (){
  6324. var self=this;
  6325. var stream;
  6326. return smalltalk.withContext(function($ctx1) {
  6327. var $1,$2;
  6328. stream=self._newStream();
  6329. $1=stream;
  6330. $2=self._newCollection();
  6331. $ctx1.sendIdx["newCollection"]=1;
  6332. _st($1)._nextPutAll_($2);
  6333. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  6334. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6335. args: [],
  6336. 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",
  6337. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6338. referencedClasses: []
  6339. }),
  6340. smalltalk.StreamTest);
  6341. smalltalk.addMethod(
  6342. smalltalk.method({
  6343. selector: "testIsEmpty",
  6344. category: 'tests',
  6345. fn: function (){
  6346. var self=this;
  6347. var stream;
  6348. return smalltalk.withContext(function($ctx1) {
  6349. var $1;
  6350. stream=self._newStream();
  6351. $1=_st(stream)._isEmpty();
  6352. $ctx1.sendIdx["isEmpty"]=1;
  6353. self._assert_($1);
  6354. _st(stream)._nextPutAll_(self._newCollection());
  6355. self._deny_(_st(stream)._isEmpty());
  6356. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6357. args: [],
  6358. 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",
  6359. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6360. referencedClasses: []
  6361. }),
  6362. smalltalk.StreamTest);
  6363. smalltalk.addMethod(
  6364. smalltalk.method({
  6365. selector: "testPosition",
  6366. category: 'tests',
  6367. fn: function (){
  6368. var self=this;
  6369. var collection,stream;
  6370. return smalltalk.withContext(function($ctx1) {
  6371. var $1,$2,$3;
  6372. collection=self._newCollection();
  6373. stream=self._newStream();
  6374. _st(stream)._nextPutAll_(collection);
  6375. $1=_st(stream)._position();
  6376. $ctx1.sendIdx["position"]=1;
  6377. self._assert_equals_($1,_st(collection)._size());
  6378. $ctx1.sendIdx["assert:equals:"]=1;
  6379. _st(stream)._position_((0));
  6380. $2=_st(stream)._position();
  6381. $ctx1.sendIdx["position"]=2;
  6382. self._assert_equals_($2,(0));
  6383. $ctx1.sendIdx["assert:equals:"]=2;
  6384. _st(stream)._next();
  6385. $ctx1.sendIdx["next"]=1;
  6386. $3=_st(stream)._position();
  6387. $ctx1.sendIdx["position"]=3;
  6388. self._assert_equals_($3,(1));
  6389. $ctx1.sendIdx["assert:equals:"]=3;
  6390. _st(stream)._next();
  6391. self._assert_equals_(_st(stream)._position(),(2));
  6392. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6393. args: [],
  6394. 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",
  6395. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6396. referencedClasses: []
  6397. }),
  6398. smalltalk.StreamTest);
  6399. smalltalk.addMethod(
  6400. smalltalk.method({
  6401. selector: "testReading",
  6402. category: 'tests',
  6403. fn: function (){
  6404. var self=this;
  6405. var stream,collection;
  6406. return smalltalk.withContext(function($ctx1) {
  6407. var $1,$2,$3;
  6408. collection=self._newCollection();
  6409. stream=self._newStream();
  6410. $1=stream;
  6411. _st($1)._nextPutAll_(collection);
  6412. $2=_st($1)._position_((0));
  6413. _st(collection)._do_((function(each){
  6414. return smalltalk.withContext(function($ctx2) {
  6415. $3=_st(stream)._next();
  6416. $ctx2.sendIdx["next"]=1;
  6417. return self._assert_equals_($3,each);
  6418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6419. self._assert_(_st(_st(stream)._next())._isNil());
  6420. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6421. args: [],
  6422. 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",
  6423. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6424. referencedClasses: []
  6425. }),
  6426. smalltalk.StreamTest);
  6427. smalltalk.addMethod(
  6428. smalltalk.method({
  6429. selector: "testStreamContents",
  6430. category: 'tests',
  6431. fn: function (){
  6432. var self=this;
  6433. return smalltalk.withContext(function($ctx1) {
  6434. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6435. args: [],
  6436. source: "testStreamContents",
  6437. messageSends: [],
  6438. referencedClasses: []
  6439. }),
  6440. smalltalk.StreamTest);
  6441. smalltalk.addMethod(
  6442. smalltalk.method({
  6443. selector: "testWrite",
  6444. category: 'tests',
  6445. fn: function (){
  6446. var self=this;
  6447. var stream,collection;
  6448. return smalltalk.withContext(function($ctx1) {
  6449. collection=self._newCollection();
  6450. stream=self._newStream();
  6451. _st(collection)._do_((function(each){
  6452. return smalltalk.withContext(function($ctx2) {
  6453. return _st(stream).__lt_lt(each);
  6454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6455. self._assert_equals_(_st(stream)._contents(),collection);
  6456. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6457. args: [],
  6458. 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",
  6459. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6460. referencedClasses: []
  6461. }),
  6462. smalltalk.StreamTest);
  6463. smalltalk.addMethod(
  6464. smalltalk.method({
  6465. selector: "testWriting",
  6466. category: 'tests',
  6467. fn: function (){
  6468. var self=this;
  6469. var stream,collection;
  6470. return smalltalk.withContext(function($ctx1) {
  6471. var $1;
  6472. collection=self._newCollection();
  6473. stream=self._newStream();
  6474. $ctx1.sendIdx["newStream"]=1;
  6475. _st(collection)._do_((function(each){
  6476. return smalltalk.withContext(function($ctx2) {
  6477. return _st(stream)._nextPut_(each);
  6478. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6479. $1=_st(stream)._contents();
  6480. $ctx1.sendIdx["contents"]=1;
  6481. self._assert_equals_($1,collection);
  6482. $ctx1.sendIdx["assert:equals:"]=1;
  6483. stream=self._newStream();
  6484. _st(stream)._nextPutAll_(collection);
  6485. self._assert_equals_(_st(stream)._contents(),collection);
  6486. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6487. args: [],
  6488. 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",
  6489. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6490. referencedClasses: []
  6491. }),
  6492. smalltalk.StreamTest);
  6493. smalltalk.addMethod(
  6494. smalltalk.method({
  6495. selector: "collectionClass",
  6496. category: 'accessing',
  6497. fn: function (){
  6498. var self=this;
  6499. return smalltalk.withContext(function($ctx1) {
  6500. return nil;
  6501. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6502. args: [],
  6503. source: "collectionClass\x0a\x09^ nil",
  6504. messageSends: [],
  6505. referencedClasses: []
  6506. }),
  6507. smalltalk.StreamTest.klass);
  6508. smalltalk.addMethod(
  6509. smalltalk.method({
  6510. selector: "isAbstract",
  6511. category: 'testing',
  6512. fn: function (){
  6513. var self=this;
  6514. return smalltalk.withContext(function($ctx1) {
  6515. var $1;
  6516. $1=_st(self._collectionClass())._isNil();
  6517. return $1;
  6518. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6519. args: [],
  6520. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6521. messageSends: ["isNil", "collectionClass"],
  6522. referencedClasses: []
  6523. }),
  6524. smalltalk.StreamTest.klass);
  6525. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6526. smalltalk.addMethod(
  6527. smalltalk.method({
  6528. selector: "newCollection",
  6529. category: 'accessing',
  6530. fn: function (){
  6531. var self=this;
  6532. return smalltalk.withContext(function($ctx1) {
  6533. var $1;
  6534. $1=[true,(1),(3).__at((4)),"foo"];
  6535. return $1;
  6536. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6537. args: [],
  6538. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6539. messageSends: ["@"],
  6540. referencedClasses: []
  6541. }),
  6542. smalltalk.ArrayStreamTest);
  6543. smalltalk.addMethod(
  6544. smalltalk.method({
  6545. selector: "collectionClass",
  6546. category: 'accessing',
  6547. fn: function (){
  6548. var self=this;
  6549. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6550. return smalltalk.withContext(function($ctx1) {
  6551. return $Array();
  6552. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6553. args: [],
  6554. source: "collectionClass\x0a\x09^ Array",
  6555. messageSends: [],
  6556. referencedClasses: ["Array"]
  6557. }),
  6558. smalltalk.ArrayStreamTest.klass);
  6559. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6560. smalltalk.addMethod(
  6561. smalltalk.method({
  6562. selector: "newCollection",
  6563. category: 'accessing',
  6564. fn: function (){
  6565. var self=this;
  6566. return smalltalk.withContext(function($ctx1) {
  6567. return "hello world";
  6568. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6569. args: [],
  6570. source: "newCollection\x0a\x09^ 'hello world'",
  6571. messageSends: [],
  6572. referencedClasses: []
  6573. }),
  6574. smalltalk.StringStreamTest);
  6575. smalltalk.addMethod(
  6576. smalltalk.method({
  6577. selector: "collectionClass",
  6578. category: 'accessing',
  6579. fn: function (){
  6580. var self=this;
  6581. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6582. return smalltalk.withContext(function($ctx1) {
  6583. return $String();
  6584. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6585. args: [],
  6586. source: "collectionClass\x0a\x09^ String",
  6587. messageSends: [],
  6588. referencedClasses: ["String"]
  6589. }),
  6590. smalltalk.StringStreamTest.klass);
  6591. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6592. smalltalk.addMethod(
  6593. smalltalk.method({
  6594. selector: "testCopying",
  6595. category: 'tests',
  6596. fn: function (){
  6597. var self=this;
  6598. return smalltalk.withContext(function($ctx1) {
  6599. self._assert_equals_(nil._copy(),nil);
  6600. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6601. args: [],
  6602. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6603. messageSends: ["assert:equals:", "copy"],
  6604. referencedClasses: []
  6605. }),
  6606. smalltalk.UndefinedTest);
  6607. smalltalk.addMethod(
  6608. smalltalk.method({
  6609. selector: "testDeepCopy",
  6610. category: 'tests',
  6611. fn: function (){
  6612. var self=this;
  6613. return smalltalk.withContext(function($ctx1) {
  6614. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6615. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6616. args: [],
  6617. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6618. messageSends: ["assert:", "=", "deepCopy"],
  6619. referencedClasses: []
  6620. }),
  6621. smalltalk.UndefinedTest);
  6622. smalltalk.addMethod(
  6623. smalltalk.method({
  6624. selector: "testIfNil",
  6625. category: 'tests',
  6626. fn: function (){
  6627. var self=this;
  6628. return smalltalk.withContext(function($ctx1) {
  6629. var $1,$3,$2,$4,$6,$5;
  6630. if(($receiver = nil) == nil || $receiver == null){
  6631. $1=true;
  6632. } else {
  6633. $1=nil;
  6634. };
  6635. self._assert_equals_($1,true);
  6636. $ctx1.sendIdx["assert:equals:"]=1;
  6637. if(($receiver = nil) == nil || $receiver == null){
  6638. $3=nil;
  6639. } else {
  6640. $3=true;
  6641. };
  6642. $2=_st($3).__eq(true);
  6643. $ctx1.sendIdx["="]=1;
  6644. self._deny_($2);
  6645. $ctx1.sendIdx["deny:"]=1;
  6646. if(($receiver = nil) == nil || $receiver == null){
  6647. $4=true;
  6648. } else {
  6649. $4=false;
  6650. };
  6651. self._assert_equals_($4,true);
  6652. if(($receiver = nil) == nil || $receiver == null){
  6653. $6=false;
  6654. } else {
  6655. $6=true;
  6656. };
  6657. $5=_st($6).__eq(true);
  6658. self._deny_($5);
  6659. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6660. args: [],
  6661. 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",
  6662. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6663. referencedClasses: []
  6664. }),
  6665. smalltalk.UndefinedTest);
  6666. smalltalk.addMethod(
  6667. smalltalk.method({
  6668. selector: "testIsNil",
  6669. category: 'tests',
  6670. fn: function (){
  6671. var self=this;
  6672. return smalltalk.withContext(function($ctx1) {
  6673. self._assert_(nil._isNil());
  6674. self._deny_(nil._notNil());
  6675. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6676. args: [],
  6677. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6678. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6679. referencedClasses: []
  6680. }),
  6681. smalltalk.UndefinedTest);
  6682. });