2
0

Kernel-Tests.js 337 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.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},smalltalk.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. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  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. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. 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.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. 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 ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. 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",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. 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",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. 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.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. 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",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. 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",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. 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)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. 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",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. 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'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. 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'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. 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;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. 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))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. 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 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. 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",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. 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)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. 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",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. 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",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. 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'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. 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",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. 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;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. 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",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. 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 ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. 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 ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. 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) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. 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",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. 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",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. 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",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  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 smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. 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",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. 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",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. 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",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. 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 ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. 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",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. 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",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. 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",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. 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",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. 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",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. 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 ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. 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 ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfAbsentPut",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var newCollection;
  2334. return smalltalk.withContext(function($ctx1) {
  2335. var $1;
  2336. newCollection=self._collection();
  2337. $ctx1.sendIdx["collection"]=1;
  2338. self._samplesDo_((function(index,value){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2341. return smalltalk.withContext(function($ctx3) {
  2342. return self._sampleNewValue();
  2343. $ctx3.sendIdx["sampleNewValue"]=1;
  2344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2345. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2346. return self._assert_equals_($1,value);
  2347. $ctx2.sendIdx["assert:equals:"]=1;
  2348. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2349. self._assert_equals_(newCollection,self._collection());
  2350. $ctx1.sendIdx["assert:equals:"]=2;
  2351. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2352. return smalltalk.withContext(function($ctx2) {
  2353. return self._sampleNewValue();
  2354. $ctx2.sendIdx["sampleNewValue"]=2;
  2355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2356. $ctx1.sendIdx["assert:equals:"]=3;
  2357. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2358. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2359. args: [],
  2360. 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",
  2361. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2362. referencedClasses: []
  2363. }),
  2364. smalltalk.IndexableCollectionTest);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "testAtIfPresent",
  2368. protocol: 'tests',
  2369. fn: function (){
  2370. var self=this;
  2371. var visited,sentinel;
  2372. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2373. return smalltalk.withContext(function($ctx1) {
  2374. var $2,$1,$4,$3;
  2375. sentinel=_st($Object())._new();
  2376. self._nonIndexesDo_((function(each){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. visited=nil;
  2379. visited;
  2380. $2=self._collection();
  2381. $ctx2.sendIdx["collection"]=1;
  2382. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2383. return smalltalk.withContext(function($ctx3) {
  2384. visited=value1;
  2385. visited;
  2386. return sentinel;
  2387. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2388. $ctx2.sendIdx["at:ifPresent:"]=1;
  2389. self._assert_equals_($1,nil);
  2390. $ctx2.sendIdx["assert:equals:"]=1;
  2391. return self._assert_(_st(visited)._isNil());
  2392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2393. self._samplesDo_((function(index,value){
  2394. return smalltalk.withContext(function($ctx2) {
  2395. visited=nil;
  2396. visited;
  2397. $4=self._collection();
  2398. $ctx2.sendIdx["collection"]=2;
  2399. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2400. return smalltalk.withContext(function($ctx3) {
  2401. visited=value2;
  2402. visited;
  2403. return sentinel;
  2404. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2405. self._assert_equals_($3,sentinel);
  2406. $ctx2.sendIdx["assert:equals:"]=2;
  2407. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2408. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2409. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2410. args: [],
  2411. 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) ]",
  2412. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2413. referencedClasses: ["Object"]
  2414. }),
  2415. smalltalk.IndexableCollectionTest);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "testAtIfPresentIfAbsent",
  2419. protocol: 'tests',
  2420. fn: function (){
  2421. var self=this;
  2422. var visited,sentinel;
  2423. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2424. return smalltalk.withContext(function($ctx1) {
  2425. var $2,$1,$3,$5,$4;
  2426. sentinel=_st($Object())._new();
  2427. self._nonIndexesDo_((function(each){
  2428. return smalltalk.withContext(function($ctx2) {
  2429. visited=nil;
  2430. visited;
  2431. $2=self._collection();
  2432. $ctx2.sendIdx["collection"]=1;
  2433. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2434. return smalltalk.withContext(function($ctx3) {
  2435. visited=value1;
  2436. visited;
  2437. return sentinel;
  2438. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2439. return smalltalk.withContext(function($ctx3) {
  2440. return self._sampleNewValue();
  2441. $ctx3.sendIdx["sampleNewValue"]=1;
  2442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2443. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2444. $3=self._sampleNewValue();
  2445. $ctx2.sendIdx["sampleNewValue"]=2;
  2446. self._assert_equals_($1,$3);
  2447. $ctx2.sendIdx["assert:equals:"]=1;
  2448. return self._assert_(_st(visited)._isNil());
  2449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2450. self._samplesDo_((function(index,value){
  2451. return smalltalk.withContext(function($ctx2) {
  2452. visited=nil;
  2453. visited;
  2454. $5=self._collection();
  2455. $ctx2.sendIdx["collection"]=2;
  2456. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2457. return smalltalk.withContext(function($ctx3) {
  2458. visited=value2;
  2459. visited;
  2460. return sentinel;
  2461. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2462. return smalltalk.withContext(function($ctx3) {
  2463. return self._sampleNewValue();
  2464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2465. self._assert_equals_($4,sentinel);
  2466. $ctx2.sendIdx["assert:equals:"]=2;
  2467. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. smalltalk.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtPut",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var newCollection;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. newCollection=self._collection();
  2485. $ctx1.sendIdx["collection"]=1;
  2486. self._samplesDo_((function(index,value){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return _st(newCollection)._at_put_(index,value);
  2489. $ctx2.sendIdx["at:put:"]=1;
  2490. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2491. self._assert_equals_(newCollection,self._collection());
  2492. $ctx1.sendIdx["assert:equals:"]=1;
  2493. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2494. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2495. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2496. args: [],
  2497. 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",
  2498. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2499. referencedClasses: []
  2500. }),
  2501. smalltalk.IndexableCollectionTest);
  2502. smalltalk.addMethod(
  2503. smalltalk.method({
  2504. selector: "testEquality",
  2505. protocol: 'tests',
  2506. fn: function (){
  2507. var self=this;
  2508. return smalltalk.withContext(function($ctx1) {
  2509. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2510. $2=self._collectionClass();
  2511. $ctx1.sendIdx["collectionClass"]=1;
  2512. $1=_st($2)._new();
  2513. $ctx1.sendIdx["new"]=1;
  2514. $4=self._collectionClass();
  2515. $ctx1.sendIdx["collectionClass"]=2;
  2516. $3=_st($4)._new();
  2517. $ctx1.sendIdx["new"]=2;
  2518. self._assert_equals_($1,$3);
  2519. $ctx1.sendIdx["assert:equals:"]=1;
  2520. $5=self._collection();
  2521. $ctx1.sendIdx["collection"]=1;
  2522. $6=self._collection();
  2523. $ctx1.sendIdx["collection"]=2;
  2524. self._assert_equals_($5,$6);
  2525. $ctx1.sendIdx["assert:equals:"]=2;
  2526. $7=self._collectionWithNewValue();
  2527. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2528. self._assert_equals_($7,self._collectionWithNewValue());
  2529. $10=self._collectionClass();
  2530. $ctx1.sendIdx["collectionClass"]=3;
  2531. $9=_st($10)._new();
  2532. $ctx1.sendIdx["new"]=3;
  2533. $11=self._collection();
  2534. $ctx1.sendIdx["collection"]=3;
  2535. $8=_st($9).__eq($11);
  2536. $ctx1.sendIdx["="]=1;
  2537. self._deny_($8);
  2538. $ctx1.sendIdx["deny:"]=1;
  2539. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.IndexableCollectionTest)})},
  2541. args: [],
  2542. 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",
  2543. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.IndexableCollectionTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testIndexOf",
  2550. protocol: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2554. return smalltalk.withContext(function($ctx1) {
  2555. var $1;
  2556. self._should_raise_((function(){
  2557. return smalltalk.withContext(function($ctx2) {
  2558. $1=self._collection();
  2559. $ctx2.sendIdx["collection"]=1;
  2560. return _st($1)._indexOf_(self._sampleNewValue());
  2561. $ctx2.sendIdx["indexOf:"]=1;
  2562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2563. self._samplesDo_((function(index,value){
  2564. return smalltalk.withContext(function($ctx2) {
  2565. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2566. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2567. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2568. args: [],
  2569. 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 ]",
  2570. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2571. referencedClasses: ["Error"]
  2572. }),
  2573. smalltalk.IndexableCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "testIndexOfWithNull",
  2577. protocol: 'tests',
  2578. fn: function (){
  2579. var self=this;
  2580. var jsNull;
  2581. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2582. return smalltalk.withContext(function($ctx1) {
  2583. var $1,$2;
  2584. jsNull=_st($JSON())._parse_("null");
  2585. self._samplesDo_((function(index,value){
  2586. return smalltalk.withContext(function($ctx2) {
  2587. $1=self._collection();
  2588. _st($1)._at_put_(index,jsNull);
  2589. $2=_st($1)._indexOf_(jsNull);
  2590. return self._assert_equals_($2,index);
  2591. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2592. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},smalltalk.IndexableCollectionTest)})},
  2593. args: [],
  2594. 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 ]",
  2595. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2596. referencedClasses: ["JSON"]
  2597. }),
  2598. smalltalk.IndexableCollectionTest);
  2599. smalltalk.addMethod(
  2600. smalltalk.method({
  2601. selector: "testWithIndexDo",
  2602. protocol: 'tests',
  2603. fn: function (){
  2604. var self=this;
  2605. var collection;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. collection=self._collection();
  2608. $ctx1.sendIdx["collection"]=1;
  2609. _st(self._collection())._withIndexDo_((function(each,index){
  2610. return smalltalk.withContext(function($ctx2) {
  2611. return self._assert_equals_(_st(collection)._at_(index),each);
  2612. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2613. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2614. args: [],
  2615. 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 ]",
  2616. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2617. referencedClasses: []
  2618. }),
  2619. smalltalk.IndexableCollectionTest);
  2620. smalltalk.addClass('AssociativeCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2621. smalltalk.addMethod(
  2622. smalltalk.method({
  2623. selector: "collectionKeys",
  2624. protocol: 'fixture',
  2625. fn: function (){
  2626. var self=this;
  2627. return smalltalk.withContext(function($ctx1) {
  2628. self._subclassResponsibility();
  2629. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.AssociativeCollectionTest)})},
  2630. args: [],
  2631. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2632. messageSends: ["subclassResponsibility"],
  2633. referencedClasses: []
  2634. }),
  2635. smalltalk.AssociativeCollectionTest);
  2636. smalltalk.addMethod(
  2637. smalltalk.method({
  2638. selector: "collectionValues",
  2639. protocol: 'fixture',
  2640. fn: function (){
  2641. var self=this;
  2642. return smalltalk.withContext(function($ctx1) {
  2643. self._subclassResponsibility();
  2644. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.AssociativeCollectionTest)})},
  2645. args: [],
  2646. source: "collectionValues\x0a\x09self subclassResponsibility",
  2647. messageSends: ["subclassResponsibility"],
  2648. referencedClasses: []
  2649. }),
  2650. smalltalk.AssociativeCollectionTest);
  2651. smalltalk.addMethod(
  2652. smalltalk.method({
  2653. selector: "nonIndexesDo:",
  2654. protocol: 'fixture',
  2655. fn: function (aBlock){
  2656. var self=this;
  2657. return smalltalk.withContext(function($ctx1) {
  2658. _st(aBlock)._value_((5));
  2659. $ctx1.sendIdx["value:"]=1;
  2660. _st(aBlock)._value_("z");
  2661. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2662. args: ["aBlock"],
  2663. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2664. messageSends: ["value:"],
  2665. referencedClasses: []
  2666. }),
  2667. smalltalk.AssociativeCollectionTest);
  2668. smalltalk.addMethod(
  2669. smalltalk.method({
  2670. selector: "sampleNewIndex",
  2671. protocol: 'fixture',
  2672. fn: function (){
  2673. var self=this;
  2674. return smalltalk.withContext(function($ctx1) {
  2675. return "new";
  2676. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.AssociativeCollectionTest)})},
  2677. args: [],
  2678. source: "sampleNewIndex\x0a\x09^ 'new'",
  2679. messageSends: [],
  2680. referencedClasses: []
  2681. }),
  2682. smalltalk.AssociativeCollectionTest);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "samplesDo:",
  2686. protocol: 'fixture',
  2687. fn: function (aBlock){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. _st(aBlock)._value_value_("a",(2));
  2691. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2692. args: ["aBlock"],
  2693. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2694. messageSends: ["value:value:"],
  2695. referencedClasses: []
  2696. }),
  2697. smalltalk.AssociativeCollectionTest);
  2698. smalltalk.addMethod(
  2699. smalltalk.method({
  2700. selector: "testAddAll",
  2701. protocol: 'tests',
  2702. fn: function (){
  2703. var self=this;
  2704. return smalltalk.withContext(function($ctx1) {
  2705. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2706. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2707. $2=self._collection();
  2708. $ctx1.sendIdx["collection"]=1;
  2709. $3=$2;
  2710. $4=self._collection();
  2711. $ctx1.sendIdx["collection"]=2;
  2712. _st($3)._addAll_($4);
  2713. $ctx1.sendIdx["addAll:"]=1;
  2714. $5=_st($2)._yourself();
  2715. $ctx1.sendIdx["yourself"]=1;
  2716. $1=$5;
  2717. $6=self._collection();
  2718. $ctx1.sendIdx["collection"]=3;
  2719. self._assert_equals_($1,$6);
  2720. $ctx1.sendIdx["assert:equals:"]=1;
  2721. $8=self._collection();
  2722. $ctx1.sendIdx["collection"]=4;
  2723. $9=$8;
  2724. $10=self._collectionWithNewValue();
  2725. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2726. _st($9)._addAll_($10);
  2727. $ctx1.sendIdx["addAll:"]=2;
  2728. $11=_st($8)._yourself();
  2729. $ctx1.sendIdx["yourself"]=2;
  2730. $7=$11;
  2731. $12=self._collectionWithNewValue();
  2732. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2733. self._assert_equals_($7,$12);
  2734. $ctx1.sendIdx["assert:equals:"]=2;
  2735. $14=self._collectionWithNewValue();
  2736. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2737. _st($14)._addAll_(self._collection());
  2738. $15=_st($14)._yourself();
  2739. $13=$15;
  2740. self._assert_equals_($13,self._collectionWithNewValue());
  2741. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.AssociativeCollectionTest)})},
  2742. args: [],
  2743. 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",
  2744. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2745. referencedClasses: []
  2746. }),
  2747. smalltalk.AssociativeCollectionTest);
  2748. smalltalk.addMethod(
  2749. smalltalk.method({
  2750. selector: "testAsDictionary",
  2751. protocol: 'tests',
  2752. fn: function (){
  2753. var self=this;
  2754. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2755. return smalltalk.withContext(function($ctx1) {
  2756. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2757. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.AssociativeCollectionTest)})},
  2758. args: [],
  2759. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2760. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2761. referencedClasses: ["Dictionary"]
  2762. }),
  2763. smalltalk.AssociativeCollectionTest);
  2764. smalltalk.addMethod(
  2765. smalltalk.method({
  2766. selector: "testAsHashedCollection",
  2767. protocol: 'tests',
  2768. fn: function (){
  2769. var self=this;
  2770. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2771. return smalltalk.withContext(function($ctx1) {
  2772. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2773. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.AssociativeCollectionTest)})},
  2774. args: [],
  2775. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2776. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2777. referencedClasses: ["HashedCollection"]
  2778. }),
  2779. smalltalk.AssociativeCollectionTest);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "testComma",
  2783. protocol: 'tests',
  2784. fn: function (){
  2785. var self=this;
  2786. return smalltalk.withContext(function($ctx1) {
  2787. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2788. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2789. $2=self._collection();
  2790. $ctx1.sendIdx["collection"]=1;
  2791. $3=self._collection();
  2792. $ctx1.sendIdx["collection"]=2;
  2793. $1=_st($2).__comma($3);
  2794. $ctx1.sendIdx[","]=1;
  2795. $4=self._collection();
  2796. $ctx1.sendIdx["collection"]=3;
  2797. self._assert_equals_($1,$4);
  2798. $ctx1.sendIdx["assert:equals:"]=1;
  2799. $6=self._collection();
  2800. $ctx1.sendIdx["collection"]=4;
  2801. $7=self._collectionWithNewValue();
  2802. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2803. $5=_st($6).__comma($7);
  2804. $ctx1.sendIdx[","]=2;
  2805. $8=self._collectionWithNewValue();
  2806. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2807. self._assert_equals_($5,$8);
  2808. $ctx1.sendIdx["assert:equals:"]=2;
  2809. $10=self._collectionWithNewValue();
  2810. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2811. $9=_st($10).__comma(self._collection());
  2812. self._assert_equals_($9,self._collectionWithNewValue());
  2813. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.AssociativeCollectionTest)})},
  2814. args: [],
  2815. 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",
  2816. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2817. referencedClasses: []
  2818. }),
  2819. smalltalk.AssociativeCollectionTest);
  2820. smalltalk.addMethod(
  2821. smalltalk.method({
  2822. selector: "testFrom",
  2823. protocol: 'tests',
  2824. fn: function (){
  2825. var self=this;
  2826. var associations;
  2827. return smalltalk.withContext(function($ctx1) {
  2828. var $1,$2,$3,$5,$4;
  2829. $1="a".__minus_gt((1));
  2830. $ctx1.sendIdx["->"]=1;
  2831. $2="b".__minus_gt((2));
  2832. $ctx1.sendIdx["->"]=2;
  2833. associations=[$1,$2];
  2834. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2835. $5="a".__minus_gt((1));
  2836. $ctx1.sendIdx["->"]=3;
  2837. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2838. self._assertSameContents_as_($3,$4);
  2839. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.AssociativeCollectionTest)})},
  2840. args: [],
  2841. 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 }.",
  2842. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2843. referencedClasses: []
  2844. }),
  2845. smalltalk.AssociativeCollectionTest);
  2846. smalltalk.addMethod(
  2847. smalltalk.method({
  2848. selector: "testKeys",
  2849. protocol: 'tests',
  2850. fn: function (){
  2851. var self=this;
  2852. return smalltalk.withContext(function($ctx1) {
  2853. var $2,$1,$3,$4;
  2854. $2=_st(_st(self._collectionClass())._new())._keys();
  2855. $ctx1.sendIdx["keys"]=1;
  2856. $1=_st($2)._isEmpty();
  2857. self._assert_($1);
  2858. $3=_st(self._collection())._keys();
  2859. $ctx1.sendIdx["keys"]=2;
  2860. $4=self._collectionKeys();
  2861. $ctx1.sendIdx["collectionKeys"]=1;
  2862. self._assertSameContents_as_($3,$4);
  2863. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2864. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2865. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},smalltalk.AssociativeCollectionTest)})},
  2866. args: [],
  2867. 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 }",
  2868. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2869. referencedClasses: []
  2870. }),
  2871. smalltalk.AssociativeCollectionTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "testNewFromPairs",
  2875. protocol: 'tests',
  2876. fn: function (){
  2877. var self=this;
  2878. var flattenedAssociations;
  2879. return smalltalk.withContext(function($ctx1) {
  2880. var $1,$3,$2;
  2881. flattenedAssociations=["a",(1),"b",(2)];
  2882. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2883. $3="a".__minus_gt((1));
  2884. $ctx1.sendIdx["->"]=1;
  2885. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2886. self._assertSameContents_as_($1,$2);
  2887. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.AssociativeCollectionTest)})},
  2888. args: [],
  2889. 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 }.",
  2890. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2891. referencedClasses: []
  2892. }),
  2893. smalltalk.AssociativeCollectionTest);
  2894. smalltalk.addMethod(
  2895. smalltalk.method({
  2896. selector: "testPrintString",
  2897. protocol: 'tests',
  2898. fn: function (){
  2899. var self=this;
  2900. return smalltalk.withContext(function($ctx1) {
  2901. var $3,$2,$4,$1,$5;
  2902. $3=self._collectionClass();
  2903. $ctx1.sendIdx["collectionClass"]=1;
  2904. $2=_st($3)._new();
  2905. _st($2)._at_put_("firstname","James");
  2906. $ctx1.sendIdx["at:put:"]=1;
  2907. _st($2)._at_put_("lastname","Bond");
  2908. $4=_st($2)._printString();
  2909. $1=$4;
  2910. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2911. $ctx1.sendIdx[","]=1;
  2912. self._assert_equals_($1,$5);
  2913. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.AssociativeCollectionTest)})},
  2914. args: [],
  2915. 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'')'",
  2916. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2917. referencedClasses: []
  2918. }),
  2919. smalltalk.AssociativeCollectionTest);
  2920. smalltalk.addMethod(
  2921. smalltalk.method({
  2922. selector: "testRemoveKey",
  2923. protocol: 'tests',
  2924. fn: function (){
  2925. var self=this;
  2926. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2927. return smalltalk.withContext(function($ctx1) {
  2928. var $1,$2,$3,$5,$6,$4,$7,$8;
  2929. self._nonIndexesDo_((function(each){
  2930. var collection;
  2931. return smalltalk.withContext(function($ctx2) {
  2932. collection=self._collection();
  2933. $ctx2.sendIdx["collection"]=1;
  2934. collection;
  2935. self._should_raise_((function(){
  2936. return smalltalk.withContext(function($ctx3) {
  2937. return _st(collection)._removeKey_(each);
  2938. $ctx3.sendIdx["removeKey:"]=1;
  2939. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2940. $1=collection;
  2941. $2=self._collection();
  2942. $ctx2.sendIdx["collection"]=2;
  2943. return self._assert_equals_($1,$2);
  2944. $ctx2.sendIdx["assert:equals:"]=1;
  2945. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2946. self._samplesDo_((function(index,value){
  2947. var collection;
  2948. return smalltalk.withContext(function($ctx2) {
  2949. collection=self._collection();
  2950. $ctx2.sendIdx["collection"]=3;
  2951. collection;
  2952. $3=_st(collection)._removeKey_(index);
  2953. $ctx2.sendIdx["removeKey:"]=2;
  2954. self._assert_equals_($3,value);
  2955. $ctx2.sendIdx["assert:equals:"]=2;
  2956. $5=collection;
  2957. $6=self._collection();
  2958. $ctx2.sendIdx["collection"]=4;
  2959. $4=_st($5).__eq($6);
  2960. return self._deny_($4);
  2961. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2962. $7=self._collectionWithNewValue();
  2963. _st($7)._removeKey_(self._sampleNewIndex());
  2964. $8=_st($7)._yourself();
  2965. self._assert_equals_($8,self._collection());
  2966. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},smalltalk.AssociativeCollectionTest)})},
  2967. args: [],
  2968. 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",
  2969. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2970. referencedClasses: ["Error"]
  2971. }),
  2972. smalltalk.AssociativeCollectionTest);
  2973. smalltalk.addMethod(
  2974. smalltalk.method({
  2975. selector: "testRemoveKeyIfAbsent",
  2976. protocol: 'tests',
  2977. fn: function (){
  2978. var self=this;
  2979. return smalltalk.withContext(function($ctx1) {
  2980. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2981. self._nonIndexesDo_((function(each){
  2982. var collection;
  2983. return smalltalk.withContext(function($ctx2) {
  2984. collection=self._collection();
  2985. $ctx2.sendIdx["collection"]=1;
  2986. collection;
  2987. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2988. return smalltalk.withContext(function($ctx3) {
  2989. return self._sampleNewValue();
  2990. $ctx3.sendIdx["sampleNewValue"]=1;
  2991. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2992. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2993. $2=self._sampleNewValue();
  2994. $ctx2.sendIdx["sampleNewValue"]=2;
  2995. self._assert_equals_($1,$2);
  2996. $ctx2.sendIdx["assert:equals:"]=1;
  2997. $3=collection;
  2998. $4=self._collection();
  2999. $ctx2.sendIdx["collection"]=2;
  3000. return self._assert_equals_($3,$4);
  3001. $ctx2.sendIdx["assert:equals:"]=2;
  3002. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3003. self._samplesDo_((function(index,value){
  3004. var collection;
  3005. return smalltalk.withContext(function($ctx2) {
  3006. collection=self._collection();
  3007. $ctx2.sendIdx["collection"]=3;
  3008. collection;
  3009. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3010. return smalltalk.withContext(function($ctx3) {
  3011. return self._sampleNewValue();
  3012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3013. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3014. self._assert_equals_($5,value);
  3015. $ctx2.sendIdx["assert:equals:"]=3;
  3016. $7=collection;
  3017. $8=self._collection();
  3018. $ctx2.sendIdx["collection"]=4;
  3019. $6=_st($7).__eq($8);
  3020. return self._deny_($6);
  3021. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3022. $9=self._collectionWithNewValue();
  3023. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3024. return smalltalk.withContext(function($ctx2) {
  3025. return self._assert_(false);
  3026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3027. $10=_st($9)._yourself();
  3028. self._assert_equals_($10,self._collection());
  3029. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},smalltalk.AssociativeCollectionTest)})},
  3030. args: [],
  3031. 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",
  3032. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3033. referencedClasses: []
  3034. }),
  3035. smalltalk.AssociativeCollectionTest);
  3036. smalltalk.addMethod(
  3037. smalltalk.method({
  3038. selector: "testValues",
  3039. protocol: 'tests',
  3040. fn: function (){
  3041. var self=this;
  3042. return smalltalk.withContext(function($ctx1) {
  3043. var $2,$1,$3,$4;
  3044. $2=_st(_st(self._collectionClass())._new())._values();
  3045. $ctx1.sendIdx["values"]=1;
  3046. $1=_st($2)._isEmpty();
  3047. self._assert_($1);
  3048. $3=_st(self._collection())._values();
  3049. $ctx1.sendIdx["values"]=2;
  3050. $4=self._collectionValues();
  3051. $ctx1.sendIdx["collectionValues"]=1;
  3052. self._assertSameContents_as_($3,$4);
  3053. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3054. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3055. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},smalltalk.AssociativeCollectionTest)})},
  3056. args: [],
  3057. 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 }",
  3058. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3059. referencedClasses: []
  3060. }),
  3061. smalltalk.AssociativeCollectionTest);
  3062. smalltalk.addClass('DictionaryTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3063. smalltalk.addMethod(
  3064. smalltalk.method({
  3065. selector: "collection",
  3066. protocol: 'fixture',
  3067. fn: function (){
  3068. var self=this;
  3069. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3070. return smalltalk.withContext(function($ctx1) {
  3071. var $2,$3,$1;
  3072. $2=_st($Dictionary())._new();
  3073. _st($2)._at_put_((1),(1));
  3074. $ctx1.sendIdx["at:put:"]=1;
  3075. _st($2)._at_put_("a",(2));
  3076. $ctx1.sendIdx["at:put:"]=2;
  3077. _st($2)._at_put_(true,(3));
  3078. $ctx1.sendIdx["at:put:"]=3;
  3079. _st($2)._at_put_((1).__at((3)),(-4));
  3080. $3=_st($2)._yourself();
  3081. $1=$3;
  3082. return $1;
  3083. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  3084. args: [],
  3085. 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",
  3086. messageSends: ["at:put:", "new", "@", "yourself"],
  3087. referencedClasses: ["Dictionary"]
  3088. }),
  3089. smalltalk.DictionaryTest);
  3090. smalltalk.addMethod(
  3091. smalltalk.method({
  3092. selector: "collectionKeys",
  3093. protocol: 'fixture',
  3094. fn: function (){
  3095. var self=this;
  3096. return smalltalk.withContext(function($ctx1) {
  3097. var $1;
  3098. $1=[(1),"a",true,(1).__at((3))];
  3099. return $1;
  3100. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.DictionaryTest)})},
  3101. args: [],
  3102. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3103. messageSends: ["@"],
  3104. referencedClasses: []
  3105. }),
  3106. smalltalk.DictionaryTest);
  3107. smalltalk.addMethod(
  3108. smalltalk.method({
  3109. selector: "collectionOfPrintStrings",
  3110. protocol: 'fixture',
  3111. fn: function (){
  3112. var self=this;
  3113. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3114. return smalltalk.withContext(function($ctx1) {
  3115. var $2,$3,$1;
  3116. $2=_st($Dictionary())._new();
  3117. _st($2)._at_put_((1),"1");
  3118. $ctx1.sendIdx["at:put:"]=1;
  3119. _st($2)._at_put_("a","2");
  3120. $ctx1.sendIdx["at:put:"]=2;
  3121. _st($2)._at_put_(true,"3");
  3122. $ctx1.sendIdx["at:put:"]=3;
  3123. _st($2)._at_put_((1).__at((3)),"-4");
  3124. $3=_st($2)._yourself();
  3125. $1=$3;
  3126. return $1;
  3127. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  3128. args: [],
  3129. 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",
  3130. messageSends: ["at:put:", "new", "@", "yourself"],
  3131. referencedClasses: ["Dictionary"]
  3132. }),
  3133. smalltalk.DictionaryTest);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "collectionSize",
  3137. protocol: 'fixture',
  3138. fn: function (){
  3139. var self=this;
  3140. return smalltalk.withContext(function($ctx1) {
  3141. return (4);
  3142. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  3143. args: [],
  3144. source: "collectionSize\x0a\x09^ 4",
  3145. messageSends: [],
  3146. referencedClasses: []
  3147. }),
  3148. smalltalk.DictionaryTest);
  3149. smalltalk.addMethod(
  3150. smalltalk.method({
  3151. selector: "collectionValues",
  3152. protocol: 'fixture',
  3153. fn: function (){
  3154. var self=this;
  3155. return smalltalk.withContext(function($ctx1) {
  3156. var $1;
  3157. $1=[(1),(2),(3),(-4)];
  3158. return $1;
  3159. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.DictionaryTest)})},
  3160. args: [],
  3161. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3162. messageSends: [],
  3163. referencedClasses: []
  3164. }),
  3165. smalltalk.DictionaryTest);
  3166. smalltalk.addMethod(
  3167. smalltalk.method({
  3168. selector: "collectionWithDuplicates",
  3169. protocol: 'fixture',
  3170. fn: function (){
  3171. var self=this;
  3172. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3173. return smalltalk.withContext(function($ctx1) {
  3174. var $2,$3,$1;
  3175. $2=_st($Dictionary())._new();
  3176. _st($2)._at_put_((1),(1));
  3177. $ctx1.sendIdx["at:put:"]=1;
  3178. _st($2)._at_put_("a",(2));
  3179. $ctx1.sendIdx["at:put:"]=2;
  3180. _st($2)._at_put_(true,(3));
  3181. $ctx1.sendIdx["at:put:"]=3;
  3182. _st($2)._at_put_((4),(-4));
  3183. $ctx1.sendIdx["at:put:"]=4;
  3184. _st($2)._at_put_("b",(1));
  3185. $ctx1.sendIdx["at:put:"]=5;
  3186. _st($2)._at_put_((3),(3));
  3187. $ctx1.sendIdx["at:put:"]=6;
  3188. _st($2)._at_put_(false,(12));
  3189. $3=_st($2)._yourself();
  3190. $1=$3;
  3191. return $1;
  3192. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  3193. args: [],
  3194. 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",
  3195. messageSends: ["at:put:", "new", "yourself"],
  3196. referencedClasses: ["Dictionary"]
  3197. }),
  3198. smalltalk.DictionaryTest);
  3199. smalltalk.addMethod(
  3200. smalltalk.method({
  3201. selector: "collectionWithNewValue",
  3202. protocol: 'fixture',
  3203. fn: function (){
  3204. var self=this;
  3205. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3206. return smalltalk.withContext(function($ctx1) {
  3207. var $2,$3,$1;
  3208. $2=_st($Dictionary())._new();
  3209. _st($2)._at_put_((1),(1));
  3210. $ctx1.sendIdx["at:put:"]=1;
  3211. _st($2)._at_put_("a",(2));
  3212. $ctx1.sendIdx["at:put:"]=2;
  3213. _st($2)._at_put_(true,(3));
  3214. $ctx1.sendIdx["at:put:"]=3;
  3215. _st($2)._at_put_((1).__at((3)),(-4));
  3216. $ctx1.sendIdx["at:put:"]=4;
  3217. _st($2)._at_put_("new","N");
  3218. $3=_st($2)._yourself();
  3219. $1=$3;
  3220. return $1;
  3221. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3222. args: [],
  3223. 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",
  3224. messageSends: ["at:put:", "new", "@", "yourself"],
  3225. referencedClasses: ["Dictionary"]
  3226. }),
  3227. smalltalk.DictionaryTest);
  3228. smalltalk.addMethod(
  3229. smalltalk.method({
  3230. selector: "sampleNewValueAsCollection",
  3231. protocol: 'fixture',
  3232. fn: function (){
  3233. var self=this;
  3234. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3235. return smalltalk.withContext(function($ctx1) {
  3236. var $2,$3,$1;
  3237. $2=_st($Dictionary())._new();
  3238. _st($2)._at_put_("new","N");
  3239. $3=_st($2)._yourself();
  3240. $1=$3;
  3241. return $1;
  3242. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3243. args: [],
  3244. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3245. messageSends: ["at:put:", "new", "yourself"],
  3246. referencedClasses: ["Dictionary"]
  3247. }),
  3248. smalltalk.DictionaryTest);
  3249. smalltalk.addMethod(
  3250. smalltalk.method({
  3251. selector: "samplesDo:",
  3252. protocol: 'fixture',
  3253. fn: function (aBlock){
  3254. var self=this;
  3255. return smalltalk.withContext(function($ctx1) {
  3256. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3257. _st(aBlock)._value_value_(true,(3));
  3258. $ctx1.sendIdx["value:value:"]=1;
  3259. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3260. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3261. args: ["aBlock"],
  3262. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3263. messageSends: ["samplesDo:", "value:value:", "@"],
  3264. referencedClasses: []
  3265. }),
  3266. smalltalk.DictionaryTest);
  3267. smalltalk.addMethod(
  3268. smalltalk.method({
  3269. selector: "testAccessing",
  3270. protocol: 'tests',
  3271. fn: function (){
  3272. var self=this;
  3273. var d;
  3274. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3275. return smalltalk.withContext(function($ctx1) {
  3276. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3277. d=_st($Dictionary())._new();
  3278. _st(d)._at_put_("hello","world");
  3279. $ctx1.sendIdx["at:put:"]=1;
  3280. $1=_st(d)._at_("hello");
  3281. $ctx1.sendIdx["at:"]=1;
  3282. self._assert_equals_($1,"world");
  3283. $ctx1.sendIdx["assert:equals:"]=1;
  3284. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3285. return smalltalk.withContext(function($ctx2) {
  3286. return nil;
  3287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3288. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3289. self._assert_equals_($2,"world");
  3290. $ctx1.sendIdx["assert:equals:"]=2;
  3291. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3292. return smalltalk.withContext(function($ctx2) {
  3293. return nil;
  3294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3295. $ctx1.sendIdx["deny:"]=1;
  3296. $3=_st(d)._includesKey_("hello");
  3297. $ctx1.sendIdx["includesKey:"]=1;
  3298. self._assert_($3);
  3299. $ctx1.sendIdx["assert:"]=1;
  3300. $4=_st(d)._includesKey_("foo");
  3301. $ctx1.sendIdx["includesKey:"]=2;
  3302. self._deny_($4);
  3303. $ctx1.sendIdx["deny:"]=2;
  3304. _st(d)._at_put_((1),(2));
  3305. $ctx1.sendIdx["at:put:"]=2;
  3306. $5=_st(d)._at_((1));
  3307. $ctx1.sendIdx["at:"]=2;
  3308. self._assert_equals_($5,(2));
  3309. $ctx1.sendIdx["assert:equals:"]=3;
  3310. $6=d;
  3311. $7=(1).__at((3));
  3312. $ctx1.sendIdx["@"]=1;
  3313. _st($6)._at_put_($7,(3));
  3314. $9=d;
  3315. $10=(1).__at((3));
  3316. $ctx1.sendIdx["@"]=2;
  3317. $8=_st($9)._at_($10);
  3318. self._assert_equals_($8,(3));
  3319. $12=d;
  3320. $13=(1).__at((3));
  3321. $ctx1.sendIdx["@"]=3;
  3322. $11=_st($12)._includesKey_($13);
  3323. $ctx1.sendIdx["includesKey:"]=3;
  3324. self._assert_($11);
  3325. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3326. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3327. args: [],
  3328. 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)",
  3329. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3330. referencedClasses: ["Dictionary"]
  3331. }),
  3332. smalltalk.DictionaryTest);
  3333. smalltalk.addMethod(
  3334. smalltalk.method({
  3335. selector: "testDynamicDictionaries",
  3336. protocol: 'tests',
  3337. fn: function (){
  3338. var self=this;
  3339. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3340. return smalltalk.withContext(function($ctx1) {
  3341. var $3,$2,$1;
  3342. $3="hello".__minus_gt((1));
  3343. $ctx1.sendIdx["->"]=1;
  3344. $2=smalltalk.HashedCollection._from_([$3]);
  3345. $1=_st($2)._asDictionary();
  3346. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3347. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3348. args: [],
  3349. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3350. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3351. referencedClasses: ["Dictionary"]
  3352. }),
  3353. smalltalk.DictionaryTest);
  3354. smalltalk.addMethod(
  3355. smalltalk.method({
  3356. selector: "collectionClass",
  3357. protocol: 'fixture',
  3358. fn: function (){
  3359. var self=this;
  3360. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3361. return smalltalk.withContext(function($ctx1) {
  3362. return $Dictionary();
  3363. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3364. args: [],
  3365. source: "collectionClass\x0a\x09^ Dictionary",
  3366. messageSends: [],
  3367. referencedClasses: ["Dictionary"]
  3368. }),
  3369. smalltalk.DictionaryTest.klass);
  3370. smalltalk.addClass('HashedCollectionTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3371. smalltalk.addMethod(
  3372. smalltalk.method({
  3373. selector: "collection",
  3374. protocol: 'fixture',
  3375. fn: function (){
  3376. var self=this;
  3377. return smalltalk.withContext(function($ctx1) {
  3378. var $2,$3,$4,$1;
  3379. $2="b".__minus_gt((1));
  3380. $ctx1.sendIdx["->"]=1;
  3381. $3="a".__minus_gt((2));
  3382. $ctx1.sendIdx["->"]=2;
  3383. $4="c".__minus_gt((3));
  3384. $ctx1.sendIdx["->"]=3;
  3385. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3386. return $1;
  3387. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  3388. args: [],
  3389. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3390. messageSends: ["->"],
  3391. referencedClasses: []
  3392. }),
  3393. smalltalk.HashedCollectionTest);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "collectionKeys",
  3397. protocol: 'fixture',
  3398. fn: function (){
  3399. var self=this;
  3400. return smalltalk.withContext(function($ctx1) {
  3401. var $1;
  3402. $1=["b","a","c","d"];
  3403. return $1;
  3404. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.HashedCollectionTest)})},
  3405. args: [],
  3406. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3407. messageSends: [],
  3408. referencedClasses: []
  3409. }),
  3410. smalltalk.HashedCollectionTest);
  3411. smalltalk.addMethod(
  3412. smalltalk.method({
  3413. selector: "collectionOfPrintStrings",
  3414. protocol: 'fixture',
  3415. fn: function (){
  3416. var self=this;
  3417. return smalltalk.withContext(function($ctx1) {
  3418. var $2,$3,$4,$1;
  3419. $2="b".__minus_gt("1");
  3420. $ctx1.sendIdx["->"]=1;
  3421. $3="a".__minus_gt("2");
  3422. $ctx1.sendIdx["->"]=2;
  3423. $4="c".__minus_gt("3");
  3424. $ctx1.sendIdx["->"]=3;
  3425. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3426. return $1;
  3427. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  3428. args: [],
  3429. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3430. messageSends: ["->"],
  3431. referencedClasses: []
  3432. }),
  3433. smalltalk.HashedCollectionTest);
  3434. smalltalk.addMethod(
  3435. smalltalk.method({
  3436. selector: "collectionSize",
  3437. protocol: 'fixture',
  3438. fn: function (){
  3439. var self=this;
  3440. return smalltalk.withContext(function($ctx1) {
  3441. return (4);
  3442. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  3443. args: [],
  3444. source: "collectionSize\x0a\x09^ 4",
  3445. messageSends: [],
  3446. referencedClasses: []
  3447. }),
  3448. smalltalk.HashedCollectionTest);
  3449. smalltalk.addMethod(
  3450. smalltalk.method({
  3451. selector: "collectionValues",
  3452. protocol: 'fixture',
  3453. fn: function (){
  3454. var self=this;
  3455. return smalltalk.withContext(function($ctx1) {
  3456. var $1;
  3457. $1=[(1),(2),(3),(-4)];
  3458. return $1;
  3459. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.HashedCollectionTest)})},
  3460. args: [],
  3461. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3462. messageSends: [],
  3463. referencedClasses: []
  3464. }),
  3465. smalltalk.HashedCollectionTest);
  3466. smalltalk.addMethod(
  3467. smalltalk.method({
  3468. selector: "collectionWithDuplicates",
  3469. protocol: 'fixture',
  3470. fn: function (){
  3471. var self=this;
  3472. return smalltalk.withContext(function($ctx1) {
  3473. var $2,$3,$4,$5,$6,$7,$1;
  3474. $2="b".__minus_gt((1));
  3475. $ctx1.sendIdx["->"]=1;
  3476. $3="a".__minus_gt((2));
  3477. $ctx1.sendIdx["->"]=2;
  3478. $4="c".__minus_gt((3));
  3479. $ctx1.sendIdx["->"]=3;
  3480. $5="d".__minus_gt((-4));
  3481. $ctx1.sendIdx["->"]=4;
  3482. $6="e".__minus_gt((1));
  3483. $ctx1.sendIdx["->"]=5;
  3484. $7="f".__minus_gt((2));
  3485. $ctx1.sendIdx["->"]=6;
  3486. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3487. return $1;
  3488. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  3489. args: [],
  3490. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3491. messageSends: ["->"],
  3492. referencedClasses: []
  3493. }),
  3494. smalltalk.HashedCollectionTest);
  3495. smalltalk.addMethod(
  3496. smalltalk.method({
  3497. selector: "collectionWithNewValue",
  3498. protocol: 'fixture',
  3499. fn: function (){
  3500. var self=this;
  3501. return smalltalk.withContext(function($ctx1) {
  3502. var $2,$3,$4,$5,$1;
  3503. $2="b".__minus_gt((1));
  3504. $ctx1.sendIdx["->"]=1;
  3505. $3="a".__minus_gt((2));
  3506. $ctx1.sendIdx["->"]=2;
  3507. $4="c".__minus_gt((3));
  3508. $ctx1.sendIdx["->"]=3;
  3509. $5="d".__minus_gt((-4));
  3510. $ctx1.sendIdx["->"]=4;
  3511. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3512. return $1;
  3513. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  3514. args: [],
  3515. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3516. messageSends: ["->"],
  3517. referencedClasses: []
  3518. }),
  3519. smalltalk.HashedCollectionTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "sampleNewValueAsCollection",
  3523. protocol: 'fixture',
  3524. fn: function (){
  3525. var self=this;
  3526. return smalltalk.withContext(function($ctx1) {
  3527. var $1;
  3528. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  3529. return $1;
  3530. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  3531. args: [],
  3532. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3533. messageSends: ["->"],
  3534. referencedClasses: []
  3535. }),
  3536. smalltalk.HashedCollectionTest);
  3537. smalltalk.addMethod(
  3538. smalltalk.method({
  3539. selector: "testDynamicDictionaries",
  3540. protocol: 'tests',
  3541. fn: function (){
  3542. var self=this;
  3543. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3544. return smalltalk.withContext(function($ctx1) {
  3545. var $3,$2,$1;
  3546. $3="hello".__minus_gt((1));
  3547. $ctx1.sendIdx["->"]=1;
  3548. $2=smalltalk.HashedCollection._from_([$3]);
  3549. $1=_st($2)._asHashedCollection();
  3550. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3551. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.HashedCollectionTest)})},
  3552. args: [],
  3553. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3554. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3555. referencedClasses: ["HashedCollection"]
  3556. }),
  3557. smalltalk.HashedCollectionTest);
  3558. smalltalk.addMethod(
  3559. smalltalk.method({
  3560. selector: "collectionClass",
  3561. protocol: 'fixture',
  3562. fn: function (){
  3563. var self=this;
  3564. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3565. return smalltalk.withContext(function($ctx1) {
  3566. return $HashedCollection();
  3567. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  3568. args: [],
  3569. source: "collectionClass\x0a\x09^ HashedCollection",
  3570. messageSends: [],
  3571. referencedClasses: ["HashedCollection"]
  3572. }),
  3573. smalltalk.HashedCollectionTest.klass);
  3574. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3575. smalltalk.addMethod(
  3576. smalltalk.method({
  3577. selector: "collectionFirst",
  3578. protocol: 'fixture',
  3579. fn: function (){
  3580. var self=this;
  3581. return smalltalk.withContext(function($ctx1) {
  3582. self._subclassResponsibility();
  3583. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3584. args: [],
  3585. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3586. messageSends: ["subclassResponsibility"],
  3587. referencedClasses: []
  3588. }),
  3589. smalltalk.SequenceableCollectionTest);
  3590. smalltalk.addMethod(
  3591. smalltalk.method({
  3592. selector: "collectionFirstTwo",
  3593. protocol: 'fixture',
  3594. fn: function (){
  3595. var self=this;
  3596. return smalltalk.withContext(function($ctx1) {
  3597. self._subclassResponsibility();
  3598. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3599. args: [],
  3600. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3601. messageSends: ["subclassResponsibility"],
  3602. referencedClasses: []
  3603. }),
  3604. smalltalk.SequenceableCollectionTest);
  3605. smalltalk.addMethod(
  3606. smalltalk.method({
  3607. selector: "collectionLast",
  3608. protocol: 'fixture',
  3609. fn: function (){
  3610. var self=this;
  3611. return smalltalk.withContext(function($ctx1) {
  3612. self._subclassResponsibility();
  3613. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3614. args: [],
  3615. source: "collectionLast\x0a\x09self subclassResponsibility",
  3616. messageSends: ["subclassResponsibility"],
  3617. referencedClasses: []
  3618. }),
  3619. smalltalk.SequenceableCollectionTest);
  3620. smalltalk.addMethod(
  3621. smalltalk.method({
  3622. selector: "collectionLastTwo",
  3623. protocol: 'fixture',
  3624. fn: function (){
  3625. var self=this;
  3626. return smalltalk.withContext(function($ctx1) {
  3627. self._subclassResponsibility();
  3628. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3629. args: [],
  3630. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3631. messageSends: ["subclassResponsibility"],
  3632. referencedClasses: []
  3633. }),
  3634. smalltalk.SequenceableCollectionTest);
  3635. smalltalk.addMethod(
  3636. smalltalk.method({
  3637. selector: "nonIndexesDo:",
  3638. protocol: 'fixture',
  3639. fn: function (aBlock){
  3640. var self=this;
  3641. return smalltalk.withContext(function($ctx1) {
  3642. _st(aBlock)._value_((0));
  3643. $ctx1.sendIdx["value:"]=1;
  3644. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3645. $ctx1.sendIdx["value:"]=2;
  3646. _st(aBlock)._value_("z");
  3647. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3648. args: ["aBlock"],
  3649. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3650. messageSends: ["value:", "+", "collectionSize"],
  3651. referencedClasses: []
  3652. }),
  3653. smalltalk.SequenceableCollectionTest);
  3654. smalltalk.addMethod(
  3655. smalltalk.method({
  3656. selector: "samplesDo:",
  3657. protocol: 'fixture',
  3658. fn: function (aBlock){
  3659. var self=this;
  3660. return smalltalk.withContext(function($ctx1) {
  3661. _st(aBlock)._value_value_((1),self._collectionFirst());
  3662. $ctx1.sendIdx["value:value:"]=1;
  3663. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3664. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3665. args: ["aBlock"],
  3666. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3667. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3668. referencedClasses: []
  3669. }),
  3670. smalltalk.SequenceableCollectionTest);
  3671. smalltalk.addMethod(
  3672. smalltalk.method({
  3673. selector: "testBeginsWith",
  3674. protocol: 'tests',
  3675. fn: function (){
  3676. var self=this;
  3677. return smalltalk.withContext(function($ctx1) {
  3678. var $2,$1,$4,$5,$3,$7,$6;
  3679. $2=self._collection();
  3680. $ctx1.sendIdx["collection"]=1;
  3681. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3682. $ctx1.sendIdx["beginsWith:"]=1;
  3683. self._assert_($1);
  3684. $ctx1.sendIdx["assert:"]=1;
  3685. $4=self._collection();
  3686. $ctx1.sendIdx["collection"]=2;
  3687. $5=self._collection();
  3688. $ctx1.sendIdx["collection"]=3;
  3689. $3=_st($4)._beginsWith_($5);
  3690. $ctx1.sendIdx["beginsWith:"]=2;
  3691. self._assert_($3);
  3692. $ctx1.sendIdx["assert:"]=2;
  3693. $7=self._collection();
  3694. $ctx1.sendIdx["collection"]=4;
  3695. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3696. $ctx1.sendIdx["beginsWith:"]=3;
  3697. self._assert_($6);
  3698. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3699. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3700. args: [],
  3701. 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)",
  3702. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3703. referencedClasses: []
  3704. }),
  3705. smalltalk.SequenceableCollectionTest);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "testEndsWith",
  3709. protocol: 'tests',
  3710. fn: function (){
  3711. var self=this;
  3712. return smalltalk.withContext(function($ctx1) {
  3713. var $2,$1,$4,$5,$3,$7,$6;
  3714. $2=self._collection();
  3715. $ctx1.sendIdx["collection"]=1;
  3716. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3717. $ctx1.sendIdx["endsWith:"]=1;
  3718. self._assert_($1);
  3719. $ctx1.sendIdx["assert:"]=1;
  3720. $4=self._collection();
  3721. $ctx1.sendIdx["collection"]=2;
  3722. $5=self._collection();
  3723. $ctx1.sendIdx["collection"]=3;
  3724. $3=_st($4)._endsWith_($5);
  3725. $ctx1.sendIdx["endsWith:"]=2;
  3726. self._assert_($3);
  3727. $ctx1.sendIdx["assert:"]=2;
  3728. $7=self._collection();
  3729. $ctx1.sendIdx["collection"]=4;
  3730. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3731. $ctx1.sendIdx["endsWith:"]=3;
  3732. self._assert_($6);
  3733. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3734. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3735. args: [],
  3736. 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)",
  3737. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3738. referencedClasses: []
  3739. }),
  3740. smalltalk.SequenceableCollectionTest);
  3741. smalltalk.addMethod(
  3742. smalltalk.method({
  3743. selector: "testFirst",
  3744. protocol: 'tests',
  3745. fn: function (){
  3746. var self=this;
  3747. return smalltalk.withContext(function($ctx1) {
  3748. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3749. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3750. args: [],
  3751. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3752. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3753. referencedClasses: []
  3754. }),
  3755. smalltalk.SequenceableCollectionTest);
  3756. smalltalk.addMethod(
  3757. smalltalk.method({
  3758. selector: "testFirstN",
  3759. protocol: 'tests',
  3760. fn: function (){
  3761. var self=this;
  3762. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3763. return smalltalk.withContext(function($ctx1) {
  3764. var $2,$1,$4,$3,$6,$5,$7;
  3765. $2=self._collection();
  3766. $ctx1.sendIdx["collection"]=1;
  3767. $1=_st($2)._first_((2));
  3768. $ctx1.sendIdx["first:"]=1;
  3769. self._assert_equals_($1,self._collectionFirstTwo());
  3770. $ctx1.sendIdx["assert:equals:"]=1;
  3771. $4=self._collection();
  3772. $ctx1.sendIdx["collection"]=2;
  3773. $3=_st($4)._first_((0));
  3774. $ctx1.sendIdx["first:"]=2;
  3775. self._assert_equals_($3,_st(self._collectionClass())._new());
  3776. $ctx1.sendIdx["assert:equals:"]=2;
  3777. $6=self._collection();
  3778. $ctx1.sendIdx["collection"]=3;
  3779. $5=_st($6)._first_(self._collectionSize());
  3780. $ctx1.sendIdx["first:"]=3;
  3781. $7=self._collection();
  3782. $ctx1.sendIdx["collection"]=4;
  3783. self._assert_equals_($5,$7);
  3784. self._should_raise_((function(){
  3785. return smalltalk.withContext(function($ctx2) {
  3786. return _st(self._collection())._first_((33));
  3787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3788. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3789. args: [],
  3790. 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",
  3791. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3792. referencedClasses: ["Error"]
  3793. }),
  3794. smalltalk.SequenceableCollectionTest);
  3795. smalltalk.addMethod(
  3796. smalltalk.method({
  3797. selector: "testFourth",
  3798. protocol: 'tests',
  3799. fn: function (){
  3800. var self=this;
  3801. return smalltalk.withContext(function($ctx1) {
  3802. var $2,$1;
  3803. $2=self._collection();
  3804. $ctx1.sendIdx["collection"]=1;
  3805. $1=_st($2)._fourth();
  3806. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3807. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3808. args: [],
  3809. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3810. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3811. referencedClasses: []
  3812. }),
  3813. smalltalk.SequenceableCollectionTest);
  3814. smalltalk.addMethod(
  3815. smalltalk.method({
  3816. selector: "testIndexOfStartingAt",
  3817. protocol: 'tests',
  3818. fn: function (){
  3819. var self=this;
  3820. var jsNull;
  3821. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3822. return smalltalk.withContext(function($ctx1) {
  3823. var $2,$1,$4,$3;
  3824. jsNull=_st($JSON())._parse_("null");
  3825. self._samplesDo_((function(index,value){
  3826. return smalltalk.withContext(function($ctx2) {
  3827. $2=self._collection();
  3828. $ctx2.sendIdx["collection"]=1;
  3829. $1=_st($2)._indexOf_startingAt_(value,(1));
  3830. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3831. self._assert_equals_($1,index);
  3832. $ctx2.sendIdx["assert:equals:"]=1;
  3833. $4=self._collection();
  3834. $ctx2.sendIdx["collection"]=2;
  3835. $3=_st($4)._indexOf_startingAt_(value,index);
  3836. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3837. self._assert_equals_($3,index);
  3838. $ctx2.sendIdx["assert:equals:"]=2;
  3839. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3840. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3841. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3842. args: [],
  3843. 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 ]",
  3844. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3845. referencedClasses: ["JSON"]
  3846. }),
  3847. smalltalk.SequenceableCollectionTest);
  3848. smalltalk.addMethod(
  3849. smalltalk.method({
  3850. selector: "testIndexOfStartingAtWithNull",
  3851. protocol: 'tests',
  3852. fn: function (){
  3853. var self=this;
  3854. var jsNull;
  3855. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3856. return smalltalk.withContext(function($ctx1) {
  3857. var $1,$2;
  3858. jsNull=_st($JSON())._parse_("null");
  3859. self._samplesDo_((function(index,value){
  3860. var collection;
  3861. return smalltalk.withContext(function($ctx2) {
  3862. collection=self._collection();
  3863. collection;
  3864. _st(collection)._at_put_(index,jsNull);
  3865. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3866. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3867. self._assert_equals_($1,index);
  3868. $ctx2.sendIdx["assert:equals:"]=1;
  3869. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3870. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3871. self._assert_equals_($2,index);
  3872. $ctx2.sendIdx["assert:equals:"]=2;
  3873. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3874. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3875. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3876. args: [],
  3877. 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 ]",
  3878. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3879. referencedClasses: ["JSON"]
  3880. }),
  3881. smalltalk.SequenceableCollectionTest);
  3882. smalltalk.addMethod(
  3883. smalltalk.method({
  3884. selector: "testLast",
  3885. protocol: 'tests',
  3886. fn: function (){
  3887. var self=this;
  3888. return smalltalk.withContext(function($ctx1) {
  3889. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3890. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3891. args: [],
  3892. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3893. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3894. referencedClasses: []
  3895. }),
  3896. smalltalk.SequenceableCollectionTest);
  3897. smalltalk.addMethod(
  3898. smalltalk.method({
  3899. selector: "testLastN",
  3900. protocol: 'tests',
  3901. fn: function (){
  3902. var self=this;
  3903. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3904. return smalltalk.withContext(function($ctx1) {
  3905. var $2,$1,$4,$3,$6,$5,$7;
  3906. $2=self._collection();
  3907. $ctx1.sendIdx["collection"]=1;
  3908. $1=_st($2)._last_((2));
  3909. $ctx1.sendIdx["last:"]=1;
  3910. self._assert_equals_($1,self._collectionLastTwo());
  3911. $ctx1.sendIdx["assert:equals:"]=1;
  3912. $4=self._collection();
  3913. $ctx1.sendIdx["collection"]=2;
  3914. $3=_st($4)._last_((0));
  3915. $ctx1.sendIdx["last:"]=2;
  3916. self._assert_equals_($3,_st(self._collectionClass())._new());
  3917. $ctx1.sendIdx["assert:equals:"]=2;
  3918. $6=self._collection();
  3919. $ctx1.sendIdx["collection"]=3;
  3920. $5=_st($6)._last_(self._collectionSize());
  3921. $ctx1.sendIdx["last:"]=3;
  3922. $7=self._collection();
  3923. $ctx1.sendIdx["collection"]=4;
  3924. self._assert_equals_($5,$7);
  3925. self._should_raise_((function(){
  3926. return smalltalk.withContext(function($ctx2) {
  3927. return _st(self._collection())._last_((33));
  3928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3929. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3930. args: [],
  3931. 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",
  3932. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3933. referencedClasses: ["Error"]
  3934. }),
  3935. smalltalk.SequenceableCollectionTest);
  3936. smalltalk.addMethod(
  3937. smalltalk.method({
  3938. selector: "testSecond",
  3939. protocol: 'tests',
  3940. fn: function (){
  3941. var self=this;
  3942. return smalltalk.withContext(function($ctx1) {
  3943. var $2,$1;
  3944. $2=self._collection();
  3945. $ctx1.sendIdx["collection"]=1;
  3946. $1=_st($2)._second();
  3947. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3948. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3949. args: [],
  3950. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3951. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3952. referencedClasses: []
  3953. }),
  3954. smalltalk.SequenceableCollectionTest);
  3955. smalltalk.addMethod(
  3956. smalltalk.method({
  3957. selector: "testThird",
  3958. protocol: 'tests',
  3959. fn: function (){
  3960. var self=this;
  3961. return smalltalk.withContext(function($ctx1) {
  3962. var $2,$1;
  3963. $2=self._collection();
  3964. $ctx1.sendIdx["collection"]=1;
  3965. $1=_st($2)._third();
  3966. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3967. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3968. args: [],
  3969. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3970. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3971. referencedClasses: []
  3972. }),
  3973. smalltalk.SequenceableCollectionTest);
  3974. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3975. smalltalk.addMethod(
  3976. smalltalk.method({
  3977. selector: "collection",
  3978. protocol: 'fixture',
  3979. fn: function (){
  3980. var self=this;
  3981. return smalltalk.withContext(function($ctx1) {
  3982. var $1;
  3983. $1=[(1), (2), (3), (-4)];
  3984. return $1;
  3985. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3986. args: [],
  3987. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3988. messageSends: [],
  3989. referencedClasses: []
  3990. }),
  3991. smalltalk.ArrayTest);
  3992. smalltalk.addMethod(
  3993. smalltalk.method({
  3994. selector: "collectionFirst",
  3995. protocol: 'fixture',
  3996. fn: function (){
  3997. var self=this;
  3998. return smalltalk.withContext(function($ctx1) {
  3999. return (1);
  4000. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  4001. args: [],
  4002. source: "collectionFirst\x0a\x09^ 1",
  4003. messageSends: [],
  4004. referencedClasses: []
  4005. }),
  4006. smalltalk.ArrayTest);
  4007. smalltalk.addMethod(
  4008. smalltalk.method({
  4009. selector: "collectionFirstTwo",
  4010. protocol: 'fixture',
  4011. fn: function (){
  4012. var self=this;
  4013. return smalltalk.withContext(function($ctx1) {
  4014. var $1;
  4015. $1=[(1), (2)];
  4016. return $1;
  4017. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  4018. args: [],
  4019. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4020. messageSends: [],
  4021. referencedClasses: []
  4022. }),
  4023. smalltalk.ArrayTest);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "collectionLast",
  4027. protocol: 'fixture',
  4028. fn: function (){
  4029. var self=this;
  4030. return smalltalk.withContext(function($ctx1) {
  4031. return (-4);
  4032. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  4033. args: [],
  4034. source: "collectionLast\x0a\x09^ -4",
  4035. messageSends: [],
  4036. referencedClasses: []
  4037. }),
  4038. smalltalk.ArrayTest);
  4039. smalltalk.addMethod(
  4040. smalltalk.method({
  4041. selector: "collectionLastTwo",
  4042. protocol: 'fixture',
  4043. fn: function (){
  4044. var self=this;
  4045. return smalltalk.withContext(function($ctx1) {
  4046. var $1;
  4047. $1=[(3), (-4)];
  4048. return $1;
  4049. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  4050. args: [],
  4051. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4052. messageSends: [],
  4053. referencedClasses: []
  4054. }),
  4055. smalltalk.ArrayTest);
  4056. smalltalk.addMethod(
  4057. smalltalk.method({
  4058. selector: "collectionOfPrintStrings",
  4059. protocol: 'fixture',
  4060. fn: function (){
  4061. var self=this;
  4062. return smalltalk.withContext(function($ctx1) {
  4063. var $1;
  4064. $1=["1", "2", "3", "-4"];
  4065. return $1;
  4066. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  4067. args: [],
  4068. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4069. messageSends: [],
  4070. referencedClasses: []
  4071. }),
  4072. smalltalk.ArrayTest);
  4073. smalltalk.addMethod(
  4074. smalltalk.method({
  4075. selector: "collectionSize",
  4076. protocol: 'fixture',
  4077. fn: function (){
  4078. var self=this;
  4079. return smalltalk.withContext(function($ctx1) {
  4080. return (4);
  4081. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  4082. args: [],
  4083. source: "collectionSize\x0a\x09^ 4",
  4084. messageSends: [],
  4085. referencedClasses: []
  4086. }),
  4087. smalltalk.ArrayTest);
  4088. smalltalk.addMethod(
  4089. smalltalk.method({
  4090. selector: "collectionWithDuplicates",
  4091. protocol: 'fixture',
  4092. fn: function (){
  4093. var self=this;
  4094. return smalltalk.withContext(function($ctx1) {
  4095. var $1;
  4096. $1=["a", "b", "c", (1), (2), (1), "a"];
  4097. return $1;
  4098. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  4099. args: [],
  4100. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4101. messageSends: [],
  4102. referencedClasses: []
  4103. }),
  4104. smalltalk.ArrayTest);
  4105. smalltalk.addMethod(
  4106. smalltalk.method({
  4107. selector: "collectionWithNewValue",
  4108. protocol: 'fixture',
  4109. fn: function (){
  4110. var self=this;
  4111. return smalltalk.withContext(function($ctx1) {
  4112. var $1;
  4113. $1=[(1), (2), (3), (-4), "N"];
  4114. return $1;
  4115. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  4116. args: [],
  4117. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4118. messageSends: [],
  4119. referencedClasses: []
  4120. }),
  4121. smalltalk.ArrayTest);
  4122. smalltalk.addMethod(
  4123. smalltalk.method({
  4124. selector: "sampleNewIndex",
  4125. protocol: 'fixture',
  4126. fn: function (){
  4127. var self=this;
  4128. return smalltalk.withContext(function($ctx1) {
  4129. return (5);
  4130. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  4131. args: [],
  4132. source: "sampleNewIndex\x0a\x09^ 5",
  4133. messageSends: [],
  4134. referencedClasses: []
  4135. }),
  4136. smalltalk.ArrayTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "samplesDo:",
  4140. protocol: 'fixture',
  4141. fn: function (aBlock){
  4142. var self=this;
  4143. return smalltalk.withContext(function($ctx1) {
  4144. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4145. _st(aBlock)._value_value_((3),(3));
  4146. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  4147. args: ["aBlock"],
  4148. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4149. messageSends: ["samplesDo:", "value:value:"],
  4150. referencedClasses: []
  4151. }),
  4152. smalltalk.ArrayTest);
  4153. smalltalk.addMethod(
  4154. smalltalk.method({
  4155. selector: "testAdd",
  4156. protocol: 'tests',
  4157. fn: function (){
  4158. var self=this;
  4159. var array;
  4160. return smalltalk.withContext(function($ctx1) {
  4161. array=self._collection();
  4162. _st(array)._add_((6));
  4163. self._assert_equals_(_st(array)._last(),(6));
  4164. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  4165. args: [],
  4166. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4167. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4168. referencedClasses: []
  4169. }),
  4170. smalltalk.ArrayTest);
  4171. smalltalk.addMethod(
  4172. smalltalk.method({
  4173. selector: "testAddFirst",
  4174. protocol: 'tests',
  4175. fn: function (){
  4176. var self=this;
  4177. return smalltalk.withContext(function($ctx1) {
  4178. var $1,$2;
  4179. $1=self._collection();
  4180. _st($1)._addFirst_((0));
  4181. $2=_st($1)._yourself();
  4182. self._assert_equals_(_st($2)._first(),(0));
  4183. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  4184. args: [],
  4185. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4186. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4187. referencedClasses: []
  4188. }),
  4189. smalltalk.ArrayTest);
  4190. smalltalk.addMethod(
  4191. smalltalk.method({
  4192. selector: "testPrintString",
  4193. protocol: 'tests',
  4194. fn: function (){
  4195. var self=this;
  4196. var array;
  4197. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4198. return smalltalk.withContext(function($ctx1) {
  4199. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4200. array=_st($Array())._new();
  4201. $1=_st(array)._printString();
  4202. $ctx1.sendIdx["printString"]=1;
  4203. self._assert_equals_($1,"an Array ()");
  4204. $ctx1.sendIdx["assert:equals:"]=1;
  4205. $2=array;
  4206. _st($2)._add_((1));
  4207. $ctx1.sendIdx["add:"]=1;
  4208. $3=_st($2)._add_((3));
  4209. $ctx1.sendIdx["add:"]=2;
  4210. $4=_st(array)._printString();
  4211. $ctx1.sendIdx["printString"]=2;
  4212. self._assert_equals_($4,"an Array (1 3)");
  4213. $ctx1.sendIdx["assert:equals:"]=2;
  4214. _st(array)._add_("foo");
  4215. $5=_st(array)._printString();
  4216. $ctx1.sendIdx["printString"]=3;
  4217. self._assert_equals_($5,"an Array (1 3 'foo')");
  4218. $ctx1.sendIdx["assert:equals:"]=3;
  4219. $6=array;
  4220. _st($6)._remove_((1));
  4221. $ctx1.sendIdx["remove:"]=1;
  4222. $7=_st($6)._remove_((3));
  4223. $8=_st(array)._printString();
  4224. $ctx1.sendIdx["printString"]=4;
  4225. self._assert_equals_($8,"an Array ('foo')");
  4226. $ctx1.sendIdx["assert:equals:"]=4;
  4227. _st(array)._addLast_((3));
  4228. $ctx1.sendIdx["addLast:"]=1;
  4229. $9=_st(array)._printString();
  4230. $ctx1.sendIdx["printString"]=5;
  4231. self._assert_equals_($9,"an Array ('foo' 3)");
  4232. $ctx1.sendIdx["assert:equals:"]=5;
  4233. _st(array)._addLast_((3));
  4234. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4235. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4236. args: [],
  4237. 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)'.",
  4238. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4239. referencedClasses: ["Array"]
  4240. }),
  4241. smalltalk.ArrayTest);
  4242. smalltalk.addMethod(
  4243. smalltalk.method({
  4244. selector: "testRemove",
  4245. protocol: 'tests',
  4246. fn: function (){
  4247. var self=this;
  4248. var array;
  4249. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4250. return smalltalk.withContext(function($ctx1) {
  4251. array=[(1), (2), (3), (4), (5)];
  4252. _st(array)._remove_((3));
  4253. $ctx1.sendIdx["remove:"]=1;
  4254. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4255. self._should_raise_((function(){
  4256. return smalltalk.withContext(function($ctx2) {
  4257. return _st(array)._remove_((3));
  4258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4259. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4260. args: [],
  4261. 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",
  4262. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4263. referencedClasses: ["Error"]
  4264. }),
  4265. smalltalk.ArrayTest);
  4266. smalltalk.addMethod(
  4267. smalltalk.method({
  4268. selector: "testRemoveFromTo",
  4269. protocol: 'tests',
  4270. fn: function (){
  4271. var self=this;
  4272. return smalltalk.withContext(function($ctx1) {
  4273. var $1,$2;
  4274. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4275. $ctx1.sendIdx["removeFrom:to:"]=1;
  4276. self._assert_equals_($1,[(4)]);
  4277. $ctx1.sendIdx["assert:equals:"]=1;
  4278. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4279. $ctx1.sendIdx["removeFrom:to:"]=2;
  4280. self._assert_equals_($2,[(1), (4)]);
  4281. $ctx1.sendIdx["assert:equals:"]=2;
  4282. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4283. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4284. args: [],
  4285. 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)",
  4286. messageSends: ["assert:equals:", "removeFrom:to:"],
  4287. referencedClasses: []
  4288. }),
  4289. smalltalk.ArrayTest);
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "testRemoveIndex",
  4293. protocol: 'tests',
  4294. fn: function (){
  4295. var self=this;
  4296. return smalltalk.withContext(function($ctx1) {
  4297. var $1,$2;
  4298. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4299. $ctx1.sendIdx["removeIndex:"]=1;
  4300. self._assert_equals_($1,[(1), (3), (4)]);
  4301. $ctx1.sendIdx["assert:equals:"]=1;
  4302. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4303. $ctx1.sendIdx["removeIndex:"]=2;
  4304. self._assert_equals_($2,[(2), (3), (4)]);
  4305. $ctx1.sendIdx["assert:equals:"]=2;
  4306. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4307. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4308. args: [],
  4309. 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: #()",
  4310. messageSends: ["assert:equals:", "removeIndex:"],
  4311. referencedClasses: []
  4312. }),
  4313. smalltalk.ArrayTest);
  4314. smalltalk.addMethod(
  4315. smalltalk.method({
  4316. selector: "testRemoveLast",
  4317. protocol: 'tests',
  4318. fn: function (){
  4319. var self=this;
  4320. var array;
  4321. return smalltalk.withContext(function($ctx1) {
  4322. array=[(1), (2)];
  4323. _st(array)._removeLast();
  4324. self._assert_equals_(_st(array)._last(),(1));
  4325. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4326. args: [],
  4327. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4328. messageSends: ["removeLast", "assert:equals:", "last"],
  4329. referencedClasses: []
  4330. }),
  4331. smalltalk.ArrayTest);
  4332. smalltalk.addMethod(
  4333. smalltalk.method({
  4334. selector: "testReversed",
  4335. protocol: 'tests',
  4336. fn: function (){
  4337. var self=this;
  4338. var array;
  4339. return smalltalk.withContext(function($ctx1) {
  4340. array=[(5), (4), (3), (2), (1)];
  4341. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4342. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4343. args: [],
  4344. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4345. messageSends: ["assert:equals:", "reversed"],
  4346. referencedClasses: []
  4347. }),
  4348. smalltalk.ArrayTest);
  4349. smalltalk.addMethod(
  4350. smalltalk.method({
  4351. selector: "testSort",
  4352. protocol: 'tests',
  4353. fn: function (){
  4354. var self=this;
  4355. var array;
  4356. return smalltalk.withContext(function($ctx1) {
  4357. array=[(3), (1), (4), (5), (2)];
  4358. _st(array)._sort();
  4359. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4360. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4361. args: [],
  4362. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4363. messageSends: ["sort", "assert:equals:"],
  4364. referencedClasses: []
  4365. }),
  4366. smalltalk.ArrayTest);
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "collectionClass",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4374. return smalltalk.withContext(function($ctx1) {
  4375. return $Array();
  4376. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4377. args: [],
  4378. source: "collectionClass\x0a\x09^ Array",
  4379. messageSends: [],
  4380. referencedClasses: ["Array"]
  4381. }),
  4382. smalltalk.ArrayTest.klass);
  4383. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4384. smalltalk.addMethod(
  4385. smalltalk.method({
  4386. selector: "collection",
  4387. protocol: 'fixture',
  4388. fn: function (){
  4389. var self=this;
  4390. return smalltalk.withContext(function($ctx1) {
  4391. return "helLo";
  4392. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4393. args: [],
  4394. source: "collection\x0a\x09^ 'helLo'",
  4395. messageSends: [],
  4396. referencedClasses: []
  4397. }),
  4398. smalltalk.StringTest);
  4399. smalltalk.addMethod(
  4400. smalltalk.method({
  4401. selector: "collectionFirst",
  4402. protocol: 'fixture',
  4403. fn: function (){
  4404. var self=this;
  4405. return smalltalk.withContext(function($ctx1) {
  4406. return "h";
  4407. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4408. args: [],
  4409. source: "collectionFirst\x0a\x09^ 'h'",
  4410. messageSends: [],
  4411. referencedClasses: []
  4412. }),
  4413. smalltalk.StringTest);
  4414. smalltalk.addMethod(
  4415. smalltalk.method({
  4416. selector: "collectionFirstTwo",
  4417. protocol: 'fixture',
  4418. fn: function (){
  4419. var self=this;
  4420. return smalltalk.withContext(function($ctx1) {
  4421. return "he";
  4422. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4423. args: [],
  4424. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4425. messageSends: [],
  4426. referencedClasses: []
  4427. }),
  4428. smalltalk.StringTest);
  4429. smalltalk.addMethod(
  4430. smalltalk.method({
  4431. selector: "collectionLast",
  4432. protocol: 'fixture',
  4433. fn: function (){
  4434. var self=this;
  4435. return smalltalk.withContext(function($ctx1) {
  4436. return "o";
  4437. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4438. args: [],
  4439. source: "collectionLast\x0a\x09^ 'o'",
  4440. messageSends: [],
  4441. referencedClasses: []
  4442. }),
  4443. smalltalk.StringTest);
  4444. smalltalk.addMethod(
  4445. smalltalk.method({
  4446. selector: "collectionLastTwo",
  4447. protocol: 'fixture',
  4448. fn: function (){
  4449. var self=this;
  4450. return smalltalk.withContext(function($ctx1) {
  4451. return "Lo";
  4452. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4453. args: [],
  4454. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4455. messageSends: [],
  4456. referencedClasses: []
  4457. }),
  4458. smalltalk.StringTest);
  4459. smalltalk.addMethod(
  4460. smalltalk.method({
  4461. selector: "collectionOfPrintStrings",
  4462. protocol: 'fixture',
  4463. fn: function (){
  4464. var self=this;
  4465. return smalltalk.withContext(function($ctx1) {
  4466. return "'h''e''l''L''o'";
  4467. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4468. args: [],
  4469. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4470. messageSends: [],
  4471. referencedClasses: []
  4472. }),
  4473. smalltalk.StringTest);
  4474. smalltalk.addMethod(
  4475. smalltalk.method({
  4476. selector: "collectionSize",
  4477. protocol: 'fixture',
  4478. fn: function (){
  4479. var self=this;
  4480. return smalltalk.withContext(function($ctx1) {
  4481. return (5);
  4482. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4483. args: [],
  4484. source: "collectionSize\x0a\x09^ 5",
  4485. messageSends: [],
  4486. referencedClasses: []
  4487. }),
  4488. smalltalk.StringTest);
  4489. smalltalk.addMethod(
  4490. smalltalk.method({
  4491. selector: "collectionWithDuplicates",
  4492. protocol: 'fixture',
  4493. fn: function (){
  4494. var self=this;
  4495. return smalltalk.withContext(function($ctx1) {
  4496. return "abbaerte";
  4497. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4498. args: [],
  4499. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4500. messageSends: [],
  4501. referencedClasses: []
  4502. }),
  4503. smalltalk.StringTest);
  4504. smalltalk.addMethod(
  4505. smalltalk.method({
  4506. selector: "collectionWithNewValue",
  4507. protocol: 'fixture',
  4508. fn: function (){
  4509. var self=this;
  4510. return smalltalk.withContext(function($ctx1) {
  4511. return "helLoN";
  4512. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4513. args: [],
  4514. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4515. messageSends: [],
  4516. referencedClasses: []
  4517. }),
  4518. smalltalk.StringTest);
  4519. smalltalk.addMethod(
  4520. smalltalk.method({
  4521. selector: "sampleNewValueAsCollection",
  4522. protocol: 'fixture',
  4523. fn: function (){
  4524. var self=this;
  4525. return smalltalk.withContext(function($ctx1) {
  4526. return "N";
  4527. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4528. args: [],
  4529. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4530. messageSends: [],
  4531. referencedClasses: []
  4532. }),
  4533. smalltalk.StringTest);
  4534. smalltalk.addMethod(
  4535. smalltalk.method({
  4536. selector: "samplesDo:",
  4537. protocol: 'fixture',
  4538. fn: function (aBlock){
  4539. var self=this;
  4540. return smalltalk.withContext(function($ctx1) {
  4541. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4542. _st(aBlock)._value_value_((3),"l");
  4543. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4544. args: ["aBlock"],
  4545. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4546. messageSends: ["samplesDo:", "value:value:"],
  4547. referencedClasses: []
  4548. }),
  4549. smalltalk.StringTest);
  4550. smalltalk.addMethod(
  4551. smalltalk.method({
  4552. selector: "testAddAll",
  4553. protocol: 'tests',
  4554. fn: function (){
  4555. var self=this;
  4556. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4557. return smalltalk.withContext(function($ctx1) {
  4558. var $1;
  4559. self._should_raise_((function(){
  4560. return smalltalk.withContext(function($ctx2) {
  4561. $1=self._collection();
  4562. $ctx2.sendIdx["collection"]=1;
  4563. return _st($1)._addAll_(self._collection());
  4564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4565. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4566. args: [],
  4567. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4568. messageSends: ["should:raise:", "addAll:", "collection"],
  4569. referencedClasses: ["Error"]
  4570. }),
  4571. smalltalk.StringTest);
  4572. smalltalk.addMethod(
  4573. smalltalk.method({
  4574. selector: "testAddRemove",
  4575. protocol: 'tests',
  4576. fn: function (){
  4577. var self=this;
  4578. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4579. return smalltalk.withContext(function($ctx1) {
  4580. self._should_raise_((function(){
  4581. return smalltalk.withContext(function($ctx2) {
  4582. return "hello"._add_("a");
  4583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4584. $ctx1.sendIdx["should:raise:"]=1;
  4585. self._should_raise_((function(){
  4586. return smalltalk.withContext(function($ctx2) {
  4587. return "hello"._remove_("h");
  4588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4589. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4590. args: [],
  4591. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4592. messageSends: ["should:raise:", "add:", "remove:"],
  4593. referencedClasses: ["Error"]
  4594. }),
  4595. smalltalk.StringTest);
  4596. smalltalk.addMethod(
  4597. smalltalk.method({
  4598. selector: "testAsArray",
  4599. protocol: 'tests',
  4600. fn: function (){
  4601. var self=this;
  4602. return smalltalk.withContext(function($ctx1) {
  4603. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4604. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4605. args: [],
  4606. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4607. messageSends: ["assert:equals:", "asArray"],
  4608. referencedClasses: []
  4609. }),
  4610. smalltalk.StringTest);
  4611. smalltalk.addMethod(
  4612. smalltalk.method({
  4613. selector: "testAsLowerCase",
  4614. protocol: 'tests',
  4615. fn: function (){
  4616. var self=this;
  4617. return smalltalk.withContext(function($ctx1) {
  4618. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4619. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4620. args: [],
  4621. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4622. messageSends: ["assert:equals:", "asLowercase"],
  4623. referencedClasses: []
  4624. }),
  4625. smalltalk.StringTest);
  4626. smalltalk.addMethod(
  4627. smalltalk.method({
  4628. selector: "testAsNumber",
  4629. protocol: 'tests',
  4630. fn: function (){
  4631. var self=this;
  4632. return smalltalk.withContext(function($ctx1) {
  4633. var $1,$2;
  4634. $1="3"._asNumber();
  4635. $ctx1.sendIdx["asNumber"]=1;
  4636. self._assert_equals_($1,(3));
  4637. $ctx1.sendIdx["assert:equals:"]=1;
  4638. $2="-3"._asNumber();
  4639. $ctx1.sendIdx["asNumber"]=2;
  4640. self._assert_equals_($2,(-3));
  4641. $ctx1.sendIdx["assert:equals:"]=2;
  4642. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4643. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4644. args: [],
  4645. 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.",
  4646. messageSends: ["assert:equals:", "asNumber"],
  4647. referencedClasses: []
  4648. }),
  4649. smalltalk.StringTest);
  4650. smalltalk.addMethod(
  4651. smalltalk.method({
  4652. selector: "testAsUpperCase",
  4653. protocol: 'tests',
  4654. fn: function (){
  4655. var self=this;
  4656. return smalltalk.withContext(function($ctx1) {
  4657. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4658. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4659. args: [],
  4660. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4661. messageSends: ["assert:equals:", "asUppercase"],
  4662. referencedClasses: []
  4663. }),
  4664. smalltalk.StringTest);
  4665. smalltalk.addMethod(
  4666. smalltalk.method({
  4667. selector: "testAsciiValue",
  4668. protocol: 'tests',
  4669. fn: function (){
  4670. var self=this;
  4671. var characterA,characterU;
  4672. return smalltalk.withContext(function($ctx1) {
  4673. var $1;
  4674. characterA="A";
  4675. characterU="U";
  4676. $1=_st(characterA)._asciiValue();
  4677. $ctx1.sendIdx["asciiValue"]=1;
  4678. self._assert_equals_($1,(65));
  4679. $ctx1.sendIdx["assert:equals:"]=1;
  4680. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4681. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4682. args: [],
  4683. 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",
  4684. messageSends: ["assert:equals:", "asciiValue"],
  4685. referencedClasses: []
  4686. }),
  4687. smalltalk.StringTest);
  4688. smalltalk.addMethod(
  4689. smalltalk.method({
  4690. selector: "testAtIfAbsentPut",
  4691. protocol: 'tests',
  4692. fn: function (){
  4693. var self=this;
  4694. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4695. return smalltalk.withContext(function($ctx1) {
  4696. self._should_raise_((function(){
  4697. return smalltalk.withContext(function($ctx2) {
  4698. return "hello"._at_ifAbsentPut_((6),(function(){
  4699. return smalltalk.withContext(function($ctx3) {
  4700. return "a";
  4701. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4703. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4704. args: [],
  4705. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4706. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4707. referencedClasses: ["Error"]
  4708. }),
  4709. smalltalk.StringTest);
  4710. smalltalk.addMethod(
  4711. smalltalk.method({
  4712. selector: "testAtPut",
  4713. protocol: 'tests',
  4714. fn: function (){
  4715. var self=this;
  4716. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4717. return smalltalk.withContext(function($ctx1) {
  4718. self._should_raise_((function(){
  4719. return smalltalk.withContext(function($ctx2) {
  4720. return "hello"._at_put_((1),"a");
  4721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4722. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4723. args: [],
  4724. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4725. messageSends: ["should:raise:", "at:put:"],
  4726. referencedClasses: ["Error"]
  4727. }),
  4728. smalltalk.StringTest);
  4729. smalltalk.addMethod(
  4730. smalltalk.method({
  4731. selector: "testCapitalized",
  4732. protocol: 'tests',
  4733. fn: function (){
  4734. var self=this;
  4735. return smalltalk.withContext(function($ctx1) {
  4736. var $1,$2,$3;
  4737. $1="test"._capitalized();
  4738. $ctx1.sendIdx["capitalized"]=1;
  4739. self._assert_equals_($1,"Test");
  4740. $ctx1.sendIdx["assert:equals:"]=1;
  4741. $2="Test"._capitalized();
  4742. $ctx1.sendIdx["capitalized"]=2;
  4743. self._assert_equals_($2,"Test");
  4744. $ctx1.sendIdx["assert:equals:"]=2;
  4745. self._assert_equals_(""._capitalized(),"");
  4746. $ctx1.sendIdx["assert:equals:"]=3;
  4747. $3="Test"._isCapitalized();
  4748. $ctx1.sendIdx["isCapitalized"]=1;
  4749. self._assert_equals_($3,true);
  4750. $ctx1.sendIdx["assert:equals:"]=4;
  4751. self._assert_equals_("test"._isCapitalized(),false);
  4752. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4753. args: [],
  4754. 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.",
  4755. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4756. referencedClasses: []
  4757. }),
  4758. smalltalk.StringTest);
  4759. smalltalk.addMethod(
  4760. smalltalk.method({
  4761. selector: "testCharCodeAt",
  4762. protocol: 'tests',
  4763. fn: function (){
  4764. var self=this;
  4765. return smalltalk.withContext(function($ctx1) {
  4766. var $1,$2,$3,$4,$5;
  4767. $1="jackie"._charCodeAt_((1));
  4768. $ctx1.sendIdx["charCodeAt:"]=1;
  4769. self._assert_equals_($1,(106));
  4770. $ctx1.sendIdx["assert:equals:"]=1;
  4771. $2="jackie"._charCodeAt_((2));
  4772. $ctx1.sendIdx["charCodeAt:"]=2;
  4773. self._assert_equals_($2,(97));
  4774. $ctx1.sendIdx["assert:equals:"]=2;
  4775. $3="jackie"._charCodeAt_((3));
  4776. $ctx1.sendIdx["charCodeAt:"]=3;
  4777. self._assert_equals_($3,(99));
  4778. $ctx1.sendIdx["assert:equals:"]=3;
  4779. $4="jackie"._charCodeAt_((4));
  4780. $ctx1.sendIdx["charCodeAt:"]=4;
  4781. self._assert_equals_($4,(107));
  4782. $ctx1.sendIdx["assert:equals:"]=4;
  4783. $5="jackie"._charCodeAt_((5));
  4784. $ctx1.sendIdx["charCodeAt:"]=5;
  4785. self._assert_equals_($5,(105));
  4786. $ctx1.sendIdx["assert:equals:"]=5;
  4787. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4788. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4789. args: [],
  4790. 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",
  4791. messageSends: ["assert:equals:", "charCodeAt:"],
  4792. referencedClasses: []
  4793. }),
  4794. smalltalk.StringTest);
  4795. smalltalk.addMethod(
  4796. smalltalk.method({
  4797. selector: "testCopyFromTo",
  4798. protocol: 'tests',
  4799. fn: function (){
  4800. var self=this;
  4801. return smalltalk.withContext(function($ctx1) {
  4802. var $1;
  4803. $1="jackie"._copyFrom_to_((1),(3));
  4804. $ctx1.sendIdx["copyFrom:to:"]=1;
  4805. self._assert_equals_($1,"jac");
  4806. $ctx1.sendIdx["assert:equals:"]=1;
  4807. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4808. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4809. args: [],
  4810. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4811. messageSends: ["assert:equals:", "copyFrom:to:"],
  4812. referencedClasses: []
  4813. }),
  4814. smalltalk.StringTest);
  4815. smalltalk.addMethod(
  4816. smalltalk.method({
  4817. selector: "testCopyWithoutAll",
  4818. protocol: 'tests',
  4819. fn: function (){
  4820. var self=this;
  4821. return smalltalk.withContext(function($ctx1) {
  4822. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4823. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4824. args: [],
  4825. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4826. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4827. referencedClasses: []
  4828. }),
  4829. smalltalk.StringTest);
  4830. smalltalk.addMethod(
  4831. smalltalk.method({
  4832. selector: "testEquality",
  4833. protocol: 'tests',
  4834. fn: function (){
  4835. var self=this;
  4836. return smalltalk.withContext(function($ctx1) {
  4837. var $1,$2,$3;
  4838. self._assert_equals_("hello","hello");
  4839. $ctx1.sendIdx["assert:equals:"]=1;
  4840. $1="hello".__eq("world");
  4841. $ctx1.sendIdx["="]=1;
  4842. self._deny_($1);
  4843. $ctx1.sendIdx["deny:"]=1;
  4844. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4845. return smalltalk.withContext(function($ctx2) {
  4846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4847. $ctx1.sendIdx["="]=2;
  4848. self._deny_($2);
  4849. $ctx1.sendIdx["deny:"]=2;
  4850. $3="hello"._yourself();
  4851. $ctx1.sendIdx["yourself"]=1;
  4852. self._assert_equals_("hello",$3);
  4853. $ctx1.sendIdx["assert:equals:"]=2;
  4854. self._assert_equals_("hello"._yourself(),"hello");
  4855. self._deny_("".__eq((0)));
  4856. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4857. args: [],
  4858. 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",
  4859. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4860. referencedClasses: []
  4861. }),
  4862. smalltalk.StringTest);
  4863. smalltalk.addMethod(
  4864. smalltalk.method({
  4865. selector: "testIdentity",
  4866. protocol: 'tests',
  4867. fn: function (){
  4868. var self=this;
  4869. return smalltalk.withContext(function($ctx1) {
  4870. var $1,$2,$4,$3,$5;
  4871. $1="hello".__eq_eq("hello");
  4872. $ctx1.sendIdx["=="]=1;
  4873. self._assert_($1);
  4874. $ctx1.sendIdx["assert:"]=1;
  4875. $2="hello".__eq_eq("world");
  4876. $ctx1.sendIdx["=="]=2;
  4877. self._deny_($2);
  4878. $ctx1.sendIdx["deny:"]=1;
  4879. $4="hello"._yourself();
  4880. $ctx1.sendIdx["yourself"]=1;
  4881. $3="hello".__eq_eq($4);
  4882. $ctx1.sendIdx["=="]=3;
  4883. self._assert_($3);
  4884. $ctx1.sendIdx["assert:"]=2;
  4885. $5=_st("hello"._yourself()).__eq_eq("hello");
  4886. $ctx1.sendIdx["=="]=4;
  4887. self._assert_($5);
  4888. self._deny_("".__eq_eq((0)));
  4889. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4890. args: [],
  4891. 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",
  4892. messageSends: ["assert:", "==", "deny:", "yourself"],
  4893. referencedClasses: []
  4894. }),
  4895. smalltalk.StringTest);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "testIdentityHash",
  4899. protocol: 'tests',
  4900. fn: function (){
  4901. var self=this;
  4902. return smalltalk.withContext(function($ctx1) {
  4903. var $1,$2,$4,$3;
  4904. $1="foo"._identityHash();
  4905. $ctx1.sendIdx["identityHash"]=1;
  4906. $2="foo"._identityHash();
  4907. $ctx1.sendIdx["identityHash"]=2;
  4908. self._assert_equals_($1,$2);
  4909. $4="foo"._identityHash();
  4910. $ctx1.sendIdx["identityHash"]=3;
  4911. $3=_st($4).__eq("bar"._identityHash());
  4912. self._deny_($3);
  4913. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4914. args: [],
  4915. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4916. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4917. referencedClasses: []
  4918. }),
  4919. smalltalk.StringTest);
  4920. smalltalk.addMethod(
  4921. smalltalk.method({
  4922. selector: "testIncludesSubString",
  4923. protocol: 'tests',
  4924. fn: function (){
  4925. var self=this;
  4926. return smalltalk.withContext(function($ctx1) {
  4927. var $1;
  4928. $1="amber"._includesSubString_("ber");
  4929. $ctx1.sendIdx["includesSubString:"]=1;
  4930. self._assert_($1);
  4931. self._deny_("amber"._includesSubString_("zork"));
  4932. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4933. args: [],
  4934. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4935. messageSends: ["assert:", "includesSubString:", "deny:"],
  4936. referencedClasses: []
  4937. }),
  4938. smalltalk.StringTest);
  4939. smalltalk.addMethod(
  4940. smalltalk.method({
  4941. selector: "testIndexOfStartingAtWithNull",
  4942. protocol: 'tests',
  4943. fn: function (){
  4944. var self=this;
  4945. return smalltalk.withContext(function($ctx1) {
  4946. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{},smalltalk.StringTest)})},
  4947. args: [],
  4948. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4949. messageSends: [],
  4950. referencedClasses: []
  4951. }),
  4952. smalltalk.StringTest);
  4953. smalltalk.addMethod(
  4954. smalltalk.method({
  4955. selector: "testIndexOfWithNull",
  4956. protocol: 'tests',
  4957. fn: function (){
  4958. var self=this;
  4959. return smalltalk.withContext(function($ctx1) {
  4960. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{},smalltalk.StringTest)})},
  4961. args: [],
  4962. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4963. messageSends: [],
  4964. referencedClasses: []
  4965. }),
  4966. smalltalk.StringTest);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "testIsVowel",
  4970. protocol: 'tests',
  4971. fn: function (){
  4972. var self=this;
  4973. var vowel,consonant;
  4974. return smalltalk.withContext(function($ctx1) {
  4975. var $1;
  4976. vowel="u";
  4977. consonant="z";
  4978. $1=_st(vowel)._isVowel();
  4979. $ctx1.sendIdx["isVowel"]=1;
  4980. self._assert_equals_($1,true);
  4981. $ctx1.sendIdx["assert:equals:"]=1;
  4982. self._assert_equals_(_st(consonant)._isVowel(),false);
  4983. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4984. args: [],
  4985. 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",
  4986. messageSends: ["assert:equals:", "isVowel"],
  4987. referencedClasses: []
  4988. }),
  4989. smalltalk.StringTest);
  4990. smalltalk.addMethod(
  4991. smalltalk.method({
  4992. selector: "testJoin",
  4993. protocol: 'tests',
  4994. fn: function (){
  4995. var self=this;
  4996. return smalltalk.withContext(function($ctx1) {
  4997. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4998. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4999. args: [],
  5000. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  5001. messageSends: ["assert:equals:", "join:"],
  5002. referencedClasses: []
  5003. }),
  5004. smalltalk.StringTest);
  5005. smalltalk.addMethod(
  5006. smalltalk.method({
  5007. selector: "testRemoveAll",
  5008. protocol: 'tests',
  5009. fn: function (){
  5010. var self=this;
  5011. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5012. return smalltalk.withContext(function($ctx1) {
  5013. self._should_raise_((function(){
  5014. return smalltalk.withContext(function($ctx2) {
  5015. return _st(self._collection())._removeAll();
  5016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5017. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  5018. args: [],
  5019. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  5020. messageSends: ["should:raise:", "removeAll", "collection"],
  5021. referencedClasses: ["Error"]
  5022. }),
  5023. smalltalk.StringTest);
  5024. smalltalk.addMethod(
  5025. smalltalk.method({
  5026. selector: "testReversed",
  5027. protocol: 'tests',
  5028. fn: function (){
  5029. var self=this;
  5030. return smalltalk.withContext(function($ctx1) {
  5031. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5032. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  5033. args: [],
  5034. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5035. messageSends: ["assert:equals:", "reversed"],
  5036. referencedClasses: []
  5037. }),
  5038. smalltalk.StringTest);
  5039. smalltalk.addMethod(
  5040. smalltalk.method({
  5041. selector: "testStreamContents",
  5042. protocol: 'tests',
  5043. fn: function (){
  5044. var self=this;
  5045. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5046. return smalltalk.withContext(function($ctx1) {
  5047. var $1;
  5048. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5049. return smalltalk.withContext(function($ctx2) {
  5050. _st(aStream)._nextPutAll_("hello");
  5051. $ctx2.sendIdx["nextPutAll:"]=1;
  5052. _st(aStream)._space();
  5053. $1=_st(aStream)._nextPutAll_("world");
  5054. return $1;
  5055. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5056. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  5057. args: [],
  5058. 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'",
  5059. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5060. referencedClasses: ["String"]
  5061. }),
  5062. smalltalk.StringTest);
  5063. smalltalk.addMethod(
  5064. smalltalk.method({
  5065. selector: "testSubStrings",
  5066. protocol: 'tests',
  5067. fn: function (){
  5068. var self=this;
  5069. return smalltalk.withContext(function($ctx1) {
  5070. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5071. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  5072. args: [],
  5073. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5074. messageSends: ["assert:equals:", "subStrings:"],
  5075. referencedClasses: []
  5076. }),
  5077. smalltalk.StringTest);
  5078. smalltalk.addMethod(
  5079. smalltalk.method({
  5080. selector: "testTrim",
  5081. protocol: 'tests',
  5082. fn: function (){
  5083. var self=this;
  5084. return smalltalk.withContext(function($ctx1) {
  5085. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5086. $ctx1.sendIdx["assert:equals:"]=1;
  5087. self._assert_equals_("jackie "._trimRight(),"jackie");
  5088. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  5089. args: [],
  5090. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5091. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5092. referencedClasses: []
  5093. }),
  5094. smalltalk.StringTest);
  5095. smalltalk.addMethod(
  5096. smalltalk.method({
  5097. selector: "collectionClass",
  5098. protocol: 'fixture',
  5099. fn: function (){
  5100. var self=this;
  5101. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5102. return smalltalk.withContext(function($ctx1) {
  5103. return $String();
  5104. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  5105. args: [],
  5106. source: "collectionClass\x0a\x09^ String",
  5107. messageSends: [],
  5108. referencedClasses: ["String"]
  5109. }),
  5110. smalltalk.StringTest.klass);
  5111. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  5112. smalltalk.addMethod(
  5113. smalltalk.method({
  5114. selector: "collection",
  5115. protocol: 'fixture',
  5116. fn: function (){
  5117. var self=this;
  5118. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5119. return smalltalk.withContext(function($ctx1) {
  5120. var $2,$3,$1;
  5121. $2=_st($Set())._new();
  5122. _st($2)._add_((1));
  5123. $ctx1.sendIdx["add:"]=1;
  5124. _st($2)._add_((2));
  5125. $ctx1.sendIdx["add:"]=2;
  5126. _st($2)._add_((3));
  5127. $ctx1.sendIdx["add:"]=3;
  5128. _st($2)._add_((-4));
  5129. $3=_st($2)._yourself();
  5130. $1=$3;
  5131. return $1;
  5132. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  5133. args: [],
  5134. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  5135. messageSends: ["add:", "new", "yourself"],
  5136. referencedClasses: ["Set"]
  5137. }),
  5138. smalltalk.SetTest);
  5139. smalltalk.addMethod(
  5140. smalltalk.method({
  5141. selector: "collectionOfPrintStrings",
  5142. protocol: 'fixture',
  5143. fn: function (){
  5144. var self=this;
  5145. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5146. return smalltalk.withContext(function($ctx1) {
  5147. var $2,$3,$1;
  5148. $2=_st($Set())._new();
  5149. _st($2)._add_("1");
  5150. $ctx1.sendIdx["add:"]=1;
  5151. _st($2)._add_("2");
  5152. $ctx1.sendIdx["add:"]=2;
  5153. _st($2)._add_("3");
  5154. $ctx1.sendIdx["add:"]=3;
  5155. _st($2)._add_("-4");
  5156. $3=_st($2)._yourself();
  5157. $1=$3;
  5158. return $1;
  5159. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  5160. args: [],
  5161. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  5162. messageSends: ["add:", "new", "yourself"],
  5163. referencedClasses: ["Set"]
  5164. }),
  5165. smalltalk.SetTest);
  5166. smalltalk.addMethod(
  5167. smalltalk.method({
  5168. selector: "collectionSize",
  5169. protocol: 'fixture',
  5170. fn: function (){
  5171. var self=this;
  5172. return smalltalk.withContext(function($ctx1) {
  5173. return (4);
  5174. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  5175. args: [],
  5176. source: "collectionSize\x0a\x09^ 4",
  5177. messageSends: [],
  5178. referencedClasses: []
  5179. }),
  5180. smalltalk.SetTest);
  5181. smalltalk.addMethod(
  5182. smalltalk.method({
  5183. selector: "collectionWithDuplicates",
  5184. protocol: 'fixture',
  5185. fn: function (){
  5186. var self=this;
  5187. return smalltalk.withContext(function($ctx1) {
  5188. var $2,$3,$1;
  5189. $2=self._collection();
  5190. _st($2)._add_("yet another");
  5191. $3=_st($2)._yourself();
  5192. $1=$3;
  5193. return $1;
  5194. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  5195. args: [],
  5196. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  5197. messageSends: ["add:", "collection", "yourself"],
  5198. referencedClasses: []
  5199. }),
  5200. smalltalk.SetTest);
  5201. smalltalk.addMethod(
  5202. smalltalk.method({
  5203. selector: "collectionWithNewValue",
  5204. protocol: 'fixture',
  5205. fn: function (){
  5206. var self=this;
  5207. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5208. return smalltalk.withContext(function($ctx1) {
  5209. var $2,$3,$1;
  5210. $2=_st($Set())._new();
  5211. _st($2)._add_((1));
  5212. $ctx1.sendIdx["add:"]=1;
  5213. _st($2)._add_((2));
  5214. $ctx1.sendIdx["add:"]=2;
  5215. _st($2)._add_((3));
  5216. $ctx1.sendIdx["add:"]=3;
  5217. _st($2)._add_("N");
  5218. $ctx1.sendIdx["add:"]=4;
  5219. _st($2)._add_((-4));
  5220. $3=_st($2)._yourself();
  5221. $1=$3;
  5222. return $1;
  5223. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5224. args: [],
  5225. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  5226. messageSends: ["add:", "new", "yourself"],
  5227. referencedClasses: ["Set"]
  5228. }),
  5229. smalltalk.SetTest);
  5230. smalltalk.addMethod(
  5231. smalltalk.method({
  5232. selector: "testAddAll",
  5233. protocol: 'tests',
  5234. fn: function (){
  5235. var self=this;
  5236. return smalltalk.withContext(function($ctx1) {
  5237. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5238. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5239. $2=self._collection();
  5240. $ctx1.sendIdx["collection"]=1;
  5241. $3=$2;
  5242. $4=self._collection();
  5243. $ctx1.sendIdx["collection"]=2;
  5244. _st($3)._addAll_($4);
  5245. $ctx1.sendIdx["addAll:"]=1;
  5246. $5=_st($2)._yourself();
  5247. $ctx1.sendIdx["yourself"]=1;
  5248. $1=$5;
  5249. $6=self._collection();
  5250. $ctx1.sendIdx["collection"]=3;
  5251. self._assert_equals_($1,$6);
  5252. $ctx1.sendIdx["assert:equals:"]=1;
  5253. $8=self._collection();
  5254. $ctx1.sendIdx["collection"]=4;
  5255. $9=$8;
  5256. $10=self._collectionWithNewValue();
  5257. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5258. _st($9)._addAll_($10);
  5259. $ctx1.sendIdx["addAll:"]=2;
  5260. $11=_st($8)._yourself();
  5261. $ctx1.sendIdx["yourself"]=2;
  5262. $7=$11;
  5263. $12=self._collectionWithNewValue();
  5264. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5265. self._assert_equals_($7,$12);
  5266. $ctx1.sendIdx["assert:equals:"]=2;
  5267. $14=self._collectionWithNewValue();
  5268. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5269. _st($14)._addAll_(self._collection());
  5270. $15=_st($14)._yourself();
  5271. $13=$15;
  5272. self._assert_equals_($13,self._collectionWithNewValue());
  5273. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5274. args: [],
  5275. 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",
  5276. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5277. referencedClasses: []
  5278. }),
  5279. smalltalk.SetTest);
  5280. smalltalk.addMethod(
  5281. smalltalk.method({
  5282. selector: "testAddRemove",
  5283. protocol: 'tests',
  5284. fn: function (){
  5285. var self=this;
  5286. var set;
  5287. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5288. return smalltalk.withContext(function($ctx1) {
  5289. var $1,$2;
  5290. set=_st($Set())._new();
  5291. self._assert_(_st(set)._isEmpty());
  5292. $ctx1.sendIdx["assert:"]=1;
  5293. _st(set)._add_((3));
  5294. $ctx1.sendIdx["add:"]=1;
  5295. $1=_st(set)._includes_((3));
  5296. $ctx1.sendIdx["includes:"]=1;
  5297. self._assert_($1);
  5298. $ctx1.sendIdx["assert:"]=2;
  5299. _st(set)._add_((5));
  5300. $2=_st(set)._includes_((5));
  5301. $ctx1.sendIdx["includes:"]=2;
  5302. self._assert_($2);
  5303. _st(set)._remove_((3));
  5304. self._deny_(_st(set)._includes_((3)));
  5305. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5306. args: [],
  5307. 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)",
  5308. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5309. referencedClasses: ["Set"]
  5310. }),
  5311. smalltalk.SetTest);
  5312. smalltalk.addMethod(
  5313. smalltalk.method({
  5314. selector: "testAt",
  5315. protocol: 'tests',
  5316. fn: function (){
  5317. var self=this;
  5318. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5319. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5320. return smalltalk.withContext(function($ctx1) {
  5321. self._should_raise_((function(){
  5322. return smalltalk.withContext(function($ctx2) {
  5323. return _st(_st($Set())._new())._at_put_((1),(2));
  5324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5325. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5326. args: [],
  5327. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5328. messageSends: ["should:raise:", "at:put:", "new"],
  5329. referencedClasses: ["Set", "Error"]
  5330. }),
  5331. smalltalk.SetTest);
  5332. smalltalk.addMethod(
  5333. smalltalk.method({
  5334. selector: "testCollect",
  5335. protocol: 'tests',
  5336. fn: function (){
  5337. var self=this;
  5338. return smalltalk.withContext(function($ctx1) {
  5339. var $2,$1;
  5340. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5341. $2=[(5), (6), (8)]._asSet();
  5342. $ctx1.sendIdx["asSet"]=1;
  5343. $1=_st($2)._collect_((function(x){
  5344. return smalltalk.withContext(function($ctx2) {
  5345. return _st(x).__backslash_backslash((3));
  5346. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5347. self._assert_equals_($1,[(0), (2)]._asSet());
  5348. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5349. args: [],
  5350. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5351. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5352. referencedClasses: []
  5353. }),
  5354. smalltalk.SetTest);
  5355. smalltalk.addMethod(
  5356. smalltalk.method({
  5357. selector: "testComma",
  5358. protocol: 'tests',
  5359. fn: function (){
  5360. var self=this;
  5361. return smalltalk.withContext(function($ctx1) {
  5362. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5363. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5364. $2=self._collection();
  5365. $ctx1.sendIdx["collection"]=1;
  5366. $3=self._collection();
  5367. $ctx1.sendIdx["collection"]=2;
  5368. $1=_st($2).__comma($3);
  5369. $ctx1.sendIdx[","]=1;
  5370. $4=self._collection();
  5371. $ctx1.sendIdx["collection"]=3;
  5372. self._assert_equals_($1,$4);
  5373. $ctx1.sendIdx["assert:equals:"]=1;
  5374. $6=self._collection();
  5375. $ctx1.sendIdx["collection"]=4;
  5376. $7=self._collectionWithNewValue();
  5377. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5378. $5=_st($6).__comma($7);
  5379. $ctx1.sendIdx[","]=2;
  5380. $8=self._collectionWithNewValue();
  5381. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5382. self._assert_equals_($5,$8);
  5383. $ctx1.sendIdx["assert:equals:"]=2;
  5384. $10=self._collectionWithNewValue();
  5385. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5386. $9=_st($10).__comma(self._collection());
  5387. self._assert_equals_($9,self._collectionWithNewValue());
  5388. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5389. args: [],
  5390. 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",
  5391. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5392. referencedClasses: []
  5393. }),
  5394. smalltalk.SetTest);
  5395. smalltalk.addMethod(
  5396. smalltalk.method({
  5397. selector: "testComparing",
  5398. protocol: 'tests',
  5399. fn: function (){
  5400. var self=this;
  5401. return smalltalk.withContext(function($ctx1) {
  5402. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5403. $1=[(0), (2)]._asSet();
  5404. $ctx1.sendIdx["asSet"]=1;
  5405. $2=[(0), (2)]._asSet();
  5406. $ctx1.sendIdx["asSet"]=2;
  5407. self._assert_equals_($1,$2);
  5408. $ctx1.sendIdx["assert:equals:"]=1;
  5409. $3=[(2), (0)]._asSet();
  5410. $ctx1.sendIdx["asSet"]=3;
  5411. $4=[(0), (2)]._asSet();
  5412. $ctx1.sendIdx["asSet"]=4;
  5413. self._assert_equals_($3,$4);
  5414. $6=[(0), (2), (3)]._asSet();
  5415. $ctx1.sendIdx["asSet"]=5;
  5416. $7=[(0), (2)]._asSet();
  5417. $ctx1.sendIdx["asSet"]=6;
  5418. $5=_st($6).__eq($7);
  5419. $ctx1.sendIdx["="]=1;
  5420. self._deny_($5);
  5421. $ctx1.sendIdx["deny:"]=1;
  5422. $9=[(1), (2)]._asSet();
  5423. $ctx1.sendIdx["asSet"]=7;
  5424. $8=_st($9).__eq([(0), (2)]._asSet());
  5425. self._deny_($8);
  5426. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5427. args: [],
  5428. 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",
  5429. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5430. referencedClasses: []
  5431. }),
  5432. smalltalk.SetTest);
  5433. smalltalk.addMethod(
  5434. smalltalk.method({
  5435. selector: "testPrintString",
  5436. protocol: 'tests',
  5437. fn: function (){
  5438. var self=this;
  5439. var set;
  5440. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5441. return smalltalk.withContext(function($ctx1) {
  5442. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5443. set=_st($Set())._new();
  5444. $1=_st(set)._printString();
  5445. $ctx1.sendIdx["printString"]=1;
  5446. self._assert_equals_($1,"a Set ()");
  5447. $ctx1.sendIdx["assert:equals:"]=1;
  5448. $2=set;
  5449. _st($2)._add_((1));
  5450. $ctx1.sendIdx["add:"]=1;
  5451. $3=_st($2)._add_((3));
  5452. $ctx1.sendIdx["add:"]=2;
  5453. $4=_st(set)._printString();
  5454. $ctx1.sendIdx["printString"]=2;
  5455. self._assert_equals_($4,"a Set (1 3)");
  5456. $ctx1.sendIdx["assert:equals:"]=2;
  5457. _st(set)._add_("foo");
  5458. $ctx1.sendIdx["add:"]=3;
  5459. $5=_st(set)._printString();
  5460. $ctx1.sendIdx["printString"]=3;
  5461. self._assert_equals_($5,"a Set (1 3 'foo')");
  5462. $ctx1.sendIdx["assert:equals:"]=3;
  5463. $6=set;
  5464. _st($6)._remove_((1));
  5465. $ctx1.sendIdx["remove:"]=1;
  5466. $7=_st($6)._remove_((3));
  5467. $8=_st(set)._printString();
  5468. $ctx1.sendIdx["printString"]=4;
  5469. self._assert_equals_($8,"a Set ('foo')");
  5470. $ctx1.sendIdx["assert:equals:"]=4;
  5471. _st(set)._add_((3));
  5472. $ctx1.sendIdx["add:"]=4;
  5473. $9=_st(set)._printString();
  5474. $ctx1.sendIdx["printString"]=5;
  5475. self._assert_equals_($9,"a Set ('foo' 3)");
  5476. $ctx1.sendIdx["assert:equals:"]=5;
  5477. _st(set)._add_((3));
  5478. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5479. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5480. args: [],
  5481. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  5482. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5483. referencedClasses: ["Set"]
  5484. }),
  5485. smalltalk.SetTest);
  5486. smalltalk.addMethod(
  5487. smalltalk.method({
  5488. selector: "testUnboxedObjects",
  5489. protocol: 'tests',
  5490. fn: function (){
  5491. var self=this;
  5492. return smalltalk.withContext(function($ctx1) {
  5493. var $4,$3,$2,$1;
  5494. $4="foo"._yourself();
  5495. $ctx1.sendIdx["yourself"]=1;
  5496. $3=[$4,"foo"._yourself()];
  5497. $2=_st($3)._asSet();
  5498. $1=_st($2)._asArray();
  5499. self._assert_equals_($1,["foo"]);
  5500. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5501. args: [],
  5502. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5503. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5504. referencedClasses: []
  5505. }),
  5506. smalltalk.SetTest);
  5507. smalltalk.addMethod(
  5508. smalltalk.method({
  5509. selector: "testUnicity",
  5510. protocol: 'tests',
  5511. fn: function (){
  5512. var self=this;
  5513. var set;
  5514. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5515. return smalltalk.withContext(function($ctx1) {
  5516. var $1;
  5517. set=_st($Set())._new();
  5518. _st(set)._add_((21));
  5519. $ctx1.sendIdx["add:"]=1;
  5520. _st(set)._add_("hello");
  5521. $ctx1.sendIdx["add:"]=2;
  5522. _st(set)._add_((21));
  5523. $ctx1.sendIdx["add:"]=3;
  5524. $1=_st(set)._size();
  5525. $ctx1.sendIdx["size"]=1;
  5526. self._assert_equals_($1,(2));
  5527. $ctx1.sendIdx["assert:equals:"]=1;
  5528. _st(set)._add_("hello");
  5529. self._assert_equals_(_st(set)._size(),(2));
  5530. $ctx1.sendIdx["assert:equals:"]=2;
  5531. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5532. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5533. args: [],
  5534. 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')",
  5535. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5536. referencedClasses: ["Set"]
  5537. }),
  5538. smalltalk.SetTest);
  5539. smalltalk.addMethod(
  5540. smalltalk.method({
  5541. selector: "collectionClass",
  5542. protocol: 'fixture',
  5543. fn: function (){
  5544. var self=this;
  5545. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5546. return smalltalk.withContext(function($ctx1) {
  5547. return $Set();
  5548. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5549. args: [],
  5550. source: "collectionClass\x0a\x09^ Set",
  5551. messageSends: [],
  5552. referencedClasses: ["Set"]
  5553. }),
  5554. smalltalk.SetTest.klass);
  5555. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5556. smalltalk.addMethod(
  5557. smalltalk.method({
  5558. selector: "testShow",
  5559. protocol: 'tests',
  5560. fn: function (){
  5561. var self=this;
  5562. var originalTranscript;
  5563. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5564. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5565. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5566. return smalltalk.withContext(function($ctx1) {
  5567. originalTranscript=_st($Transcript())._current();
  5568. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5569. $ctx1.sendIdx["register:"]=1;
  5570. self._shouldnt_raise_((function(){
  5571. return smalltalk.withContext(function($ctx2) {
  5572. return _st($Transcript())._show_("Hello console!");
  5573. $ctx2.sendIdx["show:"]=1;
  5574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5575. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5576. self._shouldnt_raise_((function(){
  5577. return smalltalk.withContext(function($ctx2) {
  5578. return _st($Transcript())._show_(console);
  5579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5580. _st($Transcript())._register_(originalTranscript);
  5581. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5582. args: [],
  5583. 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.",
  5584. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5585. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5586. }),
  5587. smalltalk.ConsoleTranscriptTest);
  5588. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5589. smalltalk.addMethod(
  5590. smalltalk.method({
  5591. selector: "jsObject",
  5592. protocol: 'accessing',
  5593. fn: function (){
  5594. var self=this;
  5595. return smalltalk.withContext(function($ctx1) {
  5596. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5597. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5598. args: [],
  5599. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5600. messageSends: [],
  5601. referencedClasses: []
  5602. }),
  5603. smalltalk.JSObjectProxyTest);
  5604. smalltalk.addMethod(
  5605. smalltalk.method({
  5606. selector: "testAtIfAbsent",
  5607. protocol: 'tests',
  5608. fn: function (){
  5609. var self=this;
  5610. var testObject;
  5611. return smalltalk.withContext(function($ctx1) {
  5612. var $1,$2,$3;
  5613. testObject=self._jsObject();
  5614. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5615. return smalltalk.withContext(function($ctx2) {
  5616. return "Property does not exist";
  5617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5618. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5619. self._assert_equals_($1,"Property does not exist");
  5620. $ctx1.sendIdx["assert:equals:"]=1;
  5621. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5622. return smalltalk.withContext(function($ctx2) {
  5623. return "Property does not exist";
  5624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5625. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5626. self._assert_equals_($2,nil);
  5627. $ctx1.sendIdx["assert:equals:"]=2;
  5628. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5629. return smalltalk.withContext(function($ctx2) {
  5630. return "Property does not exist";
  5631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5632. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5633. self._assert_equals_($3,(1));
  5634. $ctx1.sendIdx["assert:equals:"]=3;
  5635. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5636. return smalltalk.withContext(function($ctx2) {
  5637. return "Property does not exist";
  5638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5639. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5640. args: [],
  5641. 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.",
  5642. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5643. referencedClasses: []
  5644. }),
  5645. smalltalk.JSObjectProxyTest);
  5646. smalltalk.addMethod(
  5647. smalltalk.method({
  5648. selector: "testAtIfPresent",
  5649. protocol: 'tests',
  5650. fn: function (){
  5651. var self=this;
  5652. var testObject;
  5653. return smalltalk.withContext(function($ctx1) {
  5654. var $2,$1,$4,$3,$6,$5;
  5655. testObject=self._jsObject();
  5656. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5657. return smalltalk.withContext(function($ctx2) {
  5658. $2=_st(x)._asString();
  5659. $ctx2.sendIdx["asString"]=1;
  5660. return "hello ".__comma($2);
  5661. $ctx2.sendIdx[","]=1;
  5662. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5663. $ctx1.sendIdx["at:ifPresent:"]=1;
  5664. self._assert_equals_($1,nil);
  5665. $ctx1.sendIdx["assert:equals:"]=1;
  5666. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5667. return smalltalk.withContext(function($ctx2) {
  5668. $4=_st(x)._asString();
  5669. $ctx2.sendIdx["asString"]=2;
  5670. return "hello ".__comma($4);
  5671. $ctx2.sendIdx[","]=2;
  5672. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5673. $ctx1.sendIdx["at:ifPresent:"]=2;
  5674. self._assert_equals_($3,"hello nil");
  5675. $ctx1.sendIdx["assert:equals:"]=2;
  5676. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5677. return smalltalk.withContext(function($ctx2) {
  5678. $6=_st(x)._asString();
  5679. $ctx2.sendIdx["asString"]=3;
  5680. return "hello ".__comma($6);
  5681. $ctx2.sendIdx[","]=3;
  5682. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5683. $ctx1.sendIdx["at:ifPresent:"]=3;
  5684. self._assert_equals_($5,"hello 1");
  5685. $ctx1.sendIdx["assert:equals:"]=3;
  5686. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5687. return smalltalk.withContext(function($ctx2) {
  5688. return "hello ".__comma(_st(x)._asString());
  5689. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5690. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5691. args: [],
  5692. 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'.",
  5693. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5694. referencedClasses: []
  5695. }),
  5696. smalltalk.JSObjectProxyTest);
  5697. smalltalk.addMethod(
  5698. smalltalk.method({
  5699. selector: "testAtIfPresentIfAbsent",
  5700. protocol: 'tests',
  5701. fn: function (){
  5702. var self=this;
  5703. var testObject;
  5704. return smalltalk.withContext(function($ctx1) {
  5705. var $2,$1,$4,$3,$6,$5;
  5706. testObject=self._jsObject();
  5707. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5708. return smalltalk.withContext(function($ctx2) {
  5709. $2=_st(x)._asString();
  5710. $ctx2.sendIdx["asString"]=1;
  5711. return "hello ".__comma($2);
  5712. $ctx2.sendIdx[","]=1;
  5713. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5714. return smalltalk.withContext(function($ctx2) {
  5715. return "not present";
  5716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5717. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5718. self._assert_equals_($1,"not present");
  5719. $ctx1.sendIdx["assert:equals:"]=1;
  5720. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5721. return smalltalk.withContext(function($ctx2) {
  5722. $4=_st(x)._asString();
  5723. $ctx2.sendIdx["asString"]=2;
  5724. return "hello ".__comma($4);
  5725. $ctx2.sendIdx[","]=2;
  5726. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5727. return smalltalk.withContext(function($ctx2) {
  5728. return "not present";
  5729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5730. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5731. self._assert_equals_($3,"hello nil");
  5732. $ctx1.sendIdx["assert:equals:"]=2;
  5733. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5734. return smalltalk.withContext(function($ctx2) {
  5735. $6=_st(x)._asString();
  5736. $ctx2.sendIdx["asString"]=3;
  5737. return "hello ".__comma($6);
  5738. $ctx2.sendIdx[","]=3;
  5739. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5740. return smalltalk.withContext(function($ctx2) {
  5741. return "not present";
  5742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5743. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5744. self._assert_equals_($5,"hello 1");
  5745. $ctx1.sendIdx["assert:equals:"]=3;
  5746. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5747. return smalltalk.withContext(function($ctx2) {
  5748. return "hello ".__comma(_st(x)._asString());
  5749. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5750. return smalltalk.withContext(function($ctx2) {
  5751. return "not present";
  5752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5753. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5754. args: [],
  5755. 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'.",
  5756. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5757. referencedClasses: []
  5758. }),
  5759. smalltalk.JSObjectProxyTest);
  5760. smalltalk.addMethod(
  5761. smalltalk.method({
  5762. selector: "testAtPut",
  5763. protocol: 'tests',
  5764. fn: function (){
  5765. var self=this;
  5766. var testObject;
  5767. return smalltalk.withContext(function($ctx1) {
  5768. var $2,$1;
  5769. testObject=self._jsObject();
  5770. $2=_st(testObject)._at_("abc");
  5771. $ctx1.sendIdx["at:"]=1;
  5772. $1=_st($2).__tild_eq("xyz");
  5773. self._assert_($1);
  5774. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5775. $ctx1.sendIdx["assert:equals:"]=1;
  5776. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5777. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5778. args: [],
  5779. 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'",
  5780. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5781. referencedClasses: []
  5782. }),
  5783. smalltalk.JSObjectProxyTest);
  5784. smalltalk.addMethod(
  5785. smalltalk.method({
  5786. selector: "testDNU",
  5787. protocol: 'tests',
  5788. fn: function (){
  5789. var self=this;
  5790. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5791. return smalltalk.withContext(function($ctx1) {
  5792. self._should_raise_((function(){
  5793. return smalltalk.withContext(function($ctx2) {
  5794. return _st(self._jsObject())._foo();
  5795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5796. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5797. args: [],
  5798. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5799. messageSends: ["should:raise:", "foo", "jsObject"],
  5800. referencedClasses: ["MessageNotUnderstood"]
  5801. }),
  5802. smalltalk.JSObjectProxyTest);
  5803. smalltalk.addMethod(
  5804. smalltalk.method({
  5805. selector: "testMessageSend",
  5806. protocol: 'tests',
  5807. fn: function (){
  5808. var self=this;
  5809. return smalltalk.withContext(function($ctx1) {
  5810. var $2,$1,$4,$3;
  5811. $2=self._jsObject();
  5812. $ctx1.sendIdx["jsObject"]=1;
  5813. $1=_st($2)._a();
  5814. self._assert_equals_($1,(1));
  5815. $ctx1.sendIdx["assert:equals:"]=1;
  5816. $4=self._jsObject();
  5817. $ctx1.sendIdx["jsObject"]=2;
  5818. $3=_st($4)._b();
  5819. self._assert_equals_($3,(2));
  5820. $ctx1.sendIdx["assert:equals:"]=2;
  5821. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5822. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5823. args: [],
  5824. 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",
  5825. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5826. referencedClasses: []
  5827. }),
  5828. smalltalk.JSObjectProxyTest);
  5829. smalltalk.addMethod(
  5830. smalltalk.method({
  5831. selector: "testMethodWithArguments",
  5832. protocol: 'tests',
  5833. fn: function (){
  5834. var self=this;
  5835. return smalltalk.withContext(function($ctx1) {
  5836. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5837. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5838. args: [],
  5839. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5840. messageSends: ["assert:equals:", "c:", "jsObject"],
  5841. referencedClasses: []
  5842. }),
  5843. smalltalk.JSObjectProxyTest);
  5844. smalltalk.addMethod(
  5845. smalltalk.method({
  5846. selector: "testPrinting",
  5847. protocol: 'tests',
  5848. fn: function (){
  5849. var self=this;
  5850. return smalltalk.withContext(function($ctx1) {
  5851. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5852. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5853. args: [],
  5854. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5855. messageSends: ["assert:equals:", "printString", "jsObject"],
  5856. referencedClasses: []
  5857. }),
  5858. smalltalk.JSObjectProxyTest);
  5859. smalltalk.addMethod(
  5860. smalltalk.method({
  5861. selector: "testPropertyThatReturnsEmptyString",
  5862. protocol: 'tests',
  5863. fn: function (){
  5864. var self=this;
  5865. var object;
  5866. return smalltalk.withContext(function($ctx1) {
  5867. var $1;
  5868. object=self._jsObject();
  5869. $1=_st(object)._d();
  5870. $ctx1.sendIdx["d"]=1;
  5871. self._assert_equals_($1,"");
  5872. $ctx1.sendIdx["assert:equals:"]=1;
  5873. _st(object)._d_("hello");
  5874. self._assert_equals_(_st(object)._d(),"hello");
  5875. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5876. args: [],
  5877. 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'",
  5878. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5879. referencedClasses: []
  5880. }),
  5881. smalltalk.JSObjectProxyTest);
  5882. smalltalk.addMethod(
  5883. smalltalk.method({
  5884. selector: "testPropertyThatReturnsUndefined",
  5885. protocol: 'tests',
  5886. fn: function (){
  5887. var self=this;
  5888. var object;
  5889. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5890. return smalltalk.withContext(function($ctx1) {
  5891. object=self._jsObject();
  5892. self._shouldnt_raise_((function(){
  5893. return smalltalk.withContext(function($ctx2) {
  5894. return _st(object)._e();
  5895. $ctx2.sendIdx["e"]=1;
  5896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5897. self._assert_(_st(_st(object)._e())._isNil());
  5898. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5899. args: [],
  5900. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5901. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5902. referencedClasses: ["MessageNotUnderstood"]
  5903. }),
  5904. smalltalk.JSObjectProxyTest);
  5905. smalltalk.addMethod(
  5906. smalltalk.method({
  5907. selector: "testValue",
  5908. protocol: 'tests',
  5909. fn: function (){
  5910. var self=this;
  5911. var testObject;
  5912. return smalltalk.withContext(function($ctx1) {
  5913. testObject=self._jsObject();
  5914. _st(testObject)._at_put_("value","aValue");
  5915. self._assert_equals_(_st(testObject)._value(),"aValue");
  5916. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5917. args: [],
  5918. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5919. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5920. referencedClasses: []
  5921. }),
  5922. smalltalk.JSObjectProxyTest);
  5923. smalltalk.addMethod(
  5924. smalltalk.method({
  5925. selector: "testYourself",
  5926. protocol: 'tests',
  5927. fn: function (){
  5928. var self=this;
  5929. var object;
  5930. return smalltalk.withContext(function($ctx1) {
  5931. var $1,$2;
  5932. $1=self._jsObject();
  5933. _st($1)._d_("test");
  5934. $2=_st($1)._yourself();
  5935. object=$2;
  5936. self._assert_equals_(_st(object)._d(),"test");
  5937. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5938. args: [],
  5939. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5940. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5941. referencedClasses: []
  5942. }),
  5943. smalltalk.JSObjectProxyTest);
  5944. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5945. smalltalk.addMethod(
  5946. smalltalk.method({
  5947. selector: "testCatchingException",
  5948. protocol: 'tests',
  5949. fn: function (){
  5950. var self=this;
  5951. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5952. return smalltalk.withContext(function($ctx1) {
  5953. _st((function(){
  5954. return smalltalk.withContext(function($ctx2) {
  5955. return self._throwException();
  5956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5957. return smalltalk.withContext(function($ctx2) {
  5958. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5959. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5960. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5961. args: [],
  5962. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5963. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5964. referencedClasses: ["Error"]
  5965. }),
  5966. smalltalk.JavaScriptExceptionTest);
  5967. smalltalk.addMethod(
  5968. smalltalk.method({
  5969. selector: "testRaisingException",
  5970. protocol: 'tests',
  5971. fn: function (){
  5972. var self=this;
  5973. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5974. return smalltalk.withContext(function($ctx1) {
  5975. self._should_raise_((function(){
  5976. return smalltalk.withContext(function($ctx2) {
  5977. return self._throwException();
  5978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5979. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5980. args: [],
  5981. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5982. messageSends: ["should:raise:", "throwException"],
  5983. referencedClasses: ["JavaScriptException"]
  5984. }),
  5985. smalltalk.JavaScriptExceptionTest);
  5986. smalltalk.addMethod(
  5987. smalltalk.method({
  5988. selector: "throwException",
  5989. protocol: 'helpers',
  5990. fn: function (){
  5991. var self=this;
  5992. return smalltalk.withContext(function($ctx1) {
  5993. throw 'test';
  5994. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5995. args: [],
  5996. source: "throwException\x0a\x09<throw 'test'>",
  5997. messageSends: [],
  5998. referencedClasses: []
  5999. }),
  6000. smalltalk.JavaScriptExceptionTest);
  6001. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6002. smalltalk.addMethod(
  6003. smalltalk.method({
  6004. selector: "testValue",
  6005. protocol: 'tests',
  6006. fn: function (){
  6007. var self=this;
  6008. var messageSend;
  6009. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6010. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6011. return smalltalk.withContext(function($ctx1) {
  6012. var $1,$2;
  6013. $1=_st($MessageSend())._new();
  6014. $ctx1.sendIdx["new"]=1;
  6015. _st($1)._receiver_(_st($Object())._new());
  6016. _st($1)._selector_("asString");
  6017. $2=_st($1)._yourself();
  6018. messageSend=$2;
  6019. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6020. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6021. args: [],
  6022. 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'",
  6023. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6024. referencedClasses: ["MessageSend", "Object"]
  6025. }),
  6026. smalltalk.MessageSendTest);
  6027. smalltalk.addMethod(
  6028. smalltalk.method({
  6029. selector: "testValueWithArguments",
  6030. protocol: 'tests',
  6031. fn: function (){
  6032. var self=this;
  6033. var messageSend;
  6034. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6035. return smalltalk.withContext(function($ctx1) {
  6036. var $1,$2;
  6037. $1=_st($MessageSend())._new();
  6038. _st($1)._receiver_((2));
  6039. _st($1)._selector_("+");
  6040. $2=_st($1)._yourself();
  6041. messageSend=$2;
  6042. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6043. $ctx1.sendIdx["assert:equals:"]=1;
  6044. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6045. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6046. args: [],
  6047. 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",
  6048. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6049. referencedClasses: ["MessageSend"]
  6050. }),
  6051. smalltalk.MessageSendTest);
  6052. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6053. smalltalk.addMethod(
  6054. smalltalk.method({
  6055. selector: "codeGeneratorClass",
  6056. protocol: 'accessing',
  6057. fn: function (){
  6058. var self=this;
  6059. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6060. return smalltalk.withContext(function($ctx1) {
  6061. return $CodeGenerator();
  6062. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  6063. args: [],
  6064. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6065. messageSends: [],
  6066. referencedClasses: ["CodeGenerator"]
  6067. }),
  6068. smalltalk.MethodInheritanceTest);
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "compiler",
  6072. protocol: 'factory',
  6073. fn: function (){
  6074. var self=this;
  6075. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6076. return smalltalk.withContext(function($ctx1) {
  6077. var $2,$3,$1;
  6078. $2=_st($Compiler())._new();
  6079. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6080. $3=_st($2)._yourself();
  6081. $1=$3;
  6082. return $1;
  6083. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  6084. args: [],
  6085. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6086. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6087. referencedClasses: ["Compiler"]
  6088. }),
  6089. smalltalk.MethodInheritanceTest);
  6090. smalltalk.addMethod(
  6091. smalltalk.method({
  6092. selector: "deinstallBottom",
  6093. protocol: 'testing',
  6094. fn: function (){
  6095. var self=this;
  6096. return smalltalk.withContext(function($ctx1) {
  6097. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6098. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  6099. args: [],
  6100. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6101. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6102. referencedClasses: []
  6103. }),
  6104. smalltalk.MethodInheritanceTest);
  6105. smalltalk.addMethod(
  6106. smalltalk.method({
  6107. selector: "deinstallMiddle",
  6108. protocol: 'testing',
  6109. fn: function (){
  6110. var self=this;
  6111. return smalltalk.withContext(function($ctx1) {
  6112. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6113. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  6114. args: [],
  6115. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6116. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6117. referencedClasses: []
  6118. }),
  6119. smalltalk.MethodInheritanceTest);
  6120. smalltalk.addMethod(
  6121. smalltalk.method({
  6122. selector: "deinstallTop",
  6123. protocol: 'testing',
  6124. fn: function (){
  6125. var self=this;
  6126. return smalltalk.withContext(function($ctx1) {
  6127. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6128. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  6129. args: [],
  6130. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6131. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6132. referencedClasses: []
  6133. }),
  6134. smalltalk.MethodInheritanceTest);
  6135. smalltalk.addMethod(
  6136. smalltalk.method({
  6137. selector: "installBottom:",
  6138. protocol: 'testing',
  6139. fn: function (aString){
  6140. var self=this;
  6141. return smalltalk.withContext(function($ctx1) {
  6142. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6143. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6144. args: ["aString"],
  6145. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6146. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6147. referencedClasses: []
  6148. }),
  6149. smalltalk.MethodInheritanceTest);
  6150. smalltalk.addMethod(
  6151. smalltalk.method({
  6152. selector: "installMiddle:",
  6153. protocol: 'testing',
  6154. fn: function (aString){
  6155. var self=this;
  6156. return smalltalk.withContext(function($ctx1) {
  6157. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6158. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6159. args: ["aString"],
  6160. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6161. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6162. referencedClasses: []
  6163. }),
  6164. smalltalk.MethodInheritanceTest);
  6165. smalltalk.addMethod(
  6166. smalltalk.method({
  6167. selector: "installTop:",
  6168. protocol: 'testing',
  6169. fn: function (aString){
  6170. var self=this;
  6171. return smalltalk.withContext(function($ctx1) {
  6172. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6173. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6174. args: ["aString"],
  6175. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6176. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6177. referencedClasses: []
  6178. }),
  6179. smalltalk.MethodInheritanceTest);
  6180. smalltalk.addMethod(
  6181. smalltalk.method({
  6182. selector: "setUp",
  6183. protocol: 'initialization',
  6184. fn: function (){
  6185. var self=this;
  6186. return smalltalk.withContext(function($ctx1) {
  6187. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6188. $ctx1.sendIdx["new"]=1;
  6189. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6190. $ctx1.sendIdx["new"]=2;
  6191. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6192. self["@method"]=nil;
  6193. self["@performBlock"]=(function(){
  6194. return smalltalk.withContext(function($ctx2) {
  6195. return self._error_("performBlock not initialized");
  6196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6197. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  6198. args: [],
  6199. 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' ]",
  6200. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6201. referencedClasses: []
  6202. }),
  6203. smalltalk.MethodInheritanceTest);
  6204. smalltalk.addMethod(
  6205. smalltalk.method({
  6206. selector: "shouldMNU",
  6207. protocol: 'testing',
  6208. fn: function (){
  6209. var self=this;
  6210. return smalltalk.withContext(function($ctx1) {
  6211. self._shouldMNUTop();
  6212. self._shouldMNUMiddle();
  6213. self._shouldMNUBottom();
  6214. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6215. args: [],
  6216. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6217. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6218. referencedClasses: []
  6219. }),
  6220. smalltalk.MethodInheritanceTest);
  6221. smalltalk.addMethod(
  6222. smalltalk.method({
  6223. selector: "shouldMNUBottom",
  6224. protocol: 'testing',
  6225. fn: function (){
  6226. var self=this;
  6227. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6228. return smalltalk.withContext(function($ctx1) {
  6229. self._should_raise_((function(){
  6230. return smalltalk.withContext(function($ctx2) {
  6231. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6233. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6234. args: [],
  6235. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6236. messageSends: ["should:raise:", "value:"],
  6237. referencedClasses: ["MessageNotUnderstood"]
  6238. }),
  6239. smalltalk.MethodInheritanceTest);
  6240. smalltalk.addMethod(
  6241. smalltalk.method({
  6242. selector: "shouldMNUMiddle",
  6243. protocol: 'testing',
  6244. fn: function (){
  6245. var self=this;
  6246. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6247. return smalltalk.withContext(function($ctx1) {
  6248. self._should_raise_((function(){
  6249. return smalltalk.withContext(function($ctx2) {
  6250. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6252. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6253. args: [],
  6254. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6255. messageSends: ["should:raise:", "value:"],
  6256. referencedClasses: ["MessageNotUnderstood"]
  6257. }),
  6258. smalltalk.MethodInheritanceTest);
  6259. smalltalk.addMethod(
  6260. smalltalk.method({
  6261. selector: "shouldMNUTop",
  6262. protocol: 'testing',
  6263. fn: function (){
  6264. var self=this;
  6265. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6266. return smalltalk.withContext(function($ctx1) {
  6267. self._should_raise_((function(){
  6268. return smalltalk.withContext(function($ctx2) {
  6269. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6271. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6272. args: [],
  6273. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6274. messageSends: ["should:raise:", "value:"],
  6275. referencedClasses: ["MessageNotUnderstood"]
  6276. }),
  6277. smalltalk.MethodInheritanceTest);
  6278. smalltalk.addMethod(
  6279. smalltalk.method({
  6280. selector: "shouldReturn:",
  6281. protocol: 'testing',
  6282. fn: function (anObject){
  6283. var self=this;
  6284. var result;
  6285. return smalltalk.withContext(function($ctx1) {
  6286. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6287. $ctx1.sendIdx["value:"]=1;
  6288. self._assert_equals_(["top",anObject],["top",result]);
  6289. $ctx1.sendIdx["assert:equals:"]=1;
  6290. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6291. $ctx1.sendIdx["value:"]=2;
  6292. self._assert_equals_(["middle",anObject],["middle",result]);
  6293. $ctx1.sendIdx["assert:equals:"]=2;
  6294. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6295. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6296. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6297. args: ["anObject"],
  6298. 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 }",
  6299. messageSends: ["value:", "assert:equals:"],
  6300. referencedClasses: []
  6301. }),
  6302. smalltalk.MethodInheritanceTest);
  6303. smalltalk.addMethod(
  6304. smalltalk.method({
  6305. selector: "shouldReturn:and:and:",
  6306. protocol: 'testing',
  6307. fn: function (anObject,anObject2,anObject3){
  6308. var self=this;
  6309. var result;
  6310. return smalltalk.withContext(function($ctx1) {
  6311. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6312. $ctx1.sendIdx["value:"]=1;
  6313. self._assert_equals_(["top",anObject],["top",result]);
  6314. $ctx1.sendIdx["assert:equals:"]=1;
  6315. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6316. $ctx1.sendIdx["value:"]=2;
  6317. self._assert_equals_(["middle",anObject2],["middle",result]);
  6318. $ctx1.sendIdx["assert:equals:"]=2;
  6319. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6320. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6321. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6322. args: ["anObject", "anObject2", "anObject3"],
  6323. 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 }",
  6324. messageSends: ["value:", "assert:equals:"],
  6325. referencedClasses: []
  6326. }),
  6327. smalltalk.MethodInheritanceTest);
  6328. smalltalk.addMethod(
  6329. smalltalk.method({
  6330. selector: "targetClassBottom",
  6331. protocol: 'accessing',
  6332. fn: function (){
  6333. var self=this;
  6334. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6335. return smalltalk.withContext(function($ctx1) {
  6336. return $JavaScriptException();
  6337. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6338. args: [],
  6339. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6340. messageSends: [],
  6341. referencedClasses: ["JavaScriptException"]
  6342. }),
  6343. smalltalk.MethodInheritanceTest);
  6344. smalltalk.addMethod(
  6345. smalltalk.method({
  6346. selector: "targetClassMiddle",
  6347. protocol: 'accessing',
  6348. fn: function (){
  6349. var self=this;
  6350. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6351. return smalltalk.withContext(function($ctx1) {
  6352. return $Error();
  6353. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6354. args: [],
  6355. source: "targetClassMiddle\x0a\x09^ Error",
  6356. messageSends: [],
  6357. referencedClasses: ["Error"]
  6358. }),
  6359. smalltalk.MethodInheritanceTest);
  6360. smalltalk.addMethod(
  6361. smalltalk.method({
  6362. selector: "targetClassTop",
  6363. protocol: 'accessing',
  6364. fn: function (){
  6365. var self=this;
  6366. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6367. return smalltalk.withContext(function($ctx1) {
  6368. return $Object();
  6369. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6370. args: [],
  6371. source: "targetClassTop\x0a\x09^ Object",
  6372. messageSends: [],
  6373. referencedClasses: ["Object"]
  6374. }),
  6375. smalltalk.MethodInheritanceTest);
  6376. smalltalk.addMethod(
  6377. smalltalk.method({
  6378. selector: "tearDown",
  6379. protocol: 'initialization',
  6380. fn: function (){
  6381. var self=this;
  6382. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6383. return smalltalk.withContext(function($ctx1) {
  6384. _st((function(){
  6385. return smalltalk.withContext(function($ctx2) {
  6386. return self._deinstallTop();
  6387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6388. return smalltalk.withContext(function($ctx2) {
  6389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6390. $ctx1.sendIdx["on:do:"]=1;
  6391. _st((function(){
  6392. return smalltalk.withContext(function($ctx2) {
  6393. return self._deinstallMiddle();
  6394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6395. return smalltalk.withContext(function($ctx2) {
  6396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6397. $ctx1.sendIdx["on:do:"]=2;
  6398. _st((function(){
  6399. return smalltalk.withContext(function($ctx2) {
  6400. return self._deinstallBottom();
  6401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6402. return smalltalk.withContext(function($ctx2) {
  6403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6404. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6405. args: [],
  6406. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6407. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6408. referencedClasses: ["Error"]
  6409. }),
  6410. smalltalk.MethodInheritanceTest);
  6411. smalltalk.addMethod(
  6412. smalltalk.method({
  6413. selector: "testMNU11",
  6414. protocol: 'tests',
  6415. fn: function (){
  6416. var self=this;
  6417. return smalltalk.withContext(function($ctx1) {
  6418. self["@performBlock"]=(function(x){
  6419. return smalltalk.withContext(function($ctx2) {
  6420. return _st(x)._foo();
  6421. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6422. self._shouldMNU();
  6423. $ctx1.sendIdx["shouldMNU"]=1;
  6424. self._installTop_("foo ^ false");
  6425. $ctx1.sendIdx["installTop:"]=1;
  6426. self._installTop_("foo ^ true");
  6427. self._deinstallTop();
  6428. self._shouldMNU();
  6429. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6430. args: [],
  6431. 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",
  6432. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6433. referencedClasses: []
  6434. }),
  6435. smalltalk.MethodInheritanceTest);
  6436. smalltalk.addMethod(
  6437. smalltalk.method({
  6438. selector: "testMNU22",
  6439. protocol: 'tests',
  6440. fn: function (){
  6441. var self=this;
  6442. return smalltalk.withContext(function($ctx1) {
  6443. self["@performBlock"]=(function(x){
  6444. return smalltalk.withContext(function($ctx2) {
  6445. return _st(x)._foo();
  6446. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6447. self._shouldMNU();
  6448. $ctx1.sendIdx["shouldMNU"]=1;
  6449. self._installMiddle_("foo ^ false");
  6450. $ctx1.sendIdx["installMiddle:"]=1;
  6451. self._installMiddle_("foo ^ true");
  6452. self._deinstallMiddle();
  6453. self._shouldMNU();
  6454. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6455. args: [],
  6456. 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",
  6457. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6458. referencedClasses: []
  6459. }),
  6460. smalltalk.MethodInheritanceTest);
  6461. smalltalk.addMethod(
  6462. smalltalk.method({
  6463. selector: "testReturns1",
  6464. protocol: 'tests',
  6465. fn: function (){
  6466. var self=this;
  6467. return smalltalk.withContext(function($ctx1) {
  6468. self["@performBlock"]=(function(x){
  6469. return smalltalk.withContext(function($ctx2) {
  6470. return _st(x)._foo();
  6471. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6472. self._installTop_("foo ^ false");
  6473. $ctx1.sendIdx["installTop:"]=1;
  6474. self._shouldReturn_(false);
  6475. $ctx1.sendIdx["shouldReturn:"]=1;
  6476. self._installTop_("foo ^ true");
  6477. self._shouldReturn_(true);
  6478. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6479. args: [],
  6480. 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",
  6481. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6482. referencedClasses: []
  6483. }),
  6484. smalltalk.MethodInheritanceTest);
  6485. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6486. smalltalk.addMethod(
  6487. smalltalk.method({
  6488. selector: "testAbs",
  6489. protocol: 'tests',
  6490. fn: function (){
  6491. var self=this;
  6492. return smalltalk.withContext(function($ctx1) {
  6493. var $1;
  6494. $1=(4)._abs();
  6495. $ctx1.sendIdx["abs"]=1;
  6496. self._assert_equals_($1,(4));
  6497. $ctx1.sendIdx["assert:equals:"]=1;
  6498. self._assert_equals_((-4)._abs(),(4));
  6499. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6500. args: [],
  6501. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6502. messageSends: ["assert:equals:", "abs"],
  6503. referencedClasses: []
  6504. }),
  6505. smalltalk.NumberTest);
  6506. smalltalk.addMethod(
  6507. smalltalk.method({
  6508. selector: "testArithmetic",
  6509. protocol: 'tests',
  6510. fn: function (){
  6511. var self=this;
  6512. return smalltalk.withContext(function($ctx1) {
  6513. var $1,$2,$3,$5,$4;
  6514. $1=(1.5).__plus((1));
  6515. $ctx1.sendIdx["+"]=1;
  6516. self._assert_equals_($1,(2.5));
  6517. $ctx1.sendIdx["assert:equals:"]=1;
  6518. $2=(2).__minus((1));
  6519. $ctx1.sendIdx["-"]=1;
  6520. self._assert_equals_($2,(1));
  6521. $ctx1.sendIdx["assert:equals:"]=2;
  6522. self._assert_equals_((-2).__minus((1)),(-3));
  6523. $ctx1.sendIdx["assert:equals:"]=3;
  6524. self._assert_equals_((12).__slash((2)),(6));
  6525. $ctx1.sendIdx["assert:equals:"]=4;
  6526. $3=(3).__star((4));
  6527. $ctx1.sendIdx["*"]=1;
  6528. self._assert_equals_($3,(12));
  6529. $ctx1.sendIdx["assert:equals:"]=5;
  6530. self._assert_equals_((7).__slash_slash((2)),(3));
  6531. $ctx1.sendIdx["assert:equals:"]=6;
  6532. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6533. $ctx1.sendIdx["assert:equals:"]=7;
  6534. $5=(1).__plus((2));
  6535. $ctx1.sendIdx["+"]=2;
  6536. $4=_st($5).__star((3));
  6537. $ctx1.sendIdx["*"]=2;
  6538. self._assert_equals_($4,(9));
  6539. $ctx1.sendIdx["assert:equals:"]=8;
  6540. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6541. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6542. args: [],
  6543. 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",
  6544. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6545. referencedClasses: []
  6546. }),
  6547. smalltalk.NumberTest);
  6548. smalltalk.addMethod(
  6549. smalltalk.method({
  6550. selector: "testAsNumber",
  6551. protocol: 'tests',
  6552. fn: function (){
  6553. var self=this;
  6554. return smalltalk.withContext(function($ctx1) {
  6555. self._assert_equals_((3)._asNumber(),(3));
  6556. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6557. args: [],
  6558. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6559. messageSends: ["assert:equals:", "asNumber"],
  6560. referencedClasses: []
  6561. }),
  6562. smalltalk.NumberTest);
  6563. smalltalk.addMethod(
  6564. smalltalk.method({
  6565. selector: "testCeiling",
  6566. protocol: 'tests',
  6567. fn: function (){
  6568. var self=this;
  6569. return smalltalk.withContext(function($ctx1) {
  6570. var $1,$2;
  6571. $1=(1.2)._ceiling();
  6572. $ctx1.sendIdx["ceiling"]=1;
  6573. self._assert_equals_($1,(2));
  6574. $ctx1.sendIdx["assert:equals:"]=1;
  6575. $2=(-1.2)._ceiling();
  6576. $ctx1.sendIdx["ceiling"]=2;
  6577. self._assert_equals_($2,(-1));
  6578. $ctx1.sendIdx["assert:equals:"]=2;
  6579. self._assert_equals_((1)._ceiling(),(1));
  6580. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6581. args: [],
  6582. 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.",
  6583. messageSends: ["assert:equals:", "ceiling"],
  6584. referencedClasses: []
  6585. }),
  6586. smalltalk.NumberTest);
  6587. smalltalk.addMethod(
  6588. smalltalk.method({
  6589. selector: "testComparison",
  6590. protocol: 'tests',
  6591. fn: function (){
  6592. var self=this;
  6593. return smalltalk.withContext(function($ctx1) {
  6594. var $1,$2,$3,$4;
  6595. $1=(3).__gt((2));
  6596. $ctx1.sendIdx[">"]=1;
  6597. self._assert_($1);
  6598. $ctx1.sendIdx["assert:"]=1;
  6599. $2=(2).__lt((3));
  6600. $ctx1.sendIdx["<"]=1;
  6601. self._assert_($2);
  6602. $ctx1.sendIdx["assert:"]=2;
  6603. self._deny_((3).__lt((2)));
  6604. $ctx1.sendIdx["deny:"]=1;
  6605. self._deny_((2).__gt((3)));
  6606. $3=(3).__gt_eq((3));
  6607. $ctx1.sendIdx[">="]=1;
  6608. self._assert_($3);
  6609. $ctx1.sendIdx["assert:"]=3;
  6610. self._assert_((3.1).__gt_eq((3)));
  6611. $ctx1.sendIdx["assert:"]=4;
  6612. $4=(3).__lt_eq((3));
  6613. $ctx1.sendIdx["<="]=1;
  6614. self._assert_($4);
  6615. $ctx1.sendIdx["assert:"]=5;
  6616. self._assert_((3).__lt_eq((3.1)));
  6617. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6618. args: [],
  6619. 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",
  6620. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6621. referencedClasses: []
  6622. }),
  6623. smalltalk.NumberTest);
  6624. smalltalk.addMethod(
  6625. smalltalk.method({
  6626. selector: "testCopying",
  6627. protocol: 'tests',
  6628. fn: function (){
  6629. var self=this;
  6630. return smalltalk.withContext(function($ctx1) {
  6631. var $1;
  6632. $1=_st((1)._copy()).__eq_eq((1));
  6633. $ctx1.sendIdx["=="]=1;
  6634. self._assert_($1);
  6635. $ctx1.sendIdx["assert:"]=1;
  6636. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6637. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6638. args: [],
  6639. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6640. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6641. referencedClasses: []
  6642. }),
  6643. smalltalk.NumberTest);
  6644. smalltalk.addMethod(
  6645. smalltalk.method({
  6646. selector: "testEquality",
  6647. protocol: 'tests',
  6648. fn: function (){
  6649. var self=this;
  6650. return smalltalk.withContext(function($ctx1) {
  6651. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6652. $1=(1).__eq((1));
  6653. $ctx1.sendIdx["="]=1;
  6654. self._assert_($1);
  6655. $ctx1.sendIdx["assert:"]=1;
  6656. $2=(0).__eq((0));
  6657. $ctx1.sendIdx["="]=2;
  6658. self._assert_($2);
  6659. $ctx1.sendIdx["assert:"]=2;
  6660. $3=(1).__eq((0));
  6661. $ctx1.sendIdx["="]=3;
  6662. self._deny_($3);
  6663. $ctx1.sendIdx["deny:"]=1;
  6664. $5=(1)._yourself();
  6665. $ctx1.sendIdx["yourself"]=1;
  6666. $4=_st($5).__eq((1));
  6667. $ctx1.sendIdx["="]=4;
  6668. self._assert_($4);
  6669. $ctx1.sendIdx["assert:"]=3;
  6670. $7=(1)._yourself();
  6671. $ctx1.sendIdx["yourself"]=2;
  6672. $6=(1).__eq($7);
  6673. $ctx1.sendIdx["="]=5;
  6674. self._assert_($6);
  6675. $ctx1.sendIdx["assert:"]=4;
  6676. $9=(1)._yourself();
  6677. $ctx1.sendIdx["yourself"]=3;
  6678. $8=_st($9).__eq((1)._yourself());
  6679. $ctx1.sendIdx["="]=6;
  6680. self._assert_($8);
  6681. $10=(0).__eq(false);
  6682. $ctx1.sendIdx["="]=7;
  6683. self._deny_($10);
  6684. $ctx1.sendIdx["deny:"]=2;
  6685. $11=false.__eq((0));
  6686. $ctx1.sendIdx["="]=8;
  6687. self._deny_($11);
  6688. $ctx1.sendIdx["deny:"]=3;
  6689. $12="".__eq((0));
  6690. $ctx1.sendIdx["="]=9;
  6691. self._deny_($12);
  6692. $ctx1.sendIdx["deny:"]=4;
  6693. self._deny_((0).__eq(""));
  6694. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6695. args: [],
  6696. 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 = ''",
  6697. messageSends: ["assert:", "=", "deny:", "yourself"],
  6698. referencedClasses: []
  6699. }),
  6700. smalltalk.NumberTest);
  6701. smalltalk.addMethod(
  6702. smalltalk.method({
  6703. selector: "testFloor",
  6704. protocol: 'tests',
  6705. fn: function (){
  6706. var self=this;
  6707. return smalltalk.withContext(function($ctx1) {
  6708. var $1,$2;
  6709. $1=(1.2)._floor();
  6710. $ctx1.sendIdx["floor"]=1;
  6711. self._assert_equals_($1,(1));
  6712. $ctx1.sendIdx["assert:equals:"]=1;
  6713. $2=(-1.2)._floor();
  6714. $ctx1.sendIdx["floor"]=2;
  6715. self._assert_equals_($2,(-2));
  6716. $ctx1.sendIdx["assert:equals:"]=2;
  6717. self._assert_equals_((1)._floor(),(1));
  6718. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6719. args: [],
  6720. 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.",
  6721. messageSends: ["assert:equals:", "floor"],
  6722. referencedClasses: []
  6723. }),
  6724. smalltalk.NumberTest);
  6725. smalltalk.addMethod(
  6726. smalltalk.method({
  6727. selector: "testHexNumbers",
  6728. protocol: 'tests',
  6729. fn: function (){
  6730. var self=this;
  6731. return smalltalk.withContext(function($ctx1) {
  6732. var $1,$2,$3,$4,$5;
  6733. self._assert_equals_((9),(9));
  6734. $ctx1.sendIdx["assert:equals:"]=1;
  6735. $1=(10)._truncated();
  6736. $ctx1.sendIdx["truncated"]=1;
  6737. self._assert_equals_($1,(10));
  6738. $ctx1.sendIdx["assert:equals:"]=2;
  6739. $2=(11)._truncated();
  6740. $ctx1.sendIdx["truncated"]=2;
  6741. self._assert_equals_($2,(11));
  6742. $ctx1.sendIdx["assert:equals:"]=3;
  6743. $3=(12)._truncated();
  6744. $ctx1.sendIdx["truncated"]=3;
  6745. self._assert_equals_($3,(12));
  6746. $ctx1.sendIdx["assert:equals:"]=4;
  6747. $4=(13)._truncated();
  6748. $ctx1.sendIdx["truncated"]=4;
  6749. self._assert_equals_($4,(13));
  6750. $ctx1.sendIdx["assert:equals:"]=5;
  6751. $5=(14)._truncated();
  6752. $ctx1.sendIdx["truncated"]=5;
  6753. self._assert_equals_($5,(14));
  6754. $ctx1.sendIdx["assert:equals:"]=6;
  6755. self._assert_equals_((15)._truncated(),(15));
  6756. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6757. args: [],
  6758. 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",
  6759. messageSends: ["assert:equals:", "truncated"],
  6760. referencedClasses: []
  6761. }),
  6762. smalltalk.NumberTest);
  6763. smalltalk.addMethod(
  6764. smalltalk.method({
  6765. selector: "testIdentity",
  6766. protocol: 'tests',
  6767. fn: function (){
  6768. var self=this;
  6769. return smalltalk.withContext(function($ctx1) {
  6770. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6771. $1=(1).__eq_eq((1));
  6772. $ctx1.sendIdx["=="]=1;
  6773. self._assert_($1);
  6774. $ctx1.sendIdx["assert:"]=1;
  6775. $2=(0).__eq_eq((0));
  6776. $ctx1.sendIdx["=="]=2;
  6777. self._assert_($2);
  6778. $ctx1.sendIdx["assert:"]=2;
  6779. $3=(1).__eq_eq((0));
  6780. $ctx1.sendIdx["=="]=3;
  6781. self._deny_($3);
  6782. $ctx1.sendIdx["deny:"]=1;
  6783. $5=(1)._yourself();
  6784. $ctx1.sendIdx["yourself"]=1;
  6785. $4=_st($5).__eq_eq((1));
  6786. $ctx1.sendIdx["=="]=4;
  6787. self._assert_($4);
  6788. $ctx1.sendIdx["assert:"]=3;
  6789. $7=(1)._yourself();
  6790. $ctx1.sendIdx["yourself"]=2;
  6791. $6=(1).__eq_eq($7);
  6792. $ctx1.sendIdx["=="]=5;
  6793. self._assert_($6);
  6794. $ctx1.sendIdx["assert:"]=4;
  6795. $9=(1)._yourself();
  6796. $ctx1.sendIdx["yourself"]=3;
  6797. $8=_st($9).__eq_eq((1)._yourself());
  6798. $ctx1.sendIdx["=="]=6;
  6799. self._assert_($8);
  6800. self._deny_((1).__eq_eq((2)));
  6801. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6802. args: [],
  6803. 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",
  6804. messageSends: ["assert:", "==", "deny:", "yourself"],
  6805. referencedClasses: []
  6806. }),
  6807. smalltalk.NumberTest);
  6808. smalltalk.addMethod(
  6809. smalltalk.method({
  6810. selector: "testInvalidHexNumbers",
  6811. protocol: 'tests',
  6812. fn: function (){
  6813. var self=this;
  6814. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6815. return smalltalk.withContext(function($ctx1) {
  6816. self._should_raise_((function(){
  6817. return smalltalk.withContext(function($ctx2) {
  6818. return (16)._rG();
  6819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6820. $ctx1.sendIdx["should:raise:"]=1;
  6821. self._should_raise_((function(){
  6822. return smalltalk.withContext(function($ctx2) {
  6823. return (16)._rg();
  6824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6825. $ctx1.sendIdx["should:raise:"]=2;
  6826. self._should_raise_((function(){
  6827. return smalltalk.withContext(function($ctx2) {
  6828. return (16)._rH();
  6829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6830. $ctx1.sendIdx["should:raise:"]=3;
  6831. self._should_raise_((function(){
  6832. return smalltalk.withContext(function($ctx2) {
  6833. return (16)._rh();
  6834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6835. $ctx1.sendIdx["should:raise:"]=4;
  6836. self._should_raise_((function(){
  6837. return smalltalk.withContext(function($ctx2) {
  6838. return (16)._rI();
  6839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6840. $ctx1.sendIdx["should:raise:"]=5;
  6841. self._should_raise_((function(){
  6842. return smalltalk.withContext(function($ctx2) {
  6843. return (16)._ri();
  6844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6845. $ctx1.sendIdx["should:raise:"]=6;
  6846. self._should_raise_((function(){
  6847. return smalltalk.withContext(function($ctx2) {
  6848. return (16)._rJ();
  6849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6850. $ctx1.sendIdx["should:raise:"]=7;
  6851. self._should_raise_((function(){
  6852. return smalltalk.withContext(function($ctx2) {
  6853. return (16)._rj();
  6854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6855. $ctx1.sendIdx["should:raise:"]=8;
  6856. self._should_raise_((function(){
  6857. return smalltalk.withContext(function($ctx2) {
  6858. return (16)._rK();
  6859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6860. $ctx1.sendIdx["should:raise:"]=9;
  6861. self._should_raise_((function(){
  6862. return smalltalk.withContext(function($ctx2) {
  6863. return (16)._rk();
  6864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6865. $ctx1.sendIdx["should:raise:"]=10;
  6866. self._should_raise_((function(){
  6867. return smalltalk.withContext(function($ctx2) {
  6868. return (16)._rL();
  6869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6870. $ctx1.sendIdx["should:raise:"]=11;
  6871. self._should_raise_((function(){
  6872. return smalltalk.withContext(function($ctx2) {
  6873. return (16)._rl();
  6874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6875. $ctx1.sendIdx["should:raise:"]=12;
  6876. self._should_raise_((function(){
  6877. return smalltalk.withContext(function($ctx2) {
  6878. return (16)._rM();
  6879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6880. $ctx1.sendIdx["should:raise:"]=13;
  6881. self._should_raise_((function(){
  6882. return smalltalk.withContext(function($ctx2) {
  6883. return (16)._rm();
  6884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6885. $ctx1.sendIdx["should:raise:"]=14;
  6886. self._should_raise_((function(){
  6887. return smalltalk.withContext(function($ctx2) {
  6888. return (16)._rN();
  6889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6890. $ctx1.sendIdx["should:raise:"]=15;
  6891. self._should_raise_((function(){
  6892. return smalltalk.withContext(function($ctx2) {
  6893. return (16)._rn();
  6894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6895. $ctx1.sendIdx["should:raise:"]=16;
  6896. self._should_raise_((function(){
  6897. return smalltalk.withContext(function($ctx2) {
  6898. return (16)._rO();
  6899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6900. $ctx1.sendIdx["should:raise:"]=17;
  6901. self._should_raise_((function(){
  6902. return smalltalk.withContext(function($ctx2) {
  6903. return (16)._ro();
  6904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6905. $ctx1.sendIdx["should:raise:"]=18;
  6906. self._should_raise_((function(){
  6907. return smalltalk.withContext(function($ctx2) {
  6908. return (16)._rP();
  6909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6910. $ctx1.sendIdx["should:raise:"]=19;
  6911. self._should_raise_((function(){
  6912. return smalltalk.withContext(function($ctx2) {
  6913. return (16)._rp();
  6914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6915. $ctx1.sendIdx["should:raise:"]=20;
  6916. self._should_raise_((function(){
  6917. return smalltalk.withContext(function($ctx2) {
  6918. return (16)._rQ();
  6919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6920. $ctx1.sendIdx["should:raise:"]=21;
  6921. self._should_raise_((function(){
  6922. return smalltalk.withContext(function($ctx2) {
  6923. return (16)._rq();
  6924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6925. $ctx1.sendIdx["should:raise:"]=22;
  6926. self._should_raise_((function(){
  6927. return smalltalk.withContext(function($ctx2) {
  6928. return (16)._rR();
  6929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6930. $ctx1.sendIdx["should:raise:"]=23;
  6931. self._should_raise_((function(){
  6932. return smalltalk.withContext(function($ctx2) {
  6933. return (16)._rr();
  6934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6935. $ctx1.sendIdx["should:raise:"]=24;
  6936. self._should_raise_((function(){
  6937. return smalltalk.withContext(function($ctx2) {
  6938. return (16)._rS();
  6939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6940. $ctx1.sendIdx["should:raise:"]=25;
  6941. self._should_raise_((function(){
  6942. return smalltalk.withContext(function($ctx2) {
  6943. return (16)._rs();
  6944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6945. $ctx1.sendIdx["should:raise:"]=26;
  6946. self._should_raise_((function(){
  6947. return smalltalk.withContext(function($ctx2) {
  6948. return (16)._rT();
  6949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6950. $ctx1.sendIdx["should:raise:"]=27;
  6951. self._should_raise_((function(){
  6952. return smalltalk.withContext(function($ctx2) {
  6953. return (16)._rt();
  6954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6955. $ctx1.sendIdx["should:raise:"]=28;
  6956. self._should_raise_((function(){
  6957. return smalltalk.withContext(function($ctx2) {
  6958. return (16)._rU();
  6959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6960. $ctx1.sendIdx["should:raise:"]=29;
  6961. self._should_raise_((function(){
  6962. return smalltalk.withContext(function($ctx2) {
  6963. return (16)._ru();
  6964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6965. $ctx1.sendIdx["should:raise:"]=30;
  6966. self._should_raise_((function(){
  6967. return smalltalk.withContext(function($ctx2) {
  6968. return (16)._rV();
  6969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6970. $ctx1.sendIdx["should:raise:"]=31;
  6971. self._should_raise_((function(){
  6972. return smalltalk.withContext(function($ctx2) {
  6973. return (16)._rv();
  6974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6975. $ctx1.sendIdx["should:raise:"]=32;
  6976. self._should_raise_((function(){
  6977. return smalltalk.withContext(function($ctx2) {
  6978. return (16)._rW();
  6979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6980. $ctx1.sendIdx["should:raise:"]=33;
  6981. self._should_raise_((function(){
  6982. return smalltalk.withContext(function($ctx2) {
  6983. return (16)._rw();
  6984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6985. $ctx1.sendIdx["should:raise:"]=34;
  6986. self._should_raise_((function(){
  6987. return smalltalk.withContext(function($ctx2) {
  6988. return (16)._rX();
  6989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6990. $ctx1.sendIdx["should:raise:"]=35;
  6991. self._should_raise_((function(){
  6992. return smalltalk.withContext(function($ctx2) {
  6993. return (16)._rx();
  6994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6995. $ctx1.sendIdx["should:raise:"]=36;
  6996. self._should_raise_((function(){
  6997. return smalltalk.withContext(function($ctx2) {
  6998. return (16)._rY();
  6999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7000. $ctx1.sendIdx["should:raise:"]=37;
  7001. self._should_raise_((function(){
  7002. return smalltalk.withContext(function($ctx2) {
  7003. return (16)._ry();
  7004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7005. $ctx1.sendIdx["should:raise:"]=38;
  7006. self._should_raise_((function(){
  7007. return smalltalk.withContext(function($ctx2) {
  7008. return (16)._rZ();
  7009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7010. $ctx1.sendIdx["should:raise:"]=39;
  7011. self._should_raise_((function(){
  7012. return smalltalk.withContext(function($ctx2) {
  7013. return (16)._rz();
  7014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7015. $ctx1.sendIdx["should:raise:"]=40;
  7016. self._should_raise_((function(){
  7017. return smalltalk.withContext(function($ctx2) {
  7018. return (11259375)._Z();
  7019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7020. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  7021. args: [],
  7022. 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.",
  7023. 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"],
  7024. referencedClasses: ["MessageNotUnderstood"]
  7025. }),
  7026. smalltalk.NumberTest);
  7027. smalltalk.addMethod(
  7028. smalltalk.method({
  7029. selector: "testLog",
  7030. protocol: 'tests',
  7031. fn: function (){
  7032. var self=this;
  7033. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  7034. return smalltalk.withContext(function($ctx1) {
  7035. self._assert_equals_((10000)._log(),(4));
  7036. $ctx1.sendIdx["assert:equals:"]=1;
  7037. self._assert_equals_((512)._log_((2)),(9));
  7038. $ctx1.sendIdx["assert:equals:"]=2;
  7039. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7040. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  7041. args: [],
  7042. 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.",
  7043. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7044. referencedClasses: ["Number"]
  7045. }),
  7046. smalltalk.NumberTest);
  7047. smalltalk.addMethod(
  7048. smalltalk.method({
  7049. selector: "testMinMax",
  7050. protocol: 'tests',
  7051. fn: function (){
  7052. var self=this;
  7053. return smalltalk.withContext(function($ctx1) {
  7054. self._assert_equals_((2)._max_((5)),(5));
  7055. $ctx1.sendIdx["assert:equals:"]=1;
  7056. self._assert_equals_((2)._min_((5)),(2));
  7057. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  7058. args: [],
  7059. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7060. messageSends: ["assert:equals:", "max:", "min:"],
  7061. referencedClasses: []
  7062. }),
  7063. smalltalk.NumberTest);
  7064. smalltalk.addMethod(
  7065. smalltalk.method({
  7066. selector: "testNegated",
  7067. protocol: 'tests',
  7068. fn: function (){
  7069. var self=this;
  7070. return smalltalk.withContext(function($ctx1) {
  7071. var $1;
  7072. $1=(3)._negated();
  7073. $ctx1.sendIdx["negated"]=1;
  7074. self._assert_equals_($1,(-3));
  7075. $ctx1.sendIdx["assert:equals:"]=1;
  7076. self._assert_equals_((-3)._negated(),(3));
  7077. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  7078. args: [],
  7079. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7080. messageSends: ["assert:equals:", "negated"],
  7081. referencedClasses: []
  7082. }),
  7083. smalltalk.NumberTest);
  7084. smalltalk.addMethod(
  7085. smalltalk.method({
  7086. selector: "testPrintShowingDecimalPlaces",
  7087. protocol: 'tests',
  7088. fn: function (){
  7089. var self=this;
  7090. return smalltalk.withContext(function($ctx1) {
  7091. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7092. $1=(23)._printShowingDecimalPlaces_((2));
  7093. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7094. self._assert_equals_($1,"23.00");
  7095. $ctx1.sendIdx["assert:equals:"]=1;
  7096. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7097. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7098. self._assert_equals_($2,"23.57");
  7099. $ctx1.sendIdx["assert:equals:"]=2;
  7100. $4=(234.567)._negated();
  7101. $ctx1.sendIdx["negated"]=1;
  7102. $3=_st($4)._printShowingDecimalPlaces_((5));
  7103. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7104. self._assert_equals_($3,"-234.56700");
  7105. $ctx1.sendIdx["assert:equals:"]=3;
  7106. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7107. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7108. self._assert_equals_($5,"23");
  7109. $ctx1.sendIdx["assert:equals:"]=4;
  7110. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7111. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7112. self._assert_equals_($6,"24");
  7113. $ctx1.sendIdx["assert:equals:"]=5;
  7114. $8=(23.4567)._negated();
  7115. $ctx1.sendIdx["negated"]=2;
  7116. $7=_st($8)._printShowingDecimalPlaces_((0));
  7117. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7118. self._assert_equals_($7,"-23");
  7119. $ctx1.sendIdx["assert:equals:"]=6;
  7120. $10=(23.5567)._negated();
  7121. $ctx1.sendIdx["negated"]=3;
  7122. $9=_st($10)._printShowingDecimalPlaces_((0));
  7123. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7124. self._assert_equals_($9,"-24");
  7125. $ctx1.sendIdx["assert:equals:"]=7;
  7126. $11=(100000000)._printShowingDecimalPlaces_((1));
  7127. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7128. self._assert_equals_($11,"100000000.0");
  7129. $ctx1.sendIdx["assert:equals:"]=8;
  7130. $12=(0.98)._printShowingDecimalPlaces_((5));
  7131. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7132. self._assert_equals_($12,"0.98000");
  7133. $ctx1.sendIdx["assert:equals:"]=9;
  7134. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7135. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7136. self._assert_equals_($13,"-0.98");
  7137. $ctx1.sendIdx["assert:equals:"]=10;
  7138. $14=(2.567)._printShowingDecimalPlaces_((2));
  7139. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7140. self._assert_equals_($14,"2.57");
  7141. $ctx1.sendIdx["assert:equals:"]=11;
  7142. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7143. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7144. self._assert_equals_($15,"-2.57");
  7145. $ctx1.sendIdx["assert:equals:"]=12;
  7146. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7147. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  7148. args: [],
  7149. 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'.",
  7150. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7151. referencedClasses: []
  7152. }),
  7153. smalltalk.NumberTest);
  7154. smalltalk.addMethod(
  7155. smalltalk.method({
  7156. selector: "testRaisedTo",
  7157. protocol: 'tests',
  7158. fn: function (){
  7159. var self=this;
  7160. return smalltalk.withContext(function($ctx1) {
  7161. var $1,$2,$3;
  7162. $1=(2)._raisedTo_((4));
  7163. $ctx1.sendIdx["raisedTo:"]=1;
  7164. self._assert_equals_($1,(16));
  7165. $ctx1.sendIdx["assert:equals:"]=1;
  7166. $2=(2)._raisedTo_((0));
  7167. $ctx1.sendIdx["raisedTo:"]=2;
  7168. self._assert_equals_($2,(1));
  7169. $ctx1.sendIdx["assert:equals:"]=2;
  7170. $3=(2)._raisedTo_((-3));
  7171. $ctx1.sendIdx["raisedTo:"]=3;
  7172. self._assert_equals_($3,(0.125));
  7173. $ctx1.sendIdx["assert:equals:"]=3;
  7174. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7175. $ctx1.sendIdx["assert:equals:"]=4;
  7176. self._assert_equals_((2).__star_star((4)),(16));
  7177. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  7178. args: [],
  7179. 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.",
  7180. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7181. referencedClasses: []
  7182. }),
  7183. smalltalk.NumberTest);
  7184. smalltalk.addMethod(
  7185. smalltalk.method({
  7186. selector: "testRounded",
  7187. protocol: 'tests',
  7188. fn: function (){
  7189. var self=this;
  7190. return smalltalk.withContext(function($ctx1) {
  7191. var $1,$2;
  7192. $1=(3)._rounded();
  7193. $ctx1.sendIdx["rounded"]=1;
  7194. self._assert_equals_($1,(3));
  7195. $ctx1.sendIdx["assert:equals:"]=1;
  7196. $2=(3.212)._rounded();
  7197. $ctx1.sendIdx["rounded"]=2;
  7198. self._assert_equals_($2,(3));
  7199. $ctx1.sendIdx["assert:equals:"]=2;
  7200. self._assert_equals_((3.51)._rounded(),(4));
  7201. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  7202. args: [],
  7203. 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",
  7204. messageSends: ["assert:equals:", "rounded"],
  7205. referencedClasses: []
  7206. }),
  7207. smalltalk.NumberTest);
  7208. smalltalk.addMethod(
  7209. smalltalk.method({
  7210. selector: "testSign",
  7211. protocol: 'tests',
  7212. fn: function (){
  7213. var self=this;
  7214. return smalltalk.withContext(function($ctx1) {
  7215. var $1,$2;
  7216. $1=(5)._sign();
  7217. $ctx1.sendIdx["sign"]=1;
  7218. self._assert_equals_($1,(1));
  7219. $ctx1.sendIdx["assert:equals:"]=1;
  7220. $2=(0)._sign();
  7221. $ctx1.sendIdx["sign"]=2;
  7222. self._assert_equals_($2,(0));
  7223. $ctx1.sendIdx["assert:equals:"]=2;
  7224. self._assert_equals_((-1.4)._sign(),(-1));
  7225. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7226. args: [],
  7227. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7228. messageSends: ["assert:equals:", "sign"],
  7229. referencedClasses: []
  7230. }),
  7231. smalltalk.NumberTest);
  7232. smalltalk.addMethod(
  7233. smalltalk.method({
  7234. selector: "testSqrt",
  7235. protocol: 'tests',
  7236. fn: function (){
  7237. var self=this;
  7238. return smalltalk.withContext(function($ctx1) {
  7239. var $1;
  7240. $1=(4)._sqrt();
  7241. $ctx1.sendIdx["sqrt"]=1;
  7242. self._assert_equals_($1,(2));
  7243. $ctx1.sendIdx["assert:equals:"]=1;
  7244. self._assert_equals_((16)._sqrt(),(4));
  7245. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7246. args: [],
  7247. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7248. messageSends: ["assert:equals:", "sqrt"],
  7249. referencedClasses: []
  7250. }),
  7251. smalltalk.NumberTest);
  7252. smalltalk.addMethod(
  7253. smalltalk.method({
  7254. selector: "testSquared",
  7255. protocol: 'tests',
  7256. fn: function (){
  7257. var self=this;
  7258. return smalltalk.withContext(function($ctx1) {
  7259. self._assert_equals_((4)._squared(),(16));
  7260. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7261. args: [],
  7262. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7263. messageSends: ["assert:equals:", "squared"],
  7264. referencedClasses: []
  7265. }),
  7266. smalltalk.NumberTest);
  7267. smalltalk.addMethod(
  7268. smalltalk.method({
  7269. selector: "testTimesRepeat",
  7270. protocol: 'tests',
  7271. fn: function (){
  7272. var self=this;
  7273. var i;
  7274. return smalltalk.withContext(function($ctx1) {
  7275. i=(0);
  7276. (0)._timesRepeat_((function(){
  7277. return smalltalk.withContext(function($ctx2) {
  7278. i=_st(i).__plus((1));
  7279. $ctx2.sendIdx["+"]=1;
  7280. return i;
  7281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7282. $ctx1.sendIdx["timesRepeat:"]=1;
  7283. self._assert_equals_(i,(0));
  7284. $ctx1.sendIdx["assert:equals:"]=1;
  7285. (5)._timesRepeat_((function(){
  7286. return smalltalk.withContext(function($ctx2) {
  7287. i=_st(i).__plus((1));
  7288. return i;
  7289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7290. self._assert_equals_(i,(5));
  7291. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7292. args: [],
  7293. 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",
  7294. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7295. referencedClasses: []
  7296. }),
  7297. smalltalk.NumberTest);
  7298. smalltalk.addMethod(
  7299. smalltalk.method({
  7300. selector: "testTo",
  7301. protocol: 'tests',
  7302. fn: function (){
  7303. var self=this;
  7304. return smalltalk.withContext(function($ctx1) {
  7305. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7306. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7307. args: [],
  7308. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7309. messageSends: ["assert:equals:", "to:"],
  7310. referencedClasses: []
  7311. }),
  7312. smalltalk.NumberTest);
  7313. smalltalk.addMethod(
  7314. smalltalk.method({
  7315. selector: "testToBy",
  7316. protocol: 'tests',
  7317. fn: function (){
  7318. var self=this;
  7319. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7320. return smalltalk.withContext(function($ctx1) {
  7321. var $1;
  7322. $1=(0)._to_by_((6),(2));
  7323. $ctx1.sendIdx["to:by:"]=1;
  7324. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7325. self._should_raise_((function(){
  7326. return smalltalk.withContext(function($ctx2) {
  7327. return (1)._to_by_((4),(0));
  7328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7329. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7330. args: [],
  7331. 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",
  7332. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7333. referencedClasses: ["Error"]
  7334. }),
  7335. smalltalk.NumberTest);
  7336. smalltalk.addMethod(
  7337. smalltalk.method({
  7338. selector: "testTrigonometry",
  7339. protocol: 'tests',
  7340. fn: function (){
  7341. var self=this;
  7342. return smalltalk.withContext(function($ctx1) {
  7343. self._assert_equals_((0)._cos(),(1));
  7344. $ctx1.sendIdx["assert:equals:"]=1;
  7345. self._assert_equals_((0)._sin(),(0));
  7346. $ctx1.sendIdx["assert:equals:"]=2;
  7347. self._assert_equals_((0)._tan(),(0));
  7348. $ctx1.sendIdx["assert:equals:"]=3;
  7349. self._assert_equals_((1)._arcCos(),(0));
  7350. $ctx1.sendIdx["assert:equals:"]=4;
  7351. self._assert_equals_((0)._arcSin(),(0));
  7352. $ctx1.sendIdx["assert:equals:"]=5;
  7353. self._assert_equals_((0)._arcTan(),(0));
  7354. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7355. args: [],
  7356. 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.",
  7357. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7358. referencedClasses: []
  7359. }),
  7360. smalltalk.NumberTest);
  7361. smalltalk.addMethod(
  7362. smalltalk.method({
  7363. selector: "testTruncated",
  7364. protocol: 'tests',
  7365. fn: function (){
  7366. var self=this;
  7367. return smalltalk.withContext(function($ctx1) {
  7368. var $1,$2;
  7369. $1=(3)._truncated();
  7370. $ctx1.sendIdx["truncated"]=1;
  7371. self._assert_equals_($1,(3));
  7372. $ctx1.sendIdx["assert:equals:"]=1;
  7373. $2=(3.212)._truncated();
  7374. $ctx1.sendIdx["truncated"]=2;
  7375. self._assert_equals_($2,(3));
  7376. $ctx1.sendIdx["assert:equals:"]=2;
  7377. self._assert_equals_((3.51)._truncated(),(3));
  7378. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7379. args: [],
  7380. 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",
  7381. messageSends: ["assert:equals:", "truncated"],
  7382. referencedClasses: []
  7383. }),
  7384. smalltalk.NumberTest);
  7385. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7386. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7387. smalltalk.addMethod(
  7388. smalltalk.method({
  7389. selector: "foo",
  7390. protocol: 'not yet classified',
  7391. fn: function (){
  7392. var self=this;
  7393. return smalltalk.withContext(function($ctx1) {
  7394. var $1;
  7395. $1=self["@foo"];
  7396. return $1;
  7397. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7398. args: [],
  7399. source: "foo\x0a\x09^ foo",
  7400. messageSends: [],
  7401. referencedClasses: []
  7402. }),
  7403. smalltalk.ObjectMock);
  7404. smalltalk.addMethod(
  7405. smalltalk.method({
  7406. selector: "foo:",
  7407. protocol: 'not yet classified',
  7408. fn: function (anObject){
  7409. var self=this;
  7410. return smalltalk.withContext(function($ctx1) {
  7411. self["@foo"]=anObject;
  7412. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7413. args: ["anObject"],
  7414. source: "foo: anObject\x0a\x09foo := anObject",
  7415. messageSends: [],
  7416. referencedClasses: []
  7417. }),
  7418. smalltalk.ObjectMock);
  7419. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7420. smalltalk.addMethod(
  7421. smalltalk.method({
  7422. selector: "notDefined",
  7423. protocol: 'tests',
  7424. fn: function (){
  7425. var self=this;
  7426. return smalltalk.withContext(function($ctx1) {
  7427. return void 0;;
  7428. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7429. args: [],
  7430. source: "notDefined\x0a\x09<return void 0;>",
  7431. messageSends: [],
  7432. referencedClasses: []
  7433. }),
  7434. smalltalk.ObjectTest);
  7435. smalltalk.addMethod(
  7436. smalltalk.method({
  7437. selector: "testBasicAccess",
  7438. protocol: 'tests',
  7439. fn: function (){
  7440. var self=this;
  7441. var o;
  7442. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7443. return smalltalk.withContext(function($ctx1) {
  7444. var $1;
  7445. o=_st($Object())._new();
  7446. _st(o)._basicAt_put_("a",(1));
  7447. $1=_st(o)._basicAt_("a");
  7448. $ctx1.sendIdx["basicAt:"]=1;
  7449. self._assert_equals_($1,(1));
  7450. $ctx1.sendIdx["assert:equals:"]=1;
  7451. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7452. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7453. args: [],
  7454. 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",
  7455. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7456. referencedClasses: ["Object"]
  7457. }),
  7458. smalltalk.ObjectTest);
  7459. smalltalk.addMethod(
  7460. smalltalk.method({
  7461. selector: "testBasicPerform",
  7462. protocol: 'tests',
  7463. fn: function (){
  7464. var self=this;
  7465. var o;
  7466. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7467. return smalltalk.withContext(function($ctx1) {
  7468. o=_st($Object())._new();
  7469. _st(o)._basicAt_put_("func",(function(){
  7470. return smalltalk.withContext(function($ctx2) {
  7471. return "hello";
  7472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7473. $ctx1.sendIdx["basicAt:put:"]=1;
  7474. _st(o)._basicAt_put_("func2",(function(a){
  7475. return smalltalk.withContext(function($ctx2) {
  7476. return _st(a).__plus((1));
  7477. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7478. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7479. $ctx1.sendIdx["assert:equals:"]=1;
  7480. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7481. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7482. args: [],
  7483. 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",
  7484. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7485. referencedClasses: ["Object"]
  7486. }),
  7487. smalltalk.ObjectTest);
  7488. smalltalk.addMethod(
  7489. smalltalk.method({
  7490. selector: "testDNU",
  7491. protocol: 'tests',
  7492. fn: function (){
  7493. var self=this;
  7494. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7495. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7496. return smalltalk.withContext(function($ctx1) {
  7497. self._should_raise_((function(){
  7498. return smalltalk.withContext(function($ctx2) {
  7499. return _st(_st($Object())._new())._foo();
  7500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7501. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7502. args: [],
  7503. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7504. messageSends: ["should:raise:", "foo", "new"],
  7505. referencedClasses: ["Object", "MessageNotUnderstood"]
  7506. }),
  7507. smalltalk.ObjectTest);
  7508. smalltalk.addMethod(
  7509. smalltalk.method({
  7510. selector: "testEquality",
  7511. protocol: 'tests',
  7512. fn: function (){
  7513. var self=this;
  7514. var o;
  7515. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7516. return smalltalk.withContext(function($ctx1) {
  7517. var $1,$2,$4,$3;
  7518. o=_st($Object())._new();
  7519. $ctx1.sendIdx["new"]=1;
  7520. $1=_st(o).__eq(_st($Object())._new());
  7521. $ctx1.sendIdx["="]=1;
  7522. self._deny_($1);
  7523. $2=_st(o).__eq(o);
  7524. $ctx1.sendIdx["="]=2;
  7525. self._assert_($2);
  7526. $ctx1.sendIdx["assert:"]=1;
  7527. $4=_st(o)._yourself();
  7528. $ctx1.sendIdx["yourself"]=1;
  7529. $3=_st($4).__eq(o);
  7530. $ctx1.sendIdx["="]=3;
  7531. self._assert_($3);
  7532. $ctx1.sendIdx["assert:"]=2;
  7533. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7534. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7535. args: [],
  7536. 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)",
  7537. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7538. referencedClasses: ["Object"]
  7539. }),
  7540. smalltalk.ObjectTest);
  7541. smalltalk.addMethod(
  7542. smalltalk.method({
  7543. selector: "testHalt",
  7544. protocol: 'tests',
  7545. fn: function (){
  7546. var self=this;
  7547. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7548. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7549. return smalltalk.withContext(function($ctx1) {
  7550. self._should_raise_((function(){
  7551. return smalltalk.withContext(function($ctx2) {
  7552. return _st(_st($Object())._new())._halt();
  7553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7554. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7555. args: [],
  7556. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7557. messageSends: ["should:raise:", "halt", "new"],
  7558. referencedClasses: ["Object", "Error"]
  7559. }),
  7560. smalltalk.ObjectTest);
  7561. smalltalk.addMethod(
  7562. smalltalk.method({
  7563. selector: "testIdentity",
  7564. protocol: 'tests',
  7565. fn: function (){
  7566. var self=this;
  7567. var o;
  7568. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7569. return smalltalk.withContext(function($ctx1) {
  7570. var $1,$2,$4,$3;
  7571. o=_st($Object())._new();
  7572. $ctx1.sendIdx["new"]=1;
  7573. $1=_st(o).__eq_eq(_st($Object())._new());
  7574. $ctx1.sendIdx["=="]=1;
  7575. self._deny_($1);
  7576. $2=_st(o).__eq_eq(o);
  7577. $ctx1.sendIdx["=="]=2;
  7578. self._assert_($2);
  7579. $ctx1.sendIdx["assert:"]=1;
  7580. $4=_st(o)._yourself();
  7581. $ctx1.sendIdx["yourself"]=1;
  7582. $3=_st($4).__eq_eq(o);
  7583. $ctx1.sendIdx["=="]=3;
  7584. self._assert_($3);
  7585. $ctx1.sendIdx["assert:"]=2;
  7586. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7587. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7588. args: [],
  7589. 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",
  7590. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7591. referencedClasses: ["Object"]
  7592. }),
  7593. smalltalk.ObjectTest);
  7594. smalltalk.addMethod(
  7595. smalltalk.method({
  7596. selector: "testIfNil",
  7597. protocol: 'tests',
  7598. fn: function (){
  7599. var self=this;
  7600. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7601. return smalltalk.withContext(function($ctx1) {
  7602. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7603. $2=_st($Object())._new();
  7604. $ctx1.sendIdx["new"]=1;
  7605. $1=_st($2)._isNil();
  7606. self._deny_($1);
  7607. $ctx1.sendIdx["deny:"]=1;
  7608. $5=_st($Object())._new();
  7609. $ctx1.sendIdx["new"]=2;
  7610. if(($receiver = $5) == nil || $receiver == null){
  7611. $4=true;
  7612. } else {
  7613. $4=$5;
  7614. };
  7615. $3=_st($4).__eq(true);
  7616. self._deny_($3);
  7617. $7=_st($Object())._new();
  7618. $ctx1.sendIdx["new"]=3;
  7619. if(($receiver = $7) == nil || $receiver == null){
  7620. $6=$7;
  7621. } else {
  7622. $6=true;
  7623. };
  7624. self._assert_equals_($6,true);
  7625. $ctx1.sendIdx["assert:equals:"]=1;
  7626. $9=_st($Object())._new();
  7627. $ctx1.sendIdx["new"]=4;
  7628. if(($receiver = $9) == nil || $receiver == null){
  7629. $8=false;
  7630. } else {
  7631. $8=true;
  7632. };
  7633. self._assert_equals_($8,true);
  7634. $ctx1.sendIdx["assert:equals:"]=2;
  7635. $11=_st($Object())._new();
  7636. if(($receiver = $11) == nil || $receiver == null){
  7637. $10=false;
  7638. } else {
  7639. $10=true;
  7640. };
  7641. self._assert_equals_($10,true);
  7642. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7643. args: [],
  7644. 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",
  7645. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7646. referencedClasses: ["Object"]
  7647. }),
  7648. smalltalk.ObjectTest);
  7649. smalltalk.addMethod(
  7650. smalltalk.method({
  7651. selector: "testInstVars",
  7652. protocol: 'tests',
  7653. fn: function (){
  7654. var self=this;
  7655. var o;
  7656. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7657. return smalltalk.withContext(function($ctx1) {
  7658. var $1,$2;
  7659. o=_st($ObjectMock())._new();
  7660. $1=_st(o)._instVarAt_("foo");
  7661. $ctx1.sendIdx["instVarAt:"]=1;
  7662. self._assert_equals_($1,nil);
  7663. $ctx1.sendIdx["assert:equals:"]=1;
  7664. _st(o)._instVarAt_put_("foo",(1));
  7665. $2=_st(o)._instVarAt_("foo");
  7666. $ctx1.sendIdx["instVarAt:"]=2;
  7667. self._assert_equals_($2,(1));
  7668. $ctx1.sendIdx["assert:equals:"]=2;
  7669. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7670. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7671. args: [],
  7672. 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",
  7673. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7674. referencedClasses: ["ObjectMock"]
  7675. }),
  7676. smalltalk.ObjectTest);
  7677. smalltalk.addMethod(
  7678. smalltalk.method({
  7679. selector: "testNilUndefined",
  7680. protocol: 'tests',
  7681. fn: function (){
  7682. var self=this;
  7683. return smalltalk.withContext(function($ctx1) {
  7684. self._assert_equals_(self._notDefined(),nil);
  7685. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7686. args: [],
  7687. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7688. messageSends: ["assert:equals:", "notDefined"],
  7689. referencedClasses: []
  7690. }),
  7691. smalltalk.ObjectTest);
  7692. smalltalk.addMethod(
  7693. smalltalk.method({
  7694. selector: "testYourself",
  7695. protocol: 'tests',
  7696. fn: function (){
  7697. var self=this;
  7698. var o;
  7699. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7700. return smalltalk.withContext(function($ctx1) {
  7701. o=_st($ObjectMock())._new();
  7702. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7703. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7704. args: [],
  7705. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7706. messageSends: ["new", "assert:", "==", "yourself"],
  7707. referencedClasses: ["ObjectMock"]
  7708. }),
  7709. smalltalk.ObjectTest);
  7710. smalltalk.addMethod(
  7711. smalltalk.method({
  7712. selector: "testidentityHash",
  7713. protocol: 'tests',
  7714. fn: function (){
  7715. var self=this;
  7716. var o1,o2;
  7717. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7718. return smalltalk.withContext(function($ctx1) {
  7719. var $2,$3,$1,$5,$4;
  7720. o1=_st($Object())._new();
  7721. $ctx1.sendIdx["new"]=1;
  7722. o2=_st($Object())._new();
  7723. $2=_st(o1)._identityHash();
  7724. $ctx1.sendIdx["identityHash"]=1;
  7725. $3=_st(o1)._identityHash();
  7726. $ctx1.sendIdx["identityHash"]=2;
  7727. $1=_st($2).__eq_eq($3);
  7728. $ctx1.sendIdx["=="]=1;
  7729. self._assert_($1);
  7730. $5=_st(o1)._identityHash();
  7731. $ctx1.sendIdx["identityHash"]=3;
  7732. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7733. self._deny_($4);
  7734. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7735. args: [],
  7736. 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",
  7737. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7738. referencedClasses: ["Object"]
  7739. }),
  7740. smalltalk.ObjectTest);
  7741. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7742. smalltalk.addMethod(
  7743. smalltalk.method({
  7744. selector: "testAccessing",
  7745. protocol: 'tests',
  7746. fn: function (){
  7747. var self=this;
  7748. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7749. return smalltalk.withContext(function($ctx1) {
  7750. var $2,$1,$3,$6,$5,$4;
  7751. $2=_st($Point())._x_y_((3),(4));
  7752. $ctx1.sendIdx["x:y:"]=1;
  7753. $1=_st($2)._x();
  7754. $ctx1.sendIdx["x"]=1;
  7755. self._assert_equals_($1,(3));
  7756. $ctx1.sendIdx["assert:equals:"]=1;
  7757. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7758. $ctx1.sendIdx["y"]=1;
  7759. self._assert_equals_($3,(4));
  7760. $ctx1.sendIdx["assert:equals:"]=2;
  7761. $6=_st($Point())._new();
  7762. $ctx1.sendIdx["new"]=1;
  7763. $5=_st($6)._x_((3));
  7764. $4=_st($5)._x();
  7765. self._assert_equals_($4,(3));
  7766. $ctx1.sendIdx["assert:equals:"]=3;
  7767. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7768. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7769. args: [],
  7770. 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",
  7771. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7772. referencedClasses: ["Point"]
  7773. }),
  7774. smalltalk.PointTest);
  7775. smalltalk.addMethod(
  7776. smalltalk.method({
  7777. selector: "testArithmetic",
  7778. protocol: 'tests',
  7779. fn: function (){
  7780. var self=this;
  7781. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7782. return smalltalk.withContext(function($ctx1) {
  7783. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7784. $2=(3).__at((4));
  7785. $ctx1.sendIdx["@"]=1;
  7786. $3=(3).__at((4));
  7787. $ctx1.sendIdx["@"]=2;
  7788. $1=_st($2).__star($3);
  7789. $4=_st($Point())._x_y_((9),(16));
  7790. $ctx1.sendIdx["x:y:"]=1;
  7791. self._assert_equals_($1,$4);
  7792. $ctx1.sendIdx["assert:equals:"]=1;
  7793. $6=(3).__at((4));
  7794. $ctx1.sendIdx["@"]=3;
  7795. $7=(3).__at((4));
  7796. $ctx1.sendIdx["@"]=4;
  7797. $5=_st($6).__plus($7);
  7798. $8=_st($Point())._x_y_((6),(8));
  7799. $ctx1.sendIdx["x:y:"]=2;
  7800. self._assert_equals_($5,$8);
  7801. $ctx1.sendIdx["assert:equals:"]=2;
  7802. $10=(3).__at((4));
  7803. $ctx1.sendIdx["@"]=5;
  7804. $11=(3).__at((4));
  7805. $ctx1.sendIdx["@"]=6;
  7806. $9=_st($10).__minus($11);
  7807. $12=_st($Point())._x_y_((0),(0));
  7808. $ctx1.sendIdx["x:y:"]=3;
  7809. self._assert_equals_($9,$12);
  7810. $ctx1.sendIdx["assert:equals:"]=3;
  7811. $14=(6).__at((8));
  7812. $ctx1.sendIdx["@"]=7;
  7813. $13=_st($14).__slash((3).__at((4)));
  7814. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7815. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7816. args: [],
  7817. 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)",
  7818. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7819. referencedClasses: ["Point"]
  7820. }),
  7821. smalltalk.PointTest);
  7822. smalltalk.addMethod(
  7823. smalltalk.method({
  7824. selector: "testAt",
  7825. protocol: 'tests',
  7826. fn: function (){
  7827. var self=this;
  7828. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7829. return smalltalk.withContext(function($ctx1) {
  7830. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7831. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7832. args: [],
  7833. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7834. messageSends: ["assert:equals:", "@", "x:y:"],
  7835. referencedClasses: ["Point"]
  7836. }),
  7837. smalltalk.PointTest);
  7838. smalltalk.addMethod(
  7839. smalltalk.method({
  7840. selector: "testEgality",
  7841. protocol: 'tests',
  7842. fn: function (){
  7843. var self=this;
  7844. return smalltalk.withContext(function($ctx1) {
  7845. var $2,$3,$1,$5,$4;
  7846. $2=(3).__at((4));
  7847. $ctx1.sendIdx["@"]=1;
  7848. $3=(3).__at((4));
  7849. $ctx1.sendIdx["@"]=2;
  7850. $1=_st($2).__eq($3);
  7851. $ctx1.sendIdx["="]=1;
  7852. self._assert_($1);
  7853. $5=(3).__at((5));
  7854. $ctx1.sendIdx["@"]=3;
  7855. $4=_st($5).__eq((3).__at((6)));
  7856. self._deny_($4);
  7857. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7858. args: [],
  7859. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7860. messageSends: ["assert:", "=", "@", "deny:"],
  7861. referencedClasses: []
  7862. }),
  7863. smalltalk.PointTest);
  7864. smalltalk.addMethod(
  7865. smalltalk.method({
  7866. selector: "testNew",
  7867. protocol: 'tests',
  7868. fn: function (){
  7869. var self=this;
  7870. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7871. return smalltalk.withContext(function($ctx1) {
  7872. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7873. $3=_st($Point())._new();
  7874. $ctx1.sendIdx["new"]=1;
  7875. $2=_st($3)._x_((3));
  7876. $ctx1.sendIdx["x:"]=1;
  7877. $1=_st($2)._y();
  7878. $ctx1.sendIdx["y"]=1;
  7879. self._assert_equals_($1,nil);
  7880. $ctx1.sendIdx["assert:equals:"]=1;
  7881. $7=_st($Point())._new();
  7882. $ctx1.sendIdx["new"]=2;
  7883. $6=_st($7)._x_((3));
  7884. $5=_st($6)._x();
  7885. $ctx1.sendIdx["x"]=1;
  7886. $4=_st($5).__eq((0));
  7887. $ctx1.sendIdx["="]=1;
  7888. self._deny_($4);
  7889. $ctx1.sendIdx["deny:"]=1;
  7890. $10=_st($Point())._new();
  7891. $ctx1.sendIdx["new"]=3;
  7892. $9=_st($10)._y_((4));
  7893. $ctx1.sendIdx["y:"]=1;
  7894. $8=_st($9)._x();
  7895. self._assert_equals_($8,nil);
  7896. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7897. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7898. args: [],
  7899. 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",
  7900. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7901. referencedClasses: ["Point"]
  7902. }),
  7903. smalltalk.PointTest);
  7904. smalltalk.addMethod(
  7905. smalltalk.method({
  7906. selector: "testTranslateBy",
  7907. protocol: 'tests',
  7908. fn: function (){
  7909. var self=this;
  7910. return smalltalk.withContext(function($ctx1) {
  7911. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7912. $2=(3).__at((3));
  7913. $ctx1.sendIdx["@"]=1;
  7914. $3=(0).__at((1));
  7915. $ctx1.sendIdx["@"]=2;
  7916. $1=_st($2)._translateBy_($3);
  7917. $ctx1.sendIdx["translateBy:"]=1;
  7918. $4=(3).__at((4));
  7919. $ctx1.sendIdx["@"]=3;
  7920. self._assert_equals_($1,$4);
  7921. $ctx1.sendIdx["assert:equals:"]=1;
  7922. $6=(3).__at((3));
  7923. $ctx1.sendIdx["@"]=4;
  7924. $8=(1)._negated();
  7925. $ctx1.sendIdx["negated"]=1;
  7926. $7=(0).__at($8);
  7927. $ctx1.sendIdx["@"]=5;
  7928. $5=_st($6)._translateBy_($7);
  7929. $ctx1.sendIdx["translateBy:"]=2;
  7930. $9=(3).__at((2));
  7931. $ctx1.sendIdx["@"]=6;
  7932. self._assert_equals_($5,$9);
  7933. $ctx1.sendIdx["assert:equals:"]=2;
  7934. $11=(3).__at((3));
  7935. $ctx1.sendIdx["@"]=7;
  7936. $12=(2).__at((3));
  7937. $ctx1.sendIdx["@"]=8;
  7938. $10=_st($11)._translateBy_($12);
  7939. $ctx1.sendIdx["translateBy:"]=3;
  7940. $13=(5).__at((6));
  7941. $ctx1.sendIdx["@"]=9;
  7942. self._assert_equals_($10,$13);
  7943. $ctx1.sendIdx["assert:equals:"]=3;
  7944. $15=(3).__at((3));
  7945. $ctx1.sendIdx["@"]=10;
  7946. $16=_st((3)._negated()).__at((0));
  7947. $ctx1.sendIdx["@"]=11;
  7948. $14=_st($15)._translateBy_($16);
  7949. self._assert_equals_($14,(0).__at((3)));
  7950. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7951. args: [],
  7952. 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.",
  7953. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7954. referencedClasses: []
  7955. }),
  7956. smalltalk.PointTest);
  7957. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7958. smalltalk.addMethod(
  7959. smalltalk.method({
  7960. selector: "testNextIfAbsent",
  7961. protocol: 'tests',
  7962. fn: function (){
  7963. var self=this;
  7964. var queue;
  7965. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7966. return smalltalk.withContext(function($ctx1) {
  7967. var $2,$1;
  7968. queue=_st($Queue())._new();
  7969. _st(queue)._nextPut_("index1");
  7970. $2=_st(queue)._nextIfAbsent_("empty");
  7971. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7972. $1=_st($2).__eq("index1");
  7973. $ctx1.sendIdx["="]=1;
  7974. self._assert_($1);
  7975. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7976. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7977. args: [],
  7978. 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'",
  7979. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7980. referencedClasses: ["Queue"]
  7981. }),
  7982. smalltalk.QueueTest);
  7983. smalltalk.addMethod(
  7984. smalltalk.method({
  7985. selector: "testQueueNext",
  7986. protocol: 'tests',
  7987. fn: function (){
  7988. var self=this;
  7989. var queue;
  7990. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7991. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7992. return smalltalk.withContext(function($ctx1) {
  7993. var $1,$2,$4,$3,$6,$5;
  7994. queue=_st($Queue())._new();
  7995. $1=queue;
  7996. _st($1)._nextPut_("index1");
  7997. $ctx1.sendIdx["nextPut:"]=1;
  7998. $2=_st($1)._nextPut_("index2");
  7999. $4=_st(queue)._next();
  8000. $ctx1.sendIdx["next"]=1;
  8001. $3=_st($4).__eq("index1");
  8002. $ctx1.sendIdx["="]=1;
  8003. self._assert_($3);
  8004. $6=_st(queue)._next();
  8005. $ctx1.sendIdx["next"]=2;
  8006. $5=_st($6).__eq("index");
  8007. self._deny_($5);
  8008. self._should_raise_((function(){
  8009. return smalltalk.withContext(function($ctx2) {
  8010. return _st(queue)._next();
  8011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8012. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  8013. args: [],
  8014. 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",
  8015. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8016. referencedClasses: ["Queue", "Error"]
  8017. }),
  8018. smalltalk.QueueTest);
  8019. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8020. smalltalk.addMethod(
  8021. smalltalk.method({
  8022. selector: "testAtRandomNumber",
  8023. protocol: 'tests',
  8024. fn: function (){
  8025. var self=this;
  8026. var val;
  8027. return smalltalk.withContext(function($ctx1) {
  8028. (100)._timesRepeat_((function(){
  8029. return smalltalk.withContext(function($ctx2) {
  8030. val=(10)._atRandom();
  8031. val;
  8032. self._assert_(_st(val).__gt((0)));
  8033. $ctx2.sendIdx["assert:"]=1;
  8034. return self._assert_(_st(val).__lt((11)));
  8035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8036. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  8037. args: [],
  8038. 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]",
  8039. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8040. referencedClasses: []
  8041. }),
  8042. smalltalk.RandomTest);
  8043. smalltalk.addMethod(
  8044. smalltalk.method({
  8045. selector: "testAtRandomSequenceableCollection",
  8046. protocol: 'tests',
  8047. fn: function (){
  8048. var self=this;
  8049. var val;
  8050. return smalltalk.withContext(function($ctx1) {
  8051. var $3,$4,$2,$1;
  8052. (100)._timesRepeat_((function(){
  8053. return smalltalk.withContext(function($ctx2) {
  8054. val="abc"._atRandom();
  8055. val;
  8056. $3=_st(val).__eq("a");
  8057. $ctx2.sendIdx["="]=1;
  8058. $4=_st(val).__eq("b");
  8059. $ctx2.sendIdx["="]=2;
  8060. $2=_st($3).__or($4);
  8061. $1=_st($2).__or(_st(val).__eq("c"));
  8062. $ctx2.sendIdx["|"]=1;
  8063. return self._assert_($1);
  8064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8065. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  8066. args: [],
  8067. 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].",
  8068. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8069. referencedClasses: []
  8070. }),
  8071. smalltalk.RandomTest);
  8072. smalltalk.addMethod(
  8073. smalltalk.method({
  8074. selector: "textNext",
  8075. protocol: 'tests',
  8076. fn: function (){
  8077. var self=this;
  8078. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  8079. return smalltalk.withContext(function($ctx1) {
  8080. var $1;
  8081. (10000)._timesRepeat_((function(){
  8082. var current,next;
  8083. return smalltalk.withContext(function($ctx2) {
  8084. next=_st(_st($Random())._new())._next();
  8085. next;
  8086. self._assert_(_st(next).__gt_eq((0)));
  8087. $ctx2.sendIdx["assert:"]=1;
  8088. self._assert_(_st(next).__lt((1)));
  8089. $1=_st(current).__eq(next);
  8090. $ctx2.sendIdx["="]=1;
  8091. self._deny_($1);
  8092. return _st(next).__eq(current);
  8093. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8094. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  8095. args: [],
  8096. 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 ]",
  8097. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8098. referencedClasses: ["Random"]
  8099. }),
  8100. smalltalk.RandomTest);
  8101. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8102. smalltalk.addMethod(
  8103. smalltalk.method({
  8104. selector: "collectionClass",
  8105. protocol: 'accessing',
  8106. fn: function (){
  8107. var self=this;
  8108. return smalltalk.withContext(function($ctx1) {
  8109. var $1;
  8110. $1=_st(self._class())._collectionClass();
  8111. return $1;
  8112. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  8113. args: [],
  8114. source: "collectionClass\x0a\x09^ self class collectionClass",
  8115. messageSends: ["collectionClass", "class"],
  8116. referencedClasses: []
  8117. }),
  8118. smalltalk.StreamTest);
  8119. smalltalk.addMethod(
  8120. smalltalk.method({
  8121. selector: "newCollection",
  8122. protocol: 'accessing',
  8123. fn: function (){
  8124. var self=this;
  8125. return smalltalk.withContext(function($ctx1) {
  8126. var $1;
  8127. $1=_st(self._collectionClass())._new();
  8128. return $1;
  8129. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  8130. args: [],
  8131. source: "newCollection\x0a\x09^ self collectionClass new",
  8132. messageSends: ["new", "collectionClass"],
  8133. referencedClasses: []
  8134. }),
  8135. smalltalk.StreamTest);
  8136. smalltalk.addMethod(
  8137. smalltalk.method({
  8138. selector: "newStream",
  8139. protocol: 'accessing',
  8140. fn: function (){
  8141. var self=this;
  8142. return smalltalk.withContext(function($ctx1) {
  8143. var $1;
  8144. $1=_st(_st(self._collectionClass())._new())._stream();
  8145. return $1;
  8146. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  8147. args: [],
  8148. source: "newStream\x0a\x09^ self collectionClass new stream",
  8149. messageSends: ["stream", "new", "collectionClass"],
  8150. referencedClasses: []
  8151. }),
  8152. smalltalk.StreamTest);
  8153. smalltalk.addMethod(
  8154. smalltalk.method({
  8155. selector: "testAtStartAtEnd",
  8156. protocol: 'tests',
  8157. fn: function (){
  8158. var self=this;
  8159. var stream;
  8160. return smalltalk.withContext(function($ctx1) {
  8161. var $1,$2,$3,$4;
  8162. stream=self._newStream();
  8163. $1=_st(stream)._atStart();
  8164. $ctx1.sendIdx["atStart"]=1;
  8165. self._assert_($1);
  8166. $ctx1.sendIdx["assert:"]=1;
  8167. $2=_st(stream)._atEnd();
  8168. $ctx1.sendIdx["atEnd"]=1;
  8169. self._assert_($2);
  8170. $ctx1.sendIdx["assert:"]=2;
  8171. _st(stream)._nextPutAll_(self._newCollection());
  8172. $3=_st(stream)._atEnd();
  8173. $ctx1.sendIdx["atEnd"]=2;
  8174. self._assert_($3);
  8175. $4=_st(stream)._atStart();
  8176. $ctx1.sendIdx["atStart"]=2;
  8177. self._deny_($4);
  8178. $ctx1.sendIdx["deny:"]=1;
  8179. _st(stream)._position_((1));
  8180. self._deny_(_st(stream)._atEnd());
  8181. $ctx1.sendIdx["deny:"]=2;
  8182. self._deny_(_st(stream)._atStart());
  8183. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  8184. args: [],
  8185. 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",
  8186. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8187. referencedClasses: []
  8188. }),
  8189. smalltalk.StreamTest);
  8190. smalltalk.addMethod(
  8191. smalltalk.method({
  8192. selector: "testContents",
  8193. protocol: 'tests',
  8194. fn: function (){
  8195. var self=this;
  8196. var stream;
  8197. return smalltalk.withContext(function($ctx1) {
  8198. var $1,$2;
  8199. stream=self._newStream();
  8200. $1=stream;
  8201. $2=self._newCollection();
  8202. $ctx1.sendIdx["newCollection"]=1;
  8203. _st($1)._nextPutAll_($2);
  8204. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8205. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  8206. args: [],
  8207. 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",
  8208. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8209. referencedClasses: []
  8210. }),
  8211. smalltalk.StreamTest);
  8212. smalltalk.addMethod(
  8213. smalltalk.method({
  8214. selector: "testIsEmpty",
  8215. protocol: 'tests',
  8216. fn: function (){
  8217. var self=this;
  8218. var stream;
  8219. return smalltalk.withContext(function($ctx1) {
  8220. var $1;
  8221. stream=self._newStream();
  8222. $1=_st(stream)._isEmpty();
  8223. $ctx1.sendIdx["isEmpty"]=1;
  8224. self._assert_($1);
  8225. _st(stream)._nextPutAll_(self._newCollection());
  8226. self._deny_(_st(stream)._isEmpty());
  8227. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8228. args: [],
  8229. 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",
  8230. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8231. referencedClasses: []
  8232. }),
  8233. smalltalk.StreamTest);
  8234. smalltalk.addMethod(
  8235. smalltalk.method({
  8236. selector: "testPosition",
  8237. protocol: 'tests',
  8238. fn: function (){
  8239. var self=this;
  8240. var collection,stream;
  8241. return smalltalk.withContext(function($ctx1) {
  8242. var $1,$2,$3;
  8243. collection=self._newCollection();
  8244. stream=self._newStream();
  8245. _st(stream)._nextPutAll_(collection);
  8246. $1=_st(stream)._position();
  8247. $ctx1.sendIdx["position"]=1;
  8248. self._assert_equals_($1,_st(collection)._size());
  8249. $ctx1.sendIdx["assert:equals:"]=1;
  8250. _st(stream)._position_((0));
  8251. $2=_st(stream)._position();
  8252. $ctx1.sendIdx["position"]=2;
  8253. self._assert_equals_($2,(0));
  8254. $ctx1.sendIdx["assert:equals:"]=2;
  8255. _st(stream)._next();
  8256. $ctx1.sendIdx["next"]=1;
  8257. $3=_st(stream)._position();
  8258. $ctx1.sendIdx["position"]=3;
  8259. self._assert_equals_($3,(1));
  8260. $ctx1.sendIdx["assert:equals:"]=3;
  8261. _st(stream)._next();
  8262. self._assert_equals_(_st(stream)._position(),(2));
  8263. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8264. args: [],
  8265. 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",
  8266. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8267. referencedClasses: []
  8268. }),
  8269. smalltalk.StreamTest);
  8270. smalltalk.addMethod(
  8271. smalltalk.method({
  8272. selector: "testReading",
  8273. protocol: 'tests',
  8274. fn: function (){
  8275. var self=this;
  8276. var stream,collection;
  8277. return smalltalk.withContext(function($ctx1) {
  8278. var $1,$2,$3;
  8279. collection=self._newCollection();
  8280. stream=self._newStream();
  8281. $1=stream;
  8282. _st($1)._nextPutAll_(collection);
  8283. $2=_st($1)._position_((0));
  8284. _st(collection)._do_((function(each){
  8285. return smalltalk.withContext(function($ctx2) {
  8286. $3=_st(stream)._next();
  8287. $ctx2.sendIdx["next"]=1;
  8288. return self._assert_equals_($3,each);
  8289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8290. self._assert_(_st(_st(stream)._next())._isNil());
  8291. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8292. args: [],
  8293. 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",
  8294. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8295. referencedClasses: []
  8296. }),
  8297. smalltalk.StreamTest);
  8298. smalltalk.addMethod(
  8299. smalltalk.method({
  8300. selector: "testStreamContents",
  8301. protocol: 'tests',
  8302. fn: function (){
  8303. var self=this;
  8304. return smalltalk.withContext(function($ctx1) {
  8305. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8306. args: [],
  8307. source: "testStreamContents",
  8308. messageSends: [],
  8309. referencedClasses: []
  8310. }),
  8311. smalltalk.StreamTest);
  8312. smalltalk.addMethod(
  8313. smalltalk.method({
  8314. selector: "testWrite",
  8315. protocol: 'tests',
  8316. fn: function (){
  8317. var self=this;
  8318. var stream,collection;
  8319. return smalltalk.withContext(function($ctx1) {
  8320. collection=self._newCollection();
  8321. stream=self._newStream();
  8322. _st(collection)._do_((function(each){
  8323. return smalltalk.withContext(function($ctx2) {
  8324. return _st(stream).__lt_lt(each);
  8325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8326. self._assert_equals_(_st(stream)._contents(),collection);
  8327. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8328. args: [],
  8329. 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",
  8330. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8331. referencedClasses: []
  8332. }),
  8333. smalltalk.StreamTest);
  8334. smalltalk.addMethod(
  8335. smalltalk.method({
  8336. selector: "testWriting",
  8337. protocol: 'tests',
  8338. fn: function (){
  8339. var self=this;
  8340. var stream,collection;
  8341. return smalltalk.withContext(function($ctx1) {
  8342. var $1;
  8343. collection=self._newCollection();
  8344. stream=self._newStream();
  8345. $ctx1.sendIdx["newStream"]=1;
  8346. _st(collection)._do_((function(each){
  8347. return smalltalk.withContext(function($ctx2) {
  8348. return _st(stream)._nextPut_(each);
  8349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8350. $1=_st(stream)._contents();
  8351. $ctx1.sendIdx["contents"]=1;
  8352. self._assert_equals_($1,collection);
  8353. $ctx1.sendIdx["assert:equals:"]=1;
  8354. stream=self._newStream();
  8355. _st(stream)._nextPutAll_(collection);
  8356. self._assert_equals_(_st(stream)._contents(),collection);
  8357. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8358. args: [],
  8359. 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",
  8360. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8361. referencedClasses: []
  8362. }),
  8363. smalltalk.StreamTest);
  8364. smalltalk.addMethod(
  8365. smalltalk.method({
  8366. selector: "collectionClass",
  8367. protocol: 'accessing',
  8368. fn: function (){
  8369. var self=this;
  8370. return smalltalk.withContext(function($ctx1) {
  8371. return nil;
  8372. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8373. args: [],
  8374. source: "collectionClass\x0a\x09^ nil",
  8375. messageSends: [],
  8376. referencedClasses: []
  8377. }),
  8378. smalltalk.StreamTest.klass);
  8379. smalltalk.addMethod(
  8380. smalltalk.method({
  8381. selector: "isAbstract",
  8382. protocol: 'testing',
  8383. fn: function (){
  8384. var self=this;
  8385. return smalltalk.withContext(function($ctx1) {
  8386. var $1;
  8387. $1=_st(self._collectionClass())._isNil();
  8388. return $1;
  8389. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8390. args: [],
  8391. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8392. messageSends: ["isNil", "collectionClass"],
  8393. referencedClasses: []
  8394. }),
  8395. smalltalk.StreamTest.klass);
  8396. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8397. smalltalk.addMethod(
  8398. smalltalk.method({
  8399. selector: "newCollection",
  8400. protocol: 'accessing',
  8401. fn: function (){
  8402. var self=this;
  8403. return smalltalk.withContext(function($ctx1) {
  8404. var $1;
  8405. $1=[true,(1),(3).__at((4)),"foo"];
  8406. return $1;
  8407. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8408. args: [],
  8409. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8410. messageSends: ["@"],
  8411. referencedClasses: []
  8412. }),
  8413. smalltalk.ArrayStreamTest);
  8414. smalltalk.addMethod(
  8415. smalltalk.method({
  8416. selector: "collectionClass",
  8417. protocol: 'accessing',
  8418. fn: function (){
  8419. var self=this;
  8420. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8421. return smalltalk.withContext(function($ctx1) {
  8422. return $Array();
  8423. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8424. args: [],
  8425. source: "collectionClass\x0a\x09^ Array",
  8426. messageSends: [],
  8427. referencedClasses: ["Array"]
  8428. }),
  8429. smalltalk.ArrayStreamTest.klass);
  8430. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8431. smalltalk.addMethod(
  8432. smalltalk.method({
  8433. selector: "newCollection",
  8434. protocol: 'accessing',
  8435. fn: function (){
  8436. var self=this;
  8437. return smalltalk.withContext(function($ctx1) {
  8438. return "hello world";
  8439. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8440. args: [],
  8441. source: "newCollection\x0a\x09^ 'hello world'",
  8442. messageSends: [],
  8443. referencedClasses: []
  8444. }),
  8445. smalltalk.StringStreamTest);
  8446. smalltalk.addMethod(
  8447. smalltalk.method({
  8448. selector: "collectionClass",
  8449. protocol: 'accessing',
  8450. fn: function (){
  8451. var self=this;
  8452. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8453. return smalltalk.withContext(function($ctx1) {
  8454. return $String();
  8455. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8456. args: [],
  8457. source: "collectionClass\x0a\x09^ String",
  8458. messageSends: [],
  8459. referencedClasses: ["String"]
  8460. }),
  8461. smalltalk.StringStreamTest.klass);
  8462. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8463. smalltalk.addMethod(
  8464. smalltalk.method({
  8465. selector: "testCopying",
  8466. protocol: 'tests',
  8467. fn: function (){
  8468. var self=this;
  8469. return smalltalk.withContext(function($ctx1) {
  8470. self._assert_equals_(nil._copy(),nil);
  8471. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8472. args: [],
  8473. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8474. messageSends: ["assert:equals:", "copy"],
  8475. referencedClasses: []
  8476. }),
  8477. smalltalk.UndefinedTest);
  8478. smalltalk.addMethod(
  8479. smalltalk.method({
  8480. selector: "testDeepCopy",
  8481. protocol: 'tests',
  8482. fn: function (){
  8483. var self=this;
  8484. return smalltalk.withContext(function($ctx1) {
  8485. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8486. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8487. args: [],
  8488. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8489. messageSends: ["assert:", "=", "deepCopy"],
  8490. referencedClasses: []
  8491. }),
  8492. smalltalk.UndefinedTest);
  8493. smalltalk.addMethod(
  8494. smalltalk.method({
  8495. selector: "testIfNil",
  8496. protocol: 'tests',
  8497. fn: function (){
  8498. var self=this;
  8499. return smalltalk.withContext(function($ctx1) {
  8500. var $1,$3,$2,$4,$6,$5;
  8501. if(($receiver = nil) == nil || $receiver == null){
  8502. $1=true;
  8503. } else {
  8504. $1=nil;
  8505. };
  8506. self._assert_equals_($1,true);
  8507. $ctx1.sendIdx["assert:equals:"]=1;
  8508. if(($receiver = nil) == nil || $receiver == null){
  8509. $3=nil;
  8510. } else {
  8511. $3=true;
  8512. };
  8513. $2=_st($3).__eq(true);
  8514. $ctx1.sendIdx["="]=1;
  8515. self._deny_($2);
  8516. $ctx1.sendIdx["deny:"]=1;
  8517. if(($receiver = nil) == nil || $receiver == null){
  8518. $4=true;
  8519. } else {
  8520. $4=false;
  8521. };
  8522. self._assert_equals_($4,true);
  8523. if(($receiver = nil) == nil || $receiver == null){
  8524. $6=false;
  8525. } else {
  8526. $6=true;
  8527. };
  8528. $5=_st($6).__eq(true);
  8529. self._deny_($5);
  8530. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8531. args: [],
  8532. 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",
  8533. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8534. referencedClasses: []
  8535. }),
  8536. smalltalk.UndefinedTest);
  8537. smalltalk.addMethod(
  8538. smalltalk.method({
  8539. selector: "testIsNil",
  8540. protocol: 'tests',
  8541. fn: function (){
  8542. var self=this;
  8543. return smalltalk.withContext(function($ctx1) {
  8544. self._assert_(nil._isNil());
  8545. self._deny_(nil._notNil());
  8546. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8547. args: [],
  8548. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8549. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8550. referencedClasses: []
  8551. }),
  8552. smalltalk.UndefinedTest);
  8553. });