Kernel-Tests.js 326 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return globals.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},globals.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. globals.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'tests',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. globals.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoFor",
  78. protocol: 'tests',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2,$3,$4;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. $3=announcer;
  102. $4=_st($SystemAnnouncement())._new();
  103. $ctx1.sendIdx["new"]=3;
  104. _st($3)._announce_($4);
  105. $ctx1.sendIdx["announce:"]=2;
  106. self._assert_equals_(counter,(2));
  107. $ctx1.sendIdx["assert:equals:"]=2;
  108. _st(announcer)._unsubscribe_(self);
  109. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  110. self._assert_equals_(counter,(2));
  111. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  112. args: [],
  113. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  114. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  115. referencedClasses: ["Announcer", "SystemAnnouncement"]
  116. }),
  117. globals.AnnouncerTest);
  118. smalltalk.addMethod(
  119. smalltalk.method({
  120. selector: "testOnDoOnce",
  121. protocol: 'tests',
  122. fn: function (){
  123. var self=this;
  124. var counter,announcer;
  125. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  126. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  127. return smalltalk.withContext(function($ctx1) {
  128. var $1,$2;
  129. counter=(0);
  130. announcer=_st($Announcer())._new();
  131. $ctx1.sendIdx["new"]=1;
  132. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  133. return smalltalk.withContext(function($ctx2) {
  134. counter=_st(counter).__plus((1));
  135. return counter;
  136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  137. $1=announcer;
  138. $2=_st($SystemAnnouncement())._new();
  139. $ctx1.sendIdx["new"]=2;
  140. _st($1)._announce_($2);
  141. $ctx1.sendIdx["announce:"]=1;
  142. self._assert_equals_(counter,(1));
  143. $ctx1.sendIdx["assert:equals:"]=1;
  144. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  145. self._assert_equals_(counter,(1));
  146. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  147. args: [],
  148. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  149. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  150. referencedClasses: ["Announcer", "SystemAnnouncement"]
  151. }),
  152. globals.AnnouncerTest);
  153. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  154. smalltalk.addMethod(
  155. smalltalk.method({
  156. selector: "testCanClearInterval",
  157. protocol: 'tests',
  158. fn: function (){
  159. var self=this;
  160. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  161. return smalltalk.withContext(function($ctx1) {
  162. self._shouldnt_raise_((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return _st(_st((function(){
  165. return smalltalk.withContext(function($ctx3) {
  166. return _st(_st($Error())._new())._signal();
  167. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  169. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  170. args: [],
  171. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  172. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  173. referencedClasses: ["Error"]
  174. }),
  175. globals.BlockClosureTest);
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "testCanClearTimeout",
  179. protocol: 'tests',
  180. fn: function (){
  181. var self=this;
  182. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  183. return smalltalk.withContext(function($ctx1) {
  184. self._shouldnt_raise_((function(){
  185. return smalltalk.withContext(function($ctx2) {
  186. return _st(_st((function(){
  187. return smalltalk.withContext(function($ctx3) {
  188. return _st(_st($Error())._new())._signal();
  189. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  191. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  192. args: [],
  193. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  194. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  195. referencedClasses: ["Error"]
  196. }),
  197. globals.BlockClosureTest);
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCompiledSource",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. return smalltalk.withContext(function($ctx1) {
  205. self._assert_(_st(_st((function(){
  206. return smalltalk.withContext(function($ctx2) {
  207. return (1).__plus((1));
  208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  209. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  210. args: [],
  211. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  212. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  213. referencedClasses: []
  214. }),
  215. globals.BlockClosureTest);
  216. smalltalk.addMethod(
  217. smalltalk.method({
  218. selector: "testCurrySelf",
  219. protocol: 'tests',
  220. fn: function (){
  221. var self=this;
  222. var curriedMethod,array;
  223. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  224. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  225. return smalltalk.withContext(function($ctx1) {
  226. curriedMethod=_st(_st((function(selfarg,x){
  227. return smalltalk.withContext(function($ctx2) {
  228. return _st(selfarg)._at_(x);
  229. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  230. array=[(3), (1), (4)];
  231. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  232. _st((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return self._assert_equals_(_st(array)._foo_((2)),(1));
  235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  236. return smalltalk.withContext(function($ctx2) {
  237. return _st($Array())._removeCompiledMethod_(curriedMethod);
  238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  239. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  240. args: [],
  241. 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 protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  242. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  243. referencedClasses: ["ClassBuilder", "Array"]
  244. }),
  245. globals.BlockClosureTest);
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "testEnsure",
  249. protocol: 'tests',
  250. fn: function (){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. self._assert_equals_(_st((function(){
  254. return (3);
  255. }))._ensure_((function(){
  256. return (4);
  257. })),(3));
  258. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  259. args: [],
  260. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  261. messageSends: ["assert:equals:", "ensure:"],
  262. referencedClasses: []
  263. }),
  264. globals.BlockClosureTest);
  265. smalltalk.addMethod(
  266. smalltalk.method({
  267. selector: "testEnsureRaises",
  268. protocol: 'tests',
  269. fn: function (){
  270. var self=this;
  271. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  272. return smalltalk.withContext(function($ctx1) {
  273. self._should_raise_((function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return _st((function(){
  276. return smalltalk.withContext(function($ctx3) {
  277. return _st(_st($Error())._new())._signal();
  278. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  279. return true;
  280. }));
  281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  282. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  283. args: [],
  284. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  285. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  286. referencedClasses: ["Error"]
  287. }),
  288. globals.BlockClosureTest);
  289. smalltalk.addMethod(
  290. smalltalk.method({
  291. selector: "testExceptionSemantics",
  292. protocol: 'tests',
  293. fn: function (){
  294. var self=this;
  295. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  296. return smalltalk.withContext(function($ctx1) {
  297. self._timeout_((100));
  298. _st(self._async_((function(){
  299. return smalltalk.withContext(function($ctx2) {
  300. return _st((function(){
  301. return smalltalk.withContext(function($ctx3) {
  302. self._assert_(true);
  303. _st($Error())._signal();
  304. self._deny_(true);
  305. return self._finished();
  306. $ctx3.sendIdx["finished"]=1;
  307. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  308. return smalltalk.withContext(function($ctx3) {
  309. return self._finished();
  310. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  312. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  313. args: [],
  314. 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",
  315. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  316. referencedClasses: ["Error"]
  317. }),
  318. globals.BlockClosureTest);
  319. smalltalk.addMethod(
  320. smalltalk.method({
  321. selector: "testNewWithValues",
  322. protocol: 'tests',
  323. fn: function (){
  324. var self=this;
  325. return smalltalk.withContext(function($ctx1) {
  326. function TestConstructor(arg1, arg2, arg3) {}
  327. TestConstructor.prototype.name = 'theTestPrototype';
  328. var wrappedConstructor = _st(TestConstructor);
  329. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  330. self._assert_(result instanceof TestConstructor);
  331. self._assert_equals_(result.name, 'theTestPrototype');
  332. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  333. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  334. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  335. args: [],
  336. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  337. messageSends: [],
  338. referencedClasses: []
  339. }),
  340. globals.BlockClosureTest);
  341. smalltalk.addMethod(
  342. smalltalk.method({
  343. selector: "testNumArgs",
  344. protocol: 'tests',
  345. fn: function (){
  346. var self=this;
  347. return smalltalk.withContext(function($ctx1) {
  348. var $1;
  349. $1=_st((function(){
  350. }))._numArgs();
  351. $ctx1.sendIdx["numArgs"]=1;
  352. self._assert_equals_($1,(0));
  353. $ctx1.sendIdx["assert:equals:"]=1;
  354. self._assert_equals_(_st((function(a,b){
  355. }))._numArgs(),(2));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  357. args: [],
  358. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  359. messageSends: ["assert:equals:", "numArgs"],
  360. referencedClasses: []
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testOnDo",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  370. return smalltalk.withContext(function($ctx1) {
  371. self._assert_(_st((function(){
  372. return smalltalk.withContext(function($ctx2) {
  373. return _st(_st($Error())._new())._signal();
  374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  375. return true;
  376. })));
  377. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  378. args: [],
  379. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  380. messageSends: ["assert:", "on:do:", "signal", "new"],
  381. referencedClasses: ["Error"]
  382. }),
  383. globals.BlockClosureTest);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "testValue",
  387. protocol: 'tests',
  388. fn: function (){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) {
  391. var $1;
  392. $1=_st((function(){
  393. return smalltalk.withContext(function($ctx2) {
  394. return (1).__plus((1));
  395. $ctx2.sendIdx["+"]=1;
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  397. $ctx1.sendIdx["value"]=1;
  398. self._assert_equals_($1,(2));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. self._assert_equals_(_st((function(x){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(x).__plus((1));
  403. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  404. $ctx1.sendIdx["assert:equals:"]=2;
  405. self._assert_equals_(_st((function(x,y){
  406. return smalltalk.withContext(function($ctx2) {
  407. return _st(x).__star(y);
  408. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  409. $ctx1.sendIdx["assert:equals:"]=3;
  410. self._assert_equals_(_st((function(a,b,c){
  411. return (1);
  412. }))._value(),(1));
  413. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  414. args: [],
  415. 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",
  416. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  417. referencedClasses: []
  418. }),
  419. globals.BlockClosureTest);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "testValueWithPossibleArguments",
  423. protocol: 'tests',
  424. fn: function (){
  425. var self=this;
  426. return smalltalk.withContext(function($ctx1) {
  427. var $1,$2;
  428. $1=_st((function(){
  429. return (1);
  430. }))._valueWithPossibleArguments_([(3), (4)]);
  431. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  432. self._assert_equals_($1,(1));
  433. $ctx1.sendIdx["assert:equals:"]=1;
  434. $2=_st((function(a){
  435. return smalltalk.withContext(function($ctx2) {
  436. return _st(a).__plus((4));
  437. $ctx2.sendIdx["+"]=1;
  438. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  439. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  440. self._assert_equals_($2,(7));
  441. $ctx1.sendIdx["assert:equals:"]=2;
  442. self._assert_equals_(_st((function(a,b){
  443. return smalltalk.withContext(function($ctx2) {
  444. return _st(a).__plus(b);
  445. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  446. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  447. args: [],
  448. 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.",
  449. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  450. referencedClasses: []
  451. }),
  452. globals.BlockClosureTest);
  453. smalltalk.addMethod(
  454. smalltalk.method({
  455. selector: "testWhileFalse",
  456. protocol: 'tests',
  457. fn: function (){
  458. var self=this;
  459. var i;
  460. return smalltalk.withContext(function($ctx1) {
  461. i=(0);
  462. _st((function(){
  463. return smalltalk.withContext(function($ctx2) {
  464. return _st(i).__gt((5));
  465. $ctx2.sendIdx[">"]=1;
  466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  467. return smalltalk.withContext(function($ctx2) {
  468. i=_st(i).__plus((1));
  469. $ctx2.sendIdx["+"]=1;
  470. return i;
  471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  472. self._assert_equals_(i,(6));
  473. $ctx1.sendIdx["assert:equals:"]=1;
  474. i=(0);
  475. _st((function(){
  476. return smalltalk.withContext(function($ctx2) {
  477. i=_st(i).__plus((1));
  478. i;
  479. return _st(i).__gt((5));
  480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  481. self._assert_equals_(i,(6));
  482. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  483. args: [],
  484. 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",
  485. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  486. referencedClasses: []
  487. }),
  488. globals.BlockClosureTest);
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "testWhileTrue",
  492. protocol: 'tests',
  493. fn: function (){
  494. var self=this;
  495. var i;
  496. return smalltalk.withContext(function($ctx1) {
  497. i=(0);
  498. _st((function(){
  499. return smalltalk.withContext(function($ctx2) {
  500. return _st(i).__lt((5));
  501. $ctx2.sendIdx["<"]=1;
  502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  503. return smalltalk.withContext(function($ctx2) {
  504. i=_st(i).__plus((1));
  505. $ctx2.sendIdx["+"]=1;
  506. return i;
  507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  508. self._assert_equals_(i,(5));
  509. $ctx1.sendIdx["assert:equals:"]=1;
  510. i=(0);
  511. _st((function(){
  512. return smalltalk.withContext(function($ctx2) {
  513. i=_st(i).__plus((1));
  514. i;
  515. return _st(i).__lt((5));
  516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  517. self._assert_equals_(i,(5));
  518. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  519. args: [],
  520. 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",
  521. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  522. referencedClasses: []
  523. }),
  524. globals.BlockClosureTest);
  525. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  526. smalltalk.addMethod(
  527. smalltalk.method({
  528. selector: "testEquality",
  529. protocol: 'tests',
  530. fn: function (){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) {
  533. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  534. $1=(0).__eq(false);
  535. $ctx1.sendIdx["="]=1;
  536. self._deny_($1);
  537. $ctx1.sendIdx["deny:"]=1;
  538. $2=false.__eq((0));
  539. $ctx1.sendIdx["="]=2;
  540. self._deny_($2);
  541. $ctx1.sendIdx["deny:"]=2;
  542. $3="".__eq(false);
  543. $ctx1.sendIdx["="]=3;
  544. self._deny_($3);
  545. $ctx1.sendIdx["deny:"]=3;
  546. $4=false.__eq("");
  547. $ctx1.sendIdx["="]=4;
  548. self._deny_($4);
  549. $ctx1.sendIdx["deny:"]=4;
  550. $5=true.__eq(true);
  551. $ctx1.sendIdx["="]=5;
  552. self._assert_($5);
  553. $ctx1.sendIdx["assert:"]=1;
  554. $6=false.__eq(true);
  555. $ctx1.sendIdx["="]=6;
  556. self._deny_($6);
  557. $ctx1.sendIdx["deny:"]=5;
  558. $7=true.__eq(false);
  559. $ctx1.sendIdx["="]=7;
  560. self._deny_($7);
  561. $8=false.__eq(false);
  562. $ctx1.sendIdx["="]=8;
  563. self._assert_($8);
  564. $ctx1.sendIdx["assert:"]=2;
  565. $10=true._yourself();
  566. $ctx1.sendIdx["yourself"]=1;
  567. $9=_st($10).__eq(true);
  568. $ctx1.sendIdx["="]=9;
  569. self._assert_($9);
  570. $ctx1.sendIdx["assert:"]=3;
  571. $12=true._yourself();
  572. $ctx1.sendIdx["yourself"]=2;
  573. $11=_st($12).__eq(true._yourself());
  574. self._assert_($11);
  575. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  576. args: [],
  577. 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)",
  578. messageSends: ["deny:", "=", "assert:", "yourself"],
  579. referencedClasses: []
  580. }),
  581. globals.BooleanTest);
  582. smalltalk.addMethod(
  583. smalltalk.method({
  584. selector: "testIdentity",
  585. protocol: 'tests',
  586. fn: function (){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) {
  589. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  590. $1=(0).__eq_eq(false);
  591. $ctx1.sendIdx["=="]=1;
  592. self._deny_($1);
  593. $ctx1.sendIdx["deny:"]=1;
  594. $2=false.__eq_eq((0));
  595. $ctx1.sendIdx["=="]=2;
  596. self._deny_($2);
  597. $ctx1.sendIdx["deny:"]=2;
  598. $3="".__eq_eq(false);
  599. $ctx1.sendIdx["=="]=3;
  600. self._deny_($3);
  601. $ctx1.sendIdx["deny:"]=3;
  602. $4=false.__eq_eq("");
  603. $ctx1.sendIdx["=="]=4;
  604. self._deny_($4);
  605. $ctx1.sendIdx["deny:"]=4;
  606. $5=true.__eq_eq(true);
  607. $ctx1.sendIdx["=="]=5;
  608. self._assert_($5);
  609. $ctx1.sendIdx["assert:"]=1;
  610. $6=false.__eq_eq(true);
  611. $ctx1.sendIdx["=="]=6;
  612. self._deny_($6);
  613. $ctx1.sendIdx["deny:"]=5;
  614. $7=true.__eq_eq(false);
  615. $ctx1.sendIdx["=="]=7;
  616. self._deny_($7);
  617. $8=false.__eq_eq(false);
  618. $ctx1.sendIdx["=="]=8;
  619. self._assert_($8);
  620. $ctx1.sendIdx["assert:"]=2;
  621. $10=true._yourself();
  622. $ctx1.sendIdx["yourself"]=1;
  623. $9=_st($10).__eq_eq(true);
  624. $ctx1.sendIdx["=="]=9;
  625. self._assert_($9);
  626. $ctx1.sendIdx["assert:"]=3;
  627. $12=true._yourself();
  628. $ctx1.sendIdx["yourself"]=2;
  629. $11=_st($12).__eq_eq(true._yourself());
  630. self._assert_($11);
  631. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  632. args: [],
  633. 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",
  634. messageSends: ["deny:", "==", "assert:", "yourself"],
  635. referencedClasses: []
  636. }),
  637. globals.BooleanTest);
  638. smalltalk.addMethod(
  639. smalltalk.method({
  640. selector: "testIfTrueIfFalse",
  641. protocol: 'tests',
  642. fn: function (){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. var $1,$2,$3,$4,$5,$6,$7,$8;
  646. if(smalltalk.assert(true)){
  647. $1="alternative block";
  648. };
  649. self._assert_equals_($1,"alternative block");
  650. $ctx1.sendIdx["assert:equals:"]=1;
  651. if(! smalltalk.assert(true)){
  652. $2="alternative block";
  653. };
  654. self._assert_equals_($2,nil);
  655. $ctx1.sendIdx["assert:equals:"]=2;
  656. if(smalltalk.assert(false)){
  657. $3="alternative block";
  658. };
  659. self._assert_equals_($3,nil);
  660. $ctx1.sendIdx["assert:equals:"]=3;
  661. if(! smalltalk.assert(false)){
  662. $4="alternative block";
  663. };
  664. self._assert_equals_($4,"alternative block");
  665. $ctx1.sendIdx["assert:equals:"]=4;
  666. if(smalltalk.assert(false)){
  667. $5="alternative block";
  668. } else {
  669. $5="alternative block2";
  670. };
  671. self._assert_equals_($5,"alternative block2");
  672. $ctx1.sendIdx["assert:equals:"]=5;
  673. if(smalltalk.assert(false)){
  674. $6="alternative block2";
  675. } else {
  676. $6="alternative block";
  677. };
  678. self._assert_equals_($6,"alternative block");
  679. $ctx1.sendIdx["assert:equals:"]=6;
  680. if(smalltalk.assert(true)){
  681. $7="alternative block";
  682. } else {
  683. $7="alternative block2";
  684. };
  685. self._assert_equals_($7,"alternative block");
  686. $ctx1.sendIdx["assert:equals:"]=7;
  687. if(smalltalk.assert(true)){
  688. $8="alternative block2";
  689. } else {
  690. $8="alternative block";
  691. };
  692. self._assert_equals_($8,"alternative block2");
  693. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  694. args: [],
  695. 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'.",
  696. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  697. referencedClasses: []
  698. }),
  699. globals.BooleanTest);
  700. smalltalk.addMethod(
  701. smalltalk.method({
  702. selector: "testIfTrueIfFalseWithBoxing",
  703. protocol: 'tests',
  704. fn: function (){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) {
  707. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  708. $2=true._yourself();
  709. $ctx1.sendIdx["yourself"]=1;
  710. if(smalltalk.assert($2)){
  711. $1="alternative block";
  712. };
  713. self._assert_equals_($1,"alternative block");
  714. $ctx1.sendIdx["assert:equals:"]=1;
  715. $4=true._yourself();
  716. $ctx1.sendIdx["yourself"]=2;
  717. if(! smalltalk.assert($4)){
  718. $3="alternative block";
  719. };
  720. self._assert_equals_($3,nil);
  721. $ctx1.sendIdx["assert:equals:"]=2;
  722. $6=false._yourself();
  723. $ctx1.sendIdx["yourself"]=3;
  724. if(smalltalk.assert($6)){
  725. $5="alternative block";
  726. };
  727. self._assert_equals_($5,nil);
  728. $ctx1.sendIdx["assert:equals:"]=3;
  729. $8=false._yourself();
  730. $ctx1.sendIdx["yourself"]=4;
  731. if(! smalltalk.assert($8)){
  732. $7="alternative block";
  733. };
  734. self._assert_equals_($7,"alternative block");
  735. $ctx1.sendIdx["assert:equals:"]=4;
  736. $10=false._yourself();
  737. $ctx1.sendIdx["yourself"]=5;
  738. if(smalltalk.assert($10)){
  739. $9="alternative block";
  740. } else {
  741. $9="alternative block2";
  742. };
  743. self._assert_equals_($9,"alternative block2");
  744. $ctx1.sendIdx["assert:equals:"]=5;
  745. $12=false._yourself();
  746. $ctx1.sendIdx["yourself"]=6;
  747. if(smalltalk.assert($12)){
  748. $11="alternative block2";
  749. } else {
  750. $11="alternative block";
  751. };
  752. self._assert_equals_($11,"alternative block");
  753. $ctx1.sendIdx["assert:equals:"]=6;
  754. $14=true._yourself();
  755. $ctx1.sendIdx["yourself"]=7;
  756. if(smalltalk.assert($14)){
  757. $13="alternative block";
  758. } else {
  759. $13="alternative block2";
  760. };
  761. self._assert_equals_($13,"alternative block");
  762. $ctx1.sendIdx["assert:equals:"]=7;
  763. $16=true._yourself();
  764. if(smalltalk.assert($16)){
  765. $15="alternative block2";
  766. } else {
  767. $15="alternative block";
  768. };
  769. self._assert_equals_($15,"alternative block2");
  770. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  771. args: [],
  772. 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'.",
  773. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  774. referencedClasses: []
  775. }),
  776. globals.BooleanTest);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "testLogic",
  780. protocol: 'tests',
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) {
  784. 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;
  785. $1=true.__and(true);
  786. $ctx1.sendIdx["&"]=1;
  787. self._assert_($1);
  788. $ctx1.sendIdx["assert:"]=1;
  789. $2=true.__and(false);
  790. $ctx1.sendIdx["&"]=2;
  791. self._deny_($2);
  792. $ctx1.sendIdx["deny:"]=1;
  793. $3=false.__and(true);
  794. $ctx1.sendIdx["&"]=3;
  795. self._deny_($3);
  796. $ctx1.sendIdx["deny:"]=2;
  797. $5=false.__and(false);
  798. $ctx1.sendIdx["&"]=4;
  799. $4=self._deny_($5);
  800. $ctx1.sendIdx["deny:"]=3;
  801. $6=true.__or(true);
  802. $ctx1.sendIdx["|"]=1;
  803. self._assert_($6);
  804. $ctx1.sendIdx["assert:"]=2;
  805. $7=true.__or(false);
  806. $ctx1.sendIdx["|"]=2;
  807. self._assert_($7);
  808. $ctx1.sendIdx["assert:"]=3;
  809. $8=false.__or(true);
  810. $ctx1.sendIdx["|"]=3;
  811. self._assert_($8);
  812. $ctx1.sendIdx["assert:"]=4;
  813. $10=false.__or(false);
  814. $ctx1.sendIdx["|"]=4;
  815. $9=self._deny_($10);
  816. $ctx1.sendIdx["deny:"]=4;
  817. $12=(1).__gt((0));
  818. $ctx1.sendIdx[">"]=1;
  819. $11=true.__and($12);
  820. $ctx1.sendIdx["&"]=5;
  821. self._assert_($11);
  822. $ctx1.sendIdx["assert:"]=5;
  823. $14=(1).__gt((0));
  824. $ctx1.sendIdx[">"]=2;
  825. $13=_st($14).__and(false);
  826. $ctx1.sendIdx["&"]=6;
  827. self._deny_($13);
  828. $ctx1.sendIdx["deny:"]=5;
  829. $17=(1).__gt((0));
  830. $ctx1.sendIdx[">"]=3;
  831. $18=(1).__gt((2));
  832. $ctx1.sendIdx[">"]=4;
  833. $16=_st($17).__and($18);
  834. $15=self._deny_($16);
  835. $20=(1).__gt((0));
  836. $ctx1.sendIdx[">"]=5;
  837. $19=false.__or($20);
  838. $ctx1.sendIdx["|"]=5;
  839. self._assert_($19);
  840. $ctx1.sendIdx["assert:"]=6;
  841. $22=(1).__gt((0));
  842. $ctx1.sendIdx[">"]=6;
  843. $21=_st($22).__or(false);
  844. $ctx1.sendIdx["|"]=6;
  845. self._assert_($21);
  846. $ctx1.sendIdx["assert:"]=7;
  847. $25=(1).__gt((0));
  848. $ctx1.sendIdx[">"]=7;
  849. $24=_st($25).__or((1).__gt((2)));
  850. $23=self._assert_($24);
  851. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  852. args: [],
  853. 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))",
  854. messageSends: ["assert:", "&", "deny:", "|", ">"],
  855. referencedClasses: []
  856. }),
  857. globals.BooleanTest);
  858. smalltalk.addMethod(
  859. smalltalk.method({
  860. selector: "testLogicKeywords",
  861. protocol: 'tests',
  862. fn: function (){
  863. var self=this;
  864. return smalltalk.withContext(function($ctx1) {
  865. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  866. $1=true._and_((function(){
  867. return true;
  868. }));
  869. $ctx1.sendIdx["and:"]=1;
  870. self._assert_($1);
  871. $ctx1.sendIdx["assert:"]=1;
  872. $2=true._and_((function(){
  873. return false;
  874. }));
  875. $ctx1.sendIdx["and:"]=2;
  876. self._deny_($2);
  877. $ctx1.sendIdx["deny:"]=1;
  878. $3=false._and_((function(){
  879. return true;
  880. }));
  881. $ctx1.sendIdx["and:"]=3;
  882. self._deny_($3);
  883. $ctx1.sendIdx["deny:"]=2;
  884. $5=false._and_((function(){
  885. return false;
  886. }));
  887. $ctx1.sendIdx["and:"]=4;
  888. $4=self._deny_($5);
  889. $ctx1.sendIdx["deny:"]=3;
  890. $6=true._or_((function(){
  891. return true;
  892. }));
  893. $ctx1.sendIdx["or:"]=1;
  894. self._assert_($6);
  895. $ctx1.sendIdx["assert:"]=2;
  896. $7=true._or_((function(){
  897. return false;
  898. }));
  899. $ctx1.sendIdx["or:"]=2;
  900. self._assert_($7);
  901. $ctx1.sendIdx["assert:"]=3;
  902. $8=false._or_((function(){
  903. return true;
  904. }));
  905. $ctx1.sendIdx["or:"]=3;
  906. self._assert_($8);
  907. $ctx1.sendIdx["assert:"]=4;
  908. $10=false._or_((function(){
  909. return false;
  910. }));
  911. $ctx1.sendIdx["or:"]=4;
  912. $9=self._deny_($10);
  913. $ctx1.sendIdx["deny:"]=4;
  914. $11=true._and_((function(){
  915. return smalltalk.withContext(function($ctx2) {
  916. return (1).__gt((0));
  917. $ctx2.sendIdx[">"]=1;
  918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  919. $ctx1.sendIdx["and:"]=5;
  920. self._assert_($11);
  921. $ctx1.sendIdx["assert:"]=5;
  922. $13=(1).__gt((0));
  923. $ctx1.sendIdx[">"]=2;
  924. $12=_st($13)._and_((function(){
  925. return false;
  926. }));
  927. $ctx1.sendIdx["and:"]=6;
  928. self._deny_($12);
  929. $ctx1.sendIdx["deny:"]=5;
  930. $16=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=3;
  932. $15=_st($16)._and_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. $ctx2.sendIdx[">"]=4;
  936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  937. $14=self._deny_($15);
  938. $17=false._or_((function(){
  939. return smalltalk.withContext(function($ctx2) {
  940. return (1).__gt((0));
  941. $ctx2.sendIdx[">"]=5;
  942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  943. $ctx1.sendIdx["or:"]=5;
  944. self._assert_($17);
  945. $ctx1.sendIdx["assert:"]=6;
  946. $19=(1).__gt((0));
  947. $ctx1.sendIdx[">"]=6;
  948. $18=_st($19)._or_((function(){
  949. return false;
  950. }));
  951. $ctx1.sendIdx["or:"]=6;
  952. self._assert_($18);
  953. $ctx1.sendIdx["assert:"]=7;
  954. $22=(1).__gt((0));
  955. $ctx1.sendIdx[">"]=7;
  956. $21=_st($22)._or_((function(){
  957. return smalltalk.withContext(function($ctx2) {
  958. return (1).__gt((2));
  959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  960. $20=self._assert_($21);
  961. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  962. args: [],
  963. 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 ])",
  964. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  965. referencedClasses: []
  966. }),
  967. globals.BooleanTest);
  968. smalltalk.addMethod(
  969. smalltalk.method({
  970. selector: "testNonBooleanError",
  971. protocol: 'tests',
  972. fn: function (){
  973. var self=this;
  974. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  975. return smalltalk.withContext(function($ctx1) {
  976. self._should_raise_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. if(smalltalk.assert("")){
  979. } else {
  980. };
  981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  982. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  983. args: [],
  984. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  985. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  986. referencedClasses: ["NonBooleanReceiver"]
  987. }),
  988. globals.BooleanTest);
  989. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  990. smalltalk.addMethod(
  991. smalltalk.method({
  992. selector: "setUp",
  993. protocol: 'running',
  994. fn: function (){
  995. var self=this;
  996. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  997. return smalltalk.withContext(function($ctx1) {
  998. self["@builder"]=_st($ClassBuilder())._new();
  999. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "setUp\x0a\x09builder := ClassBuilder new",
  1002. messageSends: ["new"],
  1003. referencedClasses: ["ClassBuilder"]
  1004. }),
  1005. globals.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "tearDown",
  1009. protocol: 'running',
  1010. fn: function (){
  1011. var self=this;
  1012. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $1,$receiver;
  1015. $1=self["@theClass"];
  1016. if(($receiver = $1) == nil || $receiver == null){
  1017. $1;
  1018. } else {
  1019. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1020. self["@theClass"]=nil;
  1021. self["@theClass"];
  1022. };
  1023. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1024. args: [],
  1025. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1026. messageSends: ["ifNotNil:", "removeClass:"],
  1027. referencedClasses: ["Smalltalk"]
  1028. }),
  1029. globals.ClassBuilderTest);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "testClassCopy",
  1033. protocol: 'tests',
  1034. fn: function (){
  1035. var self=this;
  1036. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1037. return smalltalk.withContext(function($ctx1) {
  1038. var $2,$1,$4,$3,$6,$5,$8,$7;
  1039. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1040. $2=_st(self["@theClass"])._superclass();
  1041. $ctx1.sendIdx["superclass"]=1;
  1042. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1043. $ctx1.sendIdx["=="]=1;
  1044. self._assert_($1);
  1045. $ctx1.sendIdx["assert:"]=1;
  1046. $4=_st(self["@theClass"])._instanceVariableNames();
  1047. $ctx1.sendIdx["instanceVariableNames"]=1;
  1048. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1049. $ctx1.sendIdx["=="]=2;
  1050. self._assert_($3);
  1051. $ctx1.sendIdx["assert:"]=2;
  1052. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1053. $ctx1.sendIdx["assert:equals:"]=1;
  1054. $6=_st(self["@theClass"])._package();
  1055. $ctx1.sendIdx["package"]=1;
  1056. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1057. self._assert_($5);
  1058. $8=_st(self["@theClass"])._methodDictionary();
  1059. $ctx1.sendIdx["methodDictionary"]=1;
  1060. $7=_st($8)._keys();
  1061. $ctx1.sendIdx["keys"]=1;
  1062. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1063. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1064. args: [],
  1065. 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",
  1066. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1067. referencedClasses: ["ObjectMock"]
  1068. }),
  1069. globals.ClassBuilderTest);
  1070. smalltalk.addMethod(
  1071. smalltalk.method({
  1072. selector: "testClassMigration",
  1073. protocol: 'tests',
  1074. fn: function (){
  1075. var self=this;
  1076. var instance,oldClass;
  1077. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1078. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1079. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1080. return smalltalk.withContext(function($ctx1) {
  1081. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1082. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1083. $2=_st($Smalltalk())._globals();
  1084. $ctx1.sendIdx["globals"]=1;
  1085. $1=_st($2)._at_("ObjectMock2");
  1086. $ctx1.sendIdx["at:"]=1;
  1087. instance=_st($1)._new();
  1088. $4=_st($Smalltalk())._globals();
  1089. $ctx1.sendIdx["globals"]=2;
  1090. $3=_st($4)._at_("ObjectMock2");
  1091. $ctx1.sendIdx["at:"]=2;
  1092. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1093. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1094. $ctx1.sendIdx["=="]=1;
  1095. self._deny_($5);
  1096. $ctx1.sendIdx["deny:"]=1;
  1097. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1098. $ctx1.sendIdx["=="]=2;
  1099. self._assert_($6);
  1100. $ctx1.sendIdx["assert:"]=1;
  1101. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1102. $ctx1.sendIdx["assert:"]=2;
  1103. $7=_st($ObjectMock2())._selectors();
  1104. $ctx1.sendIdx["selectors"]=1;
  1105. self._assert_equals_($7,_st(oldClass)._selectors());
  1106. $ctx1.sendIdx["assert:equals:"]=1;
  1107. $8=_st($ObjectMock2())._comment();
  1108. $ctx1.sendIdx["comment"]=1;
  1109. self._assert_equals_($8,_st(oldClass)._comment());
  1110. $ctx1.sendIdx["assert:equals:"]=2;
  1111. $9=_st(_st($ObjectMock2())._package())._name();
  1112. $ctx1.sendIdx["name"]=1;
  1113. self._assert_equals_($9,"Kernel-Tests");
  1114. $11=_st(instance)._class();
  1115. $ctx1.sendIdx["class"]=1;
  1116. $10=_st($11).__eq_eq($ObjectMock2());
  1117. self._deny_($10);
  1118. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1119. _st($Smalltalk())._removeClass_($ObjectMock2());
  1120. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1121. args: [],
  1122. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals 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 globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1123. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1124. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1125. }),
  1126. globals.ClassBuilderTest);
  1127. smalltalk.addMethod(
  1128. smalltalk.method({
  1129. selector: "testClassMigrationWithClassInstanceVariables",
  1130. protocol: 'tests',
  1131. fn: function (){
  1132. var self=this;
  1133. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1134. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1135. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1136. return smalltalk.withContext(function($ctx1) {
  1137. var $1;
  1138. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1139. $1=_st($ObjectMock2())._class();
  1140. $ctx1.sendIdx["class"]=1;
  1141. _st($1)._instanceVariableNames_("foo bar");
  1142. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1143. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1144. _st($Smalltalk())._removeClass_($ObjectMock2());
  1145. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1146. args: [],
  1147. 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 globals 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 removeClass: ObjectMock2",
  1148. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1149. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1150. }),
  1151. globals.ClassBuilderTest);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "testClassMigrationWithSubclasses",
  1155. protocol: 'tests',
  1156. fn: function (){
  1157. var self=this;
  1158. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1159. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1160. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1161. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1162. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1163. return smalltalk.withContext(function($ctx1) {
  1164. var $2,$1,$4,$3;
  1165. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1166. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1167. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1168. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1169. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1170. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1171. $2=_st($ObjectMock())._subclasses();
  1172. $ctx1.sendIdx["subclasses"]=1;
  1173. $1=_st($2)._includes_($ObjectMock2());
  1174. $ctx1.sendIdx["includes:"]=1;
  1175. self._assert_($1);
  1176. $ctx1.sendIdx["assert:"]=1;
  1177. $4=_st($ObjectMock2())._subclasses();
  1178. $ctx1.sendIdx["subclasses"]=2;
  1179. $3=_st($4)._includes_($ObjectMock3());
  1180. $ctx1.sendIdx["includes:"]=2;
  1181. self._assert_($3);
  1182. $ctx1.sendIdx["assert:"]=2;
  1183. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1184. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1185. return smalltalk.withContext(function($ctx2) {
  1186. return _st($Smalltalk())._removeClass_(each);
  1187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1188. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1189. args: [],
  1190. 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 globals 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 removeClass: each ]",
  1191. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1192. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1193. }),
  1194. globals.ClassBuilderTest);
  1195. smalltalk.addMethod(
  1196. smalltalk.method({
  1197. selector: "testInstanceVariableNames",
  1198. protocol: 'tests',
  1199. fn: function (){
  1200. var self=this;
  1201. return smalltalk.withContext(function($ctx1) {
  1202. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1203. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1204. args: [],
  1205. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1206. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1207. referencedClasses: []
  1208. }),
  1209. globals.ClassBuilderTest);
  1210. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "assertSameContents:as:",
  1214. protocol: 'convenience',
  1215. fn: function (aCollection,anotherCollection){
  1216. var self=this;
  1217. return smalltalk.withContext(function($ctx1) {
  1218. var $2,$1,$4,$3;
  1219. $2=_st(aCollection)._size();
  1220. $ctx1.sendIdx["size"]=1;
  1221. $1=_st($2).__eq(_st(anotherCollection)._size());
  1222. $ctx1.sendIdx["="]=1;
  1223. self._assert_($1);
  1224. $ctx1.sendIdx["assert:"]=1;
  1225. _st(aCollection)._do_((function(each){
  1226. return smalltalk.withContext(function($ctx2) {
  1227. $4=_st(aCollection)._occurrencesOf_(each);
  1228. $ctx2.sendIdx["occurrencesOf:"]=1;
  1229. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1230. return self._assert_($3);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1233. args: ["aCollection", "anotherCollection"],
  1234. 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)) ]",
  1235. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1236. referencedClasses: []
  1237. }),
  1238. globals.CollectionTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "collection",
  1242. protocol: 'fixture',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._subclassResponsibility();
  1247. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1248. args: [],
  1249. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1250. messageSends: ["subclassResponsibility"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.CollectionTest);
  1254. smalltalk.addMethod(
  1255. smalltalk.method({
  1256. selector: "collectionClass",
  1257. protocol: 'fixture',
  1258. fn: function (){
  1259. var self=this;
  1260. return smalltalk.withContext(function($ctx1) {
  1261. var $1;
  1262. $1=_st(self._class())._collectionClass();
  1263. return $1;
  1264. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1265. args: [],
  1266. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1267. messageSends: ["collectionClass", "class"],
  1268. referencedClasses: []
  1269. }),
  1270. globals.CollectionTest);
  1271. smalltalk.addMethod(
  1272. smalltalk.method({
  1273. selector: "collectionOfPrintStrings",
  1274. protocol: 'fixture',
  1275. fn: function (){
  1276. var self=this;
  1277. return smalltalk.withContext(function($ctx1) {
  1278. self._subclassResponsibility();
  1279. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1280. args: [],
  1281. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1282. messageSends: ["subclassResponsibility"],
  1283. referencedClasses: []
  1284. }),
  1285. globals.CollectionTest);
  1286. smalltalk.addMethod(
  1287. smalltalk.method({
  1288. selector: "collectionSize",
  1289. protocol: 'fixture',
  1290. fn: function (){
  1291. var self=this;
  1292. return smalltalk.withContext(function($ctx1) {
  1293. self._subclassResponsibility();
  1294. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1295. args: [],
  1296. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1297. messageSends: ["subclassResponsibility"],
  1298. referencedClasses: []
  1299. }),
  1300. globals.CollectionTest);
  1301. smalltalk.addMethod(
  1302. smalltalk.method({
  1303. selector: "collectionWithDuplicates",
  1304. protocol: 'fixture',
  1305. fn: function (){
  1306. var self=this;
  1307. return smalltalk.withContext(function($ctx1) {
  1308. self._subclassResponsibility();
  1309. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1310. args: [],
  1311. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1312. messageSends: ["subclassResponsibility"],
  1313. referencedClasses: []
  1314. }),
  1315. globals.CollectionTest);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "collectionWithNewValue",
  1319. protocol: 'fixture',
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. self._subclassResponsibility();
  1324. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1325. args: [],
  1326. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1327. messageSends: ["subclassResponsibility"],
  1328. referencedClasses: []
  1329. }),
  1330. globals.CollectionTest);
  1331. smalltalk.addMethod(
  1332. smalltalk.method({
  1333. selector: "isCollectionReadOnly",
  1334. protocol: 'testing',
  1335. fn: function (){
  1336. var self=this;
  1337. return false;
  1338. },
  1339. args: [],
  1340. source: "isCollectionReadOnly\x0a\x09^ false",
  1341. messageSends: [],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "sampleNewValue",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return "N";
  1352. },
  1353. args: [],
  1354. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1355. messageSends: [],
  1356. referencedClasses: []
  1357. }),
  1358. globals.CollectionTest);
  1359. smalltalk.addMethod(
  1360. smalltalk.method({
  1361. selector: "sampleNewValueAsCollection",
  1362. protocol: 'fixture',
  1363. fn: function (){
  1364. var self=this;
  1365. return smalltalk.withContext(function($ctx1) {
  1366. var $1;
  1367. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1368. return $1;
  1369. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1370. args: [],
  1371. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1372. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1373. referencedClasses: []
  1374. }),
  1375. globals.CollectionTest);
  1376. smalltalk.addMethod(
  1377. smalltalk.method({
  1378. selector: "testAddAll",
  1379. protocol: 'tests',
  1380. fn: function (){
  1381. var self=this;
  1382. return smalltalk.withContext(function($ctx1) {
  1383. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1384. $2=self._collection();
  1385. $ctx1.sendIdx["collection"]=1;
  1386. $3=$2;
  1387. $5=self._collectionClass();
  1388. $ctx1.sendIdx["collectionClass"]=1;
  1389. $4=_st($5)._new();
  1390. $ctx1.sendIdx["new"]=1;
  1391. _st($3)._addAll_($4);
  1392. $ctx1.sendIdx["addAll:"]=1;
  1393. $6=_st($2)._yourself();
  1394. $ctx1.sendIdx["yourself"]=1;
  1395. $1=$6;
  1396. $7=self._collection();
  1397. $ctx1.sendIdx["collection"]=2;
  1398. self._assert_equals_($1,$7);
  1399. $ctx1.sendIdx["assert:equals:"]=1;
  1400. $10=self._collectionClass();
  1401. $ctx1.sendIdx["collectionClass"]=2;
  1402. $9=_st($10)._new();
  1403. $ctx1.sendIdx["new"]=2;
  1404. $11=$9;
  1405. $12=self._collection();
  1406. $ctx1.sendIdx["collection"]=3;
  1407. _st($11)._addAll_($12);
  1408. $ctx1.sendIdx["addAll:"]=2;
  1409. $13=_st($9)._yourself();
  1410. $ctx1.sendIdx["yourself"]=2;
  1411. $8=$13;
  1412. $14=self._collection();
  1413. $ctx1.sendIdx["collection"]=4;
  1414. self._assert_equals_($8,$14);
  1415. $ctx1.sendIdx["assert:equals:"]=2;
  1416. $17=self._collectionClass();
  1417. $ctx1.sendIdx["collectionClass"]=3;
  1418. $16=_st($17)._new();
  1419. $ctx1.sendIdx["new"]=3;
  1420. $18=$16;
  1421. $20=self._collectionClass();
  1422. $ctx1.sendIdx["collectionClass"]=4;
  1423. $19=_st($20)._new();
  1424. $ctx1.sendIdx["new"]=4;
  1425. _st($18)._addAll_($19);
  1426. $ctx1.sendIdx["addAll:"]=3;
  1427. $21=_st($16)._yourself();
  1428. $ctx1.sendIdx["yourself"]=3;
  1429. $15=$21;
  1430. self._assert_equals_($15,_st(self._collectionClass())._new());
  1431. $ctx1.sendIdx["assert:equals:"]=3;
  1432. $23=self._collection();
  1433. $ctx1.sendIdx["collection"]=5;
  1434. $24=$23;
  1435. $25=self._sampleNewValueAsCollection();
  1436. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1437. _st($24)._addAll_($25);
  1438. $ctx1.sendIdx["addAll:"]=4;
  1439. $26=_st($23)._yourself();
  1440. $ctx1.sendIdx["yourself"]=4;
  1441. $22=$26;
  1442. $27=self._collectionWithNewValue();
  1443. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1444. self._assert_equals_($22,$27);
  1445. $28=self._sampleNewValueAsCollection();
  1446. _st($28)._addAll_(self._collection());
  1447. $29=_st($28)._yourself();
  1448. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1449. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1450. args: [],
  1451. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1452. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1453. referencedClasses: []
  1454. }),
  1455. globals.CollectionTest);
  1456. smalltalk.addMethod(
  1457. smalltalk.method({
  1458. selector: "testAllSatisfy",
  1459. protocol: 'tests',
  1460. fn: function (){
  1461. var self=this;
  1462. var collection,anyOne;
  1463. return smalltalk.withContext(function($ctx1) {
  1464. var $1;
  1465. collection=self._collection();
  1466. anyOne=_st(collection)._anyOne();
  1467. $1=_st(collection)._allSatisfy_((function(each){
  1468. return smalltalk.withContext(function($ctx2) {
  1469. return _st(collection)._includes_(each);
  1470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1471. $ctx1.sendIdx["allSatisfy:"]=1;
  1472. self._assert_($1);
  1473. self._deny_(_st(collection)._allSatisfy_((function(each){
  1474. return smalltalk.withContext(function($ctx2) {
  1475. return _st(each).__tild_eq(anyOne);
  1476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1477. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1478. args: [],
  1479. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1480. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1481. referencedClasses: []
  1482. }),
  1483. globals.CollectionTest);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "testAnyOne",
  1487. protocol: 'tests',
  1488. fn: function (){
  1489. var self=this;
  1490. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1491. return smalltalk.withContext(function($ctx1) {
  1492. var $2,$1;
  1493. self._should_raise_((function(){
  1494. return smalltalk.withContext(function($ctx2) {
  1495. return _st(_st(self._collectionClass())._new())._anyOne();
  1496. $ctx2.sendIdx["anyOne"]=1;
  1497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1498. $2=self._collection();
  1499. $ctx1.sendIdx["collection"]=1;
  1500. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1501. self._assert_($1);
  1502. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1503. args: [],
  1504. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1505. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1506. referencedClasses: ["Error"]
  1507. }),
  1508. globals.CollectionTest);
  1509. smalltalk.addMethod(
  1510. smalltalk.method({
  1511. selector: "testAnySatisfy",
  1512. protocol: 'tests',
  1513. fn: function (){
  1514. var self=this;
  1515. var anyOne;
  1516. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1517. return smalltalk.withContext(function($ctx1) {
  1518. var $1,$3,$2;
  1519. $1=self._collection();
  1520. $ctx1.sendIdx["collection"]=1;
  1521. anyOne=_st($1)._anyOne();
  1522. $3=self._collection();
  1523. $ctx1.sendIdx["collection"]=2;
  1524. $2=_st($3)._anySatisfy_((function(each){
  1525. return smalltalk.withContext(function($ctx2) {
  1526. return _st(each).__eq(anyOne);
  1527. $ctx2.sendIdx["="]=1;
  1528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1529. $ctx1.sendIdx["anySatisfy:"]=1;
  1530. self._assert_($2);
  1531. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1532. return smalltalk.withContext(function($ctx2) {
  1533. return _st(each).__eq(_st($Object())._new());
  1534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1535. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1536. args: [],
  1537. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1538. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1539. referencedClasses: ["Object"]
  1540. }),
  1541. globals.CollectionTest);
  1542. smalltalk.addMethod(
  1543. smalltalk.method({
  1544. selector: "testAsArray",
  1545. protocol: 'tests',
  1546. fn: function (){
  1547. var self=this;
  1548. return smalltalk.withContext(function($ctx1) {
  1549. var $1;
  1550. $1=self._collection();
  1551. $ctx1.sendIdx["collection"]=1;
  1552. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1553. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1554. args: [],
  1555. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1556. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1557. referencedClasses: []
  1558. }),
  1559. globals.CollectionTest);
  1560. smalltalk.addMethod(
  1561. smalltalk.method({
  1562. selector: "testAsOrderedCollection",
  1563. protocol: 'tests',
  1564. fn: function (){
  1565. var self=this;
  1566. return smalltalk.withContext(function($ctx1) {
  1567. var $1;
  1568. $1=self._collection();
  1569. $ctx1.sendIdx["collection"]=1;
  1570. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1572. args: [],
  1573. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1574. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1575. referencedClasses: []
  1576. }),
  1577. globals.CollectionTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testAsSet",
  1581. protocol: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var c,set;
  1585. return smalltalk.withContext(function($ctx1) {
  1586. c=self._collectionWithDuplicates();
  1587. set=_st(c)._asSet();
  1588. self._assert_equals_(_st(set)._size(),(5));
  1589. _st(c)._do_((function(each){
  1590. return smalltalk.withContext(function($ctx2) {
  1591. return self._assert_(_st(set)._includes_(each));
  1592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1593. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1594. args: [],
  1595. 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) ]",
  1596. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1597. referencedClasses: []
  1598. }),
  1599. globals.CollectionTest);
  1600. smalltalk.addMethod(
  1601. smalltalk.method({
  1602. selector: "testCollect",
  1603. protocol: 'tests',
  1604. fn: function (){
  1605. var self=this;
  1606. return smalltalk.withContext(function($ctx1) {
  1607. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1608. $2=self._collection();
  1609. $ctx1.sendIdx["collection"]=1;
  1610. $1=_st($2)._collect_((function(each){
  1611. return each;
  1612. }));
  1613. $ctx1.sendIdx["collect:"]=1;
  1614. $3=self._collection();
  1615. $ctx1.sendIdx["collection"]=2;
  1616. self._assert_equals_($1,$3);
  1617. $ctx1.sendIdx["assert:equals:"]=1;
  1618. $5=self._collectionWithNewValue();
  1619. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1620. $4=_st($5)._collect_((function(each){
  1621. return each;
  1622. }));
  1623. $ctx1.sendIdx["collect:"]=2;
  1624. self._assert_equals_($4,self._collectionWithNewValue());
  1625. $ctx1.sendIdx["assert:equals:"]=2;
  1626. $8=self._collectionClass();
  1627. $ctx1.sendIdx["collectionClass"]=1;
  1628. $7=_st($8)._new();
  1629. $ctx1.sendIdx["new"]=1;
  1630. $6=_st($7)._collect_((function(each){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return _st(each)._printString();
  1633. $ctx2.sendIdx["printString"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1635. $ctx1.sendIdx["collect:"]=3;
  1636. self._assert_equals_($6,_st(self._collectionClass())._new());
  1637. $ctx1.sendIdx["assert:equals:"]=3;
  1638. $11=self._collection();
  1639. $ctx1.sendIdx["collection"]=3;
  1640. $10=_st($11)._collect_((function(){
  1641. return smalltalk.withContext(function($ctx2) {
  1642. return self._sampleNewValue();
  1643. $ctx2.sendIdx["sampleNewValue"]=1;
  1644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1645. $ctx1.sendIdx["collect:"]=4;
  1646. $9=_st($10)._detect_((function(){
  1647. return true;
  1648. }));
  1649. self._assert_equals_($9,self._sampleNewValue());
  1650. $ctx1.sendIdx["assert:equals:"]=4;
  1651. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1652. return smalltalk.withContext(function($ctx2) {
  1653. return _st(each)._printString();
  1654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1655. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1656. args: [],
  1657. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1658. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1659. referencedClasses: []
  1660. }),
  1661. globals.CollectionTest);
  1662. smalltalk.addMethod(
  1663. smalltalk.method({
  1664. selector: "testComma",
  1665. protocol: 'tests',
  1666. fn: function (){
  1667. var self=this;
  1668. return smalltalk.withContext(function($ctx1) {
  1669. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1670. $2=self._collection();
  1671. $ctx1.sendIdx["collection"]=1;
  1672. $4=self._collectionClass();
  1673. $ctx1.sendIdx["collectionClass"]=1;
  1674. $3=_st($4)._new();
  1675. $ctx1.sendIdx["new"]=1;
  1676. $1=_st($2).__comma($3);
  1677. $ctx1.sendIdx[","]=1;
  1678. $5=self._collection();
  1679. $ctx1.sendIdx["collection"]=2;
  1680. self._assert_equals_($1,$5);
  1681. $ctx1.sendIdx["assert:equals:"]=1;
  1682. $8=self._collectionClass();
  1683. $ctx1.sendIdx["collectionClass"]=2;
  1684. $7=_st($8)._new();
  1685. $ctx1.sendIdx["new"]=2;
  1686. $9=self._collection();
  1687. $ctx1.sendIdx["collection"]=3;
  1688. $6=_st($7).__comma($9);
  1689. $ctx1.sendIdx[","]=2;
  1690. $10=self._collection();
  1691. $ctx1.sendIdx["collection"]=4;
  1692. self._assert_equals_($6,$10);
  1693. $ctx1.sendIdx["assert:equals:"]=2;
  1694. $13=self._collectionClass();
  1695. $ctx1.sendIdx["collectionClass"]=3;
  1696. $12=_st($13)._new();
  1697. $ctx1.sendIdx["new"]=3;
  1698. $15=self._collectionClass();
  1699. $ctx1.sendIdx["collectionClass"]=4;
  1700. $14=_st($15)._new();
  1701. $ctx1.sendIdx["new"]=4;
  1702. $11=_st($12).__comma($14);
  1703. $ctx1.sendIdx[","]=3;
  1704. self._assert_equals_($11,_st(self._collectionClass())._new());
  1705. $ctx1.sendIdx["assert:equals:"]=3;
  1706. $17=self._collection();
  1707. $ctx1.sendIdx["collection"]=5;
  1708. $18=self._sampleNewValueAsCollection();
  1709. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1710. $16=_st($17).__comma($18);
  1711. $ctx1.sendIdx[","]=4;
  1712. $19=self._collectionWithNewValue();
  1713. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1714. self._assert_equals_($16,$19);
  1715. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1716. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1717. args: [],
  1718. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1719. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1720. referencedClasses: []
  1721. }),
  1722. globals.CollectionTest);
  1723. smalltalk.addMethod(
  1724. smalltalk.method({
  1725. selector: "testDetect",
  1726. protocol: 'tests',
  1727. fn: function (){
  1728. var self=this;
  1729. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1730. return smalltalk.withContext(function($ctx1) {
  1731. var $1,$2,$3,$4,$6,$5,$7;
  1732. self._shouldnt_raise_((function(){
  1733. return smalltalk.withContext(function($ctx2) {
  1734. $1=self._collection();
  1735. $ctx2.sendIdx["collection"]=1;
  1736. return _st($1)._detect_((function(){
  1737. return true;
  1738. }));
  1739. $ctx2.sendIdx["detect:"]=1;
  1740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1741. self._should_raise_((function(){
  1742. return smalltalk.withContext(function($ctx2) {
  1743. $2=self._collection();
  1744. $ctx2.sendIdx["collection"]=2;
  1745. return _st($2)._detect_((function(){
  1746. return false;
  1747. }));
  1748. $ctx2.sendIdx["detect:"]=2;
  1749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1750. $ctx1.sendIdx["should:raise:"]=1;
  1751. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1752. return true;
  1753. }));
  1754. $ctx1.sendIdx["detect:"]=3;
  1755. $4=self._sampleNewValue();
  1756. $ctx1.sendIdx["sampleNewValue"]=1;
  1757. self._assert_equals_($3,$4);
  1758. $ctx1.sendIdx["assert:equals:"]=1;
  1759. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1760. return smalltalk.withContext(function($ctx2) {
  1761. $6=self._sampleNewValue();
  1762. $ctx2.sendIdx["sampleNewValue"]=2;
  1763. return _st(each).__eq($6);
  1764. $ctx2.sendIdx["="]=1;
  1765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1766. $ctx1.sendIdx["detect:"]=4;
  1767. $7=self._sampleNewValue();
  1768. $ctx1.sendIdx["sampleNewValue"]=3;
  1769. self._assert_equals_($5,$7);
  1770. self._should_raise_((function(){
  1771. return smalltalk.withContext(function($ctx2) {
  1772. return _st(self._collection())._detect_((function(each){
  1773. return smalltalk.withContext(function($ctx3) {
  1774. return _st(each).__eq(self._sampleNewValue());
  1775. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1777. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1778. args: [],
  1779. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1780. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1781. referencedClasses: ["Error"]
  1782. }),
  1783. globals.CollectionTest);
  1784. smalltalk.addMethod(
  1785. smalltalk.method({
  1786. selector: "testDetectIfNone",
  1787. protocol: 'tests',
  1788. fn: function (){
  1789. var self=this;
  1790. var sentinel;
  1791. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1792. return smalltalk.withContext(function($ctx1) {
  1793. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1794. sentinel=_st($Object())._new();
  1795. $3=self._collection();
  1796. $ctx1.sendIdx["collection"]=1;
  1797. $2=_st($3)._detect_ifNone_((function(){
  1798. return true;
  1799. }),(function(){
  1800. return sentinel;
  1801. }));
  1802. $ctx1.sendIdx["detect:ifNone:"]=1;
  1803. $1=_st($2).__tild_eq(sentinel);
  1804. self._assert_($1);
  1805. $5=self._collection();
  1806. $ctx1.sendIdx["collection"]=2;
  1807. $4=_st($5)._detect_ifNone_((function(){
  1808. return false;
  1809. }),(function(){
  1810. return sentinel;
  1811. }));
  1812. $ctx1.sendIdx["detect:ifNone:"]=2;
  1813. self._assert_equals_($4,sentinel);
  1814. $ctx1.sendIdx["assert:equals:"]=1;
  1815. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1816. return true;
  1817. }),(function(){
  1818. return sentinel;
  1819. }));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return sentinel;
  1833. }));
  1834. $ctx1.sendIdx["detect:ifNone:"]=4;
  1835. $10=self._sampleNewValue();
  1836. $ctx1.sendIdx["sampleNewValue"]=3;
  1837. self._assert_equals_($8,$10);
  1838. $ctx1.sendIdx["assert:equals:"]=3;
  1839. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1840. return smalltalk.withContext(function($ctx2) {
  1841. return _st(each).__eq(self._sampleNewValue());
  1842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1843. return sentinel;
  1844. })),sentinel);
  1845. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1846. args: [],
  1847. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1848. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1849. referencedClasses: ["Object"]
  1850. }),
  1851. globals.CollectionTest);
  1852. smalltalk.addMethod(
  1853. smalltalk.method({
  1854. selector: "testDo",
  1855. protocol: 'tests',
  1856. fn: function (){
  1857. var self=this;
  1858. var newCollection;
  1859. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1860. return smalltalk.withContext(function($ctx1) {
  1861. var $1,$2;
  1862. newCollection=_st($OrderedCollection())._new();
  1863. $ctx1.sendIdx["new"]=1;
  1864. $1=self._collection();
  1865. $ctx1.sendIdx["collection"]=1;
  1866. _st($1)._do_((function(each){
  1867. return smalltalk.withContext(function($ctx2) {
  1868. return _st(newCollection)._add_(each);
  1869. $ctx2.sendIdx["add:"]=1;
  1870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1871. $ctx1.sendIdx["do:"]=1;
  1872. self._assertSameContents_as_(self._collection(),newCollection);
  1873. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1874. newCollection=_st($OrderedCollection())._new();
  1875. $2=self._collectionWithDuplicates();
  1876. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1877. _st($2)._do_((function(each){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return _st(newCollection)._add_(each);
  1880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1881. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1882. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1883. args: [],
  1884. 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.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1885. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1886. referencedClasses: ["OrderedCollection"]
  1887. }),
  1888. globals.CollectionTest);
  1889. smalltalk.addMethod(
  1890. smalltalk.method({
  1891. selector: "testIfEmptyFamily",
  1892. protocol: 'tests',
  1893. fn: function (){
  1894. var self=this;
  1895. return smalltalk.withContext(function($ctx1) {
  1896. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1897. $3=self._collectionClass();
  1898. $ctx1.sendIdx["collectionClass"]=1;
  1899. $2=_st($3)._new();
  1900. $ctx1.sendIdx["new"]=1;
  1901. $1=_st($2)._ifEmpty_((function(){
  1902. return (42);
  1903. }));
  1904. $ctx1.sendIdx["ifEmpty:"]=1;
  1905. self._assert_equals_($1,(42));
  1906. $ctx1.sendIdx["assert:equals:"]=1;
  1907. $5=self._collection();
  1908. $ctx1.sendIdx["collection"]=1;
  1909. $4=_st($5)._ifEmpty_((function(){
  1910. return (42);
  1911. }));
  1912. $6=self._collection();
  1913. $ctx1.sendIdx["collection"]=2;
  1914. self._assert_equals_($4,$6);
  1915. $ctx1.sendIdx["assert:equals:"]=2;
  1916. $9=self._collectionClass();
  1917. $ctx1.sendIdx["collectionClass"]=2;
  1918. $8=_st($9)._new();
  1919. $ctx1.sendIdx["new"]=2;
  1920. $7=_st($8)._ifNotEmpty_((function(){
  1921. return (42);
  1922. }));
  1923. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1924. $11=self._collectionClass();
  1925. $ctx1.sendIdx["collectionClass"]=3;
  1926. $10=_st($11)._new();
  1927. $ctx1.sendIdx["new"]=3;
  1928. self._assert_equals_($7,$10);
  1929. $ctx1.sendIdx["assert:equals:"]=3;
  1930. $13=self._collection();
  1931. $ctx1.sendIdx["collection"]=3;
  1932. $12=_st($13)._ifNotEmpty_((function(){
  1933. return (42);
  1934. }));
  1935. self._assert_equals_($12,(42));
  1936. $ctx1.sendIdx["assert:equals:"]=4;
  1937. $16=self._collectionClass();
  1938. $ctx1.sendIdx["collectionClass"]=4;
  1939. $15=_st($16)._new();
  1940. $ctx1.sendIdx["new"]=4;
  1941. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1942. return (42);
  1943. }),(function(){
  1944. return (999);
  1945. }));
  1946. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1947. self._assert_equals_($14,(42));
  1948. $ctx1.sendIdx["assert:equals:"]=5;
  1949. $18=self._collection();
  1950. $ctx1.sendIdx["collection"]=4;
  1951. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1952. return (42);
  1953. }),(function(){
  1954. return (999);
  1955. }));
  1956. self._assert_equals_($17,(999));
  1957. $ctx1.sendIdx["assert:equals:"]=6;
  1958. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1959. return (42);
  1960. }),(function(){
  1961. return (999);
  1962. }));
  1963. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1964. self._assert_equals_($19,(999));
  1965. $ctx1.sendIdx["assert:equals:"]=7;
  1966. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1967. return (42);
  1968. }),(function(){
  1969. return (999);
  1970. })),(42));
  1971. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1972. args: [],
  1973. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1974. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1975. referencedClasses: []
  1976. }),
  1977. globals.CollectionTest);
  1978. smalltalk.addMethod(
  1979. smalltalk.method({
  1980. selector: "testIsEmpty",
  1981. protocol: 'tests',
  1982. fn: function (){
  1983. var self=this;
  1984. return smalltalk.withContext(function($ctx1) {
  1985. var $1;
  1986. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1987. $ctx1.sendIdx["isEmpty"]=1;
  1988. self._assert_($1);
  1989. self._deny_(_st(self._collection())._isEmpty());
  1990. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  1991. args: [],
  1992. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1993. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1994. referencedClasses: []
  1995. }),
  1996. globals.CollectionTest);
  1997. smalltalk.addMethod(
  1998. smalltalk.method({
  1999. selector: "testNoneSatisfy",
  2000. protocol: 'tests',
  2001. fn: function (){
  2002. var self=this;
  2003. var anyOne;
  2004. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2005. return smalltalk.withContext(function($ctx1) {
  2006. var $1,$3,$2;
  2007. $1=self._collection();
  2008. $ctx1.sendIdx["collection"]=1;
  2009. anyOne=_st($1)._anyOne();
  2010. $3=self._collection();
  2011. $ctx1.sendIdx["collection"]=2;
  2012. $2=_st($3)._noneSatisfy_((function(each){
  2013. return smalltalk.withContext(function($ctx2) {
  2014. return _st(each).__eq(anyOne);
  2015. $ctx2.sendIdx["="]=1;
  2016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2017. $ctx1.sendIdx["noneSatisfy:"]=1;
  2018. self._deny_($2);
  2019. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2020. return smalltalk.withContext(function($ctx2) {
  2021. return _st(each).__eq(_st($Object())._new());
  2022. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2023. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2024. args: [],
  2025. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2026. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2027. referencedClasses: ["Object"]
  2028. }),
  2029. globals.CollectionTest);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "testRemoveAll",
  2033. protocol: 'tests',
  2034. fn: function (){
  2035. var self=this;
  2036. return smalltalk.withContext(function($ctx1) {
  2037. var $1,$2;
  2038. $1=self._collection();
  2039. _st($1)._removeAll();
  2040. $2=_st($1)._yourself();
  2041. self._assert_equals_($2,_st(self._collectionClass())._new());
  2042. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2043. args: [],
  2044. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2045. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2046. referencedClasses: []
  2047. }),
  2048. globals.CollectionTest);
  2049. smalltalk.addMethod(
  2050. smalltalk.method({
  2051. selector: "testSelect",
  2052. protocol: 'tests',
  2053. fn: function (){
  2054. var self=this;
  2055. return smalltalk.withContext(function($ctx1) {
  2056. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2057. $2=self._collection();
  2058. $ctx1.sendIdx["collection"]=1;
  2059. $1=_st($2)._select_((function(){
  2060. return false;
  2061. }));
  2062. $ctx1.sendIdx["select:"]=1;
  2063. $4=self._collectionClass();
  2064. $ctx1.sendIdx["collectionClass"]=1;
  2065. $3=_st($4)._new();
  2066. $ctx1.sendIdx["new"]=1;
  2067. self._assert_equals_($1,$3);
  2068. $ctx1.sendIdx["assert:equals:"]=1;
  2069. $6=self._collection();
  2070. $ctx1.sendIdx["collection"]=2;
  2071. $5=_st($6)._select_((function(){
  2072. return true;
  2073. }));
  2074. $ctx1.sendIdx["select:"]=2;
  2075. $7=self._collection();
  2076. $ctx1.sendIdx["collection"]=3;
  2077. self._assert_equals_($5,$7);
  2078. $ctx1.sendIdx["assert:equals:"]=2;
  2079. $9=self._collectionWithNewValue();
  2080. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2081. $8=_st($9)._select_((function(each){
  2082. return smalltalk.withContext(function($ctx2) {
  2083. $10=self._sampleNewValue();
  2084. $ctx2.sendIdx["sampleNewValue"]=1;
  2085. return _st(each).__eq($10);
  2086. $ctx2.sendIdx["="]=1;
  2087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2088. $ctx1.sendIdx["select:"]=3;
  2089. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2090. $ctx1.sendIdx["assert:equals:"]=3;
  2091. $12=self._collectionWithNewValue();
  2092. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2093. $11=_st($12)._select_((function(each){
  2094. return smalltalk.withContext(function($ctx2) {
  2095. $13=self._sampleNewValue();
  2096. $ctx2.sendIdx["sampleNewValue"]=2;
  2097. return _st(each).__tild_eq($13);
  2098. $ctx2.sendIdx["~="]=1;
  2099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2100. $ctx1.sendIdx["select:"]=4;
  2101. $14=self._collection();
  2102. $ctx1.sendIdx["collection"]=4;
  2103. self._assert_equals_($11,$14);
  2104. $ctx1.sendIdx["assert:equals:"]=4;
  2105. $16=self._collection();
  2106. $ctx1.sendIdx["collection"]=5;
  2107. $15=_st($16)._select_((function(each){
  2108. return smalltalk.withContext(function($ctx2) {
  2109. $17=self._sampleNewValue();
  2110. $ctx2.sendIdx["sampleNewValue"]=3;
  2111. return _st(each).__eq($17);
  2112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2113. $ctx1.sendIdx["select:"]=5;
  2114. self._assert_equals_($15,_st(self._collectionClass())._new());
  2115. $ctx1.sendIdx["assert:equals:"]=5;
  2116. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2117. return smalltalk.withContext(function($ctx2) {
  2118. return _st(each).__tild_eq(self._sampleNewValue());
  2119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2120. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2121. args: [],
  2122. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2123. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2124. referencedClasses: []
  2125. }),
  2126. globals.CollectionTest);
  2127. smalltalk.addMethod(
  2128. smalltalk.method({
  2129. selector: "testSize",
  2130. protocol: 'tests',
  2131. fn: function (){
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) {
  2134. var $1,$2;
  2135. $1=_st(_st(self._collectionClass())._new())._size();
  2136. $ctx1.sendIdx["size"]=1;
  2137. self._assert_equals_($1,(0));
  2138. $ctx1.sendIdx["assert:equals:"]=1;
  2139. $2=_st(self._sampleNewValueAsCollection())._size();
  2140. $ctx1.sendIdx["size"]=2;
  2141. self._assert_equals_($2,(1));
  2142. $ctx1.sendIdx["assert:equals:"]=2;
  2143. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2144. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2145. args: [],
  2146. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2147. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2148. referencedClasses: []
  2149. }),
  2150. globals.CollectionTest);
  2151. smalltalk.addMethod(
  2152. smalltalk.method({
  2153. selector: "collectionClass",
  2154. protocol: 'fixture',
  2155. fn: function (){
  2156. var self=this;
  2157. return nil;
  2158. },
  2159. args: [],
  2160. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2161. messageSends: [],
  2162. referencedClasses: []
  2163. }),
  2164. globals.CollectionTest.klass);
  2165. smalltalk.addMethod(
  2166. smalltalk.method({
  2167. selector: "isAbstract",
  2168. protocol: 'testing',
  2169. fn: function (){
  2170. var self=this;
  2171. return smalltalk.withContext(function($ctx1) {
  2172. var $1;
  2173. $1=_st(self._collectionClass())._isNil();
  2174. return $1;
  2175. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2178. messageSends: ["isNil", "collectionClass"],
  2179. referencedClasses: []
  2180. }),
  2181. globals.CollectionTest.klass);
  2182. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2183. smalltalk.addMethod(
  2184. smalltalk.method({
  2185. selector: "collectionWithNewValue",
  2186. protocol: 'fixture',
  2187. fn: function (){
  2188. var self=this;
  2189. return smalltalk.withContext(function($ctx1) {
  2190. self._subclassResponsibility();
  2191. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2192. args: [],
  2193. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2194. messageSends: ["subclassResponsibility"],
  2195. referencedClasses: []
  2196. }),
  2197. globals.IndexableCollectionTest);
  2198. smalltalk.addMethod(
  2199. smalltalk.method({
  2200. selector: "sampleNewIndex",
  2201. protocol: 'fixture',
  2202. fn: function (){
  2203. var self=this;
  2204. return smalltalk.withContext(function($ctx1) {
  2205. self._subclassResponsibility();
  2206. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2207. args: [],
  2208. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2209. messageSends: ["subclassResponsibility"],
  2210. referencedClasses: []
  2211. }),
  2212. globals.IndexableCollectionTest);
  2213. smalltalk.addMethod(
  2214. smalltalk.method({
  2215. selector: "sampleNonIndexesDo:",
  2216. protocol: 'fixture',
  2217. fn: function (aBlock){
  2218. var self=this;
  2219. return smalltalk.withContext(function($ctx1) {
  2220. self._subclassResponsibility();
  2221. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2222. args: ["aBlock"],
  2223. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2224. messageSends: ["subclassResponsibility"],
  2225. referencedClasses: []
  2226. }),
  2227. globals.IndexableCollectionTest);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "samplesDo:",
  2231. protocol: 'fixture',
  2232. fn: function (aBlock){
  2233. var self=this;
  2234. return smalltalk.withContext(function($ctx1) {
  2235. self._subclassResponsibility();
  2236. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2237. args: ["aBlock"],
  2238. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2239. messageSends: ["subclassResponsibility"],
  2240. referencedClasses: []
  2241. }),
  2242. globals.IndexableCollectionTest);
  2243. smalltalk.addMethod(
  2244. smalltalk.method({
  2245. selector: "testAt",
  2246. protocol: 'tests',
  2247. fn: function (){
  2248. var self=this;
  2249. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2250. return smalltalk.withContext(function($ctx1) {
  2251. var $1;
  2252. self._nonIndexesDo_((function(each){
  2253. return smalltalk.withContext(function($ctx2) {
  2254. return self._should_raise_((function(){
  2255. return smalltalk.withContext(function($ctx3) {
  2256. $1=self._collection();
  2257. $ctx3.sendIdx["collection"]=1;
  2258. return _st($1)._at_(each);
  2259. $ctx3.sendIdx["at:"]=1;
  2260. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2262. self._samplesDo_((function(index,value){
  2263. return smalltalk.withContext(function($ctx2) {
  2264. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2265. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2266. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2267. args: [],
  2268. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2269. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2270. referencedClasses: ["Error"]
  2271. }),
  2272. globals.IndexableCollectionTest);
  2273. smalltalk.addMethod(
  2274. smalltalk.method({
  2275. selector: "testAtIfAbsent",
  2276. protocol: 'tests',
  2277. fn: function (){
  2278. var self=this;
  2279. return smalltalk.withContext(function($ctx1) {
  2280. var $2,$1,$3;
  2281. self._nonIndexesDo_((function(each){
  2282. return smalltalk.withContext(function($ctx2) {
  2283. $2=self._collection();
  2284. $ctx2.sendIdx["collection"]=1;
  2285. $1=_st($2)._at_ifAbsent_(each,(function(){
  2286. return smalltalk.withContext(function($ctx3) {
  2287. return self._sampleNewValue();
  2288. $ctx3.sendIdx["sampleNewValue"]=1;
  2289. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2290. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2291. $3=self._sampleNewValue();
  2292. $ctx2.sendIdx["sampleNewValue"]=2;
  2293. return self._assert_equals_($1,$3);
  2294. $ctx2.sendIdx["assert:equals:"]=1;
  2295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2296. self._samplesDo_((function(index,value){
  2297. return smalltalk.withContext(function($ctx2) {
  2298. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2299. return smalltalk.withContext(function($ctx3) {
  2300. return self._sampleNewValue();
  2301. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2302. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2303. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2304. args: [],
  2305. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2306. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2307. referencedClasses: []
  2308. }),
  2309. globals.IndexableCollectionTest);
  2310. smalltalk.addMethod(
  2311. smalltalk.method({
  2312. selector: "testAtIfAbsentPut",
  2313. protocol: 'tests',
  2314. fn: function (){
  2315. var self=this;
  2316. var newCollection;
  2317. return smalltalk.withContext(function($ctx1) {
  2318. var $1;
  2319. newCollection=self._collection();
  2320. $ctx1.sendIdx["collection"]=1;
  2321. self._samplesDo_((function(index,value){
  2322. return smalltalk.withContext(function($ctx2) {
  2323. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2324. return smalltalk.withContext(function($ctx3) {
  2325. return self._sampleNewValue();
  2326. $ctx3.sendIdx["sampleNewValue"]=1;
  2327. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2328. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2329. return self._assert_equals_($1,value);
  2330. $ctx2.sendIdx["assert:equals:"]=1;
  2331. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2332. self._assert_equals_(newCollection,self._collection());
  2333. $ctx1.sendIdx["assert:equals:"]=2;
  2334. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2335. return smalltalk.withContext(function($ctx2) {
  2336. return self._sampleNewValue();
  2337. $ctx2.sendIdx["sampleNewValue"]=2;
  2338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2339. $ctx1.sendIdx["assert:equals:"]=3;
  2340. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2341. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2342. args: [],
  2343. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2344. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2345. referencedClasses: []
  2346. }),
  2347. globals.IndexableCollectionTest);
  2348. smalltalk.addMethod(
  2349. smalltalk.method({
  2350. selector: "testAtIfPresent",
  2351. protocol: 'tests',
  2352. fn: function (){
  2353. var self=this;
  2354. var visited,sentinel;
  2355. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2356. return smalltalk.withContext(function($ctx1) {
  2357. var $2,$1,$4,$3;
  2358. sentinel=_st($Object())._new();
  2359. self._nonIndexesDo_((function(each){
  2360. return smalltalk.withContext(function($ctx2) {
  2361. visited=nil;
  2362. visited;
  2363. $2=self._collection();
  2364. $ctx2.sendIdx["collection"]=1;
  2365. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2366. visited=value1;
  2367. visited;
  2368. return sentinel;
  2369. }));
  2370. $ctx2.sendIdx["at:ifPresent:"]=1;
  2371. self._assert_equals_($1,nil);
  2372. $ctx2.sendIdx["assert:equals:"]=1;
  2373. return self._assert_(_st(visited)._isNil());
  2374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2375. self._samplesDo_((function(index,value){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. visited=nil;
  2378. visited;
  2379. $4=self._collection();
  2380. $ctx2.sendIdx["collection"]=2;
  2381. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2382. visited=value2;
  2383. visited;
  2384. return sentinel;
  2385. }));
  2386. self._assert_equals_($3,sentinel);
  2387. $ctx2.sendIdx["assert:equals:"]=2;
  2388. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2389. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2390. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2391. args: [],
  2392. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2393. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2394. referencedClasses: ["Object"]
  2395. }),
  2396. globals.IndexableCollectionTest);
  2397. smalltalk.addMethod(
  2398. smalltalk.method({
  2399. selector: "testAtIfPresentIfAbsent",
  2400. protocol: 'tests',
  2401. fn: function (){
  2402. var self=this;
  2403. var visited,sentinel;
  2404. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2405. return smalltalk.withContext(function($ctx1) {
  2406. var $2,$1,$3,$5,$4;
  2407. sentinel=_st($Object())._new();
  2408. self._nonIndexesDo_((function(each){
  2409. return smalltalk.withContext(function($ctx2) {
  2410. visited=nil;
  2411. visited;
  2412. $2=self._collection();
  2413. $ctx2.sendIdx["collection"]=1;
  2414. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2415. visited=value1;
  2416. visited;
  2417. return sentinel;
  2418. }),(function(){
  2419. return smalltalk.withContext(function($ctx3) {
  2420. return self._sampleNewValue();
  2421. $ctx3.sendIdx["sampleNewValue"]=1;
  2422. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2423. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2424. $3=self._sampleNewValue();
  2425. $ctx2.sendIdx["sampleNewValue"]=2;
  2426. self._assert_equals_($1,$3);
  2427. $ctx2.sendIdx["assert:equals:"]=1;
  2428. return self._assert_(_st(visited)._isNil());
  2429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2430. self._samplesDo_((function(index,value){
  2431. return smalltalk.withContext(function($ctx2) {
  2432. visited=nil;
  2433. visited;
  2434. $5=self._collection();
  2435. $ctx2.sendIdx["collection"]=2;
  2436. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2437. visited=value2;
  2438. visited;
  2439. return sentinel;
  2440. }),(function(){
  2441. return smalltalk.withContext(function($ctx3) {
  2442. return self._sampleNewValue();
  2443. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2444. self._assert_equals_($4,sentinel);
  2445. $ctx2.sendIdx["assert:equals:"]=2;
  2446. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2447. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2448. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2449. args: [],
  2450. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2451. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2452. referencedClasses: ["Object"]
  2453. }),
  2454. globals.IndexableCollectionTest);
  2455. smalltalk.addMethod(
  2456. smalltalk.method({
  2457. selector: "testAtPut",
  2458. protocol: 'tests',
  2459. fn: function (){
  2460. var self=this;
  2461. var newCollection;
  2462. return smalltalk.withContext(function($ctx1) {
  2463. newCollection=self._collection();
  2464. $ctx1.sendIdx["collection"]=1;
  2465. self._samplesDo_((function(index,value){
  2466. return smalltalk.withContext(function($ctx2) {
  2467. return _st(newCollection)._at_put_(index,value);
  2468. $ctx2.sendIdx["at:put:"]=1;
  2469. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2470. self._assert_equals_(newCollection,self._collection());
  2471. $ctx1.sendIdx["assert:equals:"]=1;
  2472. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2473. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2474. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2475. args: [],
  2476. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2477. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2478. referencedClasses: []
  2479. }),
  2480. globals.IndexableCollectionTest);
  2481. smalltalk.addMethod(
  2482. smalltalk.method({
  2483. selector: "testEquality",
  2484. protocol: 'tests',
  2485. fn: function (){
  2486. var self=this;
  2487. return smalltalk.withContext(function($ctx1) {
  2488. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2489. $2=self._collectionClass();
  2490. $ctx1.sendIdx["collectionClass"]=1;
  2491. $1=_st($2)._new();
  2492. $ctx1.sendIdx["new"]=1;
  2493. $4=self._collectionClass();
  2494. $ctx1.sendIdx["collectionClass"]=2;
  2495. $3=_st($4)._new();
  2496. $ctx1.sendIdx["new"]=2;
  2497. self._assert_equals_($1,$3);
  2498. $ctx1.sendIdx["assert:equals:"]=1;
  2499. $5=self._collection();
  2500. $ctx1.sendIdx["collection"]=1;
  2501. $6=self._collection();
  2502. $ctx1.sendIdx["collection"]=2;
  2503. self._assert_equals_($5,$6);
  2504. $ctx1.sendIdx["assert:equals:"]=2;
  2505. $7=self._collectionWithNewValue();
  2506. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2507. self._assert_equals_($7,self._collectionWithNewValue());
  2508. $10=self._collectionClass();
  2509. $ctx1.sendIdx["collectionClass"]=3;
  2510. $9=_st($10)._new();
  2511. $ctx1.sendIdx["new"]=3;
  2512. $11=self._collection();
  2513. $ctx1.sendIdx["collection"]=3;
  2514. $8=_st($9).__eq($11);
  2515. $ctx1.sendIdx["="]=1;
  2516. self._deny_($8);
  2517. $ctx1.sendIdx["deny:"]=1;
  2518. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2519. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2520. args: [],
  2521. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2522. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2523. referencedClasses: []
  2524. }),
  2525. globals.IndexableCollectionTest);
  2526. smalltalk.addMethod(
  2527. smalltalk.method({
  2528. selector: "testIndexOf",
  2529. protocol: 'tests',
  2530. fn: function (){
  2531. var self=this;
  2532. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2533. return smalltalk.withContext(function($ctx1) {
  2534. var $1;
  2535. self._should_raise_((function(){
  2536. return smalltalk.withContext(function($ctx2) {
  2537. $1=self._collection();
  2538. $ctx2.sendIdx["collection"]=1;
  2539. return _st($1)._indexOf_(self._sampleNewValue());
  2540. $ctx2.sendIdx["indexOf:"]=1;
  2541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2542. self._samplesDo_((function(index,value){
  2543. return smalltalk.withContext(function($ctx2) {
  2544. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2545. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2546. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2547. args: [],
  2548. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2549. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2550. referencedClasses: ["Error"]
  2551. }),
  2552. globals.IndexableCollectionTest);
  2553. smalltalk.addMethod(
  2554. smalltalk.method({
  2555. selector: "testIndexOfWithNull",
  2556. protocol: 'tests',
  2557. fn: function (){
  2558. var self=this;
  2559. var jsNull;
  2560. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2561. return smalltalk.withContext(function($ctx1) {
  2562. var $1,$2;
  2563. jsNull=_st($JSON())._parse_("null");
  2564. self._samplesDo_((function(index,value){
  2565. return smalltalk.withContext(function($ctx2) {
  2566. $1=self._collection();
  2567. _st($1)._at_put_(index,jsNull);
  2568. $2=_st($1)._indexOf_(jsNull);
  2569. return self._assert_equals_($2,index);
  2570. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2571. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2572. args: [],
  2573. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2574. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2575. referencedClasses: ["JSON"]
  2576. }),
  2577. globals.IndexableCollectionTest);
  2578. smalltalk.addMethod(
  2579. smalltalk.method({
  2580. selector: "testWithIndexDo",
  2581. protocol: 'tests',
  2582. fn: function (){
  2583. var self=this;
  2584. var collection;
  2585. return smalltalk.withContext(function($ctx1) {
  2586. collection=self._collection();
  2587. $ctx1.sendIdx["collection"]=1;
  2588. _st(self._collection())._withIndexDo_((function(each,index){
  2589. return smalltalk.withContext(function($ctx2) {
  2590. return self._assert_equals_(_st(collection)._at_(index),each);
  2591. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2592. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2593. args: [],
  2594. 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 ]",
  2595. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2596. referencedClasses: []
  2597. }),
  2598. globals.IndexableCollectionTest);
  2599. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2600. smalltalk.addMethod(
  2601. smalltalk.method({
  2602. selector: "collectionKeys",
  2603. protocol: 'fixture',
  2604. fn: function (){
  2605. var self=this;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. self._subclassResponsibility();
  2608. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2609. args: [],
  2610. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2611. messageSends: ["subclassResponsibility"],
  2612. referencedClasses: []
  2613. }),
  2614. globals.AssociativeCollectionTest);
  2615. smalltalk.addMethod(
  2616. smalltalk.method({
  2617. selector: "collectionValues",
  2618. protocol: 'fixture',
  2619. fn: function (){
  2620. var self=this;
  2621. return smalltalk.withContext(function($ctx1) {
  2622. self._subclassResponsibility();
  2623. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2624. args: [],
  2625. source: "collectionValues\x0a\x09self subclassResponsibility",
  2626. messageSends: ["subclassResponsibility"],
  2627. referencedClasses: []
  2628. }),
  2629. globals.AssociativeCollectionTest);
  2630. smalltalk.addMethod(
  2631. smalltalk.method({
  2632. selector: "nonIndexesDo:",
  2633. protocol: 'fixture',
  2634. fn: function (aBlock){
  2635. var self=this;
  2636. return smalltalk.withContext(function($ctx1) {
  2637. _st(aBlock)._value_((5));
  2638. $ctx1.sendIdx["value:"]=1;
  2639. _st(aBlock)._value_("z");
  2640. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2641. args: ["aBlock"],
  2642. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2643. messageSends: ["value:"],
  2644. referencedClasses: []
  2645. }),
  2646. globals.AssociativeCollectionTest);
  2647. smalltalk.addMethod(
  2648. smalltalk.method({
  2649. selector: "sampleNewIndex",
  2650. protocol: 'fixture',
  2651. fn: function (){
  2652. var self=this;
  2653. return "new";
  2654. },
  2655. args: [],
  2656. source: "sampleNewIndex\x0a\x09^ 'new'",
  2657. messageSends: [],
  2658. referencedClasses: []
  2659. }),
  2660. globals.AssociativeCollectionTest);
  2661. smalltalk.addMethod(
  2662. smalltalk.method({
  2663. selector: "samplesDo:",
  2664. protocol: 'fixture',
  2665. fn: function (aBlock){
  2666. var self=this;
  2667. return smalltalk.withContext(function($ctx1) {
  2668. _st(aBlock)._value_value_("a",(2));
  2669. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2670. args: ["aBlock"],
  2671. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2672. messageSends: ["value:value:"],
  2673. referencedClasses: []
  2674. }),
  2675. globals.AssociativeCollectionTest);
  2676. smalltalk.addMethod(
  2677. smalltalk.method({
  2678. selector: "testAddAll",
  2679. protocol: 'tests',
  2680. fn: function (){
  2681. var self=this;
  2682. return smalltalk.withContext(function($ctx1) {
  2683. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2684. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2685. $2=self._collection();
  2686. $ctx1.sendIdx["collection"]=1;
  2687. $3=$2;
  2688. $4=self._collection();
  2689. $ctx1.sendIdx["collection"]=2;
  2690. _st($3)._addAll_($4);
  2691. $ctx1.sendIdx["addAll:"]=1;
  2692. $5=_st($2)._yourself();
  2693. $ctx1.sendIdx["yourself"]=1;
  2694. $1=$5;
  2695. $6=self._collection();
  2696. $ctx1.sendIdx["collection"]=3;
  2697. self._assert_equals_($1,$6);
  2698. $ctx1.sendIdx["assert:equals:"]=1;
  2699. $8=self._collection();
  2700. $ctx1.sendIdx["collection"]=4;
  2701. $9=$8;
  2702. $10=self._collectionWithNewValue();
  2703. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2704. _st($9)._addAll_($10);
  2705. $ctx1.sendIdx["addAll:"]=2;
  2706. $11=_st($8)._yourself();
  2707. $ctx1.sendIdx["yourself"]=2;
  2708. $7=$11;
  2709. $12=self._collectionWithNewValue();
  2710. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2711. self._assert_equals_($7,$12);
  2712. $ctx1.sendIdx["assert:equals:"]=2;
  2713. $14=self._collectionWithNewValue();
  2714. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2715. _st($14)._addAll_(self._collection());
  2716. $15=_st($14)._yourself();
  2717. $13=$15;
  2718. self._assert_equals_($13,self._collectionWithNewValue());
  2719. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2720. args: [],
  2721. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2722. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2723. referencedClasses: []
  2724. }),
  2725. globals.AssociativeCollectionTest);
  2726. smalltalk.addMethod(
  2727. smalltalk.method({
  2728. selector: "testAsDictionary",
  2729. protocol: 'tests',
  2730. fn: function (){
  2731. var self=this;
  2732. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2733. return smalltalk.withContext(function($ctx1) {
  2734. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2735. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2736. args: [],
  2737. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2738. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2739. referencedClasses: ["Dictionary"]
  2740. }),
  2741. globals.AssociativeCollectionTest);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "testAsHashedCollection",
  2745. protocol: 'tests',
  2746. fn: function (){
  2747. var self=this;
  2748. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2749. return smalltalk.withContext(function($ctx1) {
  2750. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2751. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2752. args: [],
  2753. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2754. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2755. referencedClasses: ["HashedCollection"]
  2756. }),
  2757. globals.AssociativeCollectionTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testComma",
  2761. protocol: 'tests',
  2762. fn: function (){
  2763. var self=this;
  2764. return smalltalk.withContext(function($ctx1) {
  2765. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2766. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2767. $2=self._collection();
  2768. $ctx1.sendIdx["collection"]=1;
  2769. $3=self._collection();
  2770. $ctx1.sendIdx["collection"]=2;
  2771. $1=_st($2).__comma($3);
  2772. $ctx1.sendIdx[","]=1;
  2773. $4=self._collection();
  2774. $ctx1.sendIdx["collection"]=3;
  2775. self._assert_equals_($1,$4);
  2776. $ctx1.sendIdx["assert:equals:"]=1;
  2777. $6=self._collection();
  2778. $ctx1.sendIdx["collection"]=4;
  2779. $7=self._collectionWithNewValue();
  2780. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2781. $5=_st($6).__comma($7);
  2782. $ctx1.sendIdx[","]=2;
  2783. $8=self._collectionWithNewValue();
  2784. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2785. self._assert_equals_($5,$8);
  2786. $ctx1.sendIdx["assert:equals:"]=2;
  2787. $10=self._collectionWithNewValue();
  2788. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2789. $9=_st($10).__comma(self._collection());
  2790. self._assert_equals_($9,self._collectionWithNewValue());
  2791. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2792. args: [],
  2793. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  2794. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2795. referencedClasses: []
  2796. }),
  2797. globals.AssociativeCollectionTest);
  2798. smalltalk.addMethod(
  2799. smalltalk.method({
  2800. selector: "testFrom",
  2801. protocol: 'tests',
  2802. fn: function (){
  2803. var self=this;
  2804. var associations;
  2805. return smalltalk.withContext(function($ctx1) {
  2806. var $1;
  2807. $1="a".__minus_gt((1));
  2808. $ctx1.sendIdx["->"]=1;
  2809. associations=[$1,"b".__minus_gt((2))];
  2810. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2811. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2812. args: [],
  2813. 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 }.",
  2814. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2815. referencedClasses: []
  2816. }),
  2817. globals.AssociativeCollectionTest);
  2818. smalltalk.addMethod(
  2819. smalltalk.method({
  2820. selector: "testKeys",
  2821. protocol: 'tests',
  2822. fn: function (){
  2823. var self=this;
  2824. return smalltalk.withContext(function($ctx1) {
  2825. var $2,$1,$3,$4;
  2826. $2=_st(_st(self._collectionClass())._new())._keys();
  2827. $ctx1.sendIdx["keys"]=1;
  2828. $1=_st($2)._isEmpty();
  2829. self._assert_($1);
  2830. $3=_st(self._collection())._keys();
  2831. $ctx1.sendIdx["keys"]=2;
  2832. $4=self._collectionKeys();
  2833. $ctx1.sendIdx["collectionKeys"]=1;
  2834. self._assertSameContents_as_($3,$4);
  2835. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2836. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2837. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2838. args: [],
  2839. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2840. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2841. referencedClasses: []
  2842. }),
  2843. globals.AssociativeCollectionTest);
  2844. smalltalk.addMethod(
  2845. smalltalk.method({
  2846. selector: "testNewFromPairs",
  2847. protocol: 'tests',
  2848. fn: function (){
  2849. var self=this;
  2850. var flattenedAssociations;
  2851. return smalltalk.withContext(function($ctx1) {
  2852. flattenedAssociations=["a",(1),"b",(2)];
  2853. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2854. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2855. args: [],
  2856. 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 }.",
  2857. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2858. referencedClasses: []
  2859. }),
  2860. globals.AssociativeCollectionTest);
  2861. smalltalk.addMethod(
  2862. smalltalk.method({
  2863. selector: "testPrintString",
  2864. protocol: 'tests',
  2865. fn: function (){
  2866. var self=this;
  2867. return smalltalk.withContext(function($ctx1) {
  2868. var $3,$2,$4,$1,$5;
  2869. $3=self._collectionClass();
  2870. $ctx1.sendIdx["collectionClass"]=1;
  2871. $2=_st($3)._new();
  2872. _st($2)._at_put_("firstname","James");
  2873. $ctx1.sendIdx["at:put:"]=1;
  2874. _st($2)._at_put_("lastname","Bond");
  2875. $4=_st($2)._printString();
  2876. $1=$4;
  2877. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2878. $ctx1.sendIdx[","]=1;
  2879. self._assert_equals_($1,$5);
  2880. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2881. args: [],
  2882. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass 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 ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2883. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2884. referencedClasses: []
  2885. }),
  2886. globals.AssociativeCollectionTest);
  2887. smalltalk.addMethod(
  2888. smalltalk.method({
  2889. selector: "testRemoveKey",
  2890. protocol: 'tests',
  2891. fn: function (){
  2892. var self=this;
  2893. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2894. return smalltalk.withContext(function($ctx1) {
  2895. var $1,$2,$3,$5,$6,$4,$7,$8;
  2896. self._nonIndexesDo_((function(each){
  2897. var collection;
  2898. return smalltalk.withContext(function($ctx2) {
  2899. collection=self._collection();
  2900. $ctx2.sendIdx["collection"]=1;
  2901. collection;
  2902. self._should_raise_((function(){
  2903. return smalltalk.withContext(function($ctx3) {
  2904. return _st(collection)._removeKey_(each);
  2905. $ctx3.sendIdx["removeKey:"]=1;
  2906. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2907. $1=collection;
  2908. $2=self._collection();
  2909. $ctx2.sendIdx["collection"]=2;
  2910. return self._assert_equals_($1,$2);
  2911. $ctx2.sendIdx["assert:equals:"]=1;
  2912. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2913. self._samplesDo_((function(index,value){
  2914. var collection;
  2915. return smalltalk.withContext(function($ctx2) {
  2916. collection=self._collection();
  2917. $ctx2.sendIdx["collection"]=3;
  2918. collection;
  2919. $3=_st(collection)._removeKey_(index);
  2920. $ctx2.sendIdx["removeKey:"]=2;
  2921. self._assert_equals_($3,value);
  2922. $ctx2.sendIdx["assert:equals:"]=2;
  2923. $5=collection;
  2924. $6=self._collection();
  2925. $ctx2.sendIdx["collection"]=4;
  2926. $4=_st($5).__eq($6);
  2927. return self._deny_($4);
  2928. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2929. $7=self._collectionWithNewValue();
  2930. _st($7)._removeKey_(self._sampleNewIndex());
  2931. $8=_st($7)._yourself();
  2932. self._assert_equals_($8,self._collection());
  2933. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2934. args: [],
  2935. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  2936. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2937. referencedClasses: ["Error"]
  2938. }),
  2939. globals.AssociativeCollectionTest);
  2940. smalltalk.addMethod(
  2941. smalltalk.method({
  2942. selector: "testRemoveKeyIfAbsent",
  2943. protocol: 'tests',
  2944. fn: function (){
  2945. var self=this;
  2946. return smalltalk.withContext(function($ctx1) {
  2947. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2948. self._nonIndexesDo_((function(each){
  2949. var collection;
  2950. return smalltalk.withContext(function($ctx2) {
  2951. collection=self._collection();
  2952. $ctx2.sendIdx["collection"]=1;
  2953. collection;
  2954. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2955. return smalltalk.withContext(function($ctx3) {
  2956. return self._sampleNewValue();
  2957. $ctx3.sendIdx["sampleNewValue"]=1;
  2958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2959. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2960. $2=self._sampleNewValue();
  2961. $ctx2.sendIdx["sampleNewValue"]=2;
  2962. self._assert_equals_($1,$2);
  2963. $ctx2.sendIdx["assert:equals:"]=1;
  2964. $3=collection;
  2965. $4=self._collection();
  2966. $ctx2.sendIdx["collection"]=2;
  2967. return self._assert_equals_($3,$4);
  2968. $ctx2.sendIdx["assert:equals:"]=2;
  2969. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2970. self._samplesDo_((function(index,value){
  2971. var collection;
  2972. return smalltalk.withContext(function($ctx2) {
  2973. collection=self._collection();
  2974. $ctx2.sendIdx["collection"]=3;
  2975. collection;
  2976. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2977. return smalltalk.withContext(function($ctx3) {
  2978. return self._sampleNewValue();
  2979. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2980. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  2981. self._assert_equals_($5,value);
  2982. $ctx2.sendIdx["assert:equals:"]=3;
  2983. $7=collection;
  2984. $8=self._collection();
  2985. $ctx2.sendIdx["collection"]=4;
  2986. $6=_st($7).__eq($8);
  2987. return self._deny_($6);
  2988. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2989. $9=self._collectionWithNewValue();
  2990. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  2991. return smalltalk.withContext(function($ctx2) {
  2992. return self._assert_(false);
  2993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  2994. $10=_st($9)._yourself();
  2995. self._assert_equals_($10,self._collection());
  2996. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  2997. args: [],
  2998. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  2999. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3000. referencedClasses: []
  3001. }),
  3002. globals.AssociativeCollectionTest);
  3003. smalltalk.addMethod(
  3004. smalltalk.method({
  3005. selector: "testValues",
  3006. protocol: 'tests',
  3007. fn: function (){
  3008. var self=this;
  3009. return smalltalk.withContext(function($ctx1) {
  3010. var $2,$1,$3,$4;
  3011. $2=_st(_st(self._collectionClass())._new())._values();
  3012. $ctx1.sendIdx["values"]=1;
  3013. $1=_st($2)._isEmpty();
  3014. self._assert_($1);
  3015. $3=_st(self._collection())._values();
  3016. $ctx1.sendIdx["values"]=2;
  3017. $4=self._collectionValues();
  3018. $ctx1.sendIdx["collectionValues"]=1;
  3019. self._assertSameContents_as_($3,$4);
  3020. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3021. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3022. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3023. args: [],
  3024. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  3025. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3026. referencedClasses: []
  3027. }),
  3028. globals.AssociativeCollectionTest);
  3029. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3030. smalltalk.addMethod(
  3031. smalltalk.method({
  3032. selector: "collection",
  3033. protocol: 'fixture',
  3034. fn: function (){
  3035. var self=this;
  3036. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3037. return smalltalk.withContext(function($ctx1) {
  3038. var $2,$3,$1;
  3039. $2=_st($Dictionary())._new();
  3040. _st($2)._at_put_((1),(1));
  3041. $ctx1.sendIdx["at:put:"]=1;
  3042. _st($2)._at_put_("a",(2));
  3043. $ctx1.sendIdx["at:put:"]=2;
  3044. _st($2)._at_put_(true,(3));
  3045. $ctx1.sendIdx["at:put:"]=3;
  3046. _st($2)._at_put_((1).__at((3)),(-4));
  3047. $3=_st($2)._yourself();
  3048. $1=$3;
  3049. return $1;
  3050. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3051. args: [],
  3052. 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: 1@3 put: -4;\x0a\x09\x09yourself",
  3053. messageSends: ["at:put:", "new", "@", "yourself"],
  3054. referencedClasses: ["Dictionary"]
  3055. }),
  3056. globals.DictionaryTest);
  3057. smalltalk.addMethod(
  3058. smalltalk.method({
  3059. selector: "collectionKeys",
  3060. protocol: 'fixture',
  3061. fn: function (){
  3062. var self=this;
  3063. return smalltalk.withContext(function($ctx1) {
  3064. var $1;
  3065. $1=[(1),"a",true,(1).__at((3))];
  3066. return $1;
  3067. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3068. args: [],
  3069. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3070. messageSends: ["@"],
  3071. referencedClasses: []
  3072. }),
  3073. globals.DictionaryTest);
  3074. smalltalk.addMethod(
  3075. smalltalk.method({
  3076. selector: "collectionOfPrintStrings",
  3077. protocol: 'fixture',
  3078. fn: function (){
  3079. var self=this;
  3080. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3081. return smalltalk.withContext(function($ctx1) {
  3082. var $2,$3,$1;
  3083. $2=_st($Dictionary())._new();
  3084. _st($2)._at_put_((1),"1");
  3085. $ctx1.sendIdx["at:put:"]=1;
  3086. _st($2)._at_put_("a","2");
  3087. $ctx1.sendIdx["at:put:"]=2;
  3088. _st($2)._at_put_(true,"3");
  3089. $ctx1.sendIdx["at:put:"]=3;
  3090. _st($2)._at_put_((1).__at((3)),"-4");
  3091. $3=_st($2)._yourself();
  3092. $1=$3;
  3093. return $1;
  3094. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3095. args: [],
  3096. source: "collectionOfPrintStrings\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: 1@3 put: '-4';\x0a\x09\x09yourself",
  3097. messageSends: ["at:put:", "new", "@", "yourself"],
  3098. referencedClasses: ["Dictionary"]
  3099. }),
  3100. globals.DictionaryTest);
  3101. smalltalk.addMethod(
  3102. smalltalk.method({
  3103. selector: "collectionSize",
  3104. protocol: 'fixture',
  3105. fn: function (){
  3106. var self=this;
  3107. return (4);
  3108. },
  3109. args: [],
  3110. source: "collectionSize\x0a\x09^ 4",
  3111. messageSends: [],
  3112. referencedClasses: []
  3113. }),
  3114. globals.DictionaryTest);
  3115. smalltalk.addMethod(
  3116. smalltalk.method({
  3117. selector: "collectionValues",
  3118. protocol: 'fixture',
  3119. fn: function (){
  3120. var self=this;
  3121. var $1;
  3122. $1=[(1),(2),(3),(-4)];
  3123. return $1;
  3124. },
  3125. args: [],
  3126. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3127. messageSends: [],
  3128. referencedClasses: []
  3129. }),
  3130. globals.DictionaryTest);
  3131. smalltalk.addMethod(
  3132. smalltalk.method({
  3133. selector: "collectionWithDuplicates",
  3134. protocol: 'fixture',
  3135. fn: function (){
  3136. var self=this;
  3137. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3138. return smalltalk.withContext(function($ctx1) {
  3139. var $2,$3,$1;
  3140. $2=_st($Dictionary())._new();
  3141. _st($2)._at_put_((1),(1));
  3142. $ctx1.sendIdx["at:put:"]=1;
  3143. _st($2)._at_put_("a",(2));
  3144. $ctx1.sendIdx["at:put:"]=2;
  3145. _st($2)._at_put_(true,(3));
  3146. $ctx1.sendIdx["at:put:"]=3;
  3147. _st($2)._at_put_((4),(-4));
  3148. $ctx1.sendIdx["at:put:"]=4;
  3149. _st($2)._at_put_("b",(1));
  3150. $ctx1.sendIdx["at:put:"]=5;
  3151. _st($2)._at_put_((3),(3));
  3152. $ctx1.sendIdx["at:put:"]=6;
  3153. _st($2)._at_put_(false,(12));
  3154. $3=_st($2)._yourself();
  3155. $1=$3;
  3156. return $1;
  3157. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3158. args: [],
  3159. 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",
  3160. messageSends: ["at:put:", "new", "yourself"],
  3161. referencedClasses: ["Dictionary"]
  3162. }),
  3163. globals.DictionaryTest);
  3164. smalltalk.addMethod(
  3165. smalltalk.method({
  3166. selector: "collectionWithNewValue",
  3167. protocol: 'fixture',
  3168. fn: function (){
  3169. var self=this;
  3170. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3171. return smalltalk.withContext(function($ctx1) {
  3172. var $2,$3,$1;
  3173. $2=_st($Dictionary())._new();
  3174. _st($2)._at_put_((1),(1));
  3175. $ctx1.sendIdx["at:put:"]=1;
  3176. _st($2)._at_put_("a",(2));
  3177. $ctx1.sendIdx["at:put:"]=2;
  3178. _st($2)._at_put_(true,(3));
  3179. $ctx1.sendIdx["at:put:"]=3;
  3180. _st($2)._at_put_((1).__at((3)),(-4));
  3181. $ctx1.sendIdx["at:put:"]=4;
  3182. _st($2)._at_put_("new","N");
  3183. $3=_st($2)._yourself();
  3184. $1=$3;
  3185. return $1;
  3186. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3187. args: [],
  3188. source: "collectionWithNewValue\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: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3189. messageSends: ["at:put:", "new", "@", "yourself"],
  3190. referencedClasses: ["Dictionary"]
  3191. }),
  3192. globals.DictionaryTest);
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "sampleNewValueAsCollection",
  3196. protocol: 'fixture',
  3197. fn: function (){
  3198. var self=this;
  3199. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3200. return smalltalk.withContext(function($ctx1) {
  3201. var $2,$3,$1;
  3202. $2=_st($Dictionary())._new();
  3203. _st($2)._at_put_("new","N");
  3204. $3=_st($2)._yourself();
  3205. $1=$3;
  3206. return $1;
  3207. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3208. args: [],
  3209. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3210. messageSends: ["at:put:", "new", "yourself"],
  3211. referencedClasses: ["Dictionary"]
  3212. }),
  3213. globals.DictionaryTest);
  3214. smalltalk.addMethod(
  3215. smalltalk.method({
  3216. selector: "samplesDo:",
  3217. protocol: 'fixture',
  3218. fn: function (aBlock){
  3219. var self=this;
  3220. return smalltalk.withContext(function($ctx1) {
  3221. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3222. _st(aBlock)._value_value_(true,(3));
  3223. $ctx1.sendIdx["value:value:"]=1;
  3224. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3225. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3226. args: ["aBlock"],
  3227. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3228. messageSends: ["samplesDo:", "value:value:", "@"],
  3229. referencedClasses: []
  3230. }),
  3231. globals.DictionaryTest);
  3232. smalltalk.addMethod(
  3233. smalltalk.method({
  3234. selector: "testAccessing",
  3235. protocol: 'tests',
  3236. fn: function (){
  3237. var self=this;
  3238. var d;
  3239. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3240. return smalltalk.withContext(function($ctx1) {
  3241. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3242. d=_st($Dictionary())._new();
  3243. _st(d)._at_put_("hello","world");
  3244. $ctx1.sendIdx["at:put:"]=1;
  3245. $1=_st(d)._at_("hello");
  3246. $ctx1.sendIdx["at:"]=1;
  3247. self._assert_equals_($1,"world");
  3248. $ctx1.sendIdx["assert:equals:"]=1;
  3249. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3250. return nil;
  3251. }));
  3252. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3253. self._assert_equals_($2,"world");
  3254. $ctx1.sendIdx["assert:equals:"]=2;
  3255. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3256. return nil;
  3257. }))).__eq("world"));
  3258. $ctx1.sendIdx["deny:"]=1;
  3259. $3=_st(d)._includesKey_("hello");
  3260. $ctx1.sendIdx["includesKey:"]=1;
  3261. self._assert_($3);
  3262. $ctx1.sendIdx["assert:"]=1;
  3263. $4=_st(d)._includesKey_("foo");
  3264. $ctx1.sendIdx["includesKey:"]=2;
  3265. self._deny_($4);
  3266. $ctx1.sendIdx["deny:"]=2;
  3267. _st(d)._at_put_((1),(2));
  3268. $ctx1.sendIdx["at:put:"]=2;
  3269. $5=_st(d)._at_((1));
  3270. $ctx1.sendIdx["at:"]=2;
  3271. self._assert_equals_($5,(2));
  3272. $ctx1.sendIdx["assert:equals:"]=3;
  3273. $6=d;
  3274. $7=(1).__at((3));
  3275. $ctx1.sendIdx["@"]=1;
  3276. _st($6)._at_put_($7,(3));
  3277. $9=d;
  3278. $10=(1).__at((3));
  3279. $ctx1.sendIdx["@"]=2;
  3280. $8=_st($9)._at_($10);
  3281. self._assert_equals_($8,(3));
  3282. $12=d;
  3283. $13=(1).__at((3));
  3284. $ctx1.sendIdx["@"]=3;
  3285. $11=_st($12)._includesKey_($13);
  3286. $ctx1.sendIdx["includesKey:"]=3;
  3287. self._assert_($11);
  3288. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3289. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3290. args: [],
  3291. 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)",
  3292. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3293. referencedClasses: ["Dictionary"]
  3294. }),
  3295. globals.DictionaryTest);
  3296. smalltalk.addMethod(
  3297. smalltalk.method({
  3298. selector: "testDynamicDictionaries",
  3299. protocol: 'tests',
  3300. fn: function (){
  3301. var self=this;
  3302. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3303. return smalltalk.withContext(function($ctx1) {
  3304. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3305. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3306. args: [],
  3307. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3308. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3309. referencedClasses: ["Dictionary"]
  3310. }),
  3311. globals.DictionaryTest);
  3312. smalltalk.addMethod(
  3313. smalltalk.method({
  3314. selector: "collectionClass",
  3315. protocol: 'fixture',
  3316. fn: function (){
  3317. var self=this;
  3318. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3319. return $Dictionary();
  3320. },
  3321. args: [],
  3322. source: "collectionClass\x0a\x09^ Dictionary",
  3323. messageSends: [],
  3324. referencedClasses: ["Dictionary"]
  3325. }),
  3326. globals.DictionaryTest.klass);
  3327. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3328. smalltalk.addMethod(
  3329. smalltalk.method({
  3330. selector: "collection",
  3331. protocol: 'fixture',
  3332. fn: function (){
  3333. var self=this;
  3334. var $1;
  3335. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3336. return $1;
  3337. },
  3338. args: [],
  3339. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3340. messageSends: [],
  3341. referencedClasses: []
  3342. }),
  3343. globals.HashedCollectionTest);
  3344. smalltalk.addMethod(
  3345. smalltalk.method({
  3346. selector: "collectionKeys",
  3347. protocol: 'fixture',
  3348. fn: function (){
  3349. var self=this;
  3350. var $1;
  3351. $1=["b","a","c","d"];
  3352. return $1;
  3353. },
  3354. args: [],
  3355. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3356. messageSends: [],
  3357. referencedClasses: []
  3358. }),
  3359. globals.HashedCollectionTest);
  3360. smalltalk.addMethod(
  3361. smalltalk.method({
  3362. selector: "collectionOfPrintStrings",
  3363. protocol: 'fixture',
  3364. fn: function (){
  3365. var self=this;
  3366. var $1;
  3367. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3368. return $1;
  3369. },
  3370. args: [],
  3371. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3372. messageSends: [],
  3373. referencedClasses: []
  3374. }),
  3375. globals.HashedCollectionTest);
  3376. smalltalk.addMethod(
  3377. smalltalk.method({
  3378. selector: "collectionSize",
  3379. protocol: 'fixture',
  3380. fn: function (){
  3381. var self=this;
  3382. return (4);
  3383. },
  3384. args: [],
  3385. source: "collectionSize\x0a\x09^ 4",
  3386. messageSends: [],
  3387. referencedClasses: []
  3388. }),
  3389. globals.HashedCollectionTest);
  3390. smalltalk.addMethod(
  3391. smalltalk.method({
  3392. selector: "collectionValues",
  3393. protocol: 'fixture',
  3394. fn: function (){
  3395. var self=this;
  3396. var $1;
  3397. $1=[(1),(2),(3),(-4)];
  3398. return $1;
  3399. },
  3400. args: [],
  3401. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3402. messageSends: [],
  3403. referencedClasses: []
  3404. }),
  3405. globals.HashedCollectionTest);
  3406. smalltalk.addMethod(
  3407. smalltalk.method({
  3408. selector: "collectionWithDuplicates",
  3409. protocol: 'fixture',
  3410. fn: function (){
  3411. var self=this;
  3412. var $1;
  3413. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3414. return $1;
  3415. },
  3416. args: [],
  3417. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3418. messageSends: [],
  3419. referencedClasses: []
  3420. }),
  3421. globals.HashedCollectionTest);
  3422. smalltalk.addMethod(
  3423. smalltalk.method({
  3424. selector: "collectionWithNewValue",
  3425. protocol: 'fixture',
  3426. fn: function (){
  3427. var self=this;
  3428. var $1;
  3429. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3430. return $1;
  3431. },
  3432. args: [],
  3433. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3434. messageSends: [],
  3435. referencedClasses: []
  3436. }),
  3437. globals.HashedCollectionTest);
  3438. smalltalk.addMethod(
  3439. smalltalk.method({
  3440. selector: "sampleNewValueAsCollection",
  3441. protocol: 'fixture',
  3442. fn: function (){
  3443. var self=this;
  3444. var $1;
  3445. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3446. return $1;
  3447. },
  3448. args: [],
  3449. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3450. messageSends: [],
  3451. referencedClasses: []
  3452. }),
  3453. globals.HashedCollectionTest);
  3454. smalltalk.addMethod(
  3455. smalltalk.method({
  3456. selector: "testDynamicDictionaries",
  3457. protocol: 'tests',
  3458. fn: function (){
  3459. var self=this;
  3460. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3461. return smalltalk.withContext(function($ctx1) {
  3462. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3463. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3464. args: [],
  3465. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3466. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3467. referencedClasses: ["HashedCollection"]
  3468. }),
  3469. globals.HashedCollectionTest);
  3470. smalltalk.addMethod(
  3471. smalltalk.method({
  3472. selector: "collectionClass",
  3473. protocol: 'fixture',
  3474. fn: function (){
  3475. var self=this;
  3476. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3477. return $HashedCollection();
  3478. },
  3479. args: [],
  3480. source: "collectionClass\x0a\x09^ HashedCollection",
  3481. messageSends: [],
  3482. referencedClasses: ["HashedCollection"]
  3483. }),
  3484. globals.HashedCollectionTest.klass);
  3485. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3486. smalltalk.addMethod(
  3487. smalltalk.method({
  3488. selector: "collectionFirst",
  3489. protocol: 'fixture',
  3490. fn: function (){
  3491. var self=this;
  3492. return smalltalk.withContext(function($ctx1) {
  3493. self._subclassResponsibility();
  3494. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3495. args: [],
  3496. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3497. messageSends: ["subclassResponsibility"],
  3498. referencedClasses: []
  3499. }),
  3500. globals.SequenceableCollectionTest);
  3501. smalltalk.addMethod(
  3502. smalltalk.method({
  3503. selector: "collectionFirstTwo",
  3504. protocol: 'fixture',
  3505. fn: function (){
  3506. var self=this;
  3507. return smalltalk.withContext(function($ctx1) {
  3508. self._subclassResponsibility();
  3509. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3510. args: [],
  3511. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3512. messageSends: ["subclassResponsibility"],
  3513. referencedClasses: []
  3514. }),
  3515. globals.SequenceableCollectionTest);
  3516. smalltalk.addMethod(
  3517. smalltalk.method({
  3518. selector: "collectionLast",
  3519. protocol: 'fixture',
  3520. fn: function (){
  3521. var self=this;
  3522. return smalltalk.withContext(function($ctx1) {
  3523. self._subclassResponsibility();
  3524. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3525. args: [],
  3526. source: "collectionLast\x0a\x09self subclassResponsibility",
  3527. messageSends: ["subclassResponsibility"],
  3528. referencedClasses: []
  3529. }),
  3530. globals.SequenceableCollectionTest);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "collectionLastTwo",
  3534. protocol: 'fixture',
  3535. fn: function (){
  3536. var self=this;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. self._subclassResponsibility();
  3539. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3540. args: [],
  3541. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3542. messageSends: ["subclassResponsibility"],
  3543. referencedClasses: []
  3544. }),
  3545. globals.SequenceableCollectionTest);
  3546. smalltalk.addMethod(
  3547. smalltalk.method({
  3548. selector: "nonIndexesDo:",
  3549. protocol: 'fixture',
  3550. fn: function (aBlock){
  3551. var self=this;
  3552. return smalltalk.withContext(function($ctx1) {
  3553. _st(aBlock)._value_((0));
  3554. $ctx1.sendIdx["value:"]=1;
  3555. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3556. $ctx1.sendIdx["value:"]=2;
  3557. _st(aBlock)._value_("z");
  3558. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3559. args: ["aBlock"],
  3560. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3561. messageSends: ["value:", "+", "collectionSize"],
  3562. referencedClasses: []
  3563. }),
  3564. globals.SequenceableCollectionTest);
  3565. smalltalk.addMethod(
  3566. smalltalk.method({
  3567. selector: "samplesDo:",
  3568. protocol: 'fixture',
  3569. fn: function (aBlock){
  3570. var self=this;
  3571. return smalltalk.withContext(function($ctx1) {
  3572. _st(aBlock)._value_value_((1),self._collectionFirst());
  3573. $ctx1.sendIdx["value:value:"]=1;
  3574. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3575. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3576. args: ["aBlock"],
  3577. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3578. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3579. referencedClasses: []
  3580. }),
  3581. globals.SequenceableCollectionTest);
  3582. smalltalk.addMethod(
  3583. smalltalk.method({
  3584. selector: "testBeginsWith",
  3585. protocol: 'tests',
  3586. fn: function (){
  3587. var self=this;
  3588. return smalltalk.withContext(function($ctx1) {
  3589. var $2,$1,$4,$5,$3,$7,$6;
  3590. $2=self._collection();
  3591. $ctx1.sendIdx["collection"]=1;
  3592. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3593. $ctx1.sendIdx["beginsWith:"]=1;
  3594. self._assert_($1);
  3595. $ctx1.sendIdx["assert:"]=1;
  3596. $4=self._collection();
  3597. $ctx1.sendIdx["collection"]=2;
  3598. $5=self._collection();
  3599. $ctx1.sendIdx["collection"]=3;
  3600. $3=_st($4)._beginsWith_($5);
  3601. $ctx1.sendIdx["beginsWith:"]=2;
  3602. self._assert_($3);
  3603. $ctx1.sendIdx["assert:"]=2;
  3604. $7=self._collection();
  3605. $ctx1.sendIdx["collection"]=4;
  3606. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3607. $ctx1.sendIdx["beginsWith:"]=3;
  3608. self._assert_($6);
  3609. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3610. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3611. args: [],
  3612. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  3613. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3614. referencedClasses: []
  3615. }),
  3616. globals.SequenceableCollectionTest);
  3617. smalltalk.addMethod(
  3618. smalltalk.method({
  3619. selector: "testEndsWith",
  3620. protocol: 'tests',
  3621. fn: function (){
  3622. var self=this;
  3623. return smalltalk.withContext(function($ctx1) {
  3624. var $2,$1,$4,$5,$3,$7,$6;
  3625. $2=self._collection();
  3626. $ctx1.sendIdx["collection"]=1;
  3627. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3628. $ctx1.sendIdx["endsWith:"]=1;
  3629. self._assert_($1);
  3630. $ctx1.sendIdx["assert:"]=1;
  3631. $4=self._collection();
  3632. $ctx1.sendIdx["collection"]=2;
  3633. $5=self._collection();
  3634. $ctx1.sendIdx["collection"]=3;
  3635. $3=_st($4)._endsWith_($5);
  3636. $ctx1.sendIdx["endsWith:"]=2;
  3637. self._assert_($3);
  3638. $ctx1.sendIdx["assert:"]=2;
  3639. $7=self._collection();
  3640. $ctx1.sendIdx["collection"]=4;
  3641. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3642. $ctx1.sendIdx["endsWith:"]=3;
  3643. self._assert_($6);
  3644. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3645. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3646. args: [],
  3647. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  3648. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3649. referencedClasses: []
  3650. }),
  3651. globals.SequenceableCollectionTest);
  3652. smalltalk.addMethod(
  3653. smalltalk.method({
  3654. selector: "testFirst",
  3655. protocol: 'tests',
  3656. fn: function (){
  3657. var self=this;
  3658. return smalltalk.withContext(function($ctx1) {
  3659. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3660. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3661. args: [],
  3662. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3663. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3664. referencedClasses: []
  3665. }),
  3666. globals.SequenceableCollectionTest);
  3667. smalltalk.addMethod(
  3668. smalltalk.method({
  3669. selector: "testFirstN",
  3670. protocol: 'tests',
  3671. fn: function (){
  3672. var self=this;
  3673. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3674. return smalltalk.withContext(function($ctx1) {
  3675. var $2,$1,$4,$3,$6,$5,$7;
  3676. $2=self._collection();
  3677. $ctx1.sendIdx["collection"]=1;
  3678. $1=_st($2)._first_((2));
  3679. $ctx1.sendIdx["first:"]=1;
  3680. self._assert_equals_($1,self._collectionFirstTwo());
  3681. $ctx1.sendIdx["assert:equals:"]=1;
  3682. $4=self._collection();
  3683. $ctx1.sendIdx["collection"]=2;
  3684. $3=_st($4)._first_((0));
  3685. $ctx1.sendIdx["first:"]=2;
  3686. self._assert_equals_($3,_st(self._collectionClass())._new());
  3687. $ctx1.sendIdx["assert:equals:"]=2;
  3688. $6=self._collection();
  3689. $ctx1.sendIdx["collection"]=3;
  3690. $5=_st($6)._first_(self._collectionSize());
  3691. $ctx1.sendIdx["first:"]=3;
  3692. $7=self._collection();
  3693. $ctx1.sendIdx["collection"]=4;
  3694. self._assert_equals_($5,$7);
  3695. self._should_raise_((function(){
  3696. return smalltalk.withContext(function($ctx2) {
  3697. return _st(self._collection())._first_((33));
  3698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3699. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3700. args: [],
  3701. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3702. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3703. referencedClasses: ["Error"]
  3704. }),
  3705. globals.SequenceableCollectionTest);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "testFourth",
  3709. protocol: 'tests',
  3710. fn: function (){
  3711. var self=this;
  3712. return smalltalk.withContext(function($ctx1) {
  3713. var $2,$1;
  3714. $2=self._collection();
  3715. $ctx1.sendIdx["collection"]=1;
  3716. $1=_st($2)._fourth();
  3717. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3718. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3719. args: [],
  3720. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3721. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3722. referencedClasses: []
  3723. }),
  3724. globals.SequenceableCollectionTest);
  3725. smalltalk.addMethod(
  3726. smalltalk.method({
  3727. selector: "testIndexOfStartingAt",
  3728. protocol: 'tests',
  3729. fn: function (){
  3730. var self=this;
  3731. var jsNull;
  3732. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3733. return smalltalk.withContext(function($ctx1) {
  3734. var $2,$1,$4,$3;
  3735. jsNull=_st($JSON())._parse_("null");
  3736. self._samplesDo_((function(index,value){
  3737. return smalltalk.withContext(function($ctx2) {
  3738. $2=self._collection();
  3739. $ctx2.sendIdx["collection"]=1;
  3740. $1=_st($2)._indexOf_startingAt_(value,(1));
  3741. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3742. self._assert_equals_($1,index);
  3743. $ctx2.sendIdx["assert:equals:"]=1;
  3744. $4=self._collection();
  3745. $ctx2.sendIdx["collection"]=2;
  3746. $3=_st($4)._indexOf_startingAt_(value,index);
  3747. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3748. self._assert_equals_($3,index);
  3749. $ctx2.sendIdx["assert:equals:"]=2;
  3750. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3751. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3752. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3753. args: [],
  3754. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3755. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3756. referencedClasses: ["JSON"]
  3757. }),
  3758. globals.SequenceableCollectionTest);
  3759. smalltalk.addMethod(
  3760. smalltalk.method({
  3761. selector: "testIndexOfStartingAtWithNull",
  3762. protocol: 'tests',
  3763. fn: function (){
  3764. var self=this;
  3765. var jsNull;
  3766. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3767. return smalltalk.withContext(function($ctx1) {
  3768. var $1,$2;
  3769. jsNull=_st($JSON())._parse_("null");
  3770. self._samplesDo_((function(index,value){
  3771. var collection;
  3772. return smalltalk.withContext(function($ctx2) {
  3773. collection=self._collection();
  3774. collection;
  3775. _st(collection)._at_put_(index,jsNull);
  3776. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3777. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3778. self._assert_equals_($1,index);
  3779. $ctx2.sendIdx["assert:equals:"]=1;
  3780. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3781. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3782. self._assert_equals_($2,index);
  3783. $ctx2.sendIdx["assert:equals:"]=2;
  3784. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3785. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3786. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3787. args: [],
  3788. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3789. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3790. referencedClasses: ["JSON"]
  3791. }),
  3792. globals.SequenceableCollectionTest);
  3793. smalltalk.addMethod(
  3794. smalltalk.method({
  3795. selector: "testLast",
  3796. protocol: 'tests',
  3797. fn: function (){
  3798. var self=this;
  3799. return smalltalk.withContext(function($ctx1) {
  3800. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3801. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3802. args: [],
  3803. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3804. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3805. referencedClasses: []
  3806. }),
  3807. globals.SequenceableCollectionTest);
  3808. smalltalk.addMethod(
  3809. smalltalk.method({
  3810. selector: "testLastN",
  3811. protocol: 'tests',
  3812. fn: function (){
  3813. var self=this;
  3814. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3815. return smalltalk.withContext(function($ctx1) {
  3816. var $2,$1,$4,$3,$6,$5,$7;
  3817. $2=self._collection();
  3818. $ctx1.sendIdx["collection"]=1;
  3819. $1=_st($2)._last_((2));
  3820. $ctx1.sendIdx["last:"]=1;
  3821. self._assert_equals_($1,self._collectionLastTwo());
  3822. $ctx1.sendIdx["assert:equals:"]=1;
  3823. $4=self._collection();
  3824. $ctx1.sendIdx["collection"]=2;
  3825. $3=_st($4)._last_((0));
  3826. $ctx1.sendIdx["last:"]=2;
  3827. self._assert_equals_($3,_st(self._collectionClass())._new());
  3828. $ctx1.sendIdx["assert:equals:"]=2;
  3829. $6=self._collection();
  3830. $ctx1.sendIdx["collection"]=3;
  3831. $5=_st($6)._last_(self._collectionSize());
  3832. $ctx1.sendIdx["last:"]=3;
  3833. $7=self._collection();
  3834. $ctx1.sendIdx["collection"]=4;
  3835. self._assert_equals_($5,$7);
  3836. self._should_raise_((function(){
  3837. return smalltalk.withContext(function($ctx2) {
  3838. return _st(self._collection())._last_((33));
  3839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3840. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3841. args: [],
  3842. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3843. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3844. referencedClasses: ["Error"]
  3845. }),
  3846. globals.SequenceableCollectionTest);
  3847. smalltalk.addMethod(
  3848. smalltalk.method({
  3849. selector: "testSecond",
  3850. protocol: 'tests',
  3851. fn: function (){
  3852. var self=this;
  3853. return smalltalk.withContext(function($ctx1) {
  3854. var $2,$1;
  3855. $2=self._collection();
  3856. $ctx1.sendIdx["collection"]=1;
  3857. $1=_st($2)._second();
  3858. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3859. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3860. args: [],
  3861. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3862. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3863. referencedClasses: []
  3864. }),
  3865. globals.SequenceableCollectionTest);
  3866. smalltalk.addMethod(
  3867. smalltalk.method({
  3868. selector: "testThird",
  3869. protocol: 'tests',
  3870. fn: function (){
  3871. var self=this;
  3872. return smalltalk.withContext(function($ctx1) {
  3873. var $2,$1;
  3874. $2=self._collection();
  3875. $ctx1.sendIdx["collection"]=1;
  3876. $1=_st($2)._third();
  3877. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3878. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3879. args: [],
  3880. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3881. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3882. referencedClasses: []
  3883. }),
  3884. globals.SequenceableCollectionTest);
  3885. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3886. smalltalk.addMethod(
  3887. smalltalk.method({
  3888. selector: "collection",
  3889. protocol: 'fixture',
  3890. fn: function (){
  3891. var self=this;
  3892. var $1;
  3893. $1=[(1), (2), (3), (-4)];
  3894. return $1;
  3895. },
  3896. args: [],
  3897. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3898. messageSends: [],
  3899. referencedClasses: []
  3900. }),
  3901. globals.ArrayTest);
  3902. smalltalk.addMethod(
  3903. smalltalk.method({
  3904. selector: "collectionFirst",
  3905. protocol: 'fixture',
  3906. fn: function (){
  3907. var self=this;
  3908. return (1);
  3909. },
  3910. args: [],
  3911. source: "collectionFirst\x0a\x09^ 1",
  3912. messageSends: [],
  3913. referencedClasses: []
  3914. }),
  3915. globals.ArrayTest);
  3916. smalltalk.addMethod(
  3917. smalltalk.method({
  3918. selector: "collectionFirstTwo",
  3919. protocol: 'fixture',
  3920. fn: function (){
  3921. var self=this;
  3922. var $1;
  3923. $1=[(1), (2)];
  3924. return $1;
  3925. },
  3926. args: [],
  3927. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3928. messageSends: [],
  3929. referencedClasses: []
  3930. }),
  3931. globals.ArrayTest);
  3932. smalltalk.addMethod(
  3933. smalltalk.method({
  3934. selector: "collectionLast",
  3935. protocol: 'fixture',
  3936. fn: function (){
  3937. var self=this;
  3938. return (-4);
  3939. },
  3940. args: [],
  3941. source: "collectionLast\x0a\x09^ -4",
  3942. messageSends: [],
  3943. referencedClasses: []
  3944. }),
  3945. globals.ArrayTest);
  3946. smalltalk.addMethod(
  3947. smalltalk.method({
  3948. selector: "collectionLastTwo",
  3949. protocol: 'fixture',
  3950. fn: function (){
  3951. var self=this;
  3952. var $1;
  3953. $1=[(3), (-4)];
  3954. return $1;
  3955. },
  3956. args: [],
  3957. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3958. messageSends: [],
  3959. referencedClasses: []
  3960. }),
  3961. globals.ArrayTest);
  3962. smalltalk.addMethod(
  3963. smalltalk.method({
  3964. selector: "collectionOfPrintStrings",
  3965. protocol: 'fixture',
  3966. fn: function (){
  3967. var self=this;
  3968. var $1;
  3969. $1=["1", "2", "3", "-4"];
  3970. return $1;
  3971. },
  3972. args: [],
  3973. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3974. messageSends: [],
  3975. referencedClasses: []
  3976. }),
  3977. globals.ArrayTest);
  3978. smalltalk.addMethod(
  3979. smalltalk.method({
  3980. selector: "collectionSize",
  3981. protocol: 'fixture',
  3982. fn: function (){
  3983. var self=this;
  3984. return (4);
  3985. },
  3986. args: [],
  3987. source: "collectionSize\x0a\x09^ 4",
  3988. messageSends: [],
  3989. referencedClasses: []
  3990. }),
  3991. globals.ArrayTest);
  3992. smalltalk.addMethod(
  3993. smalltalk.method({
  3994. selector: "collectionWithDuplicates",
  3995. protocol: 'fixture',
  3996. fn: function (){
  3997. var self=this;
  3998. var $1;
  3999. $1=["a", "b", "c", (1), (2), (1), "a"];
  4000. return $1;
  4001. },
  4002. args: [],
  4003. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4004. messageSends: [],
  4005. referencedClasses: []
  4006. }),
  4007. globals.ArrayTest);
  4008. smalltalk.addMethod(
  4009. smalltalk.method({
  4010. selector: "collectionWithNewValue",
  4011. protocol: 'fixture',
  4012. fn: function (){
  4013. var self=this;
  4014. var $1;
  4015. $1=[(1), (2), (3), (-4), "N"];
  4016. return $1;
  4017. },
  4018. args: [],
  4019. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4020. messageSends: [],
  4021. referencedClasses: []
  4022. }),
  4023. globals.ArrayTest);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "sampleNewIndex",
  4027. protocol: 'fixture',
  4028. fn: function (){
  4029. var self=this;
  4030. return (5);
  4031. },
  4032. args: [],
  4033. source: "sampleNewIndex\x0a\x09^ 5",
  4034. messageSends: [],
  4035. referencedClasses: []
  4036. }),
  4037. globals.ArrayTest);
  4038. smalltalk.addMethod(
  4039. smalltalk.method({
  4040. selector: "samplesDo:",
  4041. protocol: 'fixture',
  4042. fn: function (aBlock){
  4043. var self=this;
  4044. return smalltalk.withContext(function($ctx1) {
  4045. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4046. _st(aBlock)._value_value_((3),(3));
  4047. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4048. args: ["aBlock"],
  4049. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4050. messageSends: ["samplesDo:", "value:value:"],
  4051. referencedClasses: []
  4052. }),
  4053. globals.ArrayTest);
  4054. smalltalk.addMethod(
  4055. smalltalk.method({
  4056. selector: "testAdd",
  4057. protocol: 'tests',
  4058. fn: function (){
  4059. var self=this;
  4060. var array;
  4061. return smalltalk.withContext(function($ctx1) {
  4062. array=self._collection();
  4063. _st(array)._add_((6));
  4064. self._assert_equals_(_st(array)._last(),(6));
  4065. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4066. args: [],
  4067. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4068. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4069. referencedClasses: []
  4070. }),
  4071. globals.ArrayTest);
  4072. smalltalk.addMethod(
  4073. smalltalk.method({
  4074. selector: "testAddFirst",
  4075. protocol: 'tests',
  4076. fn: function (){
  4077. var self=this;
  4078. return smalltalk.withContext(function($ctx1) {
  4079. var $1,$2;
  4080. $1=self._collection();
  4081. _st($1)._addFirst_((0));
  4082. $2=_st($1)._yourself();
  4083. self._assert_equals_(_st($2)._first(),(0));
  4084. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4085. args: [],
  4086. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4087. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4088. referencedClasses: []
  4089. }),
  4090. globals.ArrayTest);
  4091. smalltalk.addMethod(
  4092. smalltalk.method({
  4093. selector: "testPrintString",
  4094. protocol: 'tests',
  4095. fn: function (){
  4096. var self=this;
  4097. var array;
  4098. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4099. return smalltalk.withContext(function($ctx1) {
  4100. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4101. array=_st($Array())._new();
  4102. $1=_st(array)._printString();
  4103. $ctx1.sendIdx["printString"]=1;
  4104. self._assert_equals_($1,"an Array ()");
  4105. $ctx1.sendIdx["assert:equals:"]=1;
  4106. $2=array;
  4107. _st($2)._add_((1));
  4108. $ctx1.sendIdx["add:"]=1;
  4109. $3=_st($2)._add_((3));
  4110. $ctx1.sendIdx["add:"]=2;
  4111. $4=_st(array)._printString();
  4112. $ctx1.sendIdx["printString"]=2;
  4113. self._assert_equals_($4,"an Array (1 3)");
  4114. $ctx1.sendIdx["assert:equals:"]=2;
  4115. _st(array)._add_("foo");
  4116. $5=_st(array)._printString();
  4117. $ctx1.sendIdx["printString"]=3;
  4118. self._assert_equals_($5,"an Array (1 3 'foo')");
  4119. $ctx1.sendIdx["assert:equals:"]=3;
  4120. $6=array;
  4121. _st($6)._remove_((1));
  4122. $ctx1.sendIdx["remove:"]=1;
  4123. $7=_st($6)._remove_((3));
  4124. $8=_st(array)._printString();
  4125. $ctx1.sendIdx["printString"]=4;
  4126. self._assert_equals_($8,"an Array ('foo')");
  4127. $ctx1.sendIdx["assert:equals:"]=4;
  4128. _st(array)._addLast_((3));
  4129. $ctx1.sendIdx["addLast:"]=1;
  4130. $9=_st(array)._printString();
  4131. $ctx1.sendIdx["printString"]=5;
  4132. self._assert_equals_($9,"an Array ('foo' 3)");
  4133. $ctx1.sendIdx["assert:equals:"]=5;
  4134. _st(array)._addLast_((3));
  4135. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4136. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4137. args: [],
  4138. 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)'.",
  4139. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4140. referencedClasses: ["Array"]
  4141. }),
  4142. globals.ArrayTest);
  4143. smalltalk.addMethod(
  4144. smalltalk.method({
  4145. selector: "testRemove",
  4146. protocol: 'tests',
  4147. fn: function (){
  4148. var self=this;
  4149. var array;
  4150. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4151. return smalltalk.withContext(function($ctx1) {
  4152. array=[(1), (2), (3), (4), (5)];
  4153. _st(array)._remove_((3));
  4154. $ctx1.sendIdx["remove:"]=1;
  4155. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4156. self._should_raise_((function(){
  4157. return smalltalk.withContext(function($ctx2) {
  4158. return _st(array)._remove_((3));
  4159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4160. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4161. args: [],
  4162. 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",
  4163. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4164. referencedClasses: ["Error"]
  4165. }),
  4166. globals.ArrayTest);
  4167. smalltalk.addMethod(
  4168. smalltalk.method({
  4169. selector: "testRemoveFromTo",
  4170. protocol: 'tests',
  4171. fn: function (){
  4172. var self=this;
  4173. return smalltalk.withContext(function($ctx1) {
  4174. var $1,$2;
  4175. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4176. $ctx1.sendIdx["removeFrom:to:"]=1;
  4177. self._assert_equals_($1,[(4)]);
  4178. $ctx1.sendIdx["assert:equals:"]=1;
  4179. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4180. $ctx1.sendIdx["removeFrom:to:"]=2;
  4181. self._assert_equals_($2,[(1), (4)]);
  4182. $ctx1.sendIdx["assert:equals:"]=2;
  4183. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4184. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4185. args: [],
  4186. 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)",
  4187. messageSends: ["assert:equals:", "removeFrom:to:"],
  4188. referencedClasses: []
  4189. }),
  4190. globals.ArrayTest);
  4191. smalltalk.addMethod(
  4192. smalltalk.method({
  4193. selector: "testRemoveIndex",
  4194. protocol: 'tests',
  4195. fn: function (){
  4196. var self=this;
  4197. return smalltalk.withContext(function($ctx1) {
  4198. var $1,$2;
  4199. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4200. $ctx1.sendIdx["removeIndex:"]=1;
  4201. self._assert_equals_($1,[(1), (3), (4)]);
  4202. $ctx1.sendIdx["assert:equals:"]=1;
  4203. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4204. $ctx1.sendIdx["removeIndex:"]=2;
  4205. self._assert_equals_($2,[(2), (3), (4)]);
  4206. $ctx1.sendIdx["assert:equals:"]=2;
  4207. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4208. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4209. args: [],
  4210. 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: #()",
  4211. messageSends: ["assert:equals:", "removeIndex:"],
  4212. referencedClasses: []
  4213. }),
  4214. globals.ArrayTest);
  4215. smalltalk.addMethod(
  4216. smalltalk.method({
  4217. selector: "testRemoveLast",
  4218. protocol: 'tests',
  4219. fn: function (){
  4220. var self=this;
  4221. var array;
  4222. return smalltalk.withContext(function($ctx1) {
  4223. array=[(1), (2)];
  4224. _st(array)._removeLast();
  4225. self._assert_equals_(_st(array)._last(),(1));
  4226. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4227. args: [],
  4228. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4229. messageSends: ["removeLast", "assert:equals:", "last"],
  4230. referencedClasses: []
  4231. }),
  4232. globals.ArrayTest);
  4233. smalltalk.addMethod(
  4234. smalltalk.method({
  4235. selector: "testReversed",
  4236. protocol: 'tests',
  4237. fn: function (){
  4238. var self=this;
  4239. var array;
  4240. return smalltalk.withContext(function($ctx1) {
  4241. array=[(5), (4), (3), (2), (1)];
  4242. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4243. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4244. args: [],
  4245. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4246. messageSends: ["assert:equals:", "reversed"],
  4247. referencedClasses: []
  4248. }),
  4249. globals.ArrayTest);
  4250. smalltalk.addMethod(
  4251. smalltalk.method({
  4252. selector: "testSort",
  4253. protocol: 'tests',
  4254. fn: function (){
  4255. var self=this;
  4256. var array;
  4257. return smalltalk.withContext(function($ctx1) {
  4258. array=[(10), (1), (5)];
  4259. _st(array)._sort();
  4260. self._assert_equals_(array,[(1), (5), (10)]);
  4261. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4262. args: [],
  4263. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4264. messageSends: ["sort", "assert:equals:"],
  4265. referencedClasses: []
  4266. }),
  4267. globals.ArrayTest);
  4268. smalltalk.addMethod(
  4269. smalltalk.method({
  4270. selector: "collectionClass",
  4271. protocol: 'fixture',
  4272. fn: function (){
  4273. var self=this;
  4274. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4275. return $Array();
  4276. },
  4277. args: [],
  4278. source: "collectionClass\x0a\x09^ Array",
  4279. messageSends: [],
  4280. referencedClasses: ["Array"]
  4281. }),
  4282. globals.ArrayTest.klass);
  4283. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4284. smalltalk.addMethod(
  4285. smalltalk.method({
  4286. selector: "collection",
  4287. protocol: 'fixture',
  4288. fn: function (){
  4289. var self=this;
  4290. return "helLo";
  4291. },
  4292. args: [],
  4293. source: "collection\x0a\x09^ 'helLo'",
  4294. messageSends: [],
  4295. referencedClasses: []
  4296. }),
  4297. globals.StringTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "collectionFirst",
  4301. protocol: 'fixture',
  4302. fn: function (){
  4303. var self=this;
  4304. return "h";
  4305. },
  4306. args: [],
  4307. source: "collectionFirst\x0a\x09^ 'h'",
  4308. messageSends: [],
  4309. referencedClasses: []
  4310. }),
  4311. globals.StringTest);
  4312. smalltalk.addMethod(
  4313. smalltalk.method({
  4314. selector: "collectionFirstTwo",
  4315. protocol: 'fixture',
  4316. fn: function (){
  4317. var self=this;
  4318. return "he";
  4319. },
  4320. args: [],
  4321. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4322. messageSends: [],
  4323. referencedClasses: []
  4324. }),
  4325. globals.StringTest);
  4326. smalltalk.addMethod(
  4327. smalltalk.method({
  4328. selector: "collectionLast",
  4329. protocol: 'fixture',
  4330. fn: function (){
  4331. var self=this;
  4332. return "o";
  4333. },
  4334. args: [],
  4335. source: "collectionLast\x0a\x09^ 'o'",
  4336. messageSends: [],
  4337. referencedClasses: []
  4338. }),
  4339. globals.StringTest);
  4340. smalltalk.addMethod(
  4341. smalltalk.method({
  4342. selector: "collectionLastTwo",
  4343. protocol: 'fixture',
  4344. fn: function (){
  4345. var self=this;
  4346. return "Lo";
  4347. },
  4348. args: [],
  4349. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4350. messageSends: [],
  4351. referencedClasses: []
  4352. }),
  4353. globals.StringTest);
  4354. smalltalk.addMethod(
  4355. smalltalk.method({
  4356. selector: "collectionOfPrintStrings",
  4357. protocol: 'fixture',
  4358. fn: function (){
  4359. var self=this;
  4360. return "'h''e''l''L''o'";
  4361. },
  4362. args: [],
  4363. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4364. messageSends: [],
  4365. referencedClasses: []
  4366. }),
  4367. globals.StringTest);
  4368. smalltalk.addMethod(
  4369. smalltalk.method({
  4370. selector: "collectionSize",
  4371. protocol: 'fixture',
  4372. fn: function (){
  4373. var self=this;
  4374. return (5);
  4375. },
  4376. args: [],
  4377. source: "collectionSize\x0a\x09^ 5",
  4378. messageSends: [],
  4379. referencedClasses: []
  4380. }),
  4381. globals.StringTest);
  4382. smalltalk.addMethod(
  4383. smalltalk.method({
  4384. selector: "collectionWithDuplicates",
  4385. protocol: 'fixture',
  4386. fn: function (){
  4387. var self=this;
  4388. return "abbaerte";
  4389. },
  4390. args: [],
  4391. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4392. messageSends: [],
  4393. referencedClasses: []
  4394. }),
  4395. globals.StringTest);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "collectionWithNewValue",
  4399. protocol: 'fixture',
  4400. fn: function (){
  4401. var self=this;
  4402. return "helLoN";
  4403. },
  4404. args: [],
  4405. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4406. messageSends: [],
  4407. referencedClasses: []
  4408. }),
  4409. globals.StringTest);
  4410. smalltalk.addMethod(
  4411. smalltalk.method({
  4412. selector: "sampleNewValueAsCollection",
  4413. protocol: 'fixture',
  4414. fn: function (){
  4415. var self=this;
  4416. return "N";
  4417. },
  4418. args: [],
  4419. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4420. messageSends: [],
  4421. referencedClasses: []
  4422. }),
  4423. globals.StringTest);
  4424. smalltalk.addMethod(
  4425. smalltalk.method({
  4426. selector: "samplesDo:",
  4427. protocol: 'fixture',
  4428. fn: function (aBlock){
  4429. var self=this;
  4430. return smalltalk.withContext(function($ctx1) {
  4431. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4432. _st(aBlock)._value_value_((3),"l");
  4433. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4434. args: ["aBlock"],
  4435. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4436. messageSends: ["samplesDo:", "value:value:"],
  4437. referencedClasses: []
  4438. }),
  4439. globals.StringTest);
  4440. smalltalk.addMethod(
  4441. smalltalk.method({
  4442. selector: "testAddAll",
  4443. protocol: 'tests',
  4444. fn: function (){
  4445. var self=this;
  4446. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4447. return smalltalk.withContext(function($ctx1) {
  4448. var $1;
  4449. self._should_raise_((function(){
  4450. return smalltalk.withContext(function($ctx2) {
  4451. $1=self._collection();
  4452. $ctx2.sendIdx["collection"]=1;
  4453. return _st($1)._addAll_(self._collection());
  4454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4455. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4456. args: [],
  4457. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4458. messageSends: ["should:raise:", "addAll:", "collection"],
  4459. referencedClasses: ["Error"]
  4460. }),
  4461. globals.StringTest);
  4462. smalltalk.addMethod(
  4463. smalltalk.method({
  4464. selector: "testAddRemove",
  4465. protocol: 'tests',
  4466. fn: function (){
  4467. var self=this;
  4468. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4469. return smalltalk.withContext(function($ctx1) {
  4470. self._should_raise_((function(){
  4471. return smalltalk.withContext(function($ctx2) {
  4472. return "hello"._add_("a");
  4473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4474. $ctx1.sendIdx["should:raise:"]=1;
  4475. self._should_raise_((function(){
  4476. return smalltalk.withContext(function($ctx2) {
  4477. return "hello"._remove_("h");
  4478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4479. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4480. args: [],
  4481. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4482. messageSends: ["should:raise:", "add:", "remove:"],
  4483. referencedClasses: ["Error"]
  4484. }),
  4485. globals.StringTest);
  4486. smalltalk.addMethod(
  4487. smalltalk.method({
  4488. selector: "testAsArray",
  4489. protocol: 'tests',
  4490. fn: function (){
  4491. var self=this;
  4492. return smalltalk.withContext(function($ctx1) {
  4493. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4494. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4495. args: [],
  4496. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4497. messageSends: ["assert:equals:", "asArray"],
  4498. referencedClasses: []
  4499. }),
  4500. globals.StringTest);
  4501. smalltalk.addMethod(
  4502. smalltalk.method({
  4503. selector: "testAsLowerCase",
  4504. protocol: 'tests',
  4505. fn: function (){
  4506. var self=this;
  4507. return smalltalk.withContext(function($ctx1) {
  4508. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4509. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4510. args: [],
  4511. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4512. messageSends: ["assert:equals:", "asLowercase"],
  4513. referencedClasses: []
  4514. }),
  4515. globals.StringTest);
  4516. smalltalk.addMethod(
  4517. smalltalk.method({
  4518. selector: "testAsNumber",
  4519. protocol: 'tests',
  4520. fn: function (){
  4521. var self=this;
  4522. return smalltalk.withContext(function($ctx1) {
  4523. var $1,$2;
  4524. $1="3"._asNumber();
  4525. $ctx1.sendIdx["asNumber"]=1;
  4526. self._assert_equals_($1,(3));
  4527. $ctx1.sendIdx["assert:equals:"]=1;
  4528. $2="-3"._asNumber();
  4529. $ctx1.sendIdx["asNumber"]=2;
  4530. self._assert_equals_($2,(-3));
  4531. $ctx1.sendIdx["assert:equals:"]=2;
  4532. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4533. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4534. args: [],
  4535. 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.",
  4536. messageSends: ["assert:equals:", "asNumber"],
  4537. referencedClasses: []
  4538. }),
  4539. globals.StringTest);
  4540. smalltalk.addMethod(
  4541. smalltalk.method({
  4542. selector: "testAsUpperCase",
  4543. protocol: 'tests',
  4544. fn: function (){
  4545. var self=this;
  4546. return smalltalk.withContext(function($ctx1) {
  4547. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4548. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4549. args: [],
  4550. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4551. messageSends: ["assert:equals:", "asUppercase"],
  4552. referencedClasses: []
  4553. }),
  4554. globals.StringTest);
  4555. smalltalk.addMethod(
  4556. smalltalk.method({
  4557. selector: "testAsciiValue",
  4558. protocol: 'tests',
  4559. fn: function (){
  4560. var self=this;
  4561. var characterA,characterU;
  4562. return smalltalk.withContext(function($ctx1) {
  4563. var $1;
  4564. characterA="A";
  4565. characterU="U";
  4566. $1=_st(characterA)._asciiValue();
  4567. $ctx1.sendIdx["asciiValue"]=1;
  4568. self._assert_equals_($1,(65));
  4569. $ctx1.sendIdx["assert:equals:"]=1;
  4570. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4571. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4572. args: [],
  4573. 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",
  4574. messageSends: ["assert:equals:", "asciiValue"],
  4575. referencedClasses: []
  4576. }),
  4577. globals.StringTest);
  4578. smalltalk.addMethod(
  4579. smalltalk.method({
  4580. selector: "testAtIfAbsentPut",
  4581. protocol: 'tests',
  4582. fn: function (){
  4583. var self=this;
  4584. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4585. return smalltalk.withContext(function($ctx1) {
  4586. self._should_raise_((function(){
  4587. return smalltalk.withContext(function($ctx2) {
  4588. return "hello"._at_ifAbsentPut_((6),(function(){
  4589. return "a";
  4590. }));
  4591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4592. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4593. args: [],
  4594. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4595. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4596. referencedClasses: ["Error"]
  4597. }),
  4598. globals.StringTest);
  4599. smalltalk.addMethod(
  4600. smalltalk.method({
  4601. selector: "testAtPut",
  4602. protocol: 'tests',
  4603. fn: function (){
  4604. var self=this;
  4605. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4606. return smalltalk.withContext(function($ctx1) {
  4607. self._should_raise_((function(){
  4608. return smalltalk.withContext(function($ctx2) {
  4609. return "hello"._at_put_((1),"a");
  4610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4611. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4612. args: [],
  4613. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4614. messageSends: ["should:raise:", "at:put:"],
  4615. referencedClasses: ["Error"]
  4616. }),
  4617. globals.StringTest);
  4618. smalltalk.addMethod(
  4619. smalltalk.method({
  4620. selector: "testCapitalized",
  4621. protocol: 'tests',
  4622. fn: function (){
  4623. var self=this;
  4624. return smalltalk.withContext(function($ctx1) {
  4625. var $1,$2,$3;
  4626. $1="test"._capitalized();
  4627. $ctx1.sendIdx["capitalized"]=1;
  4628. self._assert_equals_($1,"Test");
  4629. $ctx1.sendIdx["assert:equals:"]=1;
  4630. $2="Test"._capitalized();
  4631. $ctx1.sendIdx["capitalized"]=2;
  4632. self._assert_equals_($2,"Test");
  4633. $ctx1.sendIdx["assert:equals:"]=2;
  4634. self._assert_equals_(""._capitalized(),"");
  4635. $ctx1.sendIdx["assert:equals:"]=3;
  4636. $3="Test"._isCapitalized();
  4637. $ctx1.sendIdx["isCapitalized"]=1;
  4638. self._assert_equals_($3,true);
  4639. $ctx1.sendIdx["assert:equals:"]=4;
  4640. self._assert_equals_("test"._isCapitalized(),false);
  4641. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4642. args: [],
  4643. 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.",
  4644. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4645. referencedClasses: []
  4646. }),
  4647. globals.StringTest);
  4648. smalltalk.addMethod(
  4649. smalltalk.method({
  4650. selector: "testCharCodeAt",
  4651. protocol: 'tests',
  4652. fn: function (){
  4653. var self=this;
  4654. return smalltalk.withContext(function($ctx1) {
  4655. var $1,$2,$3,$4,$5;
  4656. $1="jackie"._charCodeAt_((1));
  4657. $ctx1.sendIdx["charCodeAt:"]=1;
  4658. self._assert_equals_($1,(106));
  4659. $ctx1.sendIdx["assert:equals:"]=1;
  4660. $2="jackie"._charCodeAt_((2));
  4661. $ctx1.sendIdx["charCodeAt:"]=2;
  4662. self._assert_equals_($2,(97));
  4663. $ctx1.sendIdx["assert:equals:"]=2;
  4664. $3="jackie"._charCodeAt_((3));
  4665. $ctx1.sendIdx["charCodeAt:"]=3;
  4666. self._assert_equals_($3,(99));
  4667. $ctx1.sendIdx["assert:equals:"]=3;
  4668. $4="jackie"._charCodeAt_((4));
  4669. $ctx1.sendIdx["charCodeAt:"]=4;
  4670. self._assert_equals_($4,(107));
  4671. $ctx1.sendIdx["assert:equals:"]=4;
  4672. $5="jackie"._charCodeAt_((5));
  4673. $ctx1.sendIdx["charCodeAt:"]=5;
  4674. self._assert_equals_($5,(105));
  4675. $ctx1.sendIdx["assert:equals:"]=5;
  4676. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4677. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4678. args: [],
  4679. 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",
  4680. messageSends: ["assert:equals:", "charCodeAt:"],
  4681. referencedClasses: []
  4682. }),
  4683. globals.StringTest);
  4684. smalltalk.addMethod(
  4685. smalltalk.method({
  4686. selector: "testCopyFromTo",
  4687. protocol: 'tests',
  4688. fn: function (){
  4689. var self=this;
  4690. return smalltalk.withContext(function($ctx1) {
  4691. var $1;
  4692. $1="jackie"._copyFrom_to_((1),(3));
  4693. $ctx1.sendIdx["copyFrom:to:"]=1;
  4694. self._assert_equals_($1,"jac");
  4695. $ctx1.sendIdx["assert:equals:"]=1;
  4696. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4697. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4698. args: [],
  4699. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4700. messageSends: ["assert:equals:", "copyFrom:to:"],
  4701. referencedClasses: []
  4702. }),
  4703. globals.StringTest);
  4704. smalltalk.addMethod(
  4705. smalltalk.method({
  4706. selector: "testCopyWithoutAll",
  4707. protocol: 'tests',
  4708. fn: function (){
  4709. var self=this;
  4710. return smalltalk.withContext(function($ctx1) {
  4711. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4712. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4713. args: [],
  4714. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4715. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4716. referencedClasses: []
  4717. }),
  4718. globals.StringTest);
  4719. smalltalk.addMethod(
  4720. smalltalk.method({
  4721. selector: "testEquality",
  4722. protocol: 'tests',
  4723. fn: function (){
  4724. var self=this;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. var $1,$2,$3;
  4727. self._assert_equals_("hello","hello");
  4728. $ctx1.sendIdx["assert:equals:"]=1;
  4729. $1="hello".__eq("world");
  4730. $ctx1.sendIdx["="]=1;
  4731. self._deny_($1);
  4732. $ctx1.sendIdx["deny:"]=1;
  4733. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4734. })));
  4735. $ctx1.sendIdx["="]=2;
  4736. self._deny_($2);
  4737. $ctx1.sendIdx["deny:"]=2;
  4738. $3="hello"._yourself();
  4739. $ctx1.sendIdx["yourself"]=1;
  4740. self._assert_equals_("hello",$3);
  4741. $ctx1.sendIdx["assert:equals:"]=2;
  4742. self._assert_equals_("hello"._yourself(),"hello");
  4743. self._deny_("".__eq((0)));
  4744. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4745. args: [],
  4746. 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",
  4747. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4748. referencedClasses: []
  4749. }),
  4750. globals.StringTest);
  4751. smalltalk.addMethod(
  4752. smalltalk.method({
  4753. selector: "testIdentity",
  4754. protocol: 'tests',
  4755. fn: function (){
  4756. var self=this;
  4757. return smalltalk.withContext(function($ctx1) {
  4758. var $1,$2,$4,$3,$5;
  4759. $1="hello".__eq_eq("hello");
  4760. $ctx1.sendIdx["=="]=1;
  4761. self._assert_($1);
  4762. $ctx1.sendIdx["assert:"]=1;
  4763. $2="hello".__eq_eq("world");
  4764. $ctx1.sendIdx["=="]=2;
  4765. self._deny_($2);
  4766. $ctx1.sendIdx["deny:"]=1;
  4767. $4="hello"._yourself();
  4768. $ctx1.sendIdx["yourself"]=1;
  4769. $3="hello".__eq_eq($4);
  4770. $ctx1.sendIdx["=="]=3;
  4771. self._assert_($3);
  4772. $ctx1.sendIdx["assert:"]=2;
  4773. $5=_st("hello"._yourself()).__eq_eq("hello");
  4774. $ctx1.sendIdx["=="]=4;
  4775. self._assert_($5);
  4776. self._deny_("".__eq_eq((0)));
  4777. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4778. args: [],
  4779. 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",
  4780. messageSends: ["assert:", "==", "deny:", "yourself"],
  4781. referencedClasses: []
  4782. }),
  4783. globals.StringTest);
  4784. smalltalk.addMethod(
  4785. smalltalk.method({
  4786. selector: "testIdentityHash",
  4787. protocol: 'tests',
  4788. fn: function (){
  4789. var self=this;
  4790. return smalltalk.withContext(function($ctx1) {
  4791. var $1,$2,$4,$3;
  4792. $1="foo"._identityHash();
  4793. $ctx1.sendIdx["identityHash"]=1;
  4794. $2="foo"._identityHash();
  4795. $ctx1.sendIdx["identityHash"]=2;
  4796. self._assert_equals_($1,$2);
  4797. $4="foo"._identityHash();
  4798. $ctx1.sendIdx["identityHash"]=3;
  4799. $3=_st($4).__eq("bar"._identityHash());
  4800. self._deny_($3);
  4801. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4802. args: [],
  4803. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4804. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4805. referencedClasses: []
  4806. }),
  4807. globals.StringTest);
  4808. smalltalk.addMethod(
  4809. smalltalk.method({
  4810. selector: "testIncludesSubString",
  4811. protocol: 'tests',
  4812. fn: function (){
  4813. var self=this;
  4814. return smalltalk.withContext(function($ctx1) {
  4815. var $1;
  4816. $1="amber"._includesSubString_("ber");
  4817. $ctx1.sendIdx["includesSubString:"]=1;
  4818. self._assert_($1);
  4819. self._deny_("amber"._includesSubString_("zork"));
  4820. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4821. args: [],
  4822. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4823. messageSends: ["assert:", "includesSubString:", "deny:"],
  4824. referencedClasses: []
  4825. }),
  4826. globals.StringTest);
  4827. smalltalk.addMethod(
  4828. smalltalk.method({
  4829. selector: "testIndexOfStartingAtWithNull",
  4830. protocol: 'tests',
  4831. fn: function (){
  4832. var self=this;
  4833. return self},
  4834. args: [],
  4835. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4836. messageSends: [],
  4837. referencedClasses: []
  4838. }),
  4839. globals.StringTest);
  4840. smalltalk.addMethod(
  4841. smalltalk.method({
  4842. selector: "testIndexOfWithNull",
  4843. protocol: 'tests',
  4844. fn: function (){
  4845. var self=this;
  4846. return self},
  4847. args: [],
  4848. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4849. messageSends: [],
  4850. referencedClasses: []
  4851. }),
  4852. globals.StringTest);
  4853. smalltalk.addMethod(
  4854. smalltalk.method({
  4855. selector: "testIsVowel",
  4856. protocol: 'tests',
  4857. fn: function (){
  4858. var self=this;
  4859. var vowel,consonant;
  4860. return smalltalk.withContext(function($ctx1) {
  4861. var $1;
  4862. vowel="u";
  4863. consonant="z";
  4864. $1=_st(vowel)._isVowel();
  4865. $ctx1.sendIdx["isVowel"]=1;
  4866. self._assert_equals_($1,true);
  4867. $ctx1.sendIdx["assert:equals:"]=1;
  4868. self._assert_equals_(_st(consonant)._isVowel(),false);
  4869. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4870. args: [],
  4871. 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",
  4872. messageSends: ["assert:equals:", "isVowel"],
  4873. referencedClasses: []
  4874. }),
  4875. globals.StringTest);
  4876. smalltalk.addMethod(
  4877. smalltalk.method({
  4878. selector: "testJoin",
  4879. protocol: 'tests',
  4880. fn: function (){
  4881. var self=this;
  4882. return smalltalk.withContext(function($ctx1) {
  4883. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4884. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4885. args: [],
  4886. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4887. messageSends: ["assert:equals:", "join:"],
  4888. referencedClasses: []
  4889. }),
  4890. globals.StringTest);
  4891. smalltalk.addMethod(
  4892. smalltalk.method({
  4893. selector: "testRemoveAll",
  4894. protocol: 'tests',
  4895. fn: function (){
  4896. var self=this;
  4897. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4898. return smalltalk.withContext(function($ctx1) {
  4899. self._should_raise_((function(){
  4900. return smalltalk.withContext(function($ctx2) {
  4901. return _st(self._collection())._removeAll();
  4902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4903. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4904. args: [],
  4905. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4906. messageSends: ["should:raise:", "removeAll", "collection"],
  4907. referencedClasses: ["Error"]
  4908. }),
  4909. globals.StringTest);
  4910. smalltalk.addMethod(
  4911. smalltalk.method({
  4912. selector: "testReversed",
  4913. protocol: 'tests',
  4914. fn: function (){
  4915. var self=this;
  4916. return smalltalk.withContext(function($ctx1) {
  4917. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4918. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4919. args: [],
  4920. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4921. messageSends: ["assert:equals:", "reversed"],
  4922. referencedClasses: []
  4923. }),
  4924. globals.StringTest);
  4925. smalltalk.addMethod(
  4926. smalltalk.method({
  4927. selector: "testStreamContents",
  4928. protocol: 'tests',
  4929. fn: function (){
  4930. var self=this;
  4931. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4932. return smalltalk.withContext(function($ctx1) {
  4933. var $1;
  4934. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4935. return smalltalk.withContext(function($ctx2) {
  4936. _st(aStream)._nextPutAll_("hello");
  4937. $ctx2.sendIdx["nextPutAll:"]=1;
  4938. _st(aStream)._space();
  4939. $1=_st(aStream)._nextPutAll_("world");
  4940. return $1;
  4941. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4942. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4943. args: [],
  4944. 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'",
  4945. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4946. referencedClasses: ["String"]
  4947. }),
  4948. globals.StringTest);
  4949. smalltalk.addMethod(
  4950. smalltalk.method({
  4951. selector: "testSubStrings",
  4952. protocol: 'tests',
  4953. fn: function (){
  4954. var self=this;
  4955. return smalltalk.withContext(function($ctx1) {
  4956. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4957. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  4958. args: [],
  4959. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4960. messageSends: ["assert:equals:", "subStrings:"],
  4961. referencedClasses: []
  4962. }),
  4963. globals.StringTest);
  4964. smalltalk.addMethod(
  4965. smalltalk.method({
  4966. selector: "testTrim",
  4967. protocol: 'tests',
  4968. fn: function (){
  4969. var self=this;
  4970. return smalltalk.withContext(function($ctx1) {
  4971. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4972. $ctx1.sendIdx["assert:equals:"]=1;
  4973. self._assert_equals_("jackie "._trimRight(),"jackie");
  4974. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  4975. args: [],
  4976. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4977. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4978. referencedClasses: []
  4979. }),
  4980. globals.StringTest);
  4981. smalltalk.addMethod(
  4982. smalltalk.method({
  4983. selector: "collectionClass",
  4984. protocol: 'fixture',
  4985. fn: function (){
  4986. var self=this;
  4987. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4988. return $String();
  4989. },
  4990. args: [],
  4991. source: "collectionClass\x0a\x09^ String",
  4992. messageSends: [],
  4993. referencedClasses: ["String"]
  4994. }),
  4995. globals.StringTest.klass);
  4996. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  4997. smalltalk.addMethod(
  4998. smalltalk.method({
  4999. selector: "collection",
  5000. protocol: 'fixture',
  5001. fn: function (){
  5002. var self=this;
  5003. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5004. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5005. return smalltalk.withContext(function($ctx1) {
  5006. var $2,$3,$1;
  5007. $2=_st($Set())._new();
  5008. _st($2)._add_($Smalltalk());
  5009. $ctx1.sendIdx["add:"]=1;
  5010. _st($2)._add_(nil);
  5011. $ctx1.sendIdx["add:"]=2;
  5012. _st($2)._add_((3).__at((3)));
  5013. $ctx1.sendIdx["add:"]=3;
  5014. _st($2)._add_(false);
  5015. $3=_st($2)._yourself();
  5016. $1=$3;
  5017. return $1;
  5018. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5019. args: [],
  5020. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5021. messageSends: ["add:", "new", "@", "yourself"],
  5022. referencedClasses: ["Set", "Smalltalk"]
  5023. }),
  5024. globals.SetTest);
  5025. smalltalk.addMethod(
  5026. smalltalk.method({
  5027. selector: "collectionOfPrintStrings",
  5028. protocol: 'fixture',
  5029. fn: function (){
  5030. var self=this;
  5031. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5032. return smalltalk.withContext(function($ctx1) {
  5033. var $2,$3,$1;
  5034. $2=_st($Set())._new();
  5035. _st($2)._add_("a SmalltalkImage");
  5036. $ctx1.sendIdx["add:"]=1;
  5037. _st($2)._add_("nil");
  5038. $ctx1.sendIdx["add:"]=2;
  5039. _st($2)._add_("3@3");
  5040. $ctx1.sendIdx["add:"]=3;
  5041. _st($2)._add_("false");
  5042. $3=_st($2)._yourself();
  5043. $1=$3;
  5044. return $1;
  5045. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5046. args: [],
  5047. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5048. messageSends: ["add:", "new", "yourself"],
  5049. referencedClasses: ["Set"]
  5050. }),
  5051. globals.SetTest);
  5052. smalltalk.addMethod(
  5053. smalltalk.method({
  5054. selector: "collectionSize",
  5055. protocol: 'fixture',
  5056. fn: function (){
  5057. var self=this;
  5058. return (4);
  5059. },
  5060. args: [],
  5061. source: "collectionSize\x0a\x09^ 4",
  5062. messageSends: [],
  5063. referencedClasses: []
  5064. }),
  5065. globals.SetTest);
  5066. smalltalk.addMethod(
  5067. smalltalk.method({
  5068. selector: "collectionWithDuplicates",
  5069. protocol: 'fixture',
  5070. fn: function (){
  5071. var self=this;
  5072. return smalltalk.withContext(function($ctx1) {
  5073. var $2,$3,$1;
  5074. $2=self._collection();
  5075. _st($2)._add_((0));
  5076. $3=_st($2)._yourself();
  5077. $1=$3;
  5078. return $1;
  5079. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5080. args: [],
  5081. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5082. messageSends: ["add:", "collection", "yourself"],
  5083. referencedClasses: []
  5084. }),
  5085. globals.SetTest);
  5086. smalltalk.addMethod(
  5087. smalltalk.method({
  5088. selector: "collectionWithNewValue",
  5089. protocol: 'fixture',
  5090. fn: function (){
  5091. var self=this;
  5092. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5093. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5094. return smalltalk.withContext(function($ctx1) {
  5095. var $2,$3,$1;
  5096. $2=_st($Set())._new();
  5097. _st($2)._add_($Smalltalk());
  5098. $ctx1.sendIdx["add:"]=1;
  5099. _st($2)._add_(nil);
  5100. $ctx1.sendIdx["add:"]=2;
  5101. _st($2)._add_((3).__at((3)));
  5102. $ctx1.sendIdx["add:"]=3;
  5103. _st($2)._add_("N");
  5104. $ctx1.sendIdx["add:"]=4;
  5105. _st($2)._add_(false);
  5106. $3=_st($2)._yourself();
  5107. $1=$3;
  5108. return $1;
  5109. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5110. args: [],
  5111. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5112. messageSends: ["add:", "new", "@", "yourself"],
  5113. referencedClasses: ["Set", "Smalltalk"]
  5114. }),
  5115. globals.SetTest);
  5116. smalltalk.addMethod(
  5117. smalltalk.method({
  5118. selector: "testAddAll",
  5119. protocol: 'tests',
  5120. fn: function (){
  5121. var self=this;
  5122. return smalltalk.withContext(function($ctx1) {
  5123. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5124. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5125. $2=self._collection();
  5126. $ctx1.sendIdx["collection"]=1;
  5127. $3=$2;
  5128. $4=self._collection();
  5129. $ctx1.sendIdx["collection"]=2;
  5130. _st($3)._addAll_($4);
  5131. $ctx1.sendIdx["addAll:"]=1;
  5132. $5=_st($2)._yourself();
  5133. $ctx1.sendIdx["yourself"]=1;
  5134. $1=$5;
  5135. $6=self._collection();
  5136. $ctx1.sendIdx["collection"]=3;
  5137. self._assert_equals_($1,$6);
  5138. $ctx1.sendIdx["assert:equals:"]=1;
  5139. $8=self._collection();
  5140. $ctx1.sendIdx["collection"]=4;
  5141. $9=$8;
  5142. $10=self._collectionWithNewValue();
  5143. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5144. _st($9)._addAll_($10);
  5145. $ctx1.sendIdx["addAll:"]=2;
  5146. $11=_st($8)._yourself();
  5147. $ctx1.sendIdx["yourself"]=2;
  5148. $7=$11;
  5149. $12=self._collectionWithNewValue();
  5150. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5151. self._assert_equals_($7,$12);
  5152. $ctx1.sendIdx["assert:equals:"]=2;
  5153. $14=self._collectionWithNewValue();
  5154. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5155. _st($14)._addAll_(self._collection());
  5156. $15=_st($14)._yourself();
  5157. $13=$15;
  5158. self._assert_equals_($13,self._collectionWithNewValue());
  5159. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5160. args: [],
  5161. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  5162. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5163. referencedClasses: []
  5164. }),
  5165. globals.SetTest);
  5166. smalltalk.addMethod(
  5167. smalltalk.method({
  5168. selector: "testAddRemove",
  5169. protocol: 'tests',
  5170. fn: function (){
  5171. var self=this;
  5172. var set;
  5173. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5174. return smalltalk.withContext(function($ctx1) {
  5175. var $1,$2;
  5176. set=_st($Set())._new();
  5177. self._assert_(_st(set)._isEmpty());
  5178. $ctx1.sendIdx["assert:"]=1;
  5179. _st(set)._add_((3));
  5180. $ctx1.sendIdx["add:"]=1;
  5181. $1=_st(set)._includes_((3));
  5182. $ctx1.sendIdx["includes:"]=1;
  5183. self._assert_($1);
  5184. $ctx1.sendIdx["assert:"]=2;
  5185. _st(set)._add_((5));
  5186. $2=_st(set)._includes_((5));
  5187. $ctx1.sendIdx["includes:"]=2;
  5188. self._assert_($2);
  5189. _st(set)._remove_((3));
  5190. self._deny_(_st(set)._includes_((3)));
  5191. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5192. args: [],
  5193. 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)",
  5194. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5195. referencedClasses: ["Set"]
  5196. }),
  5197. globals.SetTest);
  5198. smalltalk.addMethod(
  5199. smalltalk.method({
  5200. selector: "testAt",
  5201. protocol: 'tests',
  5202. fn: function (){
  5203. var self=this;
  5204. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5205. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5206. return smalltalk.withContext(function($ctx1) {
  5207. self._should_raise_((function(){
  5208. return smalltalk.withContext(function($ctx2) {
  5209. return _st(_st($Set())._new())._at_put_((1),(2));
  5210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5211. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5212. args: [],
  5213. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5214. messageSends: ["should:raise:", "at:put:", "new"],
  5215. referencedClasses: ["Set", "Error"]
  5216. }),
  5217. globals.SetTest);
  5218. smalltalk.addMethod(
  5219. smalltalk.method({
  5220. selector: "testCollect",
  5221. protocol: 'tests',
  5222. fn: function (){
  5223. var self=this;
  5224. return smalltalk.withContext(function($ctx1) {
  5225. var $2,$1;
  5226. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5227. $2=[(5), (6), (8)]._asSet();
  5228. $ctx1.sendIdx["asSet"]=1;
  5229. $1=_st($2)._collect_((function(x){
  5230. return smalltalk.withContext(function($ctx2) {
  5231. return _st(x).__backslash_backslash((3));
  5232. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5233. self._assert_equals_($1,[(0), (2)]._asSet());
  5234. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5235. args: [],
  5236. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5237. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5238. referencedClasses: []
  5239. }),
  5240. globals.SetTest);
  5241. smalltalk.addMethod(
  5242. smalltalk.method({
  5243. selector: "testComma",
  5244. protocol: 'tests',
  5245. fn: function (){
  5246. var self=this;
  5247. return smalltalk.withContext(function($ctx1) {
  5248. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5249. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5250. $2=self._collection();
  5251. $ctx1.sendIdx["collection"]=1;
  5252. $3=self._collection();
  5253. $ctx1.sendIdx["collection"]=2;
  5254. $1=_st($2).__comma($3);
  5255. $ctx1.sendIdx[","]=1;
  5256. $4=self._collection();
  5257. $ctx1.sendIdx["collection"]=3;
  5258. self._assert_equals_($1,$4);
  5259. $ctx1.sendIdx["assert:equals:"]=1;
  5260. $6=self._collection();
  5261. $ctx1.sendIdx["collection"]=4;
  5262. $7=self._collectionWithNewValue();
  5263. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5264. $5=_st($6).__comma($7);
  5265. $ctx1.sendIdx[","]=2;
  5266. $8=self._collectionWithNewValue();
  5267. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5268. self._assert_equals_($5,$8);
  5269. $ctx1.sendIdx["assert:equals:"]=2;
  5270. $10=self._collectionWithNewValue();
  5271. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5272. $9=_st($10).__comma(self._collection());
  5273. self._assert_equals_($9,self._collectionWithNewValue());
  5274. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5275. args: [],
  5276. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  5277. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5278. referencedClasses: []
  5279. }),
  5280. globals.SetTest);
  5281. smalltalk.addMethod(
  5282. smalltalk.method({
  5283. selector: "testComparing",
  5284. protocol: 'tests',
  5285. fn: function (){
  5286. var self=this;
  5287. return smalltalk.withContext(function($ctx1) {
  5288. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5289. $1=[(0), (2)]._asSet();
  5290. $ctx1.sendIdx["asSet"]=1;
  5291. $2=[(0), (2)]._asSet();
  5292. $ctx1.sendIdx["asSet"]=2;
  5293. self._assert_equals_($1,$2);
  5294. $ctx1.sendIdx["assert:equals:"]=1;
  5295. $3=[(2), (0)]._asSet();
  5296. $ctx1.sendIdx["asSet"]=3;
  5297. $4=[(0), (2)]._asSet();
  5298. $ctx1.sendIdx["asSet"]=4;
  5299. self._assert_equals_($3,$4);
  5300. $6=[(0), (2), (3)]._asSet();
  5301. $ctx1.sendIdx["asSet"]=5;
  5302. $7=[(0), (2)]._asSet();
  5303. $ctx1.sendIdx["asSet"]=6;
  5304. $5=_st($6).__eq($7);
  5305. $ctx1.sendIdx["="]=1;
  5306. self._deny_($5);
  5307. $ctx1.sendIdx["deny:"]=1;
  5308. $9=[(1), (2)]._asSet();
  5309. $ctx1.sendIdx["asSet"]=7;
  5310. $8=_st($9).__eq([(0), (2)]._asSet());
  5311. self._deny_($8);
  5312. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5313. args: [],
  5314. 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",
  5315. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5316. referencedClasses: []
  5317. }),
  5318. globals.SetTest);
  5319. smalltalk.addMethod(
  5320. smalltalk.method({
  5321. selector: "testPrintString",
  5322. protocol: 'tests',
  5323. fn: function (){
  5324. var self=this;
  5325. var set;
  5326. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5327. return smalltalk.withContext(function($ctx1) {
  5328. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5329. set=_st($Set())._new();
  5330. $1=_st(set)._printString();
  5331. $ctx1.sendIdx["printString"]=1;
  5332. self._assert_equals_($1,"a Set ()");
  5333. $ctx1.sendIdx["assert:equals:"]=1;
  5334. $2=set;
  5335. _st($2)._add_((1));
  5336. $ctx1.sendIdx["add:"]=1;
  5337. $3=_st($2)._add_((3));
  5338. $ctx1.sendIdx["add:"]=2;
  5339. $4=_st(set)._printString();
  5340. $ctx1.sendIdx["printString"]=2;
  5341. self._assert_equals_($4,"a Set (1 3)");
  5342. $ctx1.sendIdx["assert:equals:"]=2;
  5343. _st(set)._add_("foo");
  5344. $ctx1.sendIdx["add:"]=3;
  5345. $5=_st(set)._printString();
  5346. $ctx1.sendIdx["printString"]=3;
  5347. self._assert_equals_($5,"a Set (1 3 'foo')");
  5348. $ctx1.sendIdx["assert:equals:"]=3;
  5349. $6=set;
  5350. _st($6)._remove_((1));
  5351. $ctx1.sendIdx["remove:"]=1;
  5352. $7=_st($6)._remove_((3));
  5353. $8=_st(set)._printString();
  5354. $ctx1.sendIdx["printString"]=4;
  5355. self._assert_equals_($8,"a Set ('foo')");
  5356. $ctx1.sendIdx["assert:equals:"]=4;
  5357. _st(set)._add_((3));
  5358. $ctx1.sendIdx["add:"]=4;
  5359. $9=_st(set)._printString();
  5360. $ctx1.sendIdx["printString"]=5;
  5361. self._assert_equals_($9,"a Set (3 'foo')");
  5362. $ctx1.sendIdx["assert:equals:"]=5;
  5363. _st(set)._add_((3));
  5364. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5365. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5366. args: [],
  5367. 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 (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5368. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5369. referencedClasses: ["Set"]
  5370. }),
  5371. globals.SetTest);
  5372. smalltalk.addMethod(
  5373. smalltalk.method({
  5374. selector: "testUnboxedObjects",
  5375. protocol: 'tests',
  5376. fn: function (){
  5377. var self=this;
  5378. return smalltalk.withContext(function($ctx1) {
  5379. var $4,$3,$2,$1;
  5380. $4="foo"._yourself();
  5381. $ctx1.sendIdx["yourself"]=1;
  5382. $3=[$4,"foo"._yourself()];
  5383. $2=_st($3)._asSet();
  5384. $1=_st($2)._asArray();
  5385. self._assert_equals_($1,["foo"]);
  5386. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5387. args: [],
  5388. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5389. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5390. referencedClasses: []
  5391. }),
  5392. globals.SetTest);
  5393. smalltalk.addMethod(
  5394. smalltalk.method({
  5395. selector: "testUnicity",
  5396. protocol: 'tests',
  5397. fn: function (){
  5398. var self=this;
  5399. var set;
  5400. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5401. return smalltalk.withContext(function($ctx1) {
  5402. var $1;
  5403. set=_st($Set())._new();
  5404. _st(set)._add_((21));
  5405. $ctx1.sendIdx["add:"]=1;
  5406. _st(set)._add_("hello");
  5407. $ctx1.sendIdx["add:"]=2;
  5408. _st(set)._add_((21));
  5409. $ctx1.sendIdx["add:"]=3;
  5410. $1=_st(set)._size();
  5411. $ctx1.sendIdx["size"]=1;
  5412. self._assert_equals_($1,(2));
  5413. $ctx1.sendIdx["assert:equals:"]=1;
  5414. _st(set)._add_("hello");
  5415. self._assert_equals_(_st(set)._size(),(2));
  5416. $ctx1.sendIdx["assert:equals:"]=2;
  5417. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5418. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5419. args: [],
  5420. 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')",
  5421. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5422. referencedClasses: ["Set"]
  5423. }),
  5424. globals.SetTest);
  5425. smalltalk.addMethod(
  5426. smalltalk.method({
  5427. selector: "collectionClass",
  5428. protocol: 'fixture',
  5429. fn: function (){
  5430. var self=this;
  5431. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5432. return $Set();
  5433. },
  5434. args: [],
  5435. source: "collectionClass\x0a\x09^ Set",
  5436. messageSends: [],
  5437. referencedClasses: ["Set"]
  5438. }),
  5439. globals.SetTest.klass);
  5440. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5441. smalltalk.addMethod(
  5442. smalltalk.method({
  5443. selector: "testShow",
  5444. protocol: 'tests',
  5445. fn: function (){
  5446. var self=this;
  5447. var originalTranscript;
  5448. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5449. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5450. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5451. return smalltalk.withContext(function($ctx1) {
  5452. originalTranscript=_st($Transcript())._current();
  5453. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5454. $ctx1.sendIdx["register:"]=1;
  5455. self._shouldnt_raise_((function(){
  5456. return smalltalk.withContext(function($ctx2) {
  5457. return _st($Transcript())._show_("Hello console!");
  5458. $ctx2.sendIdx["show:"]=1;
  5459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5460. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5461. self._shouldnt_raise_((function(){
  5462. return smalltalk.withContext(function($ctx2) {
  5463. return _st($Transcript())._show_(console);
  5464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5465. _st($Transcript())._register_(originalTranscript);
  5466. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5467. args: [],
  5468. 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.",
  5469. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5470. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5471. }),
  5472. globals.ConsoleTranscriptTest);
  5473. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5474. smalltalk.addMethod(
  5475. smalltalk.method({
  5476. selector: "jsObject",
  5477. protocol: 'accessing',
  5478. fn: function (){
  5479. var self=this;
  5480. return smalltalk.withContext(function($ctx1) {
  5481. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5482. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5483. args: [],
  5484. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5485. messageSends: [],
  5486. referencedClasses: []
  5487. }),
  5488. globals.JSObjectProxyTest);
  5489. smalltalk.addMethod(
  5490. smalltalk.method({
  5491. selector: "testAtIfAbsent",
  5492. protocol: 'tests',
  5493. fn: function (){
  5494. var self=this;
  5495. var testObject;
  5496. return smalltalk.withContext(function($ctx1) {
  5497. var $1,$2,$3;
  5498. testObject=self._jsObject();
  5499. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5500. return "Property does not exist";
  5501. }));
  5502. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5503. self._assert_equals_($1,"Property does not exist");
  5504. $ctx1.sendIdx["assert:equals:"]=1;
  5505. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5506. return "Property does not exist";
  5507. }));
  5508. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5509. self._assert_equals_($2,nil);
  5510. $ctx1.sendIdx["assert:equals:"]=2;
  5511. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5512. return "Property does not exist";
  5513. }));
  5514. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5515. self._assert_equals_($3,(1));
  5516. $ctx1.sendIdx["assert:equals:"]=3;
  5517. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5518. return "Property does not exist";
  5519. })),nil);
  5520. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5521. args: [],
  5522. 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.",
  5523. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5524. referencedClasses: []
  5525. }),
  5526. globals.JSObjectProxyTest);
  5527. smalltalk.addMethod(
  5528. smalltalk.method({
  5529. selector: "testAtIfPresent",
  5530. protocol: 'tests',
  5531. fn: function (){
  5532. var self=this;
  5533. var testObject;
  5534. return smalltalk.withContext(function($ctx1) {
  5535. var $2,$1,$4,$3,$6,$5;
  5536. testObject=self._jsObject();
  5537. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5538. return smalltalk.withContext(function($ctx2) {
  5539. $2=_st(x)._asString();
  5540. $ctx2.sendIdx["asString"]=1;
  5541. return "hello ".__comma($2);
  5542. $ctx2.sendIdx[","]=1;
  5543. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5544. $ctx1.sendIdx["at:ifPresent:"]=1;
  5545. self._assert_equals_($1,nil);
  5546. $ctx1.sendIdx["assert:equals:"]=1;
  5547. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5548. return smalltalk.withContext(function($ctx2) {
  5549. $4=_st(x)._asString();
  5550. $ctx2.sendIdx["asString"]=2;
  5551. return "hello ".__comma($4);
  5552. $ctx2.sendIdx[","]=2;
  5553. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5554. $ctx1.sendIdx["at:ifPresent:"]=2;
  5555. self._assert_equals_($3,"hello nil");
  5556. $ctx1.sendIdx["assert:equals:"]=2;
  5557. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5558. return smalltalk.withContext(function($ctx2) {
  5559. $6=_st(x)._asString();
  5560. $ctx2.sendIdx["asString"]=3;
  5561. return "hello ".__comma($6);
  5562. $ctx2.sendIdx[","]=3;
  5563. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5564. $ctx1.sendIdx["at:ifPresent:"]=3;
  5565. self._assert_equals_($5,"hello 1");
  5566. $ctx1.sendIdx["assert:equals:"]=3;
  5567. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5568. return smalltalk.withContext(function($ctx2) {
  5569. return "hello ".__comma(_st(x)._asString());
  5570. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5571. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5572. args: [],
  5573. 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'.",
  5574. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5575. referencedClasses: []
  5576. }),
  5577. globals.JSObjectProxyTest);
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "testAtIfPresentIfAbsent",
  5581. protocol: 'tests',
  5582. fn: function (){
  5583. var self=this;
  5584. var testObject;
  5585. return smalltalk.withContext(function($ctx1) {
  5586. var $2,$1,$4,$3,$6,$5;
  5587. testObject=self._jsObject();
  5588. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5589. return smalltalk.withContext(function($ctx2) {
  5590. $2=_st(x)._asString();
  5591. $ctx2.sendIdx["asString"]=1;
  5592. return "hello ".__comma($2);
  5593. $ctx2.sendIdx[","]=1;
  5594. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5595. return "not present";
  5596. }));
  5597. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5598. self._assert_equals_($1,"not present");
  5599. $ctx1.sendIdx["assert:equals:"]=1;
  5600. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5601. return smalltalk.withContext(function($ctx2) {
  5602. $4=_st(x)._asString();
  5603. $ctx2.sendIdx["asString"]=2;
  5604. return "hello ".__comma($4);
  5605. $ctx2.sendIdx[","]=2;
  5606. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5607. return "not present";
  5608. }));
  5609. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5610. self._assert_equals_($3,"hello nil");
  5611. $ctx1.sendIdx["assert:equals:"]=2;
  5612. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5613. return smalltalk.withContext(function($ctx2) {
  5614. $6=_st(x)._asString();
  5615. $ctx2.sendIdx["asString"]=3;
  5616. return "hello ".__comma($6);
  5617. $ctx2.sendIdx[","]=3;
  5618. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5619. return "not present";
  5620. }));
  5621. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5622. self._assert_equals_($5,"hello 1");
  5623. $ctx1.sendIdx["assert:equals:"]=3;
  5624. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5625. return smalltalk.withContext(function($ctx2) {
  5626. return "hello ".__comma(_st(x)._asString());
  5627. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5628. return "not present";
  5629. })),"hello nil");
  5630. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5631. args: [],
  5632. 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'.",
  5633. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5634. referencedClasses: []
  5635. }),
  5636. globals.JSObjectProxyTest);
  5637. smalltalk.addMethod(
  5638. smalltalk.method({
  5639. selector: "testAtPut",
  5640. protocol: 'tests',
  5641. fn: function (){
  5642. var self=this;
  5643. var testObject;
  5644. return smalltalk.withContext(function($ctx1) {
  5645. var $2,$1;
  5646. testObject=self._jsObject();
  5647. $2=_st(testObject)._at_("abc");
  5648. $ctx1.sendIdx["at:"]=1;
  5649. $1=_st($2).__tild_eq("xyz");
  5650. self._assert_($1);
  5651. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5652. $ctx1.sendIdx["assert:equals:"]=1;
  5653. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5654. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5655. args: [],
  5656. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  5657. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5658. referencedClasses: []
  5659. }),
  5660. globals.JSObjectProxyTest);
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "testComparison",
  5664. protocol: 'tests',
  5665. fn: function (){
  5666. var self=this;
  5667. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5668. return smalltalk.withContext(function($ctx1) {
  5669. var $1,$2;
  5670. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5671. $1=_st(console).__eq(console);
  5672. $ctx1.sendIdx["="]=1;
  5673. self._assert_($1);
  5674. $2=_st(console).__eq(_st($Object())._new());
  5675. $ctx1.sendIdx["="]=2;
  5676. self._deny_($2);
  5677. $ctx1.sendIdx["deny:"]=1;
  5678. self._deny_(_st(console).__eq(self._jsObject()));
  5679. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5680. args: [],
  5681. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5682. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5683. referencedClasses: ["Object"]
  5684. }),
  5685. globals.JSObjectProxyTest);
  5686. smalltalk.addMethod(
  5687. smalltalk.method({
  5688. selector: "testDNU",
  5689. protocol: 'tests',
  5690. fn: function (){
  5691. var self=this;
  5692. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5693. return smalltalk.withContext(function($ctx1) {
  5694. self._should_raise_((function(){
  5695. return smalltalk.withContext(function($ctx2) {
  5696. return _st(self._jsObject())._foo();
  5697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5698. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5699. args: [],
  5700. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5701. messageSends: ["should:raise:", "foo", "jsObject"],
  5702. referencedClasses: ["MessageNotUnderstood"]
  5703. }),
  5704. globals.JSObjectProxyTest);
  5705. smalltalk.addMethod(
  5706. smalltalk.method({
  5707. selector: "testMessageSend",
  5708. protocol: 'tests',
  5709. fn: function (){
  5710. var self=this;
  5711. return smalltalk.withContext(function($ctx1) {
  5712. var $2,$1,$4,$3;
  5713. $2=self._jsObject();
  5714. $ctx1.sendIdx["jsObject"]=1;
  5715. $1=_st($2)._a();
  5716. self._assert_equals_($1,(1));
  5717. $ctx1.sendIdx["assert:equals:"]=1;
  5718. $4=self._jsObject();
  5719. $ctx1.sendIdx["jsObject"]=2;
  5720. $3=_st($4)._b();
  5721. self._assert_equals_($3,(2));
  5722. $ctx1.sendIdx["assert:equals:"]=2;
  5723. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5724. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5725. args: [],
  5726. 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",
  5727. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5728. referencedClasses: []
  5729. }),
  5730. globals.JSObjectProxyTest);
  5731. smalltalk.addMethod(
  5732. smalltalk.method({
  5733. selector: "testMethodWithArguments",
  5734. protocol: 'tests',
  5735. fn: function (){
  5736. var self=this;
  5737. return smalltalk.withContext(function($ctx1) {
  5738. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5739. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5740. args: [],
  5741. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5742. messageSends: ["assert:equals:", "c:", "jsObject"],
  5743. referencedClasses: []
  5744. }),
  5745. globals.JSObjectProxyTest);
  5746. smalltalk.addMethod(
  5747. smalltalk.method({
  5748. selector: "testPrinting",
  5749. protocol: 'tests',
  5750. fn: function (){
  5751. var self=this;
  5752. return smalltalk.withContext(function($ctx1) {
  5753. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5754. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5755. args: [],
  5756. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5757. messageSends: ["assert:equals:", "printString", "jsObject"],
  5758. referencedClasses: []
  5759. }),
  5760. globals.JSObjectProxyTest);
  5761. smalltalk.addMethod(
  5762. smalltalk.method({
  5763. selector: "testPropertyThatReturnsEmptyString",
  5764. protocol: 'tests',
  5765. fn: function (){
  5766. var self=this;
  5767. var object;
  5768. return smalltalk.withContext(function($ctx1) {
  5769. var $1;
  5770. object=self._jsObject();
  5771. $1=_st(object)._d();
  5772. $ctx1.sendIdx["d"]=1;
  5773. self._assert_equals_($1,"");
  5774. $ctx1.sendIdx["assert:equals:"]=1;
  5775. _st(object)._d_("hello");
  5776. self._assert_equals_(_st(object)._d(),"hello");
  5777. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5778. args: [],
  5779. 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'",
  5780. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5781. referencedClasses: []
  5782. }),
  5783. globals.JSObjectProxyTest);
  5784. smalltalk.addMethod(
  5785. smalltalk.method({
  5786. selector: "testPropertyThatReturnsUndefined",
  5787. protocol: 'tests',
  5788. fn: function (){
  5789. var self=this;
  5790. var object;
  5791. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5792. return smalltalk.withContext(function($ctx1) {
  5793. object=self._jsObject();
  5794. self._shouldnt_raise_((function(){
  5795. return smalltalk.withContext(function($ctx2) {
  5796. return _st(object)._e();
  5797. $ctx2.sendIdx["e"]=1;
  5798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5799. self._assert_(_st(_st(object)._e())._isNil());
  5800. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5801. args: [],
  5802. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5803. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5804. referencedClasses: ["MessageNotUnderstood"]
  5805. }),
  5806. globals.JSObjectProxyTest);
  5807. smalltalk.addMethod(
  5808. smalltalk.method({
  5809. selector: "testValue",
  5810. protocol: 'tests',
  5811. fn: function (){
  5812. var self=this;
  5813. var testObject;
  5814. return smalltalk.withContext(function($ctx1) {
  5815. testObject=self._jsObject();
  5816. _st(testObject)._at_put_("value","aValue");
  5817. self._assert_equals_(_st(testObject)._value(),"aValue");
  5818. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5819. args: [],
  5820. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5821. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5822. referencedClasses: []
  5823. }),
  5824. globals.JSObjectProxyTest);
  5825. smalltalk.addMethod(
  5826. smalltalk.method({
  5827. selector: "testYourself",
  5828. protocol: 'tests',
  5829. fn: function (){
  5830. var self=this;
  5831. var object;
  5832. return smalltalk.withContext(function($ctx1) {
  5833. var $1,$2;
  5834. $1=self._jsObject();
  5835. _st($1)._d_("test");
  5836. $2=_st($1)._yourself();
  5837. object=$2;
  5838. self._assert_equals_(_st(object)._d(),"test");
  5839. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5840. args: [],
  5841. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5842. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5843. referencedClasses: []
  5844. }),
  5845. globals.JSObjectProxyTest);
  5846. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5847. smalltalk.addMethod(
  5848. smalltalk.method({
  5849. selector: "testCatchingException",
  5850. protocol: 'tests',
  5851. fn: function (){
  5852. var self=this;
  5853. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5854. return smalltalk.withContext(function($ctx1) {
  5855. _st((function(){
  5856. return smalltalk.withContext(function($ctx2) {
  5857. return self._throwException();
  5858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5859. return smalltalk.withContext(function($ctx2) {
  5860. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5861. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5862. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5863. args: [],
  5864. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5865. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5866. referencedClasses: ["Error"]
  5867. }),
  5868. globals.JavaScriptExceptionTest);
  5869. smalltalk.addMethod(
  5870. smalltalk.method({
  5871. selector: "testRaisingException",
  5872. protocol: 'tests',
  5873. fn: function (){
  5874. var self=this;
  5875. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5876. return smalltalk.withContext(function($ctx1) {
  5877. self._should_raise_((function(){
  5878. return smalltalk.withContext(function($ctx2) {
  5879. return self._throwException();
  5880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5881. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5882. args: [],
  5883. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5884. messageSends: ["should:raise:", "throwException"],
  5885. referencedClasses: ["JavaScriptException"]
  5886. }),
  5887. globals.JavaScriptExceptionTest);
  5888. smalltalk.addMethod(
  5889. smalltalk.method({
  5890. selector: "throwException",
  5891. protocol: 'helpers',
  5892. fn: function (){
  5893. var self=this;
  5894. return smalltalk.withContext(function($ctx1) {
  5895. throw 'test';
  5896. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5897. args: [],
  5898. source: "throwException\x0a\x09<throw 'test'>",
  5899. messageSends: [],
  5900. referencedClasses: []
  5901. }),
  5902. globals.JavaScriptExceptionTest);
  5903. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5904. smalltalk.addMethod(
  5905. smalltalk.method({
  5906. selector: "testValue",
  5907. protocol: 'tests',
  5908. fn: function (){
  5909. var self=this;
  5910. var messageSend;
  5911. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5912. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5913. return smalltalk.withContext(function($ctx1) {
  5914. var $1,$2;
  5915. $1=_st($MessageSend())._new();
  5916. $ctx1.sendIdx["new"]=1;
  5917. _st($1)._receiver_(_st($Object())._new());
  5918. _st($1)._selector_("asString");
  5919. $2=_st($1)._yourself();
  5920. messageSend=$2;
  5921. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5922. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5923. args: [],
  5924. 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'",
  5925. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5926. referencedClasses: ["MessageSend", "Object"]
  5927. }),
  5928. globals.MessageSendTest);
  5929. smalltalk.addMethod(
  5930. smalltalk.method({
  5931. selector: "testValueWithArguments",
  5932. protocol: 'tests',
  5933. fn: function (){
  5934. var self=this;
  5935. var messageSend;
  5936. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5937. return smalltalk.withContext(function($ctx1) {
  5938. var $1,$2;
  5939. $1=_st($MessageSend())._new();
  5940. _st($1)._receiver_((2));
  5941. _st($1)._selector_("+");
  5942. $2=_st($1)._yourself();
  5943. messageSend=$2;
  5944. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5945. $ctx1.sendIdx["assert:equals:"]=1;
  5946. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5947. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  5948. args: [],
  5949. 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",
  5950. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5951. referencedClasses: ["MessageSend"]
  5952. }),
  5953. globals.MessageSendTest);
  5954. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5955. smalltalk.addMethod(
  5956. smalltalk.method({
  5957. selector: "codeGeneratorClass",
  5958. protocol: 'accessing',
  5959. fn: function (){
  5960. var self=this;
  5961. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5962. return $CodeGenerator();
  5963. },
  5964. args: [],
  5965. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5966. messageSends: [],
  5967. referencedClasses: ["CodeGenerator"]
  5968. }),
  5969. globals.MethodInheritanceTest);
  5970. smalltalk.addMethod(
  5971. smalltalk.method({
  5972. selector: "compiler",
  5973. protocol: 'factory',
  5974. fn: function (){
  5975. var self=this;
  5976. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5977. return smalltalk.withContext(function($ctx1) {
  5978. var $2,$3,$1;
  5979. $2=_st($Compiler())._new();
  5980. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5981. $3=_st($2)._yourself();
  5982. $1=$3;
  5983. return $1;
  5984. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  5985. args: [],
  5986. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5987. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5988. referencedClasses: ["Compiler"]
  5989. }),
  5990. globals.MethodInheritanceTest);
  5991. smalltalk.addMethod(
  5992. smalltalk.method({
  5993. selector: "deinstallBottom",
  5994. protocol: 'testing',
  5995. fn: function (){
  5996. var self=this;
  5997. return smalltalk.withContext(function($ctx1) {
  5998. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5999. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6000. args: [],
  6001. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6002. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6003. referencedClasses: []
  6004. }),
  6005. globals.MethodInheritanceTest);
  6006. smalltalk.addMethod(
  6007. smalltalk.method({
  6008. selector: "deinstallMiddle",
  6009. protocol: 'testing',
  6010. fn: function (){
  6011. var self=this;
  6012. return smalltalk.withContext(function($ctx1) {
  6013. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6014. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6015. args: [],
  6016. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6017. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6018. referencedClasses: []
  6019. }),
  6020. globals.MethodInheritanceTest);
  6021. smalltalk.addMethod(
  6022. smalltalk.method({
  6023. selector: "deinstallTop",
  6024. protocol: 'testing',
  6025. fn: function (){
  6026. var self=this;
  6027. return smalltalk.withContext(function($ctx1) {
  6028. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6029. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6030. args: [],
  6031. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6032. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6033. referencedClasses: []
  6034. }),
  6035. globals.MethodInheritanceTest);
  6036. smalltalk.addMethod(
  6037. smalltalk.method({
  6038. selector: "installBottom:",
  6039. protocol: 'testing',
  6040. fn: function (aString){
  6041. var self=this;
  6042. return smalltalk.withContext(function($ctx1) {
  6043. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6044. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6045. args: ["aString"],
  6046. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6047. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6048. referencedClasses: []
  6049. }),
  6050. globals.MethodInheritanceTest);
  6051. smalltalk.addMethod(
  6052. smalltalk.method({
  6053. selector: "installMiddle:",
  6054. protocol: 'testing',
  6055. fn: function (aString){
  6056. var self=this;
  6057. return smalltalk.withContext(function($ctx1) {
  6058. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6059. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6060. args: ["aString"],
  6061. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6062. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6063. referencedClasses: []
  6064. }),
  6065. globals.MethodInheritanceTest);
  6066. smalltalk.addMethod(
  6067. smalltalk.method({
  6068. selector: "installTop:",
  6069. protocol: 'testing',
  6070. fn: function (aString){
  6071. var self=this;
  6072. return smalltalk.withContext(function($ctx1) {
  6073. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6074. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6075. args: ["aString"],
  6076. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6077. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6078. referencedClasses: []
  6079. }),
  6080. globals.MethodInheritanceTest);
  6081. smalltalk.addMethod(
  6082. smalltalk.method({
  6083. selector: "setUp",
  6084. protocol: 'initialization',
  6085. fn: function (){
  6086. var self=this;
  6087. return smalltalk.withContext(function($ctx1) {
  6088. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6089. $ctx1.sendIdx["new"]=1;
  6090. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6091. $ctx1.sendIdx["new"]=2;
  6092. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6093. self["@method"]=nil;
  6094. self["@performBlock"]=(function(){
  6095. return smalltalk.withContext(function($ctx2) {
  6096. return self._error_("performBlock not initialized");
  6097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6098. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6099. args: [],
  6100. 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' ]",
  6101. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6102. referencedClasses: []
  6103. }),
  6104. globals.MethodInheritanceTest);
  6105. smalltalk.addMethod(
  6106. smalltalk.method({
  6107. selector: "shouldMNU",
  6108. protocol: 'testing',
  6109. fn: function (){
  6110. var self=this;
  6111. return smalltalk.withContext(function($ctx1) {
  6112. self._shouldMNUTop();
  6113. self._shouldMNUMiddle();
  6114. self._shouldMNUBottom();
  6115. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6116. args: [],
  6117. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6118. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6119. referencedClasses: []
  6120. }),
  6121. globals.MethodInheritanceTest);
  6122. smalltalk.addMethod(
  6123. smalltalk.method({
  6124. selector: "shouldMNUBottom",
  6125. protocol: 'testing',
  6126. fn: function (){
  6127. var self=this;
  6128. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6129. return smalltalk.withContext(function($ctx1) {
  6130. self._should_raise_((function(){
  6131. return smalltalk.withContext(function($ctx2) {
  6132. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6134. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6135. args: [],
  6136. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6137. messageSends: ["should:raise:", "value:"],
  6138. referencedClasses: ["MessageNotUnderstood"]
  6139. }),
  6140. globals.MethodInheritanceTest);
  6141. smalltalk.addMethod(
  6142. smalltalk.method({
  6143. selector: "shouldMNUMiddle",
  6144. protocol: 'testing',
  6145. fn: function (){
  6146. var self=this;
  6147. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6148. return smalltalk.withContext(function($ctx1) {
  6149. self._should_raise_((function(){
  6150. return smalltalk.withContext(function($ctx2) {
  6151. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6153. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6154. args: [],
  6155. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6156. messageSends: ["should:raise:", "value:"],
  6157. referencedClasses: ["MessageNotUnderstood"]
  6158. }),
  6159. globals.MethodInheritanceTest);
  6160. smalltalk.addMethod(
  6161. smalltalk.method({
  6162. selector: "shouldMNUTop",
  6163. protocol: 'testing',
  6164. fn: function (){
  6165. var self=this;
  6166. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6167. return smalltalk.withContext(function($ctx1) {
  6168. self._should_raise_((function(){
  6169. return smalltalk.withContext(function($ctx2) {
  6170. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6172. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6173. args: [],
  6174. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6175. messageSends: ["should:raise:", "value:"],
  6176. referencedClasses: ["MessageNotUnderstood"]
  6177. }),
  6178. globals.MethodInheritanceTest);
  6179. smalltalk.addMethod(
  6180. smalltalk.method({
  6181. selector: "shouldReturn:",
  6182. protocol: 'testing',
  6183. fn: function (anObject){
  6184. var self=this;
  6185. var result;
  6186. return smalltalk.withContext(function($ctx1) {
  6187. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6188. $ctx1.sendIdx["value:"]=1;
  6189. self._assert_equals_(["top",anObject],["top",result]);
  6190. $ctx1.sendIdx["assert:equals:"]=1;
  6191. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6192. $ctx1.sendIdx["value:"]=2;
  6193. self._assert_equals_(["middle",anObject],["middle",result]);
  6194. $ctx1.sendIdx["assert:equals:"]=2;
  6195. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6196. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6197. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6198. args: ["anObject"],
  6199. 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 }",
  6200. messageSends: ["value:", "assert:equals:"],
  6201. referencedClasses: []
  6202. }),
  6203. globals.MethodInheritanceTest);
  6204. smalltalk.addMethod(
  6205. smalltalk.method({
  6206. selector: "shouldReturn:and:and:",
  6207. protocol: 'testing',
  6208. fn: function (anObject,anObject2,anObject3){
  6209. var self=this;
  6210. var result;
  6211. return smalltalk.withContext(function($ctx1) {
  6212. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6213. $ctx1.sendIdx["value:"]=1;
  6214. self._assert_equals_(["top",anObject],["top",result]);
  6215. $ctx1.sendIdx["assert:equals:"]=1;
  6216. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6217. $ctx1.sendIdx["value:"]=2;
  6218. self._assert_equals_(["middle",anObject2],["middle",result]);
  6219. $ctx1.sendIdx["assert:equals:"]=2;
  6220. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6221. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6222. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6223. args: ["anObject", "anObject2", "anObject3"],
  6224. 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 }",
  6225. messageSends: ["value:", "assert:equals:"],
  6226. referencedClasses: []
  6227. }),
  6228. globals.MethodInheritanceTest);
  6229. smalltalk.addMethod(
  6230. smalltalk.method({
  6231. selector: "targetClassBottom",
  6232. protocol: 'accessing',
  6233. fn: function (){
  6234. var self=this;
  6235. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6236. return $JavaScriptException();
  6237. },
  6238. args: [],
  6239. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6240. messageSends: [],
  6241. referencedClasses: ["JavaScriptException"]
  6242. }),
  6243. globals.MethodInheritanceTest);
  6244. smalltalk.addMethod(
  6245. smalltalk.method({
  6246. selector: "targetClassMiddle",
  6247. protocol: 'accessing',
  6248. fn: function (){
  6249. var self=this;
  6250. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6251. return $Error();
  6252. },
  6253. args: [],
  6254. source: "targetClassMiddle\x0a\x09^ Error",
  6255. messageSends: [],
  6256. referencedClasses: ["Error"]
  6257. }),
  6258. globals.MethodInheritanceTest);
  6259. smalltalk.addMethod(
  6260. smalltalk.method({
  6261. selector: "targetClassTop",
  6262. protocol: 'accessing',
  6263. fn: function (){
  6264. var self=this;
  6265. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6266. return $Object();
  6267. },
  6268. args: [],
  6269. source: "targetClassTop\x0a\x09^ Object",
  6270. messageSends: [],
  6271. referencedClasses: ["Object"]
  6272. }),
  6273. globals.MethodInheritanceTest);
  6274. smalltalk.addMethod(
  6275. smalltalk.method({
  6276. selector: "tearDown",
  6277. protocol: 'initialization',
  6278. fn: function (){
  6279. var self=this;
  6280. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6281. return smalltalk.withContext(function($ctx1) {
  6282. _st((function(){
  6283. return smalltalk.withContext(function($ctx2) {
  6284. return self._deinstallTop();
  6285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6286. }));
  6287. $ctx1.sendIdx["on:do:"]=1;
  6288. _st((function(){
  6289. return smalltalk.withContext(function($ctx2) {
  6290. return self._deinstallMiddle();
  6291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6292. }));
  6293. $ctx1.sendIdx["on:do:"]=2;
  6294. _st((function(){
  6295. return smalltalk.withContext(function($ctx2) {
  6296. return self._deinstallBottom();
  6297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6298. }));
  6299. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6300. args: [],
  6301. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6302. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6303. referencedClasses: ["Error"]
  6304. }),
  6305. globals.MethodInheritanceTest);
  6306. smalltalk.addMethod(
  6307. smalltalk.method({
  6308. selector: "testMNU11",
  6309. protocol: 'tests',
  6310. fn: function (){
  6311. var self=this;
  6312. return smalltalk.withContext(function($ctx1) {
  6313. self["@performBlock"]=(function(x){
  6314. return smalltalk.withContext(function($ctx2) {
  6315. return _st(x)._foo();
  6316. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6317. self._shouldMNU();
  6318. $ctx1.sendIdx["shouldMNU"]=1;
  6319. self._installTop_("foo ^ false");
  6320. $ctx1.sendIdx["installTop:"]=1;
  6321. self._installTop_("foo ^ true");
  6322. self._deinstallTop();
  6323. self._shouldMNU();
  6324. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6325. args: [],
  6326. 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",
  6327. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6328. referencedClasses: []
  6329. }),
  6330. globals.MethodInheritanceTest);
  6331. smalltalk.addMethod(
  6332. smalltalk.method({
  6333. selector: "testMNU22",
  6334. protocol: 'tests',
  6335. fn: function (){
  6336. var self=this;
  6337. return smalltalk.withContext(function($ctx1) {
  6338. self["@performBlock"]=(function(x){
  6339. return smalltalk.withContext(function($ctx2) {
  6340. return _st(x)._foo();
  6341. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6342. self._shouldMNU();
  6343. $ctx1.sendIdx["shouldMNU"]=1;
  6344. self._installMiddle_("foo ^ false");
  6345. $ctx1.sendIdx["installMiddle:"]=1;
  6346. self._installMiddle_("foo ^ true");
  6347. self._deinstallMiddle();
  6348. self._shouldMNU();
  6349. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6350. args: [],
  6351. 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",
  6352. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6353. referencedClasses: []
  6354. }),
  6355. globals.MethodInheritanceTest);
  6356. smalltalk.addMethod(
  6357. smalltalk.method({
  6358. selector: "testReturns1",
  6359. protocol: 'tests',
  6360. fn: function (){
  6361. var self=this;
  6362. return smalltalk.withContext(function($ctx1) {
  6363. self["@performBlock"]=(function(x){
  6364. return smalltalk.withContext(function($ctx2) {
  6365. return _st(x)._foo();
  6366. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6367. self._installTop_("foo ^ false");
  6368. $ctx1.sendIdx["installTop:"]=1;
  6369. self._shouldReturn_(false);
  6370. $ctx1.sendIdx["shouldReturn:"]=1;
  6371. self._installTop_("foo ^ true");
  6372. self._shouldReturn_(true);
  6373. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6374. args: [],
  6375. 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",
  6376. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6377. referencedClasses: []
  6378. }),
  6379. globals.MethodInheritanceTest);
  6380. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6381. smalltalk.addMethod(
  6382. smalltalk.method({
  6383. selector: "testAbs",
  6384. protocol: 'tests',
  6385. fn: function (){
  6386. var self=this;
  6387. return smalltalk.withContext(function($ctx1) {
  6388. var $1;
  6389. $1=(4)._abs();
  6390. $ctx1.sendIdx["abs"]=1;
  6391. self._assert_equals_($1,(4));
  6392. $ctx1.sendIdx["assert:equals:"]=1;
  6393. self._assert_equals_((-4)._abs(),(4));
  6394. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6395. args: [],
  6396. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6397. messageSends: ["assert:equals:", "abs"],
  6398. referencedClasses: []
  6399. }),
  6400. globals.NumberTest);
  6401. smalltalk.addMethod(
  6402. smalltalk.method({
  6403. selector: "testArithmetic",
  6404. protocol: 'tests',
  6405. fn: function (){
  6406. var self=this;
  6407. return smalltalk.withContext(function($ctx1) {
  6408. var $1,$2,$3,$5,$4;
  6409. $1=(1.5).__plus((1));
  6410. $ctx1.sendIdx["+"]=1;
  6411. self._assert_equals_($1,(2.5));
  6412. $ctx1.sendIdx["assert:equals:"]=1;
  6413. $2=(2).__minus((1));
  6414. $ctx1.sendIdx["-"]=1;
  6415. self._assert_equals_($2,(1));
  6416. $ctx1.sendIdx["assert:equals:"]=2;
  6417. self._assert_equals_((-2).__minus((1)),(-3));
  6418. $ctx1.sendIdx["assert:equals:"]=3;
  6419. self._assert_equals_((12).__slash((2)),(6));
  6420. $ctx1.sendIdx["assert:equals:"]=4;
  6421. $3=(3).__star((4));
  6422. $ctx1.sendIdx["*"]=1;
  6423. self._assert_equals_($3,(12));
  6424. $ctx1.sendIdx["assert:equals:"]=5;
  6425. self._assert_equals_((7).__slash_slash((2)),(3));
  6426. $ctx1.sendIdx["assert:equals:"]=6;
  6427. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6428. $ctx1.sendIdx["assert:equals:"]=7;
  6429. $5=(1).__plus((2));
  6430. $ctx1.sendIdx["+"]=2;
  6431. $4=_st($5).__star((3));
  6432. $ctx1.sendIdx["*"]=2;
  6433. self._assert_equals_($4,(9));
  6434. $ctx1.sendIdx["assert:equals:"]=8;
  6435. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6436. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6437. args: [],
  6438. 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",
  6439. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6440. referencedClasses: []
  6441. }),
  6442. globals.NumberTest);
  6443. smalltalk.addMethod(
  6444. smalltalk.method({
  6445. selector: "testAsNumber",
  6446. protocol: 'tests',
  6447. fn: function (){
  6448. var self=this;
  6449. return smalltalk.withContext(function($ctx1) {
  6450. self._assert_equals_((3)._asNumber(),(3));
  6451. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6452. args: [],
  6453. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6454. messageSends: ["assert:equals:", "asNumber"],
  6455. referencedClasses: []
  6456. }),
  6457. globals.NumberTest);
  6458. smalltalk.addMethod(
  6459. smalltalk.method({
  6460. selector: "testCeiling",
  6461. protocol: 'tests',
  6462. fn: function (){
  6463. var self=this;
  6464. return smalltalk.withContext(function($ctx1) {
  6465. var $1,$2;
  6466. $1=(1.2)._ceiling();
  6467. $ctx1.sendIdx["ceiling"]=1;
  6468. self._assert_equals_($1,(2));
  6469. $ctx1.sendIdx["assert:equals:"]=1;
  6470. $2=(-1.2)._ceiling();
  6471. $ctx1.sendIdx["ceiling"]=2;
  6472. self._assert_equals_($2,(-1));
  6473. $ctx1.sendIdx["assert:equals:"]=2;
  6474. self._assert_equals_((1)._ceiling(),(1));
  6475. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6476. args: [],
  6477. 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.",
  6478. messageSends: ["assert:equals:", "ceiling"],
  6479. referencedClasses: []
  6480. }),
  6481. globals.NumberTest);
  6482. smalltalk.addMethod(
  6483. smalltalk.method({
  6484. selector: "testComparison",
  6485. protocol: 'tests',
  6486. fn: function (){
  6487. var self=this;
  6488. return smalltalk.withContext(function($ctx1) {
  6489. var $1,$2,$3,$4;
  6490. $1=(3).__gt((2));
  6491. $ctx1.sendIdx[">"]=1;
  6492. self._assert_($1);
  6493. $ctx1.sendIdx["assert:"]=1;
  6494. $2=(2).__lt((3));
  6495. $ctx1.sendIdx["<"]=1;
  6496. self._assert_($2);
  6497. $ctx1.sendIdx["assert:"]=2;
  6498. self._deny_((3).__lt((2)));
  6499. $ctx1.sendIdx["deny:"]=1;
  6500. self._deny_((2).__gt((3)));
  6501. $3=(3).__gt_eq((3));
  6502. $ctx1.sendIdx[">="]=1;
  6503. self._assert_($3);
  6504. $ctx1.sendIdx["assert:"]=3;
  6505. self._assert_((3.1).__gt_eq((3)));
  6506. $ctx1.sendIdx["assert:"]=4;
  6507. $4=(3).__lt_eq((3));
  6508. $ctx1.sendIdx["<="]=1;
  6509. self._assert_($4);
  6510. $ctx1.sendIdx["assert:"]=5;
  6511. self._assert_((3).__lt_eq((3.1)));
  6512. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6513. args: [],
  6514. 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",
  6515. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6516. referencedClasses: []
  6517. }),
  6518. globals.NumberTest);
  6519. smalltalk.addMethod(
  6520. smalltalk.method({
  6521. selector: "testCopying",
  6522. protocol: 'tests',
  6523. fn: function (){
  6524. var self=this;
  6525. return smalltalk.withContext(function($ctx1) {
  6526. var $1;
  6527. $1=_st((1)._copy()).__eq_eq((1));
  6528. $ctx1.sendIdx["=="]=1;
  6529. self._assert_($1);
  6530. $ctx1.sendIdx["assert:"]=1;
  6531. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6532. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6533. args: [],
  6534. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6535. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6536. referencedClasses: []
  6537. }),
  6538. globals.NumberTest);
  6539. smalltalk.addMethod(
  6540. smalltalk.method({
  6541. selector: "testEquality",
  6542. protocol: 'tests',
  6543. fn: function (){
  6544. var self=this;
  6545. return smalltalk.withContext(function($ctx1) {
  6546. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6547. $1=(1).__eq((1));
  6548. $ctx1.sendIdx["="]=1;
  6549. self._assert_($1);
  6550. $ctx1.sendIdx["assert:"]=1;
  6551. $2=(0).__eq((0));
  6552. $ctx1.sendIdx["="]=2;
  6553. self._assert_($2);
  6554. $ctx1.sendIdx["assert:"]=2;
  6555. $3=(1).__eq((0));
  6556. $ctx1.sendIdx["="]=3;
  6557. self._deny_($3);
  6558. $ctx1.sendIdx["deny:"]=1;
  6559. $5=(1)._yourself();
  6560. $ctx1.sendIdx["yourself"]=1;
  6561. $4=_st($5).__eq((1));
  6562. $ctx1.sendIdx["="]=4;
  6563. self._assert_($4);
  6564. $ctx1.sendIdx["assert:"]=3;
  6565. $7=(1)._yourself();
  6566. $ctx1.sendIdx["yourself"]=2;
  6567. $6=(1).__eq($7);
  6568. $ctx1.sendIdx["="]=5;
  6569. self._assert_($6);
  6570. $ctx1.sendIdx["assert:"]=4;
  6571. $9=(1)._yourself();
  6572. $ctx1.sendIdx["yourself"]=3;
  6573. $8=_st($9).__eq((1)._yourself());
  6574. $ctx1.sendIdx["="]=6;
  6575. self._assert_($8);
  6576. $10=(0).__eq(false);
  6577. $ctx1.sendIdx["="]=7;
  6578. self._deny_($10);
  6579. $ctx1.sendIdx["deny:"]=2;
  6580. $11=false.__eq((0));
  6581. $ctx1.sendIdx["="]=8;
  6582. self._deny_($11);
  6583. $ctx1.sendIdx["deny:"]=3;
  6584. $12="".__eq((0));
  6585. $ctx1.sendIdx["="]=9;
  6586. self._deny_($12);
  6587. $ctx1.sendIdx["deny:"]=4;
  6588. self._deny_((0).__eq(""));
  6589. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6590. args: [],
  6591. 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 = ''",
  6592. messageSends: ["assert:", "=", "deny:", "yourself"],
  6593. referencedClasses: []
  6594. }),
  6595. globals.NumberTest);
  6596. smalltalk.addMethod(
  6597. smalltalk.method({
  6598. selector: "testFloor",
  6599. protocol: 'tests',
  6600. fn: function (){
  6601. var self=this;
  6602. return smalltalk.withContext(function($ctx1) {
  6603. var $1,$2;
  6604. $1=(1.2)._floor();
  6605. $ctx1.sendIdx["floor"]=1;
  6606. self._assert_equals_($1,(1));
  6607. $ctx1.sendIdx["assert:equals:"]=1;
  6608. $2=(-1.2)._floor();
  6609. $ctx1.sendIdx["floor"]=2;
  6610. self._assert_equals_($2,(-2));
  6611. $ctx1.sendIdx["assert:equals:"]=2;
  6612. self._assert_equals_((1)._floor(),(1));
  6613. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6614. args: [],
  6615. 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.",
  6616. messageSends: ["assert:equals:", "floor"],
  6617. referencedClasses: []
  6618. }),
  6619. globals.NumberTest);
  6620. smalltalk.addMethod(
  6621. smalltalk.method({
  6622. selector: "testHexNumbers",
  6623. protocol: 'tests',
  6624. fn: function (){
  6625. var self=this;
  6626. return smalltalk.withContext(function($ctx1) {
  6627. var $1,$2,$3,$4,$5;
  6628. self._assert_equals_((9),(9));
  6629. $ctx1.sendIdx["assert:equals:"]=1;
  6630. $1=(10)._truncated();
  6631. $ctx1.sendIdx["truncated"]=1;
  6632. self._assert_equals_($1,(10));
  6633. $ctx1.sendIdx["assert:equals:"]=2;
  6634. $2=(11)._truncated();
  6635. $ctx1.sendIdx["truncated"]=2;
  6636. self._assert_equals_($2,(11));
  6637. $ctx1.sendIdx["assert:equals:"]=3;
  6638. $3=(12)._truncated();
  6639. $ctx1.sendIdx["truncated"]=3;
  6640. self._assert_equals_($3,(12));
  6641. $ctx1.sendIdx["assert:equals:"]=4;
  6642. $4=(13)._truncated();
  6643. $ctx1.sendIdx["truncated"]=4;
  6644. self._assert_equals_($4,(13));
  6645. $ctx1.sendIdx["assert:equals:"]=5;
  6646. $5=(14)._truncated();
  6647. $ctx1.sendIdx["truncated"]=5;
  6648. self._assert_equals_($5,(14));
  6649. $ctx1.sendIdx["assert:equals:"]=6;
  6650. self._assert_equals_((15)._truncated(),(15));
  6651. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6652. args: [],
  6653. 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",
  6654. messageSends: ["assert:equals:", "truncated"],
  6655. referencedClasses: []
  6656. }),
  6657. globals.NumberTest);
  6658. smalltalk.addMethod(
  6659. smalltalk.method({
  6660. selector: "testIdentity",
  6661. protocol: 'tests',
  6662. fn: function (){
  6663. var self=this;
  6664. return smalltalk.withContext(function($ctx1) {
  6665. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6666. $1=(1).__eq_eq((1));
  6667. $ctx1.sendIdx["=="]=1;
  6668. self._assert_($1);
  6669. $ctx1.sendIdx["assert:"]=1;
  6670. $2=(0).__eq_eq((0));
  6671. $ctx1.sendIdx["=="]=2;
  6672. self._assert_($2);
  6673. $ctx1.sendIdx["assert:"]=2;
  6674. $3=(1).__eq_eq((0));
  6675. $ctx1.sendIdx["=="]=3;
  6676. self._deny_($3);
  6677. $ctx1.sendIdx["deny:"]=1;
  6678. $5=(1)._yourself();
  6679. $ctx1.sendIdx["yourself"]=1;
  6680. $4=_st($5).__eq_eq((1));
  6681. $ctx1.sendIdx["=="]=4;
  6682. self._assert_($4);
  6683. $ctx1.sendIdx["assert:"]=3;
  6684. $7=(1)._yourself();
  6685. $ctx1.sendIdx["yourself"]=2;
  6686. $6=(1).__eq_eq($7);
  6687. $ctx1.sendIdx["=="]=5;
  6688. self._assert_($6);
  6689. $ctx1.sendIdx["assert:"]=4;
  6690. $9=(1)._yourself();
  6691. $ctx1.sendIdx["yourself"]=3;
  6692. $8=_st($9).__eq_eq((1)._yourself());
  6693. $ctx1.sendIdx["=="]=6;
  6694. self._assert_($8);
  6695. self._deny_((1).__eq_eq((2)));
  6696. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6697. args: [],
  6698. 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",
  6699. messageSends: ["assert:", "==", "deny:", "yourself"],
  6700. referencedClasses: []
  6701. }),
  6702. globals.NumberTest);
  6703. smalltalk.addMethod(
  6704. smalltalk.method({
  6705. selector: "testInvalidHexNumbers",
  6706. protocol: 'tests',
  6707. fn: function (){
  6708. var self=this;
  6709. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6710. return smalltalk.withContext(function($ctx1) {
  6711. self._should_raise_((function(){
  6712. return smalltalk.withContext(function($ctx2) {
  6713. return (16)._rG();
  6714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6715. $ctx1.sendIdx["should:raise:"]=1;
  6716. self._should_raise_((function(){
  6717. return smalltalk.withContext(function($ctx2) {
  6718. return (16)._rg();
  6719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6720. $ctx1.sendIdx["should:raise:"]=2;
  6721. self._should_raise_((function(){
  6722. return smalltalk.withContext(function($ctx2) {
  6723. return (16)._rH();
  6724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6725. $ctx1.sendIdx["should:raise:"]=3;
  6726. self._should_raise_((function(){
  6727. return smalltalk.withContext(function($ctx2) {
  6728. return (16)._rh();
  6729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6730. $ctx1.sendIdx["should:raise:"]=4;
  6731. self._should_raise_((function(){
  6732. return smalltalk.withContext(function($ctx2) {
  6733. return (16)._rI();
  6734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6735. $ctx1.sendIdx["should:raise:"]=5;
  6736. self._should_raise_((function(){
  6737. return smalltalk.withContext(function($ctx2) {
  6738. return (16)._ri();
  6739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6740. $ctx1.sendIdx["should:raise:"]=6;
  6741. self._should_raise_((function(){
  6742. return smalltalk.withContext(function($ctx2) {
  6743. return (16)._rJ();
  6744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6745. $ctx1.sendIdx["should:raise:"]=7;
  6746. self._should_raise_((function(){
  6747. return smalltalk.withContext(function($ctx2) {
  6748. return (16)._rj();
  6749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6750. $ctx1.sendIdx["should:raise:"]=8;
  6751. self._should_raise_((function(){
  6752. return smalltalk.withContext(function($ctx2) {
  6753. return (16)._rK();
  6754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6755. $ctx1.sendIdx["should:raise:"]=9;
  6756. self._should_raise_((function(){
  6757. return smalltalk.withContext(function($ctx2) {
  6758. return (16)._rk();
  6759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6760. $ctx1.sendIdx["should:raise:"]=10;
  6761. self._should_raise_((function(){
  6762. return smalltalk.withContext(function($ctx2) {
  6763. return (16)._rL();
  6764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6765. $ctx1.sendIdx["should:raise:"]=11;
  6766. self._should_raise_((function(){
  6767. return smalltalk.withContext(function($ctx2) {
  6768. return (16)._rl();
  6769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6770. $ctx1.sendIdx["should:raise:"]=12;
  6771. self._should_raise_((function(){
  6772. return smalltalk.withContext(function($ctx2) {
  6773. return (16)._rM();
  6774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6775. $ctx1.sendIdx["should:raise:"]=13;
  6776. self._should_raise_((function(){
  6777. return smalltalk.withContext(function($ctx2) {
  6778. return (16)._rm();
  6779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6780. $ctx1.sendIdx["should:raise:"]=14;
  6781. self._should_raise_((function(){
  6782. return smalltalk.withContext(function($ctx2) {
  6783. return (16)._rN();
  6784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6785. $ctx1.sendIdx["should:raise:"]=15;
  6786. self._should_raise_((function(){
  6787. return smalltalk.withContext(function($ctx2) {
  6788. return (16)._rn();
  6789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6790. $ctx1.sendIdx["should:raise:"]=16;
  6791. self._should_raise_((function(){
  6792. return smalltalk.withContext(function($ctx2) {
  6793. return (16)._rO();
  6794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6795. $ctx1.sendIdx["should:raise:"]=17;
  6796. self._should_raise_((function(){
  6797. return smalltalk.withContext(function($ctx2) {
  6798. return (16)._ro();
  6799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6800. $ctx1.sendIdx["should:raise:"]=18;
  6801. self._should_raise_((function(){
  6802. return smalltalk.withContext(function($ctx2) {
  6803. return (16)._rP();
  6804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6805. $ctx1.sendIdx["should:raise:"]=19;
  6806. self._should_raise_((function(){
  6807. return smalltalk.withContext(function($ctx2) {
  6808. return (16)._rp();
  6809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6810. $ctx1.sendIdx["should:raise:"]=20;
  6811. self._should_raise_((function(){
  6812. return smalltalk.withContext(function($ctx2) {
  6813. return (16)._rQ();
  6814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6815. $ctx1.sendIdx["should:raise:"]=21;
  6816. self._should_raise_((function(){
  6817. return smalltalk.withContext(function($ctx2) {
  6818. return (16)._rq();
  6819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6820. $ctx1.sendIdx["should:raise:"]=22;
  6821. self._should_raise_((function(){
  6822. return smalltalk.withContext(function($ctx2) {
  6823. return (16)._rR();
  6824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6825. $ctx1.sendIdx["should:raise:"]=23;
  6826. self._should_raise_((function(){
  6827. return smalltalk.withContext(function($ctx2) {
  6828. return (16)._rr();
  6829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6830. $ctx1.sendIdx["should:raise:"]=24;
  6831. self._should_raise_((function(){
  6832. return smalltalk.withContext(function($ctx2) {
  6833. return (16)._rS();
  6834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6835. $ctx1.sendIdx["should:raise:"]=25;
  6836. self._should_raise_((function(){
  6837. return smalltalk.withContext(function($ctx2) {
  6838. return (16)._rs();
  6839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6840. $ctx1.sendIdx["should:raise:"]=26;
  6841. self._should_raise_((function(){
  6842. return smalltalk.withContext(function($ctx2) {
  6843. return (16)._rT();
  6844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6845. $ctx1.sendIdx["should:raise:"]=27;
  6846. self._should_raise_((function(){
  6847. return smalltalk.withContext(function($ctx2) {
  6848. return (16)._rt();
  6849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6850. $ctx1.sendIdx["should:raise:"]=28;
  6851. self._should_raise_((function(){
  6852. return smalltalk.withContext(function($ctx2) {
  6853. return (16)._rU();
  6854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6855. $ctx1.sendIdx["should:raise:"]=29;
  6856. self._should_raise_((function(){
  6857. return smalltalk.withContext(function($ctx2) {
  6858. return (16)._ru();
  6859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6860. $ctx1.sendIdx["should:raise:"]=30;
  6861. self._should_raise_((function(){
  6862. return smalltalk.withContext(function($ctx2) {
  6863. return (16)._rV();
  6864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6865. $ctx1.sendIdx["should:raise:"]=31;
  6866. self._should_raise_((function(){
  6867. return smalltalk.withContext(function($ctx2) {
  6868. return (16)._rv();
  6869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6870. $ctx1.sendIdx["should:raise:"]=32;
  6871. self._should_raise_((function(){
  6872. return smalltalk.withContext(function($ctx2) {
  6873. return (16)._rW();
  6874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6875. $ctx1.sendIdx["should:raise:"]=33;
  6876. self._should_raise_((function(){
  6877. return smalltalk.withContext(function($ctx2) {
  6878. return (16)._rw();
  6879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6880. $ctx1.sendIdx["should:raise:"]=34;
  6881. self._should_raise_((function(){
  6882. return smalltalk.withContext(function($ctx2) {
  6883. return (16)._rX();
  6884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6885. $ctx1.sendIdx["should:raise:"]=35;
  6886. self._should_raise_((function(){
  6887. return smalltalk.withContext(function($ctx2) {
  6888. return (16)._rx();
  6889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6890. $ctx1.sendIdx["should:raise:"]=36;
  6891. self._should_raise_((function(){
  6892. return smalltalk.withContext(function($ctx2) {
  6893. return (16)._rY();
  6894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6895. $ctx1.sendIdx["should:raise:"]=37;
  6896. self._should_raise_((function(){
  6897. return smalltalk.withContext(function($ctx2) {
  6898. return (16)._ry();
  6899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6900. $ctx1.sendIdx["should:raise:"]=38;
  6901. self._should_raise_((function(){
  6902. return smalltalk.withContext(function($ctx2) {
  6903. return (16)._rZ();
  6904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6905. $ctx1.sendIdx["should:raise:"]=39;
  6906. self._should_raise_((function(){
  6907. return smalltalk.withContext(function($ctx2) {
  6908. return (16)._rz();
  6909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6910. $ctx1.sendIdx["should:raise:"]=40;
  6911. self._should_raise_((function(){
  6912. return smalltalk.withContext(function($ctx2) {
  6913. return (11259375)._Z();
  6914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6915. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6916. args: [],
  6917. 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.",
  6918. 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"],
  6919. referencedClasses: ["MessageNotUnderstood"]
  6920. }),
  6921. globals.NumberTest);
  6922. smalltalk.addMethod(
  6923. smalltalk.method({
  6924. selector: "testLog",
  6925. protocol: 'tests',
  6926. fn: function (){
  6927. var self=this;
  6928. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  6929. return smalltalk.withContext(function($ctx1) {
  6930. self._assert_equals_((10000)._log(),(4));
  6931. $ctx1.sendIdx["assert:equals:"]=1;
  6932. self._assert_equals_((512)._log_((2)),(9));
  6933. $ctx1.sendIdx["assert:equals:"]=2;
  6934. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6935. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  6936. args: [],
  6937. 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.",
  6938. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6939. referencedClasses: ["Number"]
  6940. }),
  6941. globals.NumberTest);
  6942. smalltalk.addMethod(
  6943. smalltalk.method({
  6944. selector: "testMinMax",
  6945. protocol: 'tests',
  6946. fn: function (){
  6947. var self=this;
  6948. return smalltalk.withContext(function($ctx1) {
  6949. self._assert_equals_((2)._max_((5)),(5));
  6950. $ctx1.sendIdx["assert:equals:"]=1;
  6951. self._assert_equals_((2)._min_((5)),(2));
  6952. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  6953. args: [],
  6954. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6955. messageSends: ["assert:equals:", "max:", "min:"],
  6956. referencedClasses: []
  6957. }),
  6958. globals.NumberTest);
  6959. smalltalk.addMethod(
  6960. smalltalk.method({
  6961. selector: "testNegated",
  6962. protocol: 'tests',
  6963. fn: function (){
  6964. var self=this;
  6965. return smalltalk.withContext(function($ctx1) {
  6966. var $1;
  6967. $1=(3)._negated();
  6968. $ctx1.sendIdx["negated"]=1;
  6969. self._assert_equals_($1,(-3));
  6970. $ctx1.sendIdx["assert:equals:"]=1;
  6971. self._assert_equals_((-3)._negated(),(3));
  6972. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  6973. args: [],
  6974. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6975. messageSends: ["assert:equals:", "negated"],
  6976. referencedClasses: []
  6977. }),
  6978. globals.NumberTest);
  6979. smalltalk.addMethod(
  6980. smalltalk.method({
  6981. selector: "testPrintShowingDecimalPlaces",
  6982. protocol: 'tests',
  6983. fn: function (){
  6984. var self=this;
  6985. return smalltalk.withContext(function($ctx1) {
  6986. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6987. $1=(23)._printShowingDecimalPlaces_((2));
  6988. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6989. self._assert_equals_($1,"23.00");
  6990. $ctx1.sendIdx["assert:equals:"]=1;
  6991. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6992. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6993. self._assert_equals_($2,"23.57");
  6994. $ctx1.sendIdx["assert:equals:"]=2;
  6995. $4=(234.567)._negated();
  6996. $ctx1.sendIdx["negated"]=1;
  6997. $3=_st($4)._printShowingDecimalPlaces_((5));
  6998. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6999. self._assert_equals_($3,"-234.56700");
  7000. $ctx1.sendIdx["assert:equals:"]=3;
  7001. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7002. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7003. self._assert_equals_($5,"23");
  7004. $ctx1.sendIdx["assert:equals:"]=4;
  7005. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7006. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7007. self._assert_equals_($6,"24");
  7008. $ctx1.sendIdx["assert:equals:"]=5;
  7009. $8=(23.4567)._negated();
  7010. $ctx1.sendIdx["negated"]=2;
  7011. $7=_st($8)._printShowingDecimalPlaces_((0));
  7012. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7013. self._assert_equals_($7,"-23");
  7014. $ctx1.sendIdx["assert:equals:"]=6;
  7015. $10=(23.5567)._negated();
  7016. $ctx1.sendIdx["negated"]=3;
  7017. $9=_st($10)._printShowingDecimalPlaces_((0));
  7018. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7019. self._assert_equals_($9,"-24");
  7020. $ctx1.sendIdx["assert:equals:"]=7;
  7021. $11=(100000000)._printShowingDecimalPlaces_((1));
  7022. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7023. self._assert_equals_($11,"100000000.0");
  7024. $ctx1.sendIdx["assert:equals:"]=8;
  7025. $12=(0.98)._printShowingDecimalPlaces_((5));
  7026. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7027. self._assert_equals_($12,"0.98000");
  7028. $ctx1.sendIdx["assert:equals:"]=9;
  7029. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7030. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7031. self._assert_equals_($13,"-0.98");
  7032. $ctx1.sendIdx["assert:equals:"]=10;
  7033. $14=(2.567)._printShowingDecimalPlaces_((2));
  7034. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7035. self._assert_equals_($14,"2.57");
  7036. $ctx1.sendIdx["assert:equals:"]=11;
  7037. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7038. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7039. self._assert_equals_($15,"-2.57");
  7040. $ctx1.sendIdx["assert:equals:"]=12;
  7041. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7042. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7043. args: [],
  7044. 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'.",
  7045. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7046. referencedClasses: []
  7047. }),
  7048. globals.NumberTest);
  7049. smalltalk.addMethod(
  7050. smalltalk.method({
  7051. selector: "testRaisedTo",
  7052. protocol: 'tests',
  7053. fn: function (){
  7054. var self=this;
  7055. return smalltalk.withContext(function($ctx1) {
  7056. var $1,$2,$3;
  7057. $1=(2)._raisedTo_((4));
  7058. $ctx1.sendIdx["raisedTo:"]=1;
  7059. self._assert_equals_($1,(16));
  7060. $ctx1.sendIdx["assert:equals:"]=1;
  7061. $2=(2)._raisedTo_((0));
  7062. $ctx1.sendIdx["raisedTo:"]=2;
  7063. self._assert_equals_($2,(1));
  7064. $ctx1.sendIdx["assert:equals:"]=2;
  7065. $3=(2)._raisedTo_((-3));
  7066. $ctx1.sendIdx["raisedTo:"]=3;
  7067. self._assert_equals_($3,(0.125));
  7068. $ctx1.sendIdx["assert:equals:"]=3;
  7069. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7070. $ctx1.sendIdx["assert:equals:"]=4;
  7071. self._assert_equals_((2).__star_star((4)),(16));
  7072. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7073. args: [],
  7074. 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.",
  7075. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7076. referencedClasses: []
  7077. }),
  7078. globals.NumberTest);
  7079. smalltalk.addMethod(
  7080. smalltalk.method({
  7081. selector: "testRounded",
  7082. protocol: 'tests',
  7083. fn: function (){
  7084. var self=this;
  7085. return smalltalk.withContext(function($ctx1) {
  7086. var $1,$2;
  7087. $1=(3)._rounded();
  7088. $ctx1.sendIdx["rounded"]=1;
  7089. self._assert_equals_($1,(3));
  7090. $ctx1.sendIdx["assert:equals:"]=1;
  7091. $2=(3.212)._rounded();
  7092. $ctx1.sendIdx["rounded"]=2;
  7093. self._assert_equals_($2,(3));
  7094. $ctx1.sendIdx["assert:equals:"]=2;
  7095. self._assert_equals_((3.51)._rounded(),(4));
  7096. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7097. args: [],
  7098. 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",
  7099. messageSends: ["assert:equals:", "rounded"],
  7100. referencedClasses: []
  7101. }),
  7102. globals.NumberTest);
  7103. smalltalk.addMethod(
  7104. smalltalk.method({
  7105. selector: "testSign",
  7106. protocol: 'tests',
  7107. fn: function (){
  7108. var self=this;
  7109. return smalltalk.withContext(function($ctx1) {
  7110. var $1,$2;
  7111. $1=(5)._sign();
  7112. $ctx1.sendIdx["sign"]=1;
  7113. self._assert_equals_($1,(1));
  7114. $ctx1.sendIdx["assert:equals:"]=1;
  7115. $2=(0)._sign();
  7116. $ctx1.sendIdx["sign"]=2;
  7117. self._assert_equals_($2,(0));
  7118. $ctx1.sendIdx["assert:equals:"]=2;
  7119. self._assert_equals_((-1.4)._sign(),(-1));
  7120. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7121. args: [],
  7122. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7123. messageSends: ["assert:equals:", "sign"],
  7124. referencedClasses: []
  7125. }),
  7126. globals.NumberTest);
  7127. smalltalk.addMethod(
  7128. smalltalk.method({
  7129. selector: "testSqrt",
  7130. protocol: 'tests',
  7131. fn: function (){
  7132. var self=this;
  7133. return smalltalk.withContext(function($ctx1) {
  7134. var $1;
  7135. $1=(4)._sqrt();
  7136. $ctx1.sendIdx["sqrt"]=1;
  7137. self._assert_equals_($1,(2));
  7138. $ctx1.sendIdx["assert:equals:"]=1;
  7139. self._assert_equals_((16)._sqrt(),(4));
  7140. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7141. args: [],
  7142. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7143. messageSends: ["assert:equals:", "sqrt"],
  7144. referencedClasses: []
  7145. }),
  7146. globals.NumberTest);
  7147. smalltalk.addMethod(
  7148. smalltalk.method({
  7149. selector: "testSquared",
  7150. protocol: 'tests',
  7151. fn: function (){
  7152. var self=this;
  7153. return smalltalk.withContext(function($ctx1) {
  7154. self._assert_equals_((4)._squared(),(16));
  7155. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7156. args: [],
  7157. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7158. messageSends: ["assert:equals:", "squared"],
  7159. referencedClasses: []
  7160. }),
  7161. globals.NumberTest);
  7162. smalltalk.addMethod(
  7163. smalltalk.method({
  7164. selector: "testTimesRepeat",
  7165. protocol: 'tests',
  7166. fn: function (){
  7167. var self=this;
  7168. var i;
  7169. return smalltalk.withContext(function($ctx1) {
  7170. i=(0);
  7171. (0)._timesRepeat_((function(){
  7172. return smalltalk.withContext(function($ctx2) {
  7173. i=_st(i).__plus((1));
  7174. $ctx2.sendIdx["+"]=1;
  7175. return i;
  7176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7177. $ctx1.sendIdx["timesRepeat:"]=1;
  7178. self._assert_equals_(i,(0));
  7179. $ctx1.sendIdx["assert:equals:"]=1;
  7180. (5)._timesRepeat_((function(){
  7181. return smalltalk.withContext(function($ctx2) {
  7182. i=_st(i).__plus((1));
  7183. return i;
  7184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7185. self._assert_equals_(i,(5));
  7186. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7187. args: [],
  7188. 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",
  7189. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7190. referencedClasses: []
  7191. }),
  7192. globals.NumberTest);
  7193. smalltalk.addMethod(
  7194. smalltalk.method({
  7195. selector: "testTo",
  7196. protocol: 'tests',
  7197. fn: function (){
  7198. var self=this;
  7199. return smalltalk.withContext(function($ctx1) {
  7200. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7201. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7202. args: [],
  7203. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7204. messageSends: ["assert:equals:", "to:"],
  7205. referencedClasses: []
  7206. }),
  7207. globals.NumberTest);
  7208. smalltalk.addMethod(
  7209. smalltalk.method({
  7210. selector: "testToBy",
  7211. protocol: 'tests',
  7212. fn: function (){
  7213. var self=this;
  7214. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7215. return smalltalk.withContext(function($ctx1) {
  7216. var $1;
  7217. $1=(0)._to_by_((6),(2));
  7218. $ctx1.sendIdx["to:by:"]=1;
  7219. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7220. self._should_raise_((function(){
  7221. return smalltalk.withContext(function($ctx2) {
  7222. return (1)._to_by_((4),(0));
  7223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7224. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7225. args: [],
  7226. 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",
  7227. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7228. referencedClasses: ["Error"]
  7229. }),
  7230. globals.NumberTest);
  7231. smalltalk.addMethod(
  7232. smalltalk.method({
  7233. selector: "testTrigonometry",
  7234. protocol: 'tests',
  7235. fn: function (){
  7236. var self=this;
  7237. return smalltalk.withContext(function($ctx1) {
  7238. self._assert_equals_((0)._cos(),(1));
  7239. $ctx1.sendIdx["assert:equals:"]=1;
  7240. self._assert_equals_((0)._sin(),(0));
  7241. $ctx1.sendIdx["assert:equals:"]=2;
  7242. self._assert_equals_((0)._tan(),(0));
  7243. $ctx1.sendIdx["assert:equals:"]=3;
  7244. self._assert_equals_((1)._arcCos(),(0));
  7245. $ctx1.sendIdx["assert:equals:"]=4;
  7246. self._assert_equals_((0)._arcSin(),(0));
  7247. $ctx1.sendIdx["assert:equals:"]=5;
  7248. self._assert_equals_((0)._arcTan(),(0));
  7249. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7250. args: [],
  7251. 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.",
  7252. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7253. referencedClasses: []
  7254. }),
  7255. globals.NumberTest);
  7256. smalltalk.addMethod(
  7257. smalltalk.method({
  7258. selector: "testTruncated",
  7259. protocol: 'tests',
  7260. fn: function (){
  7261. var self=this;
  7262. return smalltalk.withContext(function($ctx1) {
  7263. var $1,$2;
  7264. $1=(3)._truncated();
  7265. $ctx1.sendIdx["truncated"]=1;
  7266. self._assert_equals_($1,(3));
  7267. $ctx1.sendIdx["assert:equals:"]=1;
  7268. $2=(3.212)._truncated();
  7269. $ctx1.sendIdx["truncated"]=2;
  7270. self._assert_equals_($2,(3));
  7271. $ctx1.sendIdx["assert:equals:"]=2;
  7272. self._assert_equals_((3.51)._truncated(),(3));
  7273. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7274. args: [],
  7275. 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",
  7276. messageSends: ["assert:equals:", "truncated"],
  7277. referencedClasses: []
  7278. }),
  7279. globals.NumberTest);
  7280. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7281. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7282. smalltalk.addMethod(
  7283. smalltalk.method({
  7284. selector: "foo",
  7285. protocol: 'not yet classified',
  7286. fn: function (){
  7287. var self=this;
  7288. var $1;
  7289. $1=self["@foo"];
  7290. return $1;
  7291. },
  7292. args: [],
  7293. source: "foo\x0a\x09^ foo",
  7294. messageSends: [],
  7295. referencedClasses: []
  7296. }),
  7297. globals.ObjectMock);
  7298. smalltalk.addMethod(
  7299. smalltalk.method({
  7300. selector: "foo:",
  7301. protocol: 'not yet classified',
  7302. fn: function (anObject){
  7303. var self=this;
  7304. self["@foo"]=anObject;
  7305. return self},
  7306. args: ["anObject"],
  7307. source: "foo: anObject\x0a\x09foo := anObject",
  7308. messageSends: [],
  7309. referencedClasses: []
  7310. }),
  7311. globals.ObjectMock);
  7312. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7313. smalltalk.addMethod(
  7314. smalltalk.method({
  7315. selector: "notDefined",
  7316. protocol: 'tests',
  7317. fn: function (){
  7318. var self=this;
  7319. return smalltalk.withContext(function($ctx1) {
  7320. return void 0;;
  7321. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7322. args: [],
  7323. source: "notDefined\x0a\x09<return void 0;>",
  7324. messageSends: [],
  7325. referencedClasses: []
  7326. }),
  7327. globals.ObjectTest);
  7328. smalltalk.addMethod(
  7329. smalltalk.method({
  7330. selector: "testBasicAccess",
  7331. protocol: 'tests',
  7332. fn: function (){
  7333. var self=this;
  7334. var o;
  7335. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7336. return smalltalk.withContext(function($ctx1) {
  7337. var $1;
  7338. o=_st($Object())._new();
  7339. _st(o)._basicAt_put_("a",(1));
  7340. $1=_st(o)._basicAt_("a");
  7341. $ctx1.sendIdx["basicAt:"]=1;
  7342. self._assert_equals_($1,(1));
  7343. $ctx1.sendIdx["assert:equals:"]=1;
  7344. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7345. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7346. args: [],
  7347. 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",
  7348. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7349. referencedClasses: ["Object"]
  7350. }),
  7351. globals.ObjectTest);
  7352. smalltalk.addMethod(
  7353. smalltalk.method({
  7354. selector: "testBasicPerform",
  7355. protocol: 'tests',
  7356. fn: function (){
  7357. var self=this;
  7358. var o;
  7359. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7360. return smalltalk.withContext(function($ctx1) {
  7361. o=_st($Object())._new();
  7362. _st(o)._basicAt_put_("func",(function(){
  7363. return "hello";
  7364. }));
  7365. $ctx1.sendIdx["basicAt:put:"]=1;
  7366. _st(o)._basicAt_put_("func2",(function(a){
  7367. return smalltalk.withContext(function($ctx2) {
  7368. return _st(a).__plus((1));
  7369. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7370. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7371. $ctx1.sendIdx["assert:equals:"]=1;
  7372. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7373. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7374. args: [],
  7375. 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",
  7376. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7377. referencedClasses: ["Object"]
  7378. }),
  7379. globals.ObjectTest);
  7380. smalltalk.addMethod(
  7381. smalltalk.method({
  7382. selector: "testDNU",
  7383. protocol: 'tests',
  7384. fn: function (){
  7385. var self=this;
  7386. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7387. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7388. return smalltalk.withContext(function($ctx1) {
  7389. self._should_raise_((function(){
  7390. return smalltalk.withContext(function($ctx2) {
  7391. return _st(_st($Object())._new())._foo();
  7392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7393. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7394. args: [],
  7395. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7396. messageSends: ["should:raise:", "foo", "new"],
  7397. referencedClasses: ["Object", "MessageNotUnderstood"]
  7398. }),
  7399. globals.ObjectTest);
  7400. smalltalk.addMethod(
  7401. smalltalk.method({
  7402. selector: "testEquality",
  7403. protocol: 'tests',
  7404. fn: function (){
  7405. var self=this;
  7406. var o;
  7407. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7408. return smalltalk.withContext(function($ctx1) {
  7409. var $1,$2,$4,$3;
  7410. o=_st($Object())._new();
  7411. $ctx1.sendIdx["new"]=1;
  7412. $1=_st(o).__eq(_st($Object())._new());
  7413. $ctx1.sendIdx["="]=1;
  7414. self._deny_($1);
  7415. $2=_st(o).__eq(o);
  7416. $ctx1.sendIdx["="]=2;
  7417. self._assert_($2);
  7418. $ctx1.sendIdx["assert:"]=1;
  7419. $4=_st(o)._yourself();
  7420. $ctx1.sendIdx["yourself"]=1;
  7421. $3=_st($4).__eq(o);
  7422. $ctx1.sendIdx["="]=3;
  7423. self._assert_($3);
  7424. $ctx1.sendIdx["assert:"]=2;
  7425. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7426. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7427. args: [],
  7428. 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)",
  7429. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7430. referencedClasses: ["Object"]
  7431. }),
  7432. globals.ObjectTest);
  7433. smalltalk.addMethod(
  7434. smalltalk.method({
  7435. selector: "testHalt",
  7436. protocol: 'tests',
  7437. fn: function (){
  7438. var self=this;
  7439. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7440. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7441. return smalltalk.withContext(function($ctx1) {
  7442. self._should_raise_((function(){
  7443. return smalltalk.withContext(function($ctx2) {
  7444. return _st(_st($Object())._new())._halt();
  7445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7446. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7447. args: [],
  7448. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7449. messageSends: ["should:raise:", "halt", "new"],
  7450. referencedClasses: ["Object", "Error"]
  7451. }),
  7452. globals.ObjectTest);
  7453. smalltalk.addMethod(
  7454. smalltalk.method({
  7455. selector: "testIdentity",
  7456. protocol: 'tests',
  7457. fn: function (){
  7458. var self=this;
  7459. var o;
  7460. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7461. return smalltalk.withContext(function($ctx1) {
  7462. var $1,$2,$4,$3;
  7463. o=_st($Object())._new();
  7464. $ctx1.sendIdx["new"]=1;
  7465. $1=_st(o).__eq_eq(_st($Object())._new());
  7466. $ctx1.sendIdx["=="]=1;
  7467. self._deny_($1);
  7468. $2=_st(o).__eq_eq(o);
  7469. $ctx1.sendIdx["=="]=2;
  7470. self._assert_($2);
  7471. $ctx1.sendIdx["assert:"]=1;
  7472. $4=_st(o)._yourself();
  7473. $ctx1.sendIdx["yourself"]=1;
  7474. $3=_st($4).__eq_eq(o);
  7475. $ctx1.sendIdx["=="]=3;
  7476. self._assert_($3);
  7477. $ctx1.sendIdx["assert:"]=2;
  7478. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7479. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7480. args: [],
  7481. 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",
  7482. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7483. referencedClasses: ["Object"]
  7484. }),
  7485. globals.ObjectTest);
  7486. smalltalk.addMethod(
  7487. smalltalk.method({
  7488. selector: "testIfNil",
  7489. protocol: 'tests',
  7490. fn: function (){
  7491. var self=this;
  7492. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7493. return smalltalk.withContext(function($ctx1) {
  7494. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7495. $2=_st($Object())._new();
  7496. $ctx1.sendIdx["new"]=1;
  7497. $1=_st($2)._isNil();
  7498. self._deny_($1);
  7499. $ctx1.sendIdx["deny:"]=1;
  7500. $5=_st($Object())._new();
  7501. $ctx1.sendIdx["new"]=2;
  7502. if(($receiver = $5) == nil || $receiver == null){
  7503. $4=true;
  7504. } else {
  7505. $4=$5;
  7506. };
  7507. $3=_st($4).__eq(true);
  7508. self._deny_($3);
  7509. $7=_st($Object())._new();
  7510. $ctx1.sendIdx["new"]=3;
  7511. if(($receiver = $7) == nil || $receiver == null){
  7512. $6=$7;
  7513. } else {
  7514. $6=true;
  7515. };
  7516. self._assert_equals_($6,true);
  7517. $ctx1.sendIdx["assert:equals:"]=1;
  7518. $9=_st($Object())._new();
  7519. $ctx1.sendIdx["new"]=4;
  7520. if(($receiver = $9) == nil || $receiver == null){
  7521. $8=false;
  7522. } else {
  7523. $8=true;
  7524. };
  7525. self._assert_equals_($8,true);
  7526. $ctx1.sendIdx["assert:equals:"]=2;
  7527. $11=_st($Object())._new();
  7528. if(($receiver = $11) == nil || $receiver == null){
  7529. $10=false;
  7530. } else {
  7531. $10=true;
  7532. };
  7533. self._assert_equals_($10,true);
  7534. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7535. args: [],
  7536. 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",
  7537. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7538. referencedClasses: ["Object"]
  7539. }),
  7540. globals.ObjectTest);
  7541. smalltalk.addMethod(
  7542. smalltalk.method({
  7543. selector: "testInstVars",
  7544. protocol: 'tests',
  7545. fn: function (){
  7546. var self=this;
  7547. var o;
  7548. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7549. return smalltalk.withContext(function($ctx1) {
  7550. var $1,$2;
  7551. o=_st($ObjectMock())._new();
  7552. $1=_st(o)._instVarAt_("foo");
  7553. $ctx1.sendIdx["instVarAt:"]=1;
  7554. self._assert_equals_($1,nil);
  7555. $ctx1.sendIdx["assert:equals:"]=1;
  7556. _st(o)._instVarAt_put_("foo",(1));
  7557. $2=_st(o)._instVarAt_("foo");
  7558. $ctx1.sendIdx["instVarAt:"]=2;
  7559. self._assert_equals_($2,(1));
  7560. $ctx1.sendIdx["assert:equals:"]=2;
  7561. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7562. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7563. args: [],
  7564. 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",
  7565. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7566. referencedClasses: ["ObjectMock"]
  7567. }),
  7568. globals.ObjectTest);
  7569. smalltalk.addMethod(
  7570. smalltalk.method({
  7571. selector: "testNilUndefined",
  7572. protocol: 'tests',
  7573. fn: function (){
  7574. var self=this;
  7575. return smalltalk.withContext(function($ctx1) {
  7576. self._assert_equals_(self._notDefined(),nil);
  7577. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7578. args: [],
  7579. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7580. messageSends: ["assert:equals:", "notDefined"],
  7581. referencedClasses: []
  7582. }),
  7583. globals.ObjectTest);
  7584. smalltalk.addMethod(
  7585. smalltalk.method({
  7586. selector: "testYourself",
  7587. protocol: 'tests',
  7588. fn: function (){
  7589. var self=this;
  7590. var o;
  7591. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7592. return smalltalk.withContext(function($ctx1) {
  7593. o=_st($ObjectMock())._new();
  7594. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7595. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7596. args: [],
  7597. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7598. messageSends: ["new", "assert:", "==", "yourself"],
  7599. referencedClasses: ["ObjectMock"]
  7600. }),
  7601. globals.ObjectTest);
  7602. smalltalk.addMethod(
  7603. smalltalk.method({
  7604. selector: "testidentityHash",
  7605. protocol: 'tests',
  7606. fn: function (){
  7607. var self=this;
  7608. var o1,o2;
  7609. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7610. return smalltalk.withContext(function($ctx1) {
  7611. var $2,$3,$1,$5,$4;
  7612. o1=_st($Object())._new();
  7613. $ctx1.sendIdx["new"]=1;
  7614. o2=_st($Object())._new();
  7615. $2=_st(o1)._identityHash();
  7616. $ctx1.sendIdx["identityHash"]=1;
  7617. $3=_st(o1)._identityHash();
  7618. $ctx1.sendIdx["identityHash"]=2;
  7619. $1=_st($2).__eq_eq($3);
  7620. $ctx1.sendIdx["=="]=1;
  7621. self._assert_($1);
  7622. $5=_st(o1)._identityHash();
  7623. $ctx1.sendIdx["identityHash"]=3;
  7624. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7625. self._deny_($4);
  7626. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7627. args: [],
  7628. 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",
  7629. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7630. referencedClasses: ["Object"]
  7631. }),
  7632. globals.ObjectTest);
  7633. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7634. smalltalk.addMethod(
  7635. smalltalk.method({
  7636. selector: "testAccessing",
  7637. protocol: 'tests',
  7638. fn: function (){
  7639. var self=this;
  7640. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7641. return smalltalk.withContext(function($ctx1) {
  7642. var $2,$1,$3,$6,$5,$4;
  7643. $2=_st($Point())._x_y_((3),(4));
  7644. $ctx1.sendIdx["x:y:"]=1;
  7645. $1=_st($2)._x();
  7646. $ctx1.sendIdx["x"]=1;
  7647. self._assert_equals_($1,(3));
  7648. $ctx1.sendIdx["assert:equals:"]=1;
  7649. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7650. $ctx1.sendIdx["y"]=1;
  7651. self._assert_equals_($3,(4));
  7652. $ctx1.sendIdx["assert:equals:"]=2;
  7653. $6=_st($Point())._new();
  7654. $ctx1.sendIdx["new"]=1;
  7655. $5=_st($6)._x_((3));
  7656. $4=_st($5)._x();
  7657. self._assert_equals_($4,(3));
  7658. $ctx1.sendIdx["assert:equals:"]=3;
  7659. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7660. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7661. args: [],
  7662. 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",
  7663. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7664. referencedClasses: ["Point"]
  7665. }),
  7666. globals.PointTest);
  7667. smalltalk.addMethod(
  7668. smalltalk.method({
  7669. selector: "testArithmetic",
  7670. protocol: 'tests',
  7671. fn: function (){
  7672. var self=this;
  7673. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7674. return smalltalk.withContext(function($ctx1) {
  7675. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7676. $2=(3).__at((4));
  7677. $ctx1.sendIdx["@"]=1;
  7678. $3=(3).__at((4));
  7679. $ctx1.sendIdx["@"]=2;
  7680. $1=_st($2).__star($3);
  7681. $4=_st($Point())._x_y_((9),(16));
  7682. $ctx1.sendIdx["x:y:"]=1;
  7683. self._assert_equals_($1,$4);
  7684. $ctx1.sendIdx["assert:equals:"]=1;
  7685. $6=(3).__at((4));
  7686. $ctx1.sendIdx["@"]=3;
  7687. $7=(3).__at((4));
  7688. $ctx1.sendIdx["@"]=4;
  7689. $5=_st($6).__plus($7);
  7690. $8=_st($Point())._x_y_((6),(8));
  7691. $ctx1.sendIdx["x:y:"]=2;
  7692. self._assert_equals_($5,$8);
  7693. $ctx1.sendIdx["assert:equals:"]=2;
  7694. $10=(3).__at((4));
  7695. $ctx1.sendIdx["@"]=5;
  7696. $11=(3).__at((4));
  7697. $ctx1.sendIdx["@"]=6;
  7698. $9=_st($10).__minus($11);
  7699. $12=_st($Point())._x_y_((0),(0));
  7700. $ctx1.sendIdx["x:y:"]=3;
  7701. self._assert_equals_($9,$12);
  7702. $ctx1.sendIdx["assert:equals:"]=3;
  7703. $14=(6).__at((8));
  7704. $ctx1.sendIdx["@"]=7;
  7705. $13=_st($14).__slash((3).__at((4)));
  7706. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7707. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7708. args: [],
  7709. 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)",
  7710. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7711. referencedClasses: ["Point"]
  7712. }),
  7713. globals.PointTest);
  7714. smalltalk.addMethod(
  7715. smalltalk.method({
  7716. selector: "testAt",
  7717. protocol: 'tests',
  7718. fn: function (){
  7719. var self=this;
  7720. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7721. return smalltalk.withContext(function($ctx1) {
  7722. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7723. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7724. args: [],
  7725. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7726. messageSends: ["assert:equals:", "@", "x:y:"],
  7727. referencedClasses: ["Point"]
  7728. }),
  7729. globals.PointTest);
  7730. smalltalk.addMethod(
  7731. smalltalk.method({
  7732. selector: "testComparison",
  7733. protocol: 'tests',
  7734. fn: function (){
  7735. var self=this;
  7736. return smalltalk.withContext(function($ctx1) {
  7737. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7738. $2=(3).__at((4));
  7739. $ctx1.sendIdx["@"]=1;
  7740. $3=(4).__at((5));
  7741. $ctx1.sendIdx["@"]=2;
  7742. $1=_st($2).__lt($3);
  7743. $ctx1.sendIdx["<"]=1;
  7744. self._assert_($1);
  7745. $ctx1.sendIdx["assert:"]=1;
  7746. $5=(3).__at((4));
  7747. $ctx1.sendIdx["@"]=3;
  7748. $6=(4).__at((4));
  7749. $ctx1.sendIdx["@"]=4;
  7750. $4=_st($5).__lt($6);
  7751. self._deny_($4);
  7752. $ctx1.sendIdx["deny:"]=1;
  7753. $8=(4).__at((5));
  7754. $ctx1.sendIdx["@"]=5;
  7755. $9=(4).__at((5));
  7756. $ctx1.sendIdx["@"]=6;
  7757. $7=_st($8).__lt_eq($9);
  7758. $ctx1.sendIdx["<="]=1;
  7759. self._assert_($7);
  7760. $ctx1.sendIdx["assert:"]=2;
  7761. $11=(4).__at((5));
  7762. $ctx1.sendIdx["@"]=7;
  7763. $12=(3).__at((5));
  7764. $ctx1.sendIdx["@"]=8;
  7765. $10=_st($11).__lt_eq($12);
  7766. self._deny_($10);
  7767. $ctx1.sendIdx["deny:"]=2;
  7768. $14=(5).__at((6));
  7769. $ctx1.sendIdx["@"]=9;
  7770. $15=(4).__at((5));
  7771. $ctx1.sendIdx["@"]=10;
  7772. $13=_st($14).__gt($15);
  7773. $ctx1.sendIdx[">"]=1;
  7774. self._assert_($13);
  7775. $ctx1.sendIdx["assert:"]=3;
  7776. $17=(5).__at((6));
  7777. $ctx1.sendIdx["@"]=11;
  7778. $18=(6).__at((6));
  7779. $ctx1.sendIdx["@"]=12;
  7780. $16=_st($17).__gt($18);
  7781. self._deny_($16);
  7782. $ctx1.sendIdx["deny:"]=3;
  7783. $20=(4).__at((5));
  7784. $ctx1.sendIdx["@"]=13;
  7785. $21=(4).__at((5));
  7786. $ctx1.sendIdx["@"]=14;
  7787. $19=_st($20).__gt_eq($21);
  7788. $ctx1.sendIdx[">="]=1;
  7789. self._assert_($19);
  7790. $23=(4).__at((5));
  7791. $ctx1.sendIdx["@"]=15;
  7792. $22=_st($23).__gt_eq((5).__at((5)));
  7793. self._deny_($22);
  7794. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  7795. args: [],
  7796. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  7797. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  7798. referencedClasses: []
  7799. }),
  7800. globals.PointTest);
  7801. smalltalk.addMethod(
  7802. smalltalk.method({
  7803. selector: "testEgality",
  7804. protocol: 'tests',
  7805. fn: function (){
  7806. var self=this;
  7807. return smalltalk.withContext(function($ctx1) {
  7808. var $2,$3,$1,$5,$4;
  7809. $2=(3).__at((4));
  7810. $ctx1.sendIdx["@"]=1;
  7811. $3=(3).__at((4));
  7812. $ctx1.sendIdx["@"]=2;
  7813. $1=_st($2).__eq($3);
  7814. $ctx1.sendIdx["="]=1;
  7815. self._assert_($1);
  7816. $5=(3).__at((5));
  7817. $ctx1.sendIdx["@"]=3;
  7818. $4=_st($5).__eq((3).__at((6)));
  7819. self._deny_($4);
  7820. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7821. args: [],
  7822. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7823. messageSends: ["assert:", "=", "@", "deny:"],
  7824. referencedClasses: []
  7825. }),
  7826. globals.PointTest);
  7827. smalltalk.addMethod(
  7828. smalltalk.method({
  7829. selector: "testNew",
  7830. protocol: 'tests',
  7831. fn: function (){
  7832. var self=this;
  7833. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7834. return smalltalk.withContext(function($ctx1) {
  7835. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7836. $3=_st($Point())._new();
  7837. $ctx1.sendIdx["new"]=1;
  7838. $2=_st($3)._x_((3));
  7839. $ctx1.sendIdx["x:"]=1;
  7840. $1=_st($2)._y();
  7841. $ctx1.sendIdx["y"]=1;
  7842. self._assert_equals_($1,nil);
  7843. $ctx1.sendIdx["assert:equals:"]=1;
  7844. $7=_st($Point())._new();
  7845. $ctx1.sendIdx["new"]=2;
  7846. $6=_st($7)._x_((3));
  7847. $5=_st($6)._x();
  7848. $ctx1.sendIdx["x"]=1;
  7849. $4=_st($5).__eq((0));
  7850. $ctx1.sendIdx["="]=1;
  7851. self._deny_($4);
  7852. $ctx1.sendIdx["deny:"]=1;
  7853. $10=_st($Point())._new();
  7854. $ctx1.sendIdx["new"]=3;
  7855. $9=_st($10)._y_((4));
  7856. $ctx1.sendIdx["y:"]=1;
  7857. $8=_st($9)._x();
  7858. self._assert_equals_($8,nil);
  7859. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7860. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7861. args: [],
  7862. 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",
  7863. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7864. referencedClasses: ["Point"]
  7865. }),
  7866. globals.PointTest);
  7867. smalltalk.addMethod(
  7868. smalltalk.method({
  7869. selector: "testTranslateBy",
  7870. protocol: 'tests',
  7871. fn: function (){
  7872. var self=this;
  7873. return smalltalk.withContext(function($ctx1) {
  7874. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7875. $2=(3).__at((3));
  7876. $ctx1.sendIdx["@"]=1;
  7877. $3=(0).__at((1));
  7878. $ctx1.sendIdx["@"]=2;
  7879. $1=_st($2)._translateBy_($3);
  7880. $ctx1.sendIdx["translateBy:"]=1;
  7881. $4=(3).__at((4));
  7882. $ctx1.sendIdx["@"]=3;
  7883. self._assert_equals_($1,$4);
  7884. $ctx1.sendIdx["assert:equals:"]=1;
  7885. $6=(3).__at((3));
  7886. $ctx1.sendIdx["@"]=4;
  7887. $8=(1)._negated();
  7888. $ctx1.sendIdx["negated"]=1;
  7889. $7=(0).__at($8);
  7890. $ctx1.sendIdx["@"]=5;
  7891. $5=_st($6)._translateBy_($7);
  7892. $ctx1.sendIdx["translateBy:"]=2;
  7893. $9=(3).__at((2));
  7894. $ctx1.sendIdx["@"]=6;
  7895. self._assert_equals_($5,$9);
  7896. $ctx1.sendIdx["assert:equals:"]=2;
  7897. $11=(3).__at((3));
  7898. $ctx1.sendIdx["@"]=7;
  7899. $12=(2).__at((3));
  7900. $ctx1.sendIdx["@"]=8;
  7901. $10=_st($11)._translateBy_($12);
  7902. $ctx1.sendIdx["translateBy:"]=3;
  7903. $13=(5).__at((6));
  7904. $ctx1.sendIdx["@"]=9;
  7905. self._assert_equals_($10,$13);
  7906. $ctx1.sendIdx["assert:equals:"]=3;
  7907. $15=(3).__at((3));
  7908. $ctx1.sendIdx["@"]=10;
  7909. $16=_st((3)._negated()).__at((0));
  7910. $ctx1.sendIdx["@"]=11;
  7911. $14=_st($15)._translateBy_($16);
  7912. self._assert_equals_($14,(0).__at((3)));
  7913. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7914. args: [],
  7915. 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.",
  7916. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7917. referencedClasses: []
  7918. }),
  7919. globals.PointTest);
  7920. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7921. smalltalk.addMethod(
  7922. smalltalk.method({
  7923. selector: "testNextIfAbsent",
  7924. protocol: 'tests',
  7925. fn: function (){
  7926. var self=this;
  7927. var queue;
  7928. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7929. return smalltalk.withContext(function($ctx1) {
  7930. var $2,$1;
  7931. queue=_st($Queue())._new();
  7932. _st(queue)._nextPut_("index1");
  7933. $2=_st(queue)._nextIfAbsent_("empty");
  7934. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7935. $1=_st($2).__eq("index1");
  7936. $ctx1.sendIdx["="]=1;
  7937. self._assert_($1);
  7938. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7939. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7940. args: [],
  7941. 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'",
  7942. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7943. referencedClasses: ["Queue"]
  7944. }),
  7945. globals.QueueTest);
  7946. smalltalk.addMethod(
  7947. smalltalk.method({
  7948. selector: "testQueueNext",
  7949. protocol: 'tests',
  7950. fn: function (){
  7951. var self=this;
  7952. var queue;
  7953. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7954. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7955. return smalltalk.withContext(function($ctx1) {
  7956. var $1,$2,$4,$3,$6,$5;
  7957. queue=_st($Queue())._new();
  7958. $1=queue;
  7959. _st($1)._nextPut_("index1");
  7960. $ctx1.sendIdx["nextPut:"]=1;
  7961. $2=_st($1)._nextPut_("index2");
  7962. $4=_st(queue)._next();
  7963. $ctx1.sendIdx["next"]=1;
  7964. $3=_st($4).__eq("index1");
  7965. $ctx1.sendIdx["="]=1;
  7966. self._assert_($3);
  7967. $6=_st(queue)._next();
  7968. $ctx1.sendIdx["next"]=2;
  7969. $5=_st($6).__eq("index");
  7970. self._deny_($5);
  7971. self._should_raise_((function(){
  7972. return smalltalk.withContext(function($ctx2) {
  7973. return _st(queue)._next();
  7974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7975. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  7976. args: [],
  7977. 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",
  7978. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7979. referencedClasses: ["Queue", "Error"]
  7980. }),
  7981. globals.QueueTest);
  7982. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  7983. smalltalk.addMethod(
  7984. smalltalk.method({
  7985. selector: "testAtRandomNumber",
  7986. protocol: 'tests',
  7987. fn: function (){
  7988. var self=this;
  7989. var val;
  7990. return smalltalk.withContext(function($ctx1) {
  7991. (100)._timesRepeat_((function(){
  7992. return smalltalk.withContext(function($ctx2) {
  7993. val=(10)._atRandom();
  7994. val;
  7995. self._assert_(_st(val).__gt((0)));
  7996. $ctx2.sendIdx["assert:"]=1;
  7997. return self._assert_(_st(val).__lt((11)));
  7998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7999. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8000. args: [],
  8001. 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]",
  8002. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8003. referencedClasses: []
  8004. }),
  8005. globals.RandomTest);
  8006. smalltalk.addMethod(
  8007. smalltalk.method({
  8008. selector: "testAtRandomSequenceableCollection",
  8009. protocol: 'tests',
  8010. fn: function (){
  8011. var self=this;
  8012. var val;
  8013. return smalltalk.withContext(function($ctx1) {
  8014. var $3,$4,$2,$1;
  8015. (100)._timesRepeat_((function(){
  8016. return smalltalk.withContext(function($ctx2) {
  8017. val="abc"._atRandom();
  8018. val;
  8019. $3=_st(val).__eq("a");
  8020. $ctx2.sendIdx["="]=1;
  8021. $4=_st(val).__eq("b");
  8022. $ctx2.sendIdx["="]=2;
  8023. $2=_st($3).__or($4);
  8024. $1=_st($2).__or(_st(val).__eq("c"));
  8025. $ctx2.sendIdx["|"]=1;
  8026. return self._assert_($1);
  8027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8028. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8029. args: [],
  8030. 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].",
  8031. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8032. referencedClasses: []
  8033. }),
  8034. globals.RandomTest);
  8035. smalltalk.addMethod(
  8036. smalltalk.method({
  8037. selector: "textNext",
  8038. protocol: 'tests',
  8039. fn: function (){
  8040. var self=this;
  8041. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8042. return smalltalk.withContext(function($ctx1) {
  8043. var $1;
  8044. (10000)._timesRepeat_((function(){
  8045. var current,next;
  8046. return smalltalk.withContext(function($ctx2) {
  8047. next=_st(_st($Random())._new())._next();
  8048. next;
  8049. self._assert_(_st(next).__gt_eq((0)));
  8050. $ctx2.sendIdx["assert:"]=1;
  8051. self._assert_(_st(next).__lt((1)));
  8052. $1=_st(current).__eq(next);
  8053. $ctx2.sendIdx["="]=1;
  8054. self._deny_($1);
  8055. return _st(next).__eq(current);
  8056. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8057. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8058. args: [],
  8059. 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 ]",
  8060. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8061. referencedClasses: ["Random"]
  8062. }),
  8063. globals.RandomTest);
  8064. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8065. smalltalk.addMethod(
  8066. smalltalk.method({
  8067. selector: "collectionClass",
  8068. protocol: 'accessing',
  8069. fn: function (){
  8070. var self=this;
  8071. return smalltalk.withContext(function($ctx1) {
  8072. var $1;
  8073. $1=_st(self._class())._collectionClass();
  8074. return $1;
  8075. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8076. args: [],
  8077. source: "collectionClass\x0a\x09^ self class collectionClass",
  8078. messageSends: ["collectionClass", "class"],
  8079. referencedClasses: []
  8080. }),
  8081. globals.StreamTest);
  8082. smalltalk.addMethod(
  8083. smalltalk.method({
  8084. selector: "newCollection",
  8085. protocol: 'accessing',
  8086. fn: function (){
  8087. var self=this;
  8088. return smalltalk.withContext(function($ctx1) {
  8089. var $1;
  8090. $1=_st(self._collectionClass())._new();
  8091. return $1;
  8092. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8093. args: [],
  8094. source: "newCollection\x0a\x09^ self collectionClass new",
  8095. messageSends: ["new", "collectionClass"],
  8096. referencedClasses: []
  8097. }),
  8098. globals.StreamTest);
  8099. smalltalk.addMethod(
  8100. smalltalk.method({
  8101. selector: "newStream",
  8102. protocol: 'accessing',
  8103. fn: function (){
  8104. var self=this;
  8105. return smalltalk.withContext(function($ctx1) {
  8106. var $1;
  8107. $1=_st(_st(self._collectionClass())._new())._stream();
  8108. return $1;
  8109. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8110. args: [],
  8111. source: "newStream\x0a\x09^ self collectionClass new stream",
  8112. messageSends: ["stream", "new", "collectionClass"],
  8113. referencedClasses: []
  8114. }),
  8115. globals.StreamTest);
  8116. smalltalk.addMethod(
  8117. smalltalk.method({
  8118. selector: "testAtStartAtEnd",
  8119. protocol: 'tests',
  8120. fn: function (){
  8121. var self=this;
  8122. var stream;
  8123. return smalltalk.withContext(function($ctx1) {
  8124. var $1,$2,$3,$4;
  8125. stream=self._newStream();
  8126. $1=_st(stream)._atStart();
  8127. $ctx1.sendIdx["atStart"]=1;
  8128. self._assert_($1);
  8129. $ctx1.sendIdx["assert:"]=1;
  8130. $2=_st(stream)._atEnd();
  8131. $ctx1.sendIdx["atEnd"]=1;
  8132. self._assert_($2);
  8133. $ctx1.sendIdx["assert:"]=2;
  8134. _st(stream)._nextPutAll_(self._newCollection());
  8135. $3=_st(stream)._atEnd();
  8136. $ctx1.sendIdx["atEnd"]=2;
  8137. self._assert_($3);
  8138. $4=_st(stream)._atStart();
  8139. $ctx1.sendIdx["atStart"]=2;
  8140. self._deny_($4);
  8141. $ctx1.sendIdx["deny:"]=1;
  8142. _st(stream)._position_((1));
  8143. self._deny_(_st(stream)._atEnd());
  8144. $ctx1.sendIdx["deny:"]=2;
  8145. self._deny_(_st(stream)._atStart());
  8146. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8147. args: [],
  8148. 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",
  8149. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8150. referencedClasses: []
  8151. }),
  8152. globals.StreamTest);
  8153. smalltalk.addMethod(
  8154. smalltalk.method({
  8155. selector: "testContents",
  8156. protocol: 'tests',
  8157. fn: function (){
  8158. var self=this;
  8159. var stream;
  8160. return smalltalk.withContext(function($ctx1) {
  8161. var $1,$2;
  8162. stream=self._newStream();
  8163. $1=stream;
  8164. $2=self._newCollection();
  8165. $ctx1.sendIdx["newCollection"]=1;
  8166. _st($1)._nextPutAll_($2);
  8167. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8168. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8169. args: [],
  8170. 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",
  8171. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8172. referencedClasses: []
  8173. }),
  8174. globals.StreamTest);
  8175. smalltalk.addMethod(
  8176. smalltalk.method({
  8177. selector: "testIsEmpty",
  8178. protocol: 'tests',
  8179. fn: function (){
  8180. var self=this;
  8181. var stream;
  8182. return smalltalk.withContext(function($ctx1) {
  8183. var $1;
  8184. stream=self._newStream();
  8185. $1=_st(stream)._isEmpty();
  8186. $ctx1.sendIdx["isEmpty"]=1;
  8187. self._assert_($1);
  8188. _st(stream)._nextPutAll_(self._newCollection());
  8189. self._deny_(_st(stream)._isEmpty());
  8190. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8191. args: [],
  8192. 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",
  8193. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8194. referencedClasses: []
  8195. }),
  8196. globals.StreamTest);
  8197. smalltalk.addMethod(
  8198. smalltalk.method({
  8199. selector: "testPosition",
  8200. protocol: 'tests',
  8201. fn: function (){
  8202. var self=this;
  8203. var collection,stream;
  8204. return smalltalk.withContext(function($ctx1) {
  8205. var $1,$2,$3;
  8206. collection=self._newCollection();
  8207. stream=self._newStream();
  8208. _st(stream)._nextPutAll_(collection);
  8209. $1=_st(stream)._position();
  8210. $ctx1.sendIdx["position"]=1;
  8211. self._assert_equals_($1,_st(collection)._size());
  8212. $ctx1.sendIdx["assert:equals:"]=1;
  8213. _st(stream)._position_((0));
  8214. $2=_st(stream)._position();
  8215. $ctx1.sendIdx["position"]=2;
  8216. self._assert_equals_($2,(0));
  8217. $ctx1.sendIdx["assert:equals:"]=2;
  8218. _st(stream)._next();
  8219. $ctx1.sendIdx["next"]=1;
  8220. $3=_st(stream)._position();
  8221. $ctx1.sendIdx["position"]=3;
  8222. self._assert_equals_($3,(1));
  8223. $ctx1.sendIdx["assert:equals:"]=3;
  8224. _st(stream)._next();
  8225. self._assert_equals_(_st(stream)._position(),(2));
  8226. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8227. args: [],
  8228. 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",
  8229. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8230. referencedClasses: []
  8231. }),
  8232. globals.StreamTest);
  8233. smalltalk.addMethod(
  8234. smalltalk.method({
  8235. selector: "testReading",
  8236. protocol: 'tests',
  8237. fn: function (){
  8238. var self=this;
  8239. var stream,collection;
  8240. return smalltalk.withContext(function($ctx1) {
  8241. var $1,$2,$3;
  8242. collection=self._newCollection();
  8243. stream=self._newStream();
  8244. $1=stream;
  8245. _st($1)._nextPutAll_(collection);
  8246. $2=_st($1)._position_((0));
  8247. _st(collection)._do_((function(each){
  8248. return smalltalk.withContext(function($ctx2) {
  8249. $3=_st(stream)._next();
  8250. $ctx2.sendIdx["next"]=1;
  8251. return self._assert_equals_($3,each);
  8252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8253. self._assert_(_st(_st(stream)._next())._isNil());
  8254. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8255. args: [],
  8256. 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",
  8257. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8258. referencedClasses: []
  8259. }),
  8260. globals.StreamTest);
  8261. smalltalk.addMethod(
  8262. smalltalk.method({
  8263. selector: "testStreamContents",
  8264. protocol: 'tests',
  8265. fn: function (){
  8266. var self=this;
  8267. return self},
  8268. args: [],
  8269. source: "testStreamContents",
  8270. messageSends: [],
  8271. referencedClasses: []
  8272. }),
  8273. globals.StreamTest);
  8274. smalltalk.addMethod(
  8275. smalltalk.method({
  8276. selector: "testWrite",
  8277. protocol: 'tests',
  8278. fn: function (){
  8279. var self=this;
  8280. var stream,collection;
  8281. return smalltalk.withContext(function($ctx1) {
  8282. collection=self._newCollection();
  8283. stream=self._newStream();
  8284. _st(collection)._do_((function(each){
  8285. return smalltalk.withContext(function($ctx2) {
  8286. return _st(stream).__lt_lt(each);
  8287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8288. self._assert_equals_(_st(stream)._contents(),collection);
  8289. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8290. args: [],
  8291. 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",
  8292. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8293. referencedClasses: []
  8294. }),
  8295. globals.StreamTest);
  8296. smalltalk.addMethod(
  8297. smalltalk.method({
  8298. selector: "testWriting",
  8299. protocol: 'tests',
  8300. fn: function (){
  8301. var self=this;
  8302. var stream,collection;
  8303. return smalltalk.withContext(function($ctx1) {
  8304. var $1;
  8305. collection=self._newCollection();
  8306. stream=self._newStream();
  8307. $ctx1.sendIdx["newStream"]=1;
  8308. _st(collection)._do_((function(each){
  8309. return smalltalk.withContext(function($ctx2) {
  8310. return _st(stream)._nextPut_(each);
  8311. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8312. $1=_st(stream)._contents();
  8313. $ctx1.sendIdx["contents"]=1;
  8314. self._assert_equals_($1,collection);
  8315. $ctx1.sendIdx["assert:equals:"]=1;
  8316. stream=self._newStream();
  8317. _st(stream)._nextPutAll_(collection);
  8318. self._assert_equals_(_st(stream)._contents(),collection);
  8319. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8320. args: [],
  8321. 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",
  8322. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8323. referencedClasses: []
  8324. }),
  8325. globals.StreamTest);
  8326. smalltalk.addMethod(
  8327. smalltalk.method({
  8328. selector: "collectionClass",
  8329. protocol: 'accessing',
  8330. fn: function (){
  8331. var self=this;
  8332. return nil;
  8333. },
  8334. args: [],
  8335. source: "collectionClass\x0a\x09^ nil",
  8336. messageSends: [],
  8337. referencedClasses: []
  8338. }),
  8339. globals.StreamTest.klass);
  8340. smalltalk.addMethod(
  8341. smalltalk.method({
  8342. selector: "isAbstract",
  8343. protocol: 'testing',
  8344. fn: function (){
  8345. var self=this;
  8346. return smalltalk.withContext(function($ctx1) {
  8347. var $1;
  8348. $1=_st(self._collectionClass())._isNil();
  8349. return $1;
  8350. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8351. args: [],
  8352. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8353. messageSends: ["isNil", "collectionClass"],
  8354. referencedClasses: []
  8355. }),
  8356. globals.StreamTest.klass);
  8357. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8358. smalltalk.addMethod(
  8359. smalltalk.method({
  8360. selector: "newCollection",
  8361. protocol: 'accessing',
  8362. fn: function (){
  8363. var self=this;
  8364. return smalltalk.withContext(function($ctx1) {
  8365. var $1;
  8366. $1=[true,(1),(3).__at((4)),"foo"];
  8367. return $1;
  8368. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8369. args: [],
  8370. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8371. messageSends: ["@"],
  8372. referencedClasses: []
  8373. }),
  8374. globals.ArrayStreamTest);
  8375. smalltalk.addMethod(
  8376. smalltalk.method({
  8377. selector: "collectionClass",
  8378. protocol: 'accessing',
  8379. fn: function (){
  8380. var self=this;
  8381. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8382. return $Array();
  8383. },
  8384. args: [],
  8385. source: "collectionClass\x0a\x09^ Array",
  8386. messageSends: [],
  8387. referencedClasses: ["Array"]
  8388. }),
  8389. globals.ArrayStreamTest.klass);
  8390. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8391. smalltalk.addMethod(
  8392. smalltalk.method({
  8393. selector: "newCollection",
  8394. protocol: 'accessing',
  8395. fn: function (){
  8396. var self=this;
  8397. return "hello world";
  8398. },
  8399. args: [],
  8400. source: "newCollection\x0a\x09^ 'hello world'",
  8401. messageSends: [],
  8402. referencedClasses: []
  8403. }),
  8404. globals.StringStreamTest);
  8405. smalltalk.addMethod(
  8406. smalltalk.method({
  8407. selector: "collectionClass",
  8408. protocol: 'accessing',
  8409. fn: function (){
  8410. var self=this;
  8411. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8412. return $String();
  8413. },
  8414. args: [],
  8415. source: "collectionClass\x0a\x09^ String",
  8416. messageSends: [],
  8417. referencedClasses: ["String"]
  8418. }),
  8419. globals.StringStreamTest.klass);
  8420. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8421. smalltalk.addMethod(
  8422. smalltalk.method({
  8423. selector: "testCopying",
  8424. protocol: 'tests',
  8425. fn: function (){
  8426. var self=this;
  8427. return smalltalk.withContext(function($ctx1) {
  8428. self._assert_equals_(nil._copy(),nil);
  8429. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8430. args: [],
  8431. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8432. messageSends: ["assert:equals:", "copy"],
  8433. referencedClasses: []
  8434. }),
  8435. globals.UndefinedTest);
  8436. smalltalk.addMethod(
  8437. smalltalk.method({
  8438. selector: "testDeepCopy",
  8439. protocol: 'tests',
  8440. fn: function (){
  8441. var self=this;
  8442. return smalltalk.withContext(function($ctx1) {
  8443. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8444. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8445. args: [],
  8446. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8447. messageSends: ["assert:", "=", "deepCopy"],
  8448. referencedClasses: []
  8449. }),
  8450. globals.UndefinedTest);
  8451. smalltalk.addMethod(
  8452. smalltalk.method({
  8453. selector: "testIfNil",
  8454. protocol: 'tests',
  8455. fn: function (){
  8456. var self=this;
  8457. return smalltalk.withContext(function($ctx1) {
  8458. var $1,$3,$2,$4,$6,$5,$receiver;
  8459. if(($receiver = nil) == nil || $receiver == null){
  8460. $1=true;
  8461. } else {
  8462. $1=nil;
  8463. };
  8464. self._assert_equals_($1,true);
  8465. $ctx1.sendIdx["assert:equals:"]=1;
  8466. if(($receiver = nil) == nil || $receiver == null){
  8467. $3=nil;
  8468. } else {
  8469. $3=true;
  8470. };
  8471. $2=_st($3).__eq(true);
  8472. $ctx1.sendIdx["="]=1;
  8473. self._deny_($2);
  8474. $ctx1.sendIdx["deny:"]=1;
  8475. if(($receiver = nil) == nil || $receiver == null){
  8476. $4=true;
  8477. } else {
  8478. $4=false;
  8479. };
  8480. self._assert_equals_($4,true);
  8481. if(($receiver = nil) == nil || $receiver == null){
  8482. $6=false;
  8483. } else {
  8484. $6=true;
  8485. };
  8486. $5=_st($6).__eq(true);
  8487. self._deny_($5);
  8488. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8489. args: [],
  8490. 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",
  8491. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8492. referencedClasses: []
  8493. }),
  8494. globals.UndefinedTest);
  8495. smalltalk.addMethod(
  8496. smalltalk.method({
  8497. selector: "testIsNil",
  8498. protocol: 'tests',
  8499. fn: function (){
  8500. var self=this;
  8501. return smalltalk.withContext(function($ctx1) {
  8502. self._assert_(nil._isNil());
  8503. self._deny_(nil._notNil());
  8504. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8505. args: [],
  8506. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8507. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8508. referencedClasses: []
  8509. }),
  8510. globals.UndefinedTest);
  8511. });