Kernel-Tests.js 332 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077
  1. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Tests');
  4. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "testAddExtensionMethod",
  9. protocol: 'tests',
  10. fn: function (){
  11. var self=this;
  12. var method,dirty;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  15. $2=self._class();
  16. $ctx1.sendIdx["class"]=1;
  17. $1=_st($2)._package();
  18. $ctx1.sendIdx["package"]=1;
  19. dirty=_st($1)._isDirty();
  20. $ctx1.sendIdx["isDirty"]=1;
  21. $4=self._class();
  22. $ctx1.sendIdx["class"]=2;
  23. $3=_st($4)._package();
  24. $ctx1.sendIdx["package"]=2;
  25. _st($3)._beClean();
  26. $5=self._class();
  27. $ctx1.sendIdx["class"]=3;
  28. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  29. $8=self._class();
  30. $ctx1.sendIdx["class"]=4;
  31. $7=_st($8)._package();
  32. $ctx1.sendIdx["package"]=3;
  33. $6=_st($7)._isDirty();
  34. self._deny_($6);
  35. $9=self._class();
  36. $ctx1.sendIdx["class"]=5;
  37. _st($9)._removeCompiledMethod_(method);
  38. $10=dirty;
  39. if(smalltalk.assert($10)){
  40. _st(_st(self._class())._package())._beDirty();
  41. };
  42. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)})},
  43. args: [],
  44. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  45. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  46. referencedClasses: []
  47. }),
  48. globals.AnnouncementSubscriptionTest);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "testHandlesAnnouncement",
  52. protocol: 'tests',
  53. fn: function (){
  54. var self=this;
  55. var subscription,announcementClass1,announcementClass2,classBuilder;
  56. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  57. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  59. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  60. return smalltalk.withContext(function($ctx1) {
  61. var $1,$2;
  62. classBuilder=_st($ClassBuilder())._new();
  63. $ctx1.sendIdx["new"]=1;
  64. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  65. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  66. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  67. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  68. self._assert_equals_($1,true);
  69. $ctx1.sendIdx["assert:equals:"]=1;
  70. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  71. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  72. self._assert_equals_($2,true);
  73. $ctx1.sendIdx["assert:equals:"]=2;
  74. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  75. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  76. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  77. args: [],
  78. 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.",
  79. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  80. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  81. }),
  82. globals.AnnouncementSubscriptionTest);
  83. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "testOnDo",
  87. protocol: 'tests',
  88. fn: function (){
  89. var self=this;
  90. var counter,announcer;
  91. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  92. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  93. return smalltalk.withContext(function($ctx1) {
  94. var $1,$2;
  95. counter=(0);
  96. announcer=_st($Announcer())._new();
  97. $ctx1.sendIdx["new"]=1;
  98. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. counter=_st(counter).__plus((1));
  101. return counter;
  102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  103. $1=announcer;
  104. $2=_st($SystemAnnouncement())._new();
  105. $ctx1.sendIdx["new"]=2;
  106. _st($1)._announce_($2);
  107. $ctx1.sendIdx["announce:"]=1;
  108. self._assert_equals_(counter,(1));
  109. $ctx1.sendIdx["assert:equals:"]=1;
  110. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  111. self._assert_equals_(counter,(2));
  112. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  113. args: [],
  114. 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.",
  115. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  116. referencedClasses: ["Announcer", "SystemAnnouncement"]
  117. }),
  118. globals.AnnouncerTest);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "testOnDoFor",
  122. protocol: 'tests',
  123. fn: function (){
  124. var self=this;
  125. var counter,announcer;
  126. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  127. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1,$2,$3,$4;
  130. counter=(0);
  131. announcer=_st($Announcer())._new();
  132. $ctx1.sendIdx["new"]=1;
  133. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  134. return smalltalk.withContext(function($ctx2) {
  135. counter=_st(counter).__plus((1));
  136. return counter;
  137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  138. $1=announcer;
  139. $2=_st($SystemAnnouncement())._new();
  140. $ctx1.sendIdx["new"]=2;
  141. _st($1)._announce_($2);
  142. $ctx1.sendIdx["announce:"]=1;
  143. self._assert_equals_(counter,(1));
  144. $ctx1.sendIdx["assert:equals:"]=1;
  145. $3=announcer;
  146. $4=_st($SystemAnnouncement())._new();
  147. $ctx1.sendIdx["new"]=3;
  148. _st($3)._announce_($4);
  149. $ctx1.sendIdx["announce:"]=2;
  150. self._assert_equals_(counter,(2));
  151. $ctx1.sendIdx["assert:equals:"]=2;
  152. _st(announcer)._unsubscribe_(self);
  153. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  154. self._assert_equals_(counter,(2));
  155. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  156. args: [],
  157. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  158. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  159. referencedClasses: ["Announcer", "SystemAnnouncement"]
  160. }),
  161. globals.AnnouncerTest);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "testOnDoOnce",
  165. protocol: 'tests',
  166. fn: function (){
  167. var self=this;
  168. var counter,announcer;
  169. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  170. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  171. return smalltalk.withContext(function($ctx1) {
  172. var $1,$2;
  173. counter=(0);
  174. announcer=_st($Announcer())._new();
  175. $ctx1.sendIdx["new"]=1;
  176. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  177. return smalltalk.withContext(function($ctx2) {
  178. counter=_st(counter).__plus((1));
  179. return counter;
  180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  181. $1=announcer;
  182. $2=_st($SystemAnnouncement())._new();
  183. $ctx1.sendIdx["new"]=2;
  184. _st($1)._announce_($2);
  185. $ctx1.sendIdx["announce:"]=1;
  186. self._assert_equals_(counter,(1));
  187. $ctx1.sendIdx["assert:equals:"]=1;
  188. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  189. self._assert_equals_(counter,(1));
  190. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  191. args: [],
  192. 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.",
  193. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  194. referencedClasses: ["Announcer", "SystemAnnouncement"]
  195. }),
  196. globals.AnnouncerTest);
  197. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCanClearInterval",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  205. return smalltalk.withContext(function($ctx1) {
  206. self._shouldnt_raise_((function(){
  207. return smalltalk.withContext(function($ctx2) {
  208. return _st(_st((function(){
  209. return smalltalk.withContext(function($ctx3) {
  210. return _st(_st($Error())._new())._signal();
  211. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  213. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  214. args: [],
  215. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  216. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  217. referencedClasses: ["Error"]
  218. }),
  219. globals.BlockClosureTest);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "testCanClearTimeout",
  223. protocol: 'tests',
  224. fn: function (){
  225. var self=this;
  226. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  227. return smalltalk.withContext(function($ctx1) {
  228. self._shouldnt_raise_((function(){
  229. return smalltalk.withContext(function($ctx2) {
  230. return _st(_st((function(){
  231. return smalltalk.withContext(function($ctx3) {
  232. return _st(_st($Error())._new())._signal();
  233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  235. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  236. args: [],
  237. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  238. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  239. referencedClasses: ["Error"]
  240. }),
  241. globals.BlockClosureTest);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "testCompiledSource",
  245. protocol: 'tests',
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. self._assert_(_st(_st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. return (1).__plus((1));
  252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  253. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  254. args: [],
  255. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  256. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  257. referencedClasses: []
  258. }),
  259. globals.BlockClosureTest);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "testCurrySelf",
  263. protocol: 'tests',
  264. fn: function (){
  265. var self=this;
  266. var curriedMethod,array;
  267. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  268. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  269. return smalltalk.withContext(function($ctx1) {
  270. curriedMethod=_st(_st((function(selfarg,x){
  271. return smalltalk.withContext(function($ctx2) {
  272. return _st(selfarg)._at_(x);
  273. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  274. array=[(3), (1), (4)];
  275. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  276. _st((function(){
  277. return smalltalk.withContext(function($ctx2) {
  278. return self._assert_equals_(_st(array)._foo_((2)),(1));
  279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  280. return smalltalk.withContext(function($ctx2) {
  281. return _st($Array())._removeCompiledMethod_(curriedMethod);
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  284. args: [],
  285. 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 ]",
  286. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  287. referencedClasses: ["ClassBuilder", "Array"]
  288. }),
  289. globals.BlockClosureTest);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "testEnsure",
  293. protocol: 'tests',
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. self._assert_equals_(_st((function(){
  298. return (3);
  299. }))._ensure_((function(){
  300. return (4);
  301. })),(3));
  302. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  303. args: [],
  304. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  305. messageSends: ["assert:equals:", "ensure:"],
  306. referencedClasses: []
  307. }),
  308. globals.BlockClosureTest);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "testEnsureRaises",
  312. protocol: 'tests',
  313. fn: function (){
  314. var self=this;
  315. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  316. return smalltalk.withContext(function($ctx1) {
  317. self._should_raise_((function(){
  318. return smalltalk.withContext(function($ctx2) {
  319. return _st((function(){
  320. return smalltalk.withContext(function($ctx3) {
  321. return _st(_st($Error())._new())._signal();
  322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  323. return true;
  324. }));
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  326. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  327. args: [],
  328. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  329. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  330. referencedClasses: ["Error"]
  331. }),
  332. globals.BlockClosureTest);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "testExceptionSemantics",
  336. protocol: 'tests',
  337. fn: function (){
  338. var self=this;
  339. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  340. return smalltalk.withContext(function($ctx1) {
  341. self._timeout_((100));
  342. _st(self._async_((function(){
  343. return smalltalk.withContext(function($ctx2) {
  344. return _st((function(){
  345. return smalltalk.withContext(function($ctx3) {
  346. self._assert_(true);
  347. _st($Error())._signal();
  348. self._deny_(true);
  349. return self._finished();
  350. $ctx3.sendIdx["finished"]=1;
  351. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  352. return smalltalk.withContext(function($ctx3) {
  353. return self._finished();
  354. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  357. args: [],
  358. 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",
  359. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  360. referencedClasses: ["Error"]
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testNewWithValues",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. return smalltalk.withContext(function($ctx1) {
  370. function TestConstructor(arg1, arg2, arg3) {}
  371. TestConstructor.prototype.name = 'theTestPrototype';
  372. var wrappedConstructor = _st(TestConstructor);
  373. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  374. self._assert_(result instanceof TestConstructor);
  375. self._assert_equals_(result.name, 'theTestPrototype');
  376. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  377. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  378. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  379. args: [],
  380. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  381. messageSends: [],
  382. referencedClasses: []
  383. }),
  384. globals.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testNumArgs",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st((function(){
  394. }))._numArgs();
  395. $ctx1.sendIdx["numArgs"]=1;
  396. self._assert_equals_($1,(0));
  397. $ctx1.sendIdx["assert:equals:"]=1;
  398. self._assert_equals_(_st((function(a,b){
  399. }))._numArgs(),(2));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  401. args: [],
  402. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  403. messageSends: ["assert:equals:", "numArgs"],
  404. referencedClasses: []
  405. }),
  406. globals.BlockClosureTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testOnDo",
  410. protocol: 'tests',
  411. fn: function (){
  412. var self=this;
  413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  414. return smalltalk.withContext(function($ctx1) {
  415. self._assert_(_st((function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. return _st(_st($Error())._new())._signal();
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  419. return true;
  420. })));
  421. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  422. args: [],
  423. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  424. messageSends: ["assert:", "on:do:", "signal", "new"],
  425. referencedClasses: ["Error"]
  426. }),
  427. globals.BlockClosureTest);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testValue",
  431. protocol: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st((function(){
  437. return smalltalk.withContext(function($ctx2) {
  438. return (1).__plus((1));
  439. $ctx2.sendIdx["+"]=1;
  440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  441. $ctx1.sendIdx["value"]=1;
  442. self._assert_equals_($1,(2));
  443. $ctx1.sendIdx["assert:equals:"]=1;
  444. self._assert_equals_(_st((function(x){
  445. return smalltalk.withContext(function($ctx2) {
  446. return _st(x).__plus((1));
  447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  448. $ctx1.sendIdx["assert:equals:"]=2;
  449. self._assert_equals_(_st((function(x,y){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st(x).__star(y);
  452. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  453. $ctx1.sendIdx["assert:equals:"]=3;
  454. self._assert_equals_(_st((function(a,b,c){
  455. return (1);
  456. }))._value(),(1));
  457. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  458. args: [],
  459. 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",
  460. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  461. referencedClasses: []
  462. }),
  463. globals.BlockClosureTest);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "testValueWithPossibleArguments",
  467. protocol: 'tests',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) {
  471. var $1,$2;
  472. $1=_st((function(){
  473. return (1);
  474. }))._valueWithPossibleArguments_([(3), (4)]);
  475. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  476. self._assert_equals_($1,(1));
  477. $ctx1.sendIdx["assert:equals:"]=1;
  478. $2=_st((function(a){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st(a).__plus((4));
  481. $ctx2.sendIdx["+"]=1;
  482. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  483. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  484. self._assert_equals_($2,(7));
  485. $ctx1.sendIdx["assert:equals:"]=2;
  486. self._assert_equals_(_st((function(a,b){
  487. return smalltalk.withContext(function($ctx2) {
  488. return _st(a).__plus(b);
  489. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  490. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  491. args: [],
  492. 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.",
  493. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  494. referencedClasses: []
  495. }),
  496. globals.BlockClosureTest);
  497. smalltalk.addMethod(
  498. smalltalk.method({
  499. selector: "testWhileFalse",
  500. protocol: 'tests',
  501. fn: function (){
  502. var self=this;
  503. var i;
  504. return smalltalk.withContext(function($ctx1) {
  505. i=(0);
  506. _st((function(){
  507. return smalltalk.withContext(function($ctx2) {
  508. return _st(i).__gt((5));
  509. $ctx2.sendIdx[">"]=1;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  511. return smalltalk.withContext(function($ctx2) {
  512. i=_st(i).__plus((1));
  513. $ctx2.sendIdx["+"]=1;
  514. return i;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  516. self._assert_equals_(i,(6));
  517. $ctx1.sendIdx["assert:equals:"]=1;
  518. i=(0);
  519. _st((function(){
  520. return smalltalk.withContext(function($ctx2) {
  521. i=_st(i).__plus((1));
  522. i;
  523. return _st(i).__gt((5));
  524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  525. self._assert_equals_(i,(6));
  526. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  527. args: [],
  528. 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",
  529. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  530. referencedClasses: []
  531. }),
  532. globals.BlockClosureTest);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "testWhileTrue",
  536. protocol: 'tests',
  537. fn: function (){
  538. var self=this;
  539. var i;
  540. return smalltalk.withContext(function($ctx1) {
  541. i=(0);
  542. _st((function(){
  543. return smalltalk.withContext(function($ctx2) {
  544. return _st(i).__lt((5));
  545. $ctx2.sendIdx["<"]=1;
  546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  547. return smalltalk.withContext(function($ctx2) {
  548. i=_st(i).__plus((1));
  549. $ctx2.sendIdx["+"]=1;
  550. return i;
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  552. self._assert_equals_(i,(5));
  553. $ctx1.sendIdx["assert:equals:"]=1;
  554. i=(0);
  555. _st((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. i=_st(i).__plus((1));
  558. i;
  559. return _st(i).__lt((5));
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  561. self._assert_equals_(i,(5));
  562. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  563. args: [],
  564. 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",
  565. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  566. referencedClasses: []
  567. }),
  568. globals.BlockClosureTest);
  569. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  570. smalltalk.addMethod(
  571. smalltalk.method({
  572. selector: "testEquality",
  573. protocol: 'tests',
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  578. $1=(0).__eq(false);
  579. $ctx1.sendIdx["="]=1;
  580. self._deny_($1);
  581. $ctx1.sendIdx["deny:"]=1;
  582. $2=false.__eq((0));
  583. $ctx1.sendIdx["="]=2;
  584. self._deny_($2);
  585. $ctx1.sendIdx["deny:"]=2;
  586. $3="".__eq(false);
  587. $ctx1.sendIdx["="]=3;
  588. self._deny_($3);
  589. $ctx1.sendIdx["deny:"]=3;
  590. $4=false.__eq("");
  591. $ctx1.sendIdx["="]=4;
  592. self._deny_($4);
  593. $ctx1.sendIdx["deny:"]=4;
  594. $5=true.__eq(true);
  595. $ctx1.sendIdx["="]=5;
  596. self._assert_($5);
  597. $ctx1.sendIdx["assert:"]=1;
  598. $6=false.__eq(true);
  599. $ctx1.sendIdx["="]=6;
  600. self._deny_($6);
  601. $ctx1.sendIdx["deny:"]=5;
  602. $7=true.__eq(false);
  603. $ctx1.sendIdx["="]=7;
  604. self._deny_($7);
  605. $8=false.__eq(false);
  606. $ctx1.sendIdx["="]=8;
  607. self._assert_($8);
  608. $ctx1.sendIdx["assert:"]=2;
  609. $10=true._yourself();
  610. $ctx1.sendIdx["yourself"]=1;
  611. $9=_st($10).__eq(true);
  612. $ctx1.sendIdx["="]=9;
  613. self._assert_($9);
  614. $ctx1.sendIdx["assert:"]=3;
  615. $12=true._yourself();
  616. $ctx1.sendIdx["yourself"]=2;
  617. $11=_st($12).__eq(true._yourself());
  618. self._assert_($11);
  619. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  620. args: [],
  621. 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)",
  622. messageSends: ["deny:", "=", "assert:", "yourself"],
  623. referencedClasses: []
  624. }),
  625. globals.BooleanTest);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "testIdentity",
  629. protocol: 'tests',
  630. fn: function (){
  631. var self=this;
  632. return smalltalk.withContext(function($ctx1) {
  633. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  634. $1=(0).__eq_eq(false);
  635. $ctx1.sendIdx["=="]=1;
  636. self._deny_($1);
  637. $ctx1.sendIdx["deny:"]=1;
  638. $2=false.__eq_eq((0));
  639. $ctx1.sendIdx["=="]=2;
  640. self._deny_($2);
  641. $ctx1.sendIdx["deny:"]=2;
  642. $3="".__eq_eq(false);
  643. $ctx1.sendIdx["=="]=3;
  644. self._deny_($3);
  645. $ctx1.sendIdx["deny:"]=3;
  646. $4=false.__eq_eq("");
  647. $ctx1.sendIdx["=="]=4;
  648. self._deny_($4);
  649. $ctx1.sendIdx["deny:"]=4;
  650. $5=true.__eq_eq(true);
  651. $ctx1.sendIdx["=="]=5;
  652. self._assert_($5);
  653. $ctx1.sendIdx["assert:"]=1;
  654. $6=false.__eq_eq(true);
  655. $ctx1.sendIdx["=="]=6;
  656. self._deny_($6);
  657. $ctx1.sendIdx["deny:"]=5;
  658. $7=true.__eq_eq(false);
  659. $ctx1.sendIdx["=="]=7;
  660. self._deny_($7);
  661. $8=false.__eq_eq(false);
  662. $ctx1.sendIdx["=="]=8;
  663. self._assert_($8);
  664. $ctx1.sendIdx["assert:"]=2;
  665. $10=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. $9=_st($10).__eq_eq(true);
  668. $ctx1.sendIdx["=="]=9;
  669. self._assert_($9);
  670. $ctx1.sendIdx["assert:"]=3;
  671. $12=true._yourself();
  672. $ctx1.sendIdx["yourself"]=2;
  673. $11=_st($12).__eq_eq(true._yourself());
  674. self._assert_($11);
  675. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  676. args: [],
  677. 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",
  678. messageSends: ["deny:", "==", "assert:", "yourself"],
  679. referencedClasses: []
  680. }),
  681. globals.BooleanTest);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "testIfTrueIfFalse",
  685. protocol: 'tests',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1,$2,$3,$4,$5,$6,$7,$8;
  690. if(smalltalk.assert(true)){
  691. $1="alternative block";
  692. };
  693. self._assert_equals_($1,"alternative block");
  694. $ctx1.sendIdx["assert:equals:"]=1;
  695. if(! smalltalk.assert(true)){
  696. $2="alternative block";
  697. };
  698. self._assert_equals_($2,nil);
  699. $ctx1.sendIdx["assert:equals:"]=2;
  700. if(smalltalk.assert(false)){
  701. $3="alternative block";
  702. };
  703. self._assert_equals_($3,nil);
  704. $ctx1.sendIdx["assert:equals:"]=3;
  705. if(! smalltalk.assert(false)){
  706. $4="alternative block";
  707. };
  708. self._assert_equals_($4,"alternative block");
  709. $ctx1.sendIdx["assert:equals:"]=4;
  710. if(smalltalk.assert(false)){
  711. $5="alternative block";
  712. } else {
  713. $5="alternative block2";
  714. };
  715. self._assert_equals_($5,"alternative block2");
  716. $ctx1.sendIdx["assert:equals:"]=5;
  717. if(smalltalk.assert(false)){
  718. $6="alternative block2";
  719. } else {
  720. $6="alternative block";
  721. };
  722. self._assert_equals_($6,"alternative block");
  723. $ctx1.sendIdx["assert:equals:"]=6;
  724. if(smalltalk.assert(true)){
  725. $7="alternative block";
  726. } else {
  727. $7="alternative block2";
  728. };
  729. self._assert_equals_($7,"alternative block");
  730. $ctx1.sendIdx["assert:equals:"]=7;
  731. if(smalltalk.assert(true)){
  732. $8="alternative block2";
  733. } else {
  734. $8="alternative block";
  735. };
  736. self._assert_equals_($8,"alternative block2");
  737. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  738. args: [],
  739. 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'.",
  740. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  741. referencedClasses: []
  742. }),
  743. globals.BooleanTest);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "testIfTrueIfFalseWithBoxing",
  747. protocol: 'tests',
  748. fn: function (){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) {
  751. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  752. $2=true._yourself();
  753. $ctx1.sendIdx["yourself"]=1;
  754. if(smalltalk.assert($2)){
  755. $1="alternative block";
  756. };
  757. self._assert_equals_($1,"alternative block");
  758. $ctx1.sendIdx["assert:equals:"]=1;
  759. $4=true._yourself();
  760. $ctx1.sendIdx["yourself"]=2;
  761. if(! smalltalk.assert($4)){
  762. $3="alternative block";
  763. };
  764. self._assert_equals_($3,nil);
  765. $ctx1.sendIdx["assert:equals:"]=2;
  766. $6=false._yourself();
  767. $ctx1.sendIdx["yourself"]=3;
  768. if(smalltalk.assert($6)){
  769. $5="alternative block";
  770. };
  771. self._assert_equals_($5,nil);
  772. $ctx1.sendIdx["assert:equals:"]=3;
  773. $8=false._yourself();
  774. $ctx1.sendIdx["yourself"]=4;
  775. if(! smalltalk.assert($8)){
  776. $7="alternative block";
  777. };
  778. self._assert_equals_($7,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=4;
  780. $10=false._yourself();
  781. $ctx1.sendIdx["yourself"]=5;
  782. if(smalltalk.assert($10)){
  783. $9="alternative block";
  784. } else {
  785. $9="alternative block2";
  786. };
  787. self._assert_equals_($9,"alternative block2");
  788. $ctx1.sendIdx["assert:equals:"]=5;
  789. $12=false._yourself();
  790. $ctx1.sendIdx["yourself"]=6;
  791. if(smalltalk.assert($12)){
  792. $11="alternative block2";
  793. } else {
  794. $11="alternative block";
  795. };
  796. self._assert_equals_($11,"alternative block");
  797. $ctx1.sendIdx["assert:equals:"]=6;
  798. $14=true._yourself();
  799. $ctx1.sendIdx["yourself"]=7;
  800. if(smalltalk.assert($14)){
  801. $13="alternative block";
  802. } else {
  803. $13="alternative block2";
  804. };
  805. self._assert_equals_($13,"alternative block");
  806. $ctx1.sendIdx["assert:equals:"]=7;
  807. $16=true._yourself();
  808. if(smalltalk.assert($16)){
  809. $15="alternative block2";
  810. } else {
  811. $15="alternative block";
  812. };
  813. self._assert_equals_($15,"alternative block2");
  814. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  815. args: [],
  816. 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'.",
  817. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  818. referencedClasses: []
  819. }),
  820. globals.BooleanTest);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "testLogic",
  824. protocol: 'tests',
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. 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;
  829. $1=true.__and(true);
  830. $ctx1.sendIdx["&"]=1;
  831. self._assert_($1);
  832. $ctx1.sendIdx["assert:"]=1;
  833. $2=true.__and(false);
  834. $ctx1.sendIdx["&"]=2;
  835. self._deny_($2);
  836. $ctx1.sendIdx["deny:"]=1;
  837. $3=false.__and(true);
  838. $ctx1.sendIdx["&"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false.__and(false);
  842. $ctx1.sendIdx["&"]=4;
  843. $4=self._deny_($5);
  844. $ctx1.sendIdx["deny:"]=3;
  845. $6=true.__or(true);
  846. $ctx1.sendIdx["|"]=1;
  847. self._assert_($6);
  848. $ctx1.sendIdx["assert:"]=2;
  849. $7=true.__or(false);
  850. $ctx1.sendIdx["|"]=2;
  851. self._assert_($7);
  852. $ctx1.sendIdx["assert:"]=3;
  853. $8=false.__or(true);
  854. $ctx1.sendIdx["|"]=3;
  855. self._assert_($8);
  856. $ctx1.sendIdx["assert:"]=4;
  857. $10=false.__or(false);
  858. $ctx1.sendIdx["|"]=4;
  859. $9=self._deny_($10);
  860. $ctx1.sendIdx["deny:"]=4;
  861. $12=(1).__gt((0));
  862. $ctx1.sendIdx[">"]=1;
  863. $11=true.__and($12);
  864. $ctx1.sendIdx["&"]=5;
  865. self._assert_($11);
  866. $ctx1.sendIdx["assert:"]=5;
  867. $14=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=2;
  869. $13=_st($14).__and(false);
  870. $ctx1.sendIdx["&"]=6;
  871. self._deny_($13);
  872. $ctx1.sendIdx["deny:"]=5;
  873. $17=(1).__gt((0));
  874. $ctx1.sendIdx[">"]=3;
  875. $18=(1).__gt((2));
  876. $ctx1.sendIdx[">"]=4;
  877. $16=_st($17).__and($18);
  878. $15=self._deny_($16);
  879. $20=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=5;
  881. $19=false.__or($20);
  882. $ctx1.sendIdx["|"]=5;
  883. self._assert_($19);
  884. $ctx1.sendIdx["assert:"]=6;
  885. $22=(1).__gt((0));
  886. $ctx1.sendIdx[">"]=6;
  887. $21=_st($22).__or(false);
  888. $ctx1.sendIdx["|"]=6;
  889. self._assert_($21);
  890. $ctx1.sendIdx["assert:"]=7;
  891. $25=(1).__gt((0));
  892. $ctx1.sendIdx[">"]=7;
  893. $24=_st($25).__or((1).__gt((2)));
  894. $23=self._assert_($24);
  895. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  896. args: [],
  897. 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))",
  898. messageSends: ["assert:", "&", "deny:", "|", ">"],
  899. referencedClasses: []
  900. }),
  901. globals.BooleanTest);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "testLogicKeywords",
  905. protocol: 'tests',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  910. $1=true._and_((function(){
  911. return true;
  912. }));
  913. $ctx1.sendIdx["and:"]=1;
  914. self._assert_($1);
  915. $ctx1.sendIdx["assert:"]=1;
  916. $2=true._and_((function(){
  917. return false;
  918. }));
  919. $ctx1.sendIdx["and:"]=2;
  920. self._deny_($2);
  921. $ctx1.sendIdx["deny:"]=1;
  922. $3=false._and_((function(){
  923. return true;
  924. }));
  925. $ctx1.sendIdx["and:"]=3;
  926. self._deny_($3);
  927. $ctx1.sendIdx["deny:"]=2;
  928. $5=false._and_((function(){
  929. return false;
  930. }));
  931. $ctx1.sendIdx["and:"]=4;
  932. $4=self._deny_($5);
  933. $ctx1.sendIdx["deny:"]=3;
  934. $6=true._or_((function(){
  935. return true;
  936. }));
  937. $ctx1.sendIdx["or:"]=1;
  938. self._assert_($6);
  939. $ctx1.sendIdx["assert:"]=2;
  940. $7=true._or_((function(){
  941. return false;
  942. }));
  943. $ctx1.sendIdx["or:"]=2;
  944. self._assert_($7);
  945. $ctx1.sendIdx["assert:"]=3;
  946. $8=false._or_((function(){
  947. return true;
  948. }));
  949. $ctx1.sendIdx["or:"]=3;
  950. self._assert_($8);
  951. $ctx1.sendIdx["assert:"]=4;
  952. $10=false._or_((function(){
  953. return false;
  954. }));
  955. $ctx1.sendIdx["or:"]=4;
  956. $9=self._deny_($10);
  957. $ctx1.sendIdx["deny:"]=4;
  958. $11=true._and_((function(){
  959. return smalltalk.withContext(function($ctx2) {
  960. return (1).__gt((0));
  961. $ctx2.sendIdx[">"]=1;
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  963. $ctx1.sendIdx["and:"]=5;
  964. self._assert_($11);
  965. $ctx1.sendIdx["assert:"]=5;
  966. $13=(1).__gt((0));
  967. $ctx1.sendIdx[">"]=2;
  968. $12=_st($13)._and_((function(){
  969. return false;
  970. }));
  971. $ctx1.sendIdx["and:"]=6;
  972. self._deny_($12);
  973. $ctx1.sendIdx["deny:"]=5;
  974. $16=(1).__gt((0));
  975. $ctx1.sendIdx[">"]=3;
  976. $15=_st($16)._and_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. return (1).__gt((2));
  979. $ctx2.sendIdx[">"]=4;
  980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  981. $14=self._deny_($15);
  982. $17=false._or_((function(){
  983. return smalltalk.withContext(function($ctx2) {
  984. return (1).__gt((0));
  985. $ctx2.sendIdx[">"]=5;
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  987. $ctx1.sendIdx["or:"]=5;
  988. self._assert_($17);
  989. $ctx1.sendIdx["assert:"]=6;
  990. $19=(1).__gt((0));
  991. $ctx1.sendIdx[">"]=6;
  992. $18=_st($19)._or_((function(){
  993. return false;
  994. }));
  995. $ctx1.sendIdx["or:"]=6;
  996. self._assert_($18);
  997. $ctx1.sendIdx["assert:"]=7;
  998. $22=(1).__gt((0));
  999. $ctx1.sendIdx[">"]=7;
  1000. $21=_st($22)._or_((function(){
  1001. return smalltalk.withContext(function($ctx2) {
  1002. return (1).__gt((2));
  1003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  1004. $20=self._assert_($21);
  1005. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  1006. args: [],
  1007. 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 ])",
  1008. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  1009. referencedClasses: []
  1010. }),
  1011. globals.BooleanTest);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "testNonBooleanError",
  1015. protocol: 'tests',
  1016. fn: function (){
  1017. var self=this;
  1018. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1019. return smalltalk.withContext(function($ctx1) {
  1020. self._should_raise_((function(){
  1021. return smalltalk.withContext(function($ctx2) {
  1022. if(smalltalk.assert("")){
  1023. } else {
  1024. };
  1025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1026. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1027. args: [],
  1028. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1029. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1030. referencedClasses: ["NonBooleanReceiver"]
  1031. }),
  1032. globals.BooleanTest);
  1033. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1034. smalltalk.addMethod(
  1035. smalltalk.method({
  1036. selector: "setUp",
  1037. protocol: 'running',
  1038. fn: function (){
  1039. var self=this;
  1040. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1041. return smalltalk.withContext(function($ctx1) {
  1042. self["@builder"]=_st($ClassBuilder())._new();
  1043. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1044. args: [],
  1045. source: "setUp\x0a\x09builder := ClassBuilder new",
  1046. messageSends: ["new"],
  1047. referencedClasses: ["ClassBuilder"]
  1048. }),
  1049. globals.ClassBuilderTest);
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "tearDown",
  1053. protocol: 'running',
  1054. fn: function (){
  1055. var self=this;
  1056. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1,$receiver;
  1059. $1=self["@theClass"];
  1060. if(($receiver = $1) == null || $receiver.isNil){
  1061. $1;
  1062. } else {
  1063. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1064. self["@theClass"]=nil;
  1065. self["@theClass"];
  1066. };
  1067. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1068. args: [],
  1069. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1070. messageSends: ["ifNotNil:", "removeClass:"],
  1071. referencedClasses: ["Smalltalk"]
  1072. }),
  1073. globals.ClassBuilderTest);
  1074. smalltalk.addMethod(
  1075. smalltalk.method({
  1076. selector: "testClassCopy",
  1077. protocol: 'tests',
  1078. fn: function (){
  1079. var self=this;
  1080. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1081. return smalltalk.withContext(function($ctx1) {
  1082. var $2,$1,$4,$3,$6,$5,$8,$7;
  1083. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1084. $2=_st(self["@theClass"])._superclass();
  1085. $ctx1.sendIdx["superclass"]=1;
  1086. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1087. $ctx1.sendIdx["=="]=1;
  1088. self._assert_($1);
  1089. $ctx1.sendIdx["assert:"]=1;
  1090. $4=_st(self["@theClass"])._instanceVariableNames();
  1091. $ctx1.sendIdx["instanceVariableNames"]=1;
  1092. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1093. $ctx1.sendIdx["=="]=2;
  1094. self._assert_($3);
  1095. $ctx1.sendIdx["assert:"]=2;
  1096. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1097. $ctx1.sendIdx["assert:equals:"]=1;
  1098. $6=_st(self["@theClass"])._package();
  1099. $ctx1.sendIdx["package"]=1;
  1100. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1101. self._assert_($5);
  1102. $8=_st(self["@theClass"])._methodDictionary();
  1103. $ctx1.sendIdx["methodDictionary"]=1;
  1104. $7=_st($8)._keys();
  1105. $ctx1.sendIdx["keys"]=1;
  1106. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1107. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1108. args: [],
  1109. 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",
  1110. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1111. referencedClasses: ["ObjectMock"]
  1112. }),
  1113. globals.ClassBuilderTest);
  1114. smalltalk.addMethod(
  1115. smalltalk.method({
  1116. selector: "testClassMigration",
  1117. protocol: 'tests',
  1118. fn: function (){
  1119. var self=this;
  1120. var instance,oldClass;
  1121. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1122. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1123. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1126. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1127. $2=_st($Smalltalk())._globals();
  1128. $ctx1.sendIdx["globals"]=1;
  1129. $1=_st($2)._at_("ObjectMock2");
  1130. $ctx1.sendIdx["at:"]=1;
  1131. instance=_st($1)._new();
  1132. $4=_st($Smalltalk())._globals();
  1133. $ctx1.sendIdx["globals"]=2;
  1134. $3=_st($4)._at_("ObjectMock2");
  1135. $ctx1.sendIdx["at:"]=2;
  1136. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1137. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1138. $ctx1.sendIdx["=="]=1;
  1139. self._deny_($5);
  1140. $ctx1.sendIdx["deny:"]=1;
  1141. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1142. $ctx1.sendIdx["=="]=2;
  1143. self._assert_($6);
  1144. $ctx1.sendIdx["assert:"]=1;
  1145. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1146. $ctx1.sendIdx["assert:"]=2;
  1147. $7=_st($ObjectMock2())._selectors();
  1148. $ctx1.sendIdx["selectors"]=1;
  1149. self._assert_equals_($7,_st(oldClass)._selectors());
  1150. $ctx1.sendIdx["assert:equals:"]=1;
  1151. $8=_st($ObjectMock2())._comment();
  1152. $ctx1.sendIdx["comment"]=1;
  1153. self._assert_equals_($8,_st(oldClass)._comment());
  1154. $ctx1.sendIdx["assert:equals:"]=2;
  1155. $9=_st(_st($ObjectMock2())._package())._name();
  1156. $ctx1.sendIdx["name"]=1;
  1157. self._assert_equals_($9,"Kernel-Tests");
  1158. $11=_st(instance)._class();
  1159. $ctx1.sendIdx["class"]=1;
  1160. $10=_st($11).__eq_eq($ObjectMock2());
  1161. self._deny_($10);
  1162. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1163. _st($Smalltalk())._removeClass_($ObjectMock2());
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1165. args: [],
  1166. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1167. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1169. }),
  1170. globals.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testClassMigrationWithClassInstanceVariables",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1178. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1183. $1=_st($ObjectMock2())._class();
  1184. $ctx1.sendIdx["class"]=1;
  1185. _st($1)._instanceVariableNames_("foo bar");
  1186. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1187. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1188. _st($Smalltalk())._removeClass_($ObjectMock2());
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1192. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1193. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1194. }),
  1195. globals.ClassBuilderTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "testClassMigrationWithSubclasses",
  1199. protocol: 'tests',
  1200. fn: function (){
  1201. var self=this;
  1202. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1203. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1204. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1205. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1206. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $2,$1,$4,$3;
  1209. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1210. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1211. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1212. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1213. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1214. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1215. $2=_st($ObjectMock())._subclasses();
  1216. $ctx1.sendIdx["subclasses"]=1;
  1217. $1=_st($2)._includes_($ObjectMock2());
  1218. $ctx1.sendIdx["includes:"]=1;
  1219. self._assert_($1);
  1220. $ctx1.sendIdx["assert:"]=1;
  1221. $4=_st($ObjectMock2())._subclasses();
  1222. $ctx1.sendIdx["subclasses"]=2;
  1223. $3=_st($4)._includes_($ObjectMock3());
  1224. $ctx1.sendIdx["includes:"]=2;
  1225. self._assert_($3);
  1226. $ctx1.sendIdx["assert:"]=2;
  1227. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1228. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st($Smalltalk())._removeClass_(each);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1233. args: [],
  1234. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  1235. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1236. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1237. }),
  1238. globals.ClassBuilderTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "testInstanceVariableNames",
  1242. protocol: 'tests',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1248. args: [],
  1249. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1250. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.ClassBuilderTest);
  1254. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "assertSameContents:as:",
  1258. protocol: 'convenience',
  1259. fn: function (aCollection,anotherCollection){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $2,$1,$4,$3;
  1263. $2=_st(aCollection)._size();
  1264. $ctx1.sendIdx["size"]=1;
  1265. $1=_st($2).__eq(_st(anotherCollection)._size());
  1266. $ctx1.sendIdx["="]=1;
  1267. self._assert_($1);
  1268. $ctx1.sendIdx["assert:"]=1;
  1269. _st(aCollection)._do_((function(each){
  1270. return smalltalk.withContext(function($ctx2) {
  1271. $4=_st(aCollection)._occurrencesOf_(each);
  1272. $ctx2.sendIdx["occurrencesOf:"]=1;
  1273. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1274. return self._assert_($3);
  1275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1276. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1277. args: ["aCollection", "anotherCollection"],
  1278. 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)) ]",
  1279. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1280. referencedClasses: []
  1281. }),
  1282. globals.CollectionTest);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "collection",
  1286. protocol: 'fixture',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. self._subclassResponsibility();
  1291. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1292. args: [],
  1293. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1294. messageSends: ["subclassResponsibility"],
  1295. referencedClasses: []
  1296. }),
  1297. globals.CollectionTest);
  1298. smalltalk.addMethod(
  1299. smalltalk.method({
  1300. selector: "collectionClass",
  1301. protocol: 'fixture',
  1302. fn: function (){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. var $1;
  1306. $1=_st(self._class())._collectionClass();
  1307. return $1;
  1308. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1309. args: [],
  1310. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1311. messageSends: ["collectionClass", "class"],
  1312. referencedClasses: []
  1313. }),
  1314. globals.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "collectionOfPrintStrings",
  1318. protocol: 'fixture',
  1319. fn: function (){
  1320. var self=this;
  1321. return smalltalk.withContext(function($ctx1) {
  1322. self._subclassResponsibility();
  1323. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1324. args: [],
  1325. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1326. messageSends: ["subclassResponsibility"],
  1327. referencedClasses: []
  1328. }),
  1329. globals.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "collectionSize",
  1333. protocol: 'fixture',
  1334. fn: function (){
  1335. var self=this;
  1336. return smalltalk.withContext(function($ctx1) {
  1337. self._subclassResponsibility();
  1338. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1339. args: [],
  1340. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1341. messageSends: ["subclassResponsibility"],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "collectionWithDuplicates",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. self._subclassResponsibility();
  1353. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1354. args: [],
  1355. 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",
  1356. messageSends: ["subclassResponsibility"],
  1357. referencedClasses: []
  1358. }),
  1359. globals.CollectionTest);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "collectionWithNewValue",
  1363. protocol: 'fixture',
  1364. fn: function (){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. self._subclassResponsibility();
  1368. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1369. args: [],
  1370. 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",
  1371. messageSends: ["subclassResponsibility"],
  1372. referencedClasses: []
  1373. }),
  1374. globals.CollectionTest);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "isCollectionReadOnly",
  1378. protocol: 'testing',
  1379. fn: function (){
  1380. var self=this;
  1381. return false;
  1382. },
  1383. args: [],
  1384. source: "isCollectionReadOnly\x0a\x09^ false",
  1385. messageSends: [],
  1386. referencedClasses: []
  1387. }),
  1388. globals.CollectionTest);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "sampleNewValue",
  1392. protocol: 'fixture',
  1393. fn: function (){
  1394. var self=this;
  1395. return "N";
  1396. },
  1397. args: [],
  1398. 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'",
  1399. messageSends: [],
  1400. referencedClasses: []
  1401. }),
  1402. globals.CollectionTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "sampleNewValueAsCollection",
  1406. protocol: 'fixture',
  1407. fn: function (){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1414. args: [],
  1415. 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",
  1416. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1417. referencedClasses: []
  1418. }),
  1419. globals.CollectionTest);
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "testAddAll",
  1423. protocol: 'tests',
  1424. fn: function (){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. 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;
  1428. $2=self._collection();
  1429. $ctx1.sendIdx["collection"]=1;
  1430. $3=$2;
  1431. $5=self._collectionClass();
  1432. $ctx1.sendIdx["collectionClass"]=1;
  1433. $4=_st($5)._new();
  1434. $ctx1.sendIdx["new"]=1;
  1435. _st($3)._addAll_($4);
  1436. $ctx1.sendIdx["addAll:"]=1;
  1437. $6=_st($2)._yourself();
  1438. $ctx1.sendIdx["yourself"]=1;
  1439. $1=$6;
  1440. $7=self._collection();
  1441. $ctx1.sendIdx["collection"]=2;
  1442. self._assert_equals_($1,$7);
  1443. $ctx1.sendIdx["assert:equals:"]=1;
  1444. $10=self._collectionClass();
  1445. $ctx1.sendIdx["collectionClass"]=2;
  1446. $9=_st($10)._new();
  1447. $ctx1.sendIdx["new"]=2;
  1448. $11=$9;
  1449. $12=self._collection();
  1450. $ctx1.sendIdx["collection"]=3;
  1451. _st($11)._addAll_($12);
  1452. $ctx1.sendIdx["addAll:"]=2;
  1453. $13=_st($9)._yourself();
  1454. $ctx1.sendIdx["yourself"]=2;
  1455. $8=$13;
  1456. $14=self._collection();
  1457. $ctx1.sendIdx["collection"]=4;
  1458. self._assert_equals_($8,$14);
  1459. $ctx1.sendIdx["assert:equals:"]=2;
  1460. $17=self._collectionClass();
  1461. $ctx1.sendIdx["collectionClass"]=3;
  1462. $16=_st($17)._new();
  1463. $ctx1.sendIdx["new"]=3;
  1464. $18=$16;
  1465. $20=self._collectionClass();
  1466. $ctx1.sendIdx["collectionClass"]=4;
  1467. $19=_st($20)._new();
  1468. $ctx1.sendIdx["new"]=4;
  1469. _st($18)._addAll_($19);
  1470. $ctx1.sendIdx["addAll:"]=3;
  1471. $21=_st($16)._yourself();
  1472. $ctx1.sendIdx["yourself"]=3;
  1473. $15=$21;
  1474. self._assert_equals_($15,_st(self._collectionClass())._new());
  1475. $ctx1.sendIdx["assert:equals:"]=3;
  1476. $23=self._collection();
  1477. $ctx1.sendIdx["collection"]=5;
  1478. $24=$23;
  1479. $25=self._sampleNewValueAsCollection();
  1480. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1481. _st($24)._addAll_($25);
  1482. $ctx1.sendIdx["addAll:"]=4;
  1483. $26=_st($23)._yourself();
  1484. $ctx1.sendIdx["yourself"]=4;
  1485. $22=$26;
  1486. $27=self._collectionWithNewValue();
  1487. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1488. self._assert_equals_($22,$27);
  1489. $28=self._sampleNewValueAsCollection();
  1490. _st($28)._addAll_(self._collection());
  1491. $29=_st($28)._yourself();
  1492. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1493. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1494. args: [],
  1495. 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",
  1496. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1497. referencedClasses: []
  1498. }),
  1499. globals.CollectionTest);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "testAllSatisfy",
  1503. protocol: 'tests',
  1504. fn: function (){
  1505. var self=this;
  1506. var collection,anyOne;
  1507. return smalltalk.withContext(function($ctx1) {
  1508. var $1;
  1509. collection=self._collection();
  1510. anyOne=_st(collection)._anyOne();
  1511. $1=_st(collection)._allSatisfy_((function(each){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return _st(collection)._includes_(each);
  1514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1515. $ctx1.sendIdx["allSatisfy:"]=1;
  1516. self._assert_($1);
  1517. self._deny_(_st(collection)._allSatisfy_((function(each){
  1518. return smalltalk.withContext(function($ctx2) {
  1519. return _st(each).__tild_eq(anyOne);
  1520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1522. args: [],
  1523. 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 ])",
  1524. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1525. referencedClasses: []
  1526. }),
  1527. globals.CollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAnyOne",
  1531. protocol: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1535. return smalltalk.withContext(function($ctx1) {
  1536. var $2,$1;
  1537. self._should_raise_((function(){
  1538. return smalltalk.withContext(function($ctx2) {
  1539. return _st(_st(self._collectionClass())._new())._anyOne();
  1540. $ctx2.sendIdx["anyOne"]=1;
  1541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1542. $2=self._collection();
  1543. $ctx1.sendIdx["collection"]=1;
  1544. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1545. self._assert_($1);
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1547. args: [],
  1548. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1549. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1550. referencedClasses: ["Error"]
  1551. }),
  1552. globals.CollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testAnySatisfy",
  1556. protocol: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var anyOne;
  1560. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1,$3,$2;
  1563. $1=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. anyOne=_st($1)._anyOne();
  1566. $3=self._collection();
  1567. $ctx1.sendIdx["collection"]=2;
  1568. $2=_st($3)._anySatisfy_((function(each){
  1569. return smalltalk.withContext(function($ctx2) {
  1570. return _st(each).__eq(anyOne);
  1571. $ctx2.sendIdx["="]=1;
  1572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1573. $ctx1.sendIdx["anySatisfy:"]=1;
  1574. self._assert_($2);
  1575. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. return _st(each).__eq(_st($Object())._new());
  1578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1579. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1580. args: [],
  1581. 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 ])",
  1582. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1583. referencedClasses: ["Object"]
  1584. }),
  1585. globals.CollectionTest);
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "testAsArray",
  1589. protocol: 'tests',
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1598. args: [],
  1599. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1600. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.CollectionTest);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "testAsOrderedCollection",
  1607. protocol: 'tests',
  1608. fn: function (){
  1609. var self=this;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. $1=self._collection();
  1613. $ctx1.sendIdx["collection"]=1;
  1614. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1615. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1616. args: [],
  1617. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1618. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1619. referencedClasses: []
  1620. }),
  1621. globals.CollectionTest);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "testAsSet",
  1625. protocol: 'tests',
  1626. fn: function (){
  1627. var self=this;
  1628. var c,set;
  1629. return smalltalk.withContext(function($ctx1) {
  1630. c=self._collectionWithDuplicates();
  1631. set=_st(c)._asSet();
  1632. self._assert_equals_(_st(set)._size(),(5));
  1633. _st(c)._do_((function(each){
  1634. return smalltalk.withContext(function($ctx2) {
  1635. return self._assert_(_st(set)._includes_(each));
  1636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1637. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1638. args: [],
  1639. 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) ]",
  1640. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1641. referencedClasses: []
  1642. }),
  1643. globals.CollectionTest);
  1644. smalltalk.addMethod(
  1645. smalltalk.method({
  1646. selector: "testCollect",
  1647. protocol: 'tests',
  1648. fn: function (){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) {
  1651. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1652. $2=self._collection();
  1653. $ctx1.sendIdx["collection"]=1;
  1654. $1=_st($2)._collect_((function(each){
  1655. return each;
  1656. }));
  1657. $ctx1.sendIdx["collect:"]=1;
  1658. $3=self._collection();
  1659. $ctx1.sendIdx["collection"]=2;
  1660. self._assert_equals_($1,$3);
  1661. $ctx1.sendIdx["assert:equals:"]=1;
  1662. $5=self._collectionWithNewValue();
  1663. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1664. $4=_st($5)._collect_((function(each){
  1665. return each;
  1666. }));
  1667. $ctx1.sendIdx["collect:"]=2;
  1668. self._assert_equals_($4,self._collectionWithNewValue());
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $8=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=1;
  1672. $7=_st($8)._new();
  1673. $ctx1.sendIdx["new"]=1;
  1674. $6=_st($7)._collect_((function(each){
  1675. return smalltalk.withContext(function($ctx2) {
  1676. return _st(each)._printString();
  1677. $ctx2.sendIdx["printString"]=1;
  1678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1679. $ctx1.sendIdx["collect:"]=3;
  1680. self._assert_equals_($6,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $11=self._collection();
  1683. $ctx1.sendIdx["collection"]=3;
  1684. $10=_st($11)._collect_((function(){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. return self._sampleNewValue();
  1687. $ctx2.sendIdx["sampleNewValue"]=1;
  1688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1689. $ctx1.sendIdx["collect:"]=4;
  1690. $9=_st($10)._detect_((function(){
  1691. return true;
  1692. }));
  1693. self._assert_equals_($9,self._sampleNewValue());
  1694. $ctx1.sendIdx["assert:equals:"]=4;
  1695. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1696. return smalltalk.withContext(function($ctx2) {
  1697. return _st(each)._printString();
  1698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1699. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1700. args: [],
  1701. 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",
  1702. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.CollectionTest);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "testComma",
  1709. protocol: 'tests',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1714. $2=self._collection();
  1715. $ctx1.sendIdx["collection"]=1;
  1716. $4=self._collectionClass();
  1717. $ctx1.sendIdx["collectionClass"]=1;
  1718. $3=_st($4)._new();
  1719. $ctx1.sendIdx["new"]=1;
  1720. $1=_st($2).__comma($3);
  1721. $ctx1.sendIdx[","]=1;
  1722. $5=self._collection();
  1723. $ctx1.sendIdx["collection"]=2;
  1724. self._assert_equals_($1,$5);
  1725. $ctx1.sendIdx["assert:equals:"]=1;
  1726. $8=self._collectionClass();
  1727. $ctx1.sendIdx["collectionClass"]=2;
  1728. $7=_st($8)._new();
  1729. $ctx1.sendIdx["new"]=2;
  1730. $9=self._collection();
  1731. $ctx1.sendIdx["collection"]=3;
  1732. $6=_st($7).__comma($9);
  1733. $ctx1.sendIdx[","]=2;
  1734. $10=self._collection();
  1735. $ctx1.sendIdx["collection"]=4;
  1736. self._assert_equals_($6,$10);
  1737. $ctx1.sendIdx["assert:equals:"]=2;
  1738. $13=self._collectionClass();
  1739. $ctx1.sendIdx["collectionClass"]=3;
  1740. $12=_st($13)._new();
  1741. $ctx1.sendIdx["new"]=3;
  1742. $15=self._collectionClass();
  1743. $ctx1.sendIdx["collectionClass"]=4;
  1744. $14=_st($15)._new();
  1745. $ctx1.sendIdx["new"]=4;
  1746. $11=_st($12).__comma($14);
  1747. $ctx1.sendIdx[","]=3;
  1748. self._assert_equals_($11,_st(self._collectionClass())._new());
  1749. $ctx1.sendIdx["assert:equals:"]=3;
  1750. $17=self._collection();
  1751. $ctx1.sendIdx["collection"]=5;
  1752. $18=self._sampleNewValueAsCollection();
  1753. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1754. $16=_st($17).__comma($18);
  1755. $ctx1.sendIdx[","]=4;
  1756. $19=self._collectionWithNewValue();
  1757. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1758. self._assert_equals_($16,$19);
  1759. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1761. args: [],
  1762. 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",
  1763. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1764. referencedClasses: []
  1765. }),
  1766. globals.CollectionTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testDetect",
  1770. protocol: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $1,$2,$3,$4,$6,$5,$7;
  1776. self._shouldnt_raise_((function(){
  1777. return smalltalk.withContext(function($ctx2) {
  1778. $1=self._collection();
  1779. $ctx2.sendIdx["collection"]=1;
  1780. return _st($1)._detect_((function(){
  1781. return true;
  1782. }));
  1783. $ctx2.sendIdx["detect:"]=1;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1785. self._should_raise_((function(){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. $2=self._collection();
  1788. $ctx2.sendIdx["collection"]=2;
  1789. return _st($2)._detect_((function(){
  1790. return false;
  1791. }));
  1792. $ctx2.sendIdx["detect:"]=2;
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1794. $ctx1.sendIdx["should:raise:"]=1;
  1795. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1796. return true;
  1797. }));
  1798. $ctx1.sendIdx["detect:"]=3;
  1799. $4=self._sampleNewValue();
  1800. $ctx1.sendIdx["sampleNewValue"]=1;
  1801. self._assert_equals_($3,$4);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. $6=self._sampleNewValue();
  1806. $ctx2.sendIdx["sampleNewValue"]=2;
  1807. return _st(each).__eq($6);
  1808. $ctx2.sendIdx["="]=1;
  1809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:"]=4;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=3;
  1813. self._assert_equals_($5,$7);
  1814. self._should_raise_((function(){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. return _st(self._collection())._detect_((function(each){
  1817. return smalltalk.withContext(function($ctx3) {
  1818. return _st(each).__eq(self._sampleNewValue());
  1819. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1821. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1822. args: [],
  1823. 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",
  1824. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1825. referencedClasses: ["Error"]
  1826. }),
  1827. globals.CollectionTest);
  1828. smalltalk.addMethod(
  1829. smalltalk.method({
  1830. selector: "testDetectIfNone",
  1831. protocol: 'tests',
  1832. fn: function (){
  1833. var self=this;
  1834. var sentinel;
  1835. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1836. return smalltalk.withContext(function($ctx1) {
  1837. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1838. sentinel=_st($Object())._new();
  1839. $3=self._collection();
  1840. $ctx1.sendIdx["collection"]=1;
  1841. $2=_st($3)._detect_ifNone_((function(){
  1842. return true;
  1843. }),(function(){
  1844. return sentinel;
  1845. }));
  1846. $ctx1.sendIdx["detect:ifNone:"]=1;
  1847. $1=_st($2).__tild_eq(sentinel);
  1848. self._assert_($1);
  1849. $5=self._collection();
  1850. $ctx1.sendIdx["collection"]=2;
  1851. $4=_st($5)._detect_ifNone_((function(){
  1852. return false;
  1853. }),(function(){
  1854. return sentinel;
  1855. }));
  1856. $ctx1.sendIdx["detect:ifNone:"]=2;
  1857. self._assert_equals_($4,sentinel);
  1858. $ctx1.sendIdx["assert:equals:"]=1;
  1859. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1860. return true;
  1861. }),(function(){
  1862. return sentinel;
  1863. }));
  1864. $ctx1.sendIdx["detect:ifNone:"]=3;
  1865. $7=self._sampleNewValue();
  1866. $ctx1.sendIdx["sampleNewValue"]=1;
  1867. self._assert_equals_($6,$7);
  1868. $ctx1.sendIdx["assert:equals:"]=2;
  1869. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. $9=self._sampleNewValue();
  1872. $ctx2.sendIdx["sampleNewValue"]=2;
  1873. return _st(each).__eq($9);
  1874. $ctx2.sendIdx["="]=1;
  1875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1876. return sentinel;
  1877. }));
  1878. $ctx1.sendIdx["detect:ifNone:"]=4;
  1879. $10=self._sampleNewValue();
  1880. $ctx1.sendIdx["sampleNewValue"]=3;
  1881. self._assert_equals_($8,$10);
  1882. $ctx1.sendIdx["assert:equals:"]=3;
  1883. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1884. return smalltalk.withContext(function($ctx2) {
  1885. return _st(each).__eq(self._sampleNewValue());
  1886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1887. return sentinel;
  1888. })),sentinel);
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1890. args: [],
  1891. 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",
  1892. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1893. referencedClasses: ["Object"]
  1894. }),
  1895. globals.CollectionTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testDo",
  1899. protocol: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. var newCollection;
  1903. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1904. return smalltalk.withContext(function($ctx1) {
  1905. var $1,$2;
  1906. newCollection=_st($OrderedCollection())._new();
  1907. $ctx1.sendIdx["new"]=1;
  1908. $1=self._collection();
  1909. $ctx1.sendIdx["collection"]=1;
  1910. _st($1)._do_((function(each){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return _st(newCollection)._add_(each);
  1913. $ctx2.sendIdx["add:"]=1;
  1914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1915. $ctx1.sendIdx["do:"]=1;
  1916. self._assertSameContents_as_(self._collection(),newCollection);
  1917. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1918. newCollection=_st($OrderedCollection())._new();
  1919. $2=self._collectionWithDuplicates();
  1920. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1921. _st($2)._do_((function(each){
  1922. return smalltalk.withContext(function($ctx2) {
  1923. return _st(newCollection)._add_(each);
  1924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1925. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1926. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1927. args: [],
  1928. 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",
  1929. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1930. referencedClasses: ["OrderedCollection"]
  1931. }),
  1932. globals.CollectionTest);
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "testIfEmptyFamily",
  1936. protocol: 'tests',
  1937. fn: function (){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  1941. $3=self._collectionClass();
  1942. $ctx1.sendIdx["collectionClass"]=1;
  1943. $2=_st($3)._new();
  1944. $ctx1.sendIdx["new"]=1;
  1945. $1=_st($2)._ifEmpty_((function(){
  1946. return (42);
  1947. }));
  1948. $ctx1.sendIdx["ifEmpty:"]=1;
  1949. self._assert_equals_($1,(42));
  1950. $ctx1.sendIdx["assert:equals:"]=1;
  1951. $5=self._collection();
  1952. $ctx1.sendIdx["collection"]=1;
  1953. $4=_st($5)._ifEmpty_((function(){
  1954. return (42);
  1955. }));
  1956. $6=self._collection();
  1957. $ctx1.sendIdx["collection"]=2;
  1958. self._assert_equals_($4,$6);
  1959. $ctx1.sendIdx["assert:equals:"]=2;
  1960. $9=self._collectionClass();
  1961. $ctx1.sendIdx["collectionClass"]=2;
  1962. $8=_st($9)._new();
  1963. $ctx1.sendIdx["new"]=2;
  1964. $7=_st($8)._ifNotEmpty_((function(){
  1965. return (42);
  1966. }));
  1967. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1968. $11=self._collectionClass();
  1969. $ctx1.sendIdx["collectionClass"]=3;
  1970. $10=_st($11)._new();
  1971. $ctx1.sendIdx["new"]=3;
  1972. self._assert_equals_($7,$10);
  1973. $ctx1.sendIdx["assert:equals:"]=3;
  1974. $13=self._collection();
  1975. $ctx1.sendIdx["collection"]=3;
  1976. $12=_st($13)._ifNotEmpty_((function(){
  1977. return (42);
  1978. }));
  1979. $ctx1.sendIdx["ifNotEmpty:"]=2;
  1980. self._assert_equals_($12,(42));
  1981. $ctx1.sendIdx["assert:equals:"]=4;
  1982. $15=self._collection();
  1983. $ctx1.sendIdx["collection"]=4;
  1984. $14=_st($15)._ifNotEmpty_((function(col){
  1985. return col;
  1986. }));
  1987. $16=self._collection();
  1988. $ctx1.sendIdx["collection"]=5;
  1989. self._assert_equals_($14,$16);
  1990. $ctx1.sendIdx["assert:equals:"]=5;
  1991. $19=self._collectionClass();
  1992. $ctx1.sendIdx["collectionClass"]=4;
  1993. $18=_st($19)._new();
  1994. $ctx1.sendIdx["new"]=4;
  1995. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1996. return (42);
  1997. }),(function(){
  1998. return (999);
  1999. }));
  2000. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  2001. self._assert_equals_($17,(42));
  2002. $ctx1.sendIdx["assert:equals:"]=6;
  2003. $21=self._collection();
  2004. $ctx1.sendIdx["collection"]=6;
  2005. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  2006. return (42);
  2007. }),(function(){
  2008. return (999);
  2009. }));
  2010. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  2011. self._assert_equals_($20,(999));
  2012. $ctx1.sendIdx["assert:equals:"]=7;
  2013. $23=self._collection();
  2014. $ctx1.sendIdx["collection"]=7;
  2015. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  2016. return (42);
  2017. }),(function(col){
  2018. return col;
  2019. }));
  2020. $24=self._collection();
  2021. $ctx1.sendIdx["collection"]=8;
  2022. self._assert_equals_($22,$24);
  2023. $ctx1.sendIdx["assert:equals:"]=8;
  2024. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  2025. return (42);
  2026. }),(function(){
  2027. return (999);
  2028. }));
  2029. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  2030. self._assert_equals_($25,(999));
  2031. $ctx1.sendIdx["assert:equals:"]=9;
  2032. $27=self._collection();
  2033. $ctx1.sendIdx["collection"]=9;
  2034. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  2035. return (42);
  2036. }),(function(){
  2037. return (999);
  2038. }));
  2039. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  2040. self._assert_equals_($26,(42));
  2041. $ctx1.sendIdx["assert:equals:"]=10;
  2042. $29=self._collection();
  2043. $ctx1.sendIdx["collection"]=10;
  2044. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  2045. return col;
  2046. }),(function(){
  2047. return (999);
  2048. }));
  2049. self._assert_equals_($28,self._collection());
  2050. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  2051. args: [],
  2052. 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\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\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\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  2053. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2054. referencedClasses: []
  2055. }),
  2056. globals.CollectionTest);
  2057. smalltalk.addMethod(
  2058. smalltalk.method({
  2059. selector: "testIsEmpty",
  2060. protocol: 'tests',
  2061. fn: function (){
  2062. var self=this;
  2063. return smalltalk.withContext(function($ctx1) {
  2064. var $1;
  2065. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2066. $ctx1.sendIdx["isEmpty"]=1;
  2067. self._assert_($1);
  2068. self._deny_(_st(self._collection())._isEmpty());
  2069. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2070. args: [],
  2071. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2072. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2073. referencedClasses: []
  2074. }),
  2075. globals.CollectionTest);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "testNoneSatisfy",
  2079. protocol: 'tests',
  2080. fn: function (){
  2081. var self=this;
  2082. var anyOne;
  2083. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2084. return smalltalk.withContext(function($ctx1) {
  2085. var $1,$3,$2;
  2086. $1=self._collection();
  2087. $ctx1.sendIdx["collection"]=1;
  2088. anyOne=_st($1)._anyOne();
  2089. $3=self._collection();
  2090. $ctx1.sendIdx["collection"]=2;
  2091. $2=_st($3)._noneSatisfy_((function(each){
  2092. return smalltalk.withContext(function($ctx2) {
  2093. return _st(each).__eq(anyOne);
  2094. $ctx2.sendIdx["="]=1;
  2095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2096. $ctx1.sendIdx["noneSatisfy:"]=1;
  2097. self._deny_($2);
  2098. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2099. return smalltalk.withContext(function($ctx2) {
  2100. return _st(each).__eq(_st($Object())._new());
  2101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2102. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2103. args: [],
  2104. 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 ])",
  2105. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2106. referencedClasses: ["Object"]
  2107. }),
  2108. globals.CollectionTest);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "testRemoveAll",
  2112. protocol: 'tests',
  2113. fn: function (){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. var $1,$2;
  2117. $1=self._collection();
  2118. _st($1)._removeAll();
  2119. $2=_st($1)._yourself();
  2120. self._assert_equals_($2,_st(self._collectionClass())._new());
  2121. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2122. args: [],
  2123. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2124. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2125. referencedClasses: []
  2126. }),
  2127. globals.CollectionTest);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "testSelect",
  2131. protocol: 'tests',
  2132. fn: function (){
  2133. var self=this;
  2134. return smalltalk.withContext(function($ctx1) {
  2135. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2136. $2=self._collection();
  2137. $ctx1.sendIdx["collection"]=1;
  2138. $1=_st($2)._select_((function(){
  2139. return false;
  2140. }));
  2141. $ctx1.sendIdx["select:"]=1;
  2142. $4=self._collectionClass();
  2143. $ctx1.sendIdx["collectionClass"]=1;
  2144. $3=_st($4)._new();
  2145. $ctx1.sendIdx["new"]=1;
  2146. self._assert_equals_($1,$3);
  2147. $ctx1.sendIdx["assert:equals:"]=1;
  2148. $6=self._collection();
  2149. $ctx1.sendIdx["collection"]=2;
  2150. $5=_st($6)._select_((function(){
  2151. return true;
  2152. }));
  2153. $ctx1.sendIdx["select:"]=2;
  2154. $7=self._collection();
  2155. $ctx1.sendIdx["collection"]=3;
  2156. self._assert_equals_($5,$7);
  2157. $ctx1.sendIdx["assert:equals:"]=2;
  2158. $9=self._collectionWithNewValue();
  2159. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2160. $8=_st($9)._select_((function(each){
  2161. return smalltalk.withContext(function($ctx2) {
  2162. $10=self._sampleNewValue();
  2163. $ctx2.sendIdx["sampleNewValue"]=1;
  2164. return _st(each).__eq($10);
  2165. $ctx2.sendIdx["="]=1;
  2166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2167. $ctx1.sendIdx["select:"]=3;
  2168. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2169. $ctx1.sendIdx["assert:equals:"]=3;
  2170. $12=self._collectionWithNewValue();
  2171. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2172. $11=_st($12)._select_((function(each){
  2173. return smalltalk.withContext(function($ctx2) {
  2174. $13=self._sampleNewValue();
  2175. $ctx2.sendIdx["sampleNewValue"]=2;
  2176. return _st(each).__tild_eq($13);
  2177. $ctx2.sendIdx["~="]=1;
  2178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2179. $ctx1.sendIdx["select:"]=4;
  2180. $14=self._collection();
  2181. $ctx1.sendIdx["collection"]=4;
  2182. self._assert_equals_($11,$14);
  2183. $ctx1.sendIdx["assert:equals:"]=4;
  2184. $16=self._collection();
  2185. $ctx1.sendIdx["collection"]=5;
  2186. $15=_st($16)._select_((function(each){
  2187. return smalltalk.withContext(function($ctx2) {
  2188. $17=self._sampleNewValue();
  2189. $ctx2.sendIdx["sampleNewValue"]=3;
  2190. return _st(each).__eq($17);
  2191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2192. $ctx1.sendIdx["select:"]=5;
  2193. self._assert_equals_($15,_st(self._collectionClass())._new());
  2194. $ctx1.sendIdx["assert:equals:"]=5;
  2195. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2196. return smalltalk.withContext(function($ctx2) {
  2197. return _st(each).__tild_eq(self._sampleNewValue());
  2198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2200. args: [],
  2201. 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",
  2202. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2203. referencedClasses: []
  2204. }),
  2205. globals.CollectionTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testSize",
  2209. protocol: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. return smalltalk.withContext(function($ctx1) {
  2213. var $1,$2;
  2214. $1=_st(_st(self._collectionClass())._new())._size();
  2215. $ctx1.sendIdx["size"]=1;
  2216. self._assert_equals_($1,(0));
  2217. $ctx1.sendIdx["assert:equals:"]=1;
  2218. $2=_st(self._sampleNewValueAsCollection())._size();
  2219. $ctx1.sendIdx["size"]=2;
  2220. self._assert_equals_($2,(1));
  2221. $ctx1.sendIdx["assert:equals:"]=2;
  2222. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2227. referencedClasses: []
  2228. }),
  2229. globals.CollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "collectionClass",
  2233. protocol: 'fixture',
  2234. fn: function (){
  2235. var self=this;
  2236. return nil;
  2237. },
  2238. args: [],
  2239. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. globals.CollectionTest.klass);
  2244. smalltalk.addMethod(
  2245. smalltalk.method({
  2246. selector: "isAbstract",
  2247. protocol: 'testing',
  2248. fn: function (){
  2249. var self=this;
  2250. return smalltalk.withContext(function($ctx1) {
  2251. var $1;
  2252. $1=_st(self._collectionClass())._isNil();
  2253. return $1;
  2254. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2255. args: [],
  2256. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2257. messageSends: ["isNil", "collectionClass"],
  2258. referencedClasses: []
  2259. }),
  2260. globals.CollectionTest.klass);
  2261. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "collectionWithNewValue",
  2265. protocol: 'fixture',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) {
  2269. self._subclassResponsibility();
  2270. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2271. args: [],
  2272. 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",
  2273. messageSends: ["subclassResponsibility"],
  2274. referencedClasses: []
  2275. }),
  2276. globals.IndexableCollectionTest);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "sampleNewIndex",
  2280. protocol: 'fixture',
  2281. fn: function (){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. self._subclassResponsibility();
  2285. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2286. args: [],
  2287. 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",
  2288. messageSends: ["subclassResponsibility"],
  2289. referencedClasses: []
  2290. }),
  2291. globals.IndexableCollectionTest);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "sampleNonIndexesDo:",
  2295. protocol: 'fixture',
  2296. fn: function (aBlock){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. self._subclassResponsibility();
  2300. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2301. args: ["aBlock"],
  2302. 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",
  2303. messageSends: ["subclassResponsibility"],
  2304. referencedClasses: []
  2305. }),
  2306. globals.IndexableCollectionTest);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "samplesDo:",
  2310. protocol: 'fixture',
  2311. fn: function (aBlock){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. self._subclassResponsibility();
  2315. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2316. args: ["aBlock"],
  2317. 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",
  2318. messageSends: ["subclassResponsibility"],
  2319. referencedClasses: []
  2320. }),
  2321. globals.IndexableCollectionTest);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "testAt",
  2325. protocol: 'tests',
  2326. fn: function (){
  2327. var self=this;
  2328. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2329. return smalltalk.withContext(function($ctx1) {
  2330. var $1;
  2331. self._nonIndexesDo_((function(each){
  2332. return smalltalk.withContext(function($ctx2) {
  2333. return self._should_raise_((function(){
  2334. return smalltalk.withContext(function($ctx3) {
  2335. $1=self._collection();
  2336. $ctx3.sendIdx["collection"]=1;
  2337. return _st($1)._at_(each);
  2338. $ctx3.sendIdx["at:"]=1;
  2339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2341. self._samplesDo_((function(index,value){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2344. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2345. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2346. args: [],
  2347. 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 ]",
  2348. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2349. referencedClasses: ["Error"]
  2350. }),
  2351. globals.IndexableCollectionTest);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "testAtIfAbsent",
  2355. protocol: 'tests',
  2356. fn: function (){
  2357. var self=this;
  2358. return smalltalk.withContext(function($ctx1) {
  2359. var $2,$1,$3;
  2360. self._nonIndexesDo_((function(each){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. $2=self._collection();
  2363. $ctx2.sendIdx["collection"]=1;
  2364. $1=_st($2)._at_ifAbsent_(each,(function(){
  2365. return smalltalk.withContext(function($ctx3) {
  2366. return self._sampleNewValue();
  2367. $ctx3.sendIdx["sampleNewValue"]=1;
  2368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2369. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2370. $3=self._sampleNewValue();
  2371. $ctx2.sendIdx["sampleNewValue"]=2;
  2372. return self._assert_equals_($1,$3);
  2373. $ctx2.sendIdx["assert:equals:"]=1;
  2374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2375. self._samplesDo_((function(index,value){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2378. return smalltalk.withContext(function($ctx3) {
  2379. return self._sampleNewValue();
  2380. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2381. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2382. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2383. args: [],
  2384. 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 ].",
  2385. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2386. referencedClasses: []
  2387. }),
  2388. globals.IndexableCollectionTest);
  2389. smalltalk.addMethod(
  2390. smalltalk.method({
  2391. selector: "testAtIfAbsentPut",
  2392. protocol: 'tests',
  2393. fn: function (){
  2394. var self=this;
  2395. var newCollection;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. var $1;
  2398. newCollection=self._collection();
  2399. $ctx1.sendIdx["collection"]=1;
  2400. self._samplesDo_((function(index,value){
  2401. return smalltalk.withContext(function($ctx2) {
  2402. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2403. return smalltalk.withContext(function($ctx3) {
  2404. return self._sampleNewValue();
  2405. $ctx3.sendIdx["sampleNewValue"]=1;
  2406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2407. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2408. return self._assert_equals_($1,value);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2411. self._assert_equals_(newCollection,self._collection());
  2412. $ctx1.sendIdx["assert:equals:"]=2;
  2413. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2414. return smalltalk.withContext(function($ctx2) {
  2415. return self._sampleNewValue();
  2416. $ctx2.sendIdx["sampleNewValue"]=2;
  2417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2418. $ctx1.sendIdx["assert:equals:"]=3;
  2419. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2420. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2421. args: [],
  2422. 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",
  2423. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2424. referencedClasses: []
  2425. }),
  2426. globals.IndexableCollectionTest);
  2427. smalltalk.addMethod(
  2428. smalltalk.method({
  2429. selector: "testAtIfPresent",
  2430. protocol: 'tests',
  2431. fn: function (){
  2432. var self=this;
  2433. var visited,sentinel;
  2434. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2435. return smalltalk.withContext(function($ctx1) {
  2436. var $2,$1,$4,$3;
  2437. sentinel=_st($Object())._new();
  2438. self._nonIndexesDo_((function(each){
  2439. return smalltalk.withContext(function($ctx2) {
  2440. visited=nil;
  2441. visited;
  2442. $2=self._collection();
  2443. $ctx2.sendIdx["collection"]=1;
  2444. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2445. visited=value1;
  2446. visited;
  2447. return sentinel;
  2448. }));
  2449. $ctx2.sendIdx["at:ifPresent:"]=1;
  2450. self._assert_equals_($1,nil);
  2451. $ctx2.sendIdx["assert:equals:"]=1;
  2452. return self._assert_(_st(visited)._isNil());
  2453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2454. self._samplesDo_((function(index,value){
  2455. return smalltalk.withContext(function($ctx2) {
  2456. visited=nil;
  2457. visited;
  2458. $4=self._collection();
  2459. $ctx2.sendIdx["collection"]=2;
  2460. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2461. visited=value2;
  2462. visited;
  2463. return sentinel;
  2464. }));
  2465. self._assert_equals_($3,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,3)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. globals.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtIfPresentIfAbsent",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var visited,sentinel;
  2483. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2484. return smalltalk.withContext(function($ctx1) {
  2485. var $2,$1,$3,$5,$4;
  2486. sentinel=_st($Object())._new();
  2487. self._nonIndexesDo_((function(each){
  2488. return smalltalk.withContext(function($ctx2) {
  2489. visited=nil;
  2490. visited;
  2491. $2=self._collection();
  2492. $ctx2.sendIdx["collection"]=1;
  2493. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2494. visited=value1;
  2495. visited;
  2496. return sentinel;
  2497. }),(function(){
  2498. return smalltalk.withContext(function($ctx3) {
  2499. return self._sampleNewValue();
  2500. $ctx3.sendIdx["sampleNewValue"]=1;
  2501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2502. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2503. $3=self._sampleNewValue();
  2504. $ctx2.sendIdx["sampleNewValue"]=2;
  2505. self._assert_equals_($1,$3);
  2506. $ctx2.sendIdx["assert:equals:"]=1;
  2507. return self._assert_(_st(visited)._isNil());
  2508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2509. self._samplesDo_((function(index,value){
  2510. return smalltalk.withContext(function($ctx2) {
  2511. visited=nil;
  2512. visited;
  2513. $5=self._collection();
  2514. $ctx2.sendIdx["collection"]=2;
  2515. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2516. visited=value2;
  2517. visited;
  2518. return sentinel;
  2519. }),(function(){
  2520. return smalltalk.withContext(function($ctx3) {
  2521. return self._sampleNewValue();
  2522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2523. self._assert_equals_($4,sentinel);
  2524. $ctx2.sendIdx["assert:equals:"]=2;
  2525. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2526. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2527. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2528. args: [],
  2529. 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) ]",
  2530. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2531. referencedClasses: ["Object"]
  2532. }),
  2533. globals.IndexableCollectionTest);
  2534. smalltalk.addMethod(
  2535. smalltalk.method({
  2536. selector: "testAtPut",
  2537. protocol: 'tests',
  2538. fn: function (){
  2539. var self=this;
  2540. var newCollection;
  2541. return smalltalk.withContext(function($ctx1) {
  2542. newCollection=self._collection();
  2543. $ctx1.sendIdx["collection"]=1;
  2544. self._samplesDo_((function(index,value){
  2545. return smalltalk.withContext(function($ctx2) {
  2546. return _st(newCollection)._at_put_(index,value);
  2547. $ctx2.sendIdx["at:put:"]=1;
  2548. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2549. self._assert_equals_(newCollection,self._collection());
  2550. $ctx1.sendIdx["assert:equals:"]=1;
  2551. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2552. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2553. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2554. args: [],
  2555. 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",
  2556. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2557. referencedClasses: []
  2558. }),
  2559. globals.IndexableCollectionTest);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "testEquality",
  2563. protocol: 'tests',
  2564. fn: function (){
  2565. var self=this;
  2566. return smalltalk.withContext(function($ctx1) {
  2567. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2568. $2=self._collectionClass();
  2569. $ctx1.sendIdx["collectionClass"]=1;
  2570. $1=_st($2)._new();
  2571. $ctx1.sendIdx["new"]=1;
  2572. $4=self._collectionClass();
  2573. $ctx1.sendIdx["collectionClass"]=2;
  2574. $3=_st($4)._new();
  2575. $ctx1.sendIdx["new"]=2;
  2576. self._assert_equals_($1,$3);
  2577. $ctx1.sendIdx["assert:equals:"]=1;
  2578. $5=self._collection();
  2579. $ctx1.sendIdx["collection"]=1;
  2580. $6=self._collection();
  2581. $ctx1.sendIdx["collection"]=2;
  2582. self._assert_equals_($5,$6);
  2583. $ctx1.sendIdx["assert:equals:"]=2;
  2584. $7=self._collectionWithNewValue();
  2585. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2586. self._assert_equals_($7,self._collectionWithNewValue());
  2587. $10=self._collectionClass();
  2588. $ctx1.sendIdx["collectionClass"]=3;
  2589. $9=_st($10)._new();
  2590. $ctx1.sendIdx["new"]=3;
  2591. $11=self._collection();
  2592. $ctx1.sendIdx["collection"]=3;
  2593. $8=_st($9).__eq($11);
  2594. $ctx1.sendIdx["="]=1;
  2595. self._deny_($8);
  2596. $ctx1.sendIdx["deny:"]=1;
  2597. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2598. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2599. args: [],
  2600. 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",
  2601. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2602. referencedClasses: []
  2603. }),
  2604. globals.IndexableCollectionTest);
  2605. smalltalk.addMethod(
  2606. smalltalk.method({
  2607. selector: "testIndexOf",
  2608. protocol: 'tests',
  2609. fn: function (){
  2610. var self=this;
  2611. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2612. return smalltalk.withContext(function($ctx1) {
  2613. var $1;
  2614. self._should_raise_((function(){
  2615. return smalltalk.withContext(function($ctx2) {
  2616. $1=self._collection();
  2617. $ctx2.sendIdx["collection"]=1;
  2618. return _st($1)._indexOf_(self._sampleNewValue());
  2619. $ctx2.sendIdx["indexOf:"]=1;
  2620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2621. self._samplesDo_((function(index,value){
  2622. return smalltalk.withContext(function($ctx2) {
  2623. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2624. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2625. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2626. args: [],
  2627. 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 ]",
  2628. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2629. referencedClasses: ["Error"]
  2630. }),
  2631. globals.IndexableCollectionTest);
  2632. smalltalk.addMethod(
  2633. smalltalk.method({
  2634. selector: "testIndexOfWithNull",
  2635. protocol: 'tests',
  2636. fn: function (){
  2637. var self=this;
  2638. var jsNull;
  2639. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2640. return smalltalk.withContext(function($ctx1) {
  2641. var $1,$2;
  2642. jsNull=_st($JSON())._parse_("null");
  2643. self._samplesDo_((function(index,value){
  2644. return smalltalk.withContext(function($ctx2) {
  2645. $1=self._collection();
  2646. _st($1)._at_put_(index,jsNull);
  2647. $2=_st($1)._indexOf_(jsNull);
  2648. return self._assert_equals_($2,index);
  2649. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2650. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2651. args: [],
  2652. 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 ]",
  2653. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2654. referencedClasses: ["JSON"]
  2655. }),
  2656. globals.IndexableCollectionTest);
  2657. smalltalk.addMethod(
  2658. smalltalk.method({
  2659. selector: "testWithIndexDo",
  2660. protocol: 'tests',
  2661. fn: function (){
  2662. var self=this;
  2663. var collection;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. collection=self._collection();
  2666. $ctx1.sendIdx["collection"]=1;
  2667. _st(self._collection())._withIndexDo_((function(each,index){
  2668. return smalltalk.withContext(function($ctx2) {
  2669. return self._assert_equals_(_st(collection)._at_(index),each);
  2670. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2671. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2672. args: [],
  2673. 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 ]",
  2674. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2675. referencedClasses: []
  2676. }),
  2677. globals.IndexableCollectionTest);
  2678. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2679. smalltalk.addMethod(
  2680. smalltalk.method({
  2681. selector: "collectionKeys",
  2682. protocol: 'fixture',
  2683. fn: function (){
  2684. var self=this;
  2685. return smalltalk.withContext(function($ctx1) {
  2686. self._subclassResponsibility();
  2687. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2688. args: [],
  2689. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2690. messageSends: ["subclassResponsibility"],
  2691. referencedClasses: []
  2692. }),
  2693. globals.AssociativeCollectionTest);
  2694. smalltalk.addMethod(
  2695. smalltalk.method({
  2696. selector: "collectionValues",
  2697. protocol: 'fixture',
  2698. fn: function (){
  2699. var self=this;
  2700. return smalltalk.withContext(function($ctx1) {
  2701. self._subclassResponsibility();
  2702. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2703. args: [],
  2704. source: "collectionValues\x0a\x09self subclassResponsibility",
  2705. messageSends: ["subclassResponsibility"],
  2706. referencedClasses: []
  2707. }),
  2708. globals.AssociativeCollectionTest);
  2709. smalltalk.addMethod(
  2710. smalltalk.method({
  2711. selector: "nonIndexesDo:",
  2712. protocol: 'fixture',
  2713. fn: function (aBlock){
  2714. var self=this;
  2715. return smalltalk.withContext(function($ctx1) {
  2716. _st(aBlock)._value_((5));
  2717. $ctx1.sendIdx["value:"]=1;
  2718. _st(aBlock)._value_("z");
  2719. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2720. args: ["aBlock"],
  2721. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2722. messageSends: ["value:"],
  2723. referencedClasses: []
  2724. }),
  2725. globals.AssociativeCollectionTest);
  2726. smalltalk.addMethod(
  2727. smalltalk.method({
  2728. selector: "sampleNewIndex",
  2729. protocol: 'fixture',
  2730. fn: function (){
  2731. var self=this;
  2732. return "new";
  2733. },
  2734. args: [],
  2735. source: "sampleNewIndex\x0a\x09^ 'new'",
  2736. messageSends: [],
  2737. referencedClasses: []
  2738. }),
  2739. globals.AssociativeCollectionTest);
  2740. smalltalk.addMethod(
  2741. smalltalk.method({
  2742. selector: "samplesDo:",
  2743. protocol: 'fixture',
  2744. fn: function (aBlock){
  2745. var self=this;
  2746. return smalltalk.withContext(function($ctx1) {
  2747. _st(aBlock)._value_value_("a",(2));
  2748. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2749. args: ["aBlock"],
  2750. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2751. messageSends: ["value:value:"],
  2752. referencedClasses: []
  2753. }),
  2754. globals.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testAddAll",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. return smalltalk.withContext(function($ctx1) {
  2762. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2763. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2764. $ctx1.supercall = false;
  2765. $2=self._collection();
  2766. $ctx1.sendIdx["collection"]=1;
  2767. $3=$2;
  2768. $4=self._collection();
  2769. $ctx1.sendIdx["collection"]=2;
  2770. _st($3)._addAll_($4);
  2771. $ctx1.sendIdx["addAll:"]=1;
  2772. $5=_st($2)._yourself();
  2773. $ctx1.sendIdx["yourself"]=1;
  2774. $1=$5;
  2775. $6=self._collection();
  2776. $ctx1.sendIdx["collection"]=3;
  2777. self._assert_equals_($1,$6);
  2778. $ctx1.sendIdx["assert:equals:"]=1;
  2779. $8=self._collection();
  2780. $ctx1.sendIdx["collection"]=4;
  2781. $9=$8;
  2782. $10=self._collectionWithNewValue();
  2783. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2784. _st($9)._addAll_($10);
  2785. $ctx1.sendIdx["addAll:"]=2;
  2786. $11=_st($8)._yourself();
  2787. $ctx1.sendIdx["yourself"]=2;
  2788. $7=$11;
  2789. $12=self._collectionWithNewValue();
  2790. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2791. self._assert_equals_($7,$12);
  2792. $ctx1.sendIdx["assert:equals:"]=2;
  2793. $14=self._collectionWithNewValue();
  2794. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2795. _st($14)._addAll_(self._collection());
  2796. $15=_st($14)._yourself();
  2797. $13=$15;
  2798. self._assert_equals_($13,self._collectionWithNewValue());
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2800. args: [],
  2801. 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",
  2802. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2803. referencedClasses: []
  2804. }),
  2805. globals.AssociativeCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testAsDictionary",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2813. return smalltalk.withContext(function($ctx1) {
  2814. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2815. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2816. args: [],
  2817. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2818. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2819. referencedClasses: ["Dictionary"]
  2820. }),
  2821. globals.AssociativeCollectionTest);
  2822. smalltalk.addMethod(
  2823. smalltalk.method({
  2824. selector: "testAsHashedCollection",
  2825. protocol: 'tests',
  2826. fn: function (){
  2827. var self=this;
  2828. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2829. return smalltalk.withContext(function($ctx1) {
  2830. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2831. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2832. args: [],
  2833. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2834. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2835. referencedClasses: ["HashedCollection"]
  2836. }),
  2837. globals.AssociativeCollectionTest);
  2838. smalltalk.addMethod(
  2839. smalltalk.method({
  2840. selector: "testComma",
  2841. protocol: 'tests',
  2842. fn: function (){
  2843. var self=this;
  2844. return smalltalk.withContext(function($ctx1) {
  2845. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2846. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2847. $ctx1.supercall = false;
  2848. $2=self._collection();
  2849. $ctx1.sendIdx["collection"]=1;
  2850. $3=self._collection();
  2851. $ctx1.sendIdx["collection"]=2;
  2852. $1=_st($2).__comma($3);
  2853. $ctx1.sendIdx[","]=1;
  2854. $4=self._collection();
  2855. $ctx1.sendIdx["collection"]=3;
  2856. self._assert_equals_($1,$4);
  2857. $ctx1.sendIdx["assert:equals:"]=1;
  2858. $6=self._collection();
  2859. $ctx1.sendIdx["collection"]=4;
  2860. $7=self._collectionWithNewValue();
  2861. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2862. $5=_st($6).__comma($7);
  2863. $ctx1.sendIdx[","]=2;
  2864. $8=self._collectionWithNewValue();
  2865. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2866. self._assert_equals_($5,$8);
  2867. $ctx1.sendIdx["assert:equals:"]=2;
  2868. $10=self._collectionWithNewValue();
  2869. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2870. $9=_st($10).__comma(self._collection());
  2871. self._assert_equals_($9,self._collectionWithNewValue());
  2872. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2873. args: [],
  2874. 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",
  2875. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2876. referencedClasses: []
  2877. }),
  2878. globals.AssociativeCollectionTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "testFrom",
  2882. protocol: 'tests',
  2883. fn: function (){
  2884. var self=this;
  2885. var associations;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. var $1;
  2888. $1="a".__minus_gt((1));
  2889. $ctx1.sendIdx["->"]=1;
  2890. associations=[$1,"b".__minus_gt((2))];
  2891. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2892. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2893. args: [],
  2894. 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 }.",
  2895. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2896. referencedClasses: []
  2897. }),
  2898. globals.AssociativeCollectionTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "testKeys",
  2902. protocol: 'tests',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. var $2,$1,$3,$4;
  2907. $2=_st(_st(self._collectionClass())._new())._keys();
  2908. $ctx1.sendIdx["keys"]=1;
  2909. $1=_st($2)._isEmpty();
  2910. self._assert_($1);
  2911. $3=_st(self._collection())._keys();
  2912. $ctx1.sendIdx["keys"]=2;
  2913. $4=self._collectionKeys();
  2914. $ctx1.sendIdx["collectionKeys"]=1;
  2915. self._assertSameContents_as_($3,$4);
  2916. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2917. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2918. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2919. args: [],
  2920. 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 }",
  2921. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2922. referencedClasses: []
  2923. }),
  2924. globals.AssociativeCollectionTest);
  2925. smalltalk.addMethod(
  2926. smalltalk.method({
  2927. selector: "testNewFromPairs",
  2928. protocol: 'tests',
  2929. fn: function (){
  2930. var self=this;
  2931. var flattenedAssociations;
  2932. return smalltalk.withContext(function($ctx1) {
  2933. flattenedAssociations=["a",(1),"b",(2)];
  2934. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2935. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2936. args: [],
  2937. 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 }.",
  2938. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2939. referencedClasses: []
  2940. }),
  2941. globals.AssociativeCollectionTest);
  2942. smalltalk.addMethod(
  2943. smalltalk.method({
  2944. selector: "testPrintString",
  2945. protocol: 'tests',
  2946. fn: function (){
  2947. var self=this;
  2948. return smalltalk.withContext(function($ctx1) {
  2949. var $3,$2,$4,$1,$5;
  2950. $3=self._collectionClass();
  2951. $ctx1.sendIdx["collectionClass"]=1;
  2952. $2=_st($3)._new();
  2953. _st($2)._at_put_("firstname","James");
  2954. $ctx1.sendIdx["at:put:"]=1;
  2955. _st($2)._at_put_("lastname","Bond");
  2956. $4=_st($2)._printString();
  2957. $1=$4;
  2958. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2959. $ctx1.sendIdx[","]=1;
  2960. self._assert_equals_($1,$5);
  2961. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2962. args: [],
  2963. 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'')'",
  2964. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2965. referencedClasses: []
  2966. }),
  2967. globals.AssociativeCollectionTest);
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "testRemoveKey",
  2971. protocol: 'tests',
  2972. fn: function (){
  2973. var self=this;
  2974. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2975. return smalltalk.withContext(function($ctx1) {
  2976. var $1,$2,$3,$5,$6,$4,$7,$8;
  2977. self._nonIndexesDo_((function(each){
  2978. var collection;
  2979. return smalltalk.withContext(function($ctx2) {
  2980. collection=self._collection();
  2981. $ctx2.sendIdx["collection"]=1;
  2982. collection;
  2983. self._should_raise_((function(){
  2984. return smalltalk.withContext(function($ctx3) {
  2985. return _st(collection)._removeKey_(each);
  2986. $ctx3.sendIdx["removeKey:"]=1;
  2987. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2988. $1=collection;
  2989. $2=self._collection();
  2990. $ctx2.sendIdx["collection"]=2;
  2991. return self._assert_equals_($1,$2);
  2992. $ctx2.sendIdx["assert:equals:"]=1;
  2993. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2994. self._samplesDo_((function(index,value){
  2995. var collection;
  2996. return smalltalk.withContext(function($ctx2) {
  2997. collection=self._collection();
  2998. $ctx2.sendIdx["collection"]=3;
  2999. collection;
  3000. $3=_st(collection)._removeKey_(index);
  3001. $ctx2.sendIdx["removeKey:"]=2;
  3002. self._assert_equals_($3,value);
  3003. $ctx2.sendIdx["assert:equals:"]=2;
  3004. $5=collection;
  3005. $6=self._collection();
  3006. $ctx2.sendIdx["collection"]=4;
  3007. $4=_st($5).__eq($6);
  3008. return self._deny_($4);
  3009. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3010. $7=self._collectionWithNewValue();
  3011. _st($7)._removeKey_(self._sampleNewIndex());
  3012. $8=_st($7)._yourself();
  3013. self._assert_equals_($8,self._collection());
  3014. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  3015. args: [],
  3016. 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",
  3017. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  3018. referencedClasses: ["Error"]
  3019. }),
  3020. globals.AssociativeCollectionTest);
  3021. smalltalk.addMethod(
  3022. smalltalk.method({
  3023. selector: "testRemoveKeyIfAbsent",
  3024. protocol: 'tests',
  3025. fn: function (){
  3026. var self=this;
  3027. return smalltalk.withContext(function($ctx1) {
  3028. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  3029. self._nonIndexesDo_((function(each){
  3030. var collection;
  3031. return smalltalk.withContext(function($ctx2) {
  3032. collection=self._collection();
  3033. $ctx2.sendIdx["collection"]=1;
  3034. collection;
  3035. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  3036. return smalltalk.withContext(function($ctx3) {
  3037. return self._sampleNewValue();
  3038. $ctx3.sendIdx["sampleNewValue"]=1;
  3039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  3040. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  3041. $2=self._sampleNewValue();
  3042. $ctx2.sendIdx["sampleNewValue"]=2;
  3043. self._assert_equals_($1,$2);
  3044. $ctx2.sendIdx["assert:equals:"]=1;
  3045. $3=collection;
  3046. $4=self._collection();
  3047. $ctx2.sendIdx["collection"]=2;
  3048. return self._assert_equals_($3,$4);
  3049. $ctx2.sendIdx["assert:equals:"]=2;
  3050. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3051. self._samplesDo_((function(index,value){
  3052. var collection;
  3053. return smalltalk.withContext(function($ctx2) {
  3054. collection=self._collection();
  3055. $ctx2.sendIdx["collection"]=3;
  3056. collection;
  3057. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3058. return smalltalk.withContext(function($ctx3) {
  3059. return self._sampleNewValue();
  3060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3061. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3062. self._assert_equals_($5,value);
  3063. $ctx2.sendIdx["assert:equals:"]=3;
  3064. $7=collection;
  3065. $8=self._collection();
  3066. $ctx2.sendIdx["collection"]=4;
  3067. $6=_st($7).__eq($8);
  3068. return self._deny_($6);
  3069. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3070. $9=self._collectionWithNewValue();
  3071. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3072. return smalltalk.withContext(function($ctx2) {
  3073. return self._assert_(false);
  3074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3075. $10=_st($9)._yourself();
  3076. self._assert_equals_($10,self._collection());
  3077. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3078. args: [],
  3079. 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",
  3080. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3081. referencedClasses: []
  3082. }),
  3083. globals.AssociativeCollectionTest);
  3084. smalltalk.addMethod(
  3085. smalltalk.method({
  3086. selector: "testValues",
  3087. protocol: 'tests',
  3088. fn: function (){
  3089. var self=this;
  3090. return smalltalk.withContext(function($ctx1) {
  3091. var $2,$1,$3,$4;
  3092. $2=_st(_st(self._collectionClass())._new())._values();
  3093. $ctx1.sendIdx["values"]=1;
  3094. $1=_st($2)._isEmpty();
  3095. self._assert_($1);
  3096. $3=_st(self._collection())._values();
  3097. $ctx1.sendIdx["values"]=2;
  3098. $4=self._collectionValues();
  3099. $ctx1.sendIdx["collectionValues"]=1;
  3100. self._assertSameContents_as_($3,$4);
  3101. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3102. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3103. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3104. args: [],
  3105. 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 }",
  3106. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3107. referencedClasses: []
  3108. }),
  3109. globals.AssociativeCollectionTest);
  3110. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3111. smalltalk.addMethod(
  3112. smalltalk.method({
  3113. selector: "collection",
  3114. protocol: 'fixture',
  3115. fn: function (){
  3116. var self=this;
  3117. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3118. return smalltalk.withContext(function($ctx1) {
  3119. var $2,$3,$1;
  3120. $2=_st($Dictionary())._new();
  3121. _st($2)._at_put_((1),(1));
  3122. $ctx1.sendIdx["at:put:"]=1;
  3123. _st($2)._at_put_("a",(2));
  3124. $ctx1.sendIdx["at:put:"]=2;
  3125. _st($2)._at_put_(true,(3));
  3126. $ctx1.sendIdx["at:put:"]=3;
  3127. _st($2)._at_put_((1).__at((3)),(-4));
  3128. $3=_st($2)._yourself();
  3129. $1=$3;
  3130. return $1;
  3131. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3132. args: [],
  3133. 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",
  3134. messageSends: ["at:put:", "new", "@", "yourself"],
  3135. referencedClasses: ["Dictionary"]
  3136. }),
  3137. globals.DictionaryTest);
  3138. smalltalk.addMethod(
  3139. smalltalk.method({
  3140. selector: "collectionKeys",
  3141. protocol: 'fixture',
  3142. fn: function (){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) {
  3145. var $1;
  3146. $1=[(1),"a",true,(1).__at((3))];
  3147. return $1;
  3148. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3149. args: [],
  3150. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3151. messageSends: ["@"],
  3152. referencedClasses: []
  3153. }),
  3154. globals.DictionaryTest);
  3155. smalltalk.addMethod(
  3156. smalltalk.method({
  3157. selector: "collectionOfPrintStrings",
  3158. protocol: 'fixture',
  3159. fn: function (){
  3160. var self=this;
  3161. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3162. return smalltalk.withContext(function($ctx1) {
  3163. var $2,$3,$1;
  3164. $2=_st($Dictionary())._new();
  3165. _st($2)._at_put_((1),"1");
  3166. $ctx1.sendIdx["at:put:"]=1;
  3167. _st($2)._at_put_("a","2");
  3168. $ctx1.sendIdx["at:put:"]=2;
  3169. _st($2)._at_put_(true,"3");
  3170. $ctx1.sendIdx["at:put:"]=3;
  3171. _st($2)._at_put_((1).__at((3)),"-4");
  3172. $3=_st($2)._yourself();
  3173. $1=$3;
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3176. args: [],
  3177. 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",
  3178. messageSends: ["at:put:", "new", "@", "yourself"],
  3179. referencedClasses: ["Dictionary"]
  3180. }),
  3181. globals.DictionaryTest);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "collectionSize",
  3185. protocol: 'fixture',
  3186. fn: function (){
  3187. var self=this;
  3188. return (4);
  3189. },
  3190. args: [],
  3191. source: "collectionSize\x0a\x09^ 4",
  3192. messageSends: [],
  3193. referencedClasses: []
  3194. }),
  3195. globals.DictionaryTest);
  3196. smalltalk.addMethod(
  3197. smalltalk.method({
  3198. selector: "collectionValues",
  3199. protocol: 'fixture',
  3200. fn: function (){
  3201. var self=this;
  3202. var $1;
  3203. $1=[(1),(2),(3),(-4)];
  3204. return $1;
  3205. },
  3206. args: [],
  3207. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3208. messageSends: [],
  3209. referencedClasses: []
  3210. }),
  3211. globals.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "collectionWithDuplicates",
  3215. protocol: 'fixture',
  3216. fn: function (){
  3217. var self=this;
  3218. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3219. return smalltalk.withContext(function($ctx1) {
  3220. var $2,$3,$1;
  3221. $2=_st($Dictionary())._new();
  3222. _st($2)._at_put_((1),(1));
  3223. $ctx1.sendIdx["at:put:"]=1;
  3224. _st($2)._at_put_("a",(2));
  3225. $ctx1.sendIdx["at:put:"]=2;
  3226. _st($2)._at_put_(true,(3));
  3227. $ctx1.sendIdx["at:put:"]=3;
  3228. _st($2)._at_put_((4),(-4));
  3229. $ctx1.sendIdx["at:put:"]=4;
  3230. _st($2)._at_put_("b",(1));
  3231. $ctx1.sendIdx["at:put:"]=5;
  3232. _st($2)._at_put_((3),(3));
  3233. $ctx1.sendIdx["at:put:"]=6;
  3234. _st($2)._at_put_(false,(12));
  3235. $3=_st($2)._yourself();
  3236. $1=$3;
  3237. return $1;
  3238. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3239. args: [],
  3240. 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",
  3241. messageSends: ["at:put:", "new", "yourself"],
  3242. referencedClasses: ["Dictionary"]
  3243. }),
  3244. globals.DictionaryTest);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "collectionWithNewValue",
  3248. protocol: 'fixture',
  3249. fn: function (){
  3250. var self=this;
  3251. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3252. return smalltalk.withContext(function($ctx1) {
  3253. var $2,$3,$1;
  3254. $2=_st($Dictionary())._new();
  3255. _st($2)._at_put_((1),(1));
  3256. $ctx1.sendIdx["at:put:"]=1;
  3257. _st($2)._at_put_("a",(2));
  3258. $ctx1.sendIdx["at:put:"]=2;
  3259. _st($2)._at_put_(true,(3));
  3260. $ctx1.sendIdx["at:put:"]=3;
  3261. _st($2)._at_put_((1).__at((3)),(-4));
  3262. $ctx1.sendIdx["at:put:"]=4;
  3263. _st($2)._at_put_("new","N");
  3264. $3=_st($2)._yourself();
  3265. $1=$3;
  3266. return $1;
  3267. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3268. args: [],
  3269. 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",
  3270. messageSends: ["at:put:", "new", "@", "yourself"],
  3271. referencedClasses: ["Dictionary"]
  3272. }),
  3273. globals.DictionaryTest);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "sampleNewValueAsCollection",
  3277. protocol: 'fixture',
  3278. fn: function (){
  3279. var self=this;
  3280. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $2,$3,$1;
  3283. $2=_st($Dictionary())._new();
  3284. _st($2)._at_put_("new","N");
  3285. $3=_st($2)._yourself();
  3286. $1=$3;
  3287. return $1;
  3288. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3289. args: [],
  3290. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3291. messageSends: ["at:put:", "new", "yourself"],
  3292. referencedClasses: ["Dictionary"]
  3293. }),
  3294. globals.DictionaryTest);
  3295. smalltalk.addMethod(
  3296. smalltalk.method({
  3297. selector: "samplesDo:",
  3298. protocol: 'fixture',
  3299. fn: function (aBlock){
  3300. var self=this;
  3301. return smalltalk.withContext(function($ctx1) {
  3302. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3303. $ctx1.supercall = false;
  3304. _st(aBlock)._value_value_(true,(3));
  3305. $ctx1.sendIdx["value:value:"]=1;
  3306. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3307. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3308. args: ["aBlock"],
  3309. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3310. messageSends: ["samplesDo:", "value:value:", "@"],
  3311. referencedClasses: []
  3312. }),
  3313. globals.DictionaryTest);
  3314. smalltalk.addMethod(
  3315. smalltalk.method({
  3316. selector: "testAccessing",
  3317. protocol: 'tests',
  3318. fn: function (){
  3319. var self=this;
  3320. var d;
  3321. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3322. return smalltalk.withContext(function($ctx1) {
  3323. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3324. d=_st($Dictionary())._new();
  3325. _st(d)._at_put_("hello","world");
  3326. $ctx1.sendIdx["at:put:"]=1;
  3327. $1=_st(d)._at_("hello");
  3328. $ctx1.sendIdx["at:"]=1;
  3329. self._assert_equals_($1,"world");
  3330. $ctx1.sendIdx["assert:equals:"]=1;
  3331. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3332. return nil;
  3333. }));
  3334. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3335. self._assert_equals_($2,"world");
  3336. $ctx1.sendIdx["assert:equals:"]=2;
  3337. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3338. return nil;
  3339. }))).__eq("world"));
  3340. $ctx1.sendIdx["deny:"]=1;
  3341. $3=_st(d)._includesKey_("hello");
  3342. $ctx1.sendIdx["includesKey:"]=1;
  3343. self._assert_($3);
  3344. $ctx1.sendIdx["assert:"]=1;
  3345. $4=_st(d)._includesKey_("foo");
  3346. $ctx1.sendIdx["includesKey:"]=2;
  3347. self._deny_($4);
  3348. $ctx1.sendIdx["deny:"]=2;
  3349. _st(d)._at_put_((1),(2));
  3350. $ctx1.sendIdx["at:put:"]=2;
  3351. $5=_st(d)._at_((1));
  3352. $ctx1.sendIdx["at:"]=2;
  3353. self._assert_equals_($5,(2));
  3354. $ctx1.sendIdx["assert:equals:"]=3;
  3355. $6=d;
  3356. $7=(1).__at((3));
  3357. $ctx1.sendIdx["@"]=1;
  3358. _st($6)._at_put_($7,(3));
  3359. $9=d;
  3360. $10=(1).__at((3));
  3361. $ctx1.sendIdx["@"]=2;
  3362. $8=_st($9)._at_($10);
  3363. self._assert_equals_($8,(3));
  3364. $12=d;
  3365. $13=(1).__at((3));
  3366. $ctx1.sendIdx["@"]=3;
  3367. $11=_st($12)._includesKey_($13);
  3368. $ctx1.sendIdx["includesKey:"]=3;
  3369. self._assert_($11);
  3370. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3371. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3372. args: [],
  3373. 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)",
  3374. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3375. referencedClasses: ["Dictionary"]
  3376. }),
  3377. globals.DictionaryTest);
  3378. smalltalk.addMethod(
  3379. smalltalk.method({
  3380. selector: "testDynamicDictionaries",
  3381. protocol: 'tests',
  3382. fn: function (){
  3383. var self=this;
  3384. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3385. return smalltalk.withContext(function($ctx1) {
  3386. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3387. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3388. args: [],
  3389. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3390. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3391. referencedClasses: ["Dictionary"]
  3392. }),
  3393. globals.DictionaryTest);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "collectionClass",
  3397. protocol: 'fixture',
  3398. fn: function (){
  3399. var self=this;
  3400. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3401. return $Dictionary();
  3402. },
  3403. args: [],
  3404. source: "collectionClass\x0a\x09^ Dictionary",
  3405. messageSends: [],
  3406. referencedClasses: ["Dictionary"]
  3407. }),
  3408. globals.DictionaryTest.klass);
  3409. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "collection",
  3413. protocol: 'fixture',
  3414. fn: function (){
  3415. var self=this;
  3416. var $1;
  3417. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3418. return $1;
  3419. },
  3420. args: [],
  3421. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3422. messageSends: [],
  3423. referencedClasses: []
  3424. }),
  3425. globals.HashedCollectionTest);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "collectionKeys",
  3429. protocol: 'fixture',
  3430. fn: function (){
  3431. var self=this;
  3432. var $1;
  3433. $1=["b","a","c","d"];
  3434. return $1;
  3435. },
  3436. args: [],
  3437. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3438. messageSends: [],
  3439. referencedClasses: []
  3440. }),
  3441. globals.HashedCollectionTest);
  3442. smalltalk.addMethod(
  3443. smalltalk.method({
  3444. selector: "collectionOfPrintStrings",
  3445. protocol: 'fixture',
  3446. fn: function (){
  3447. var self=this;
  3448. var $1;
  3449. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3450. return $1;
  3451. },
  3452. args: [],
  3453. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3454. messageSends: [],
  3455. referencedClasses: []
  3456. }),
  3457. globals.HashedCollectionTest);
  3458. smalltalk.addMethod(
  3459. smalltalk.method({
  3460. selector: "collectionSize",
  3461. protocol: 'fixture',
  3462. fn: function (){
  3463. var self=this;
  3464. return (4);
  3465. },
  3466. args: [],
  3467. source: "collectionSize\x0a\x09^ 4",
  3468. messageSends: [],
  3469. referencedClasses: []
  3470. }),
  3471. globals.HashedCollectionTest);
  3472. smalltalk.addMethod(
  3473. smalltalk.method({
  3474. selector: "collectionValues",
  3475. protocol: 'fixture',
  3476. fn: function (){
  3477. var self=this;
  3478. var $1;
  3479. $1=[(1),(2),(3),(-4)];
  3480. return $1;
  3481. },
  3482. args: [],
  3483. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3484. messageSends: [],
  3485. referencedClasses: []
  3486. }),
  3487. globals.HashedCollectionTest);
  3488. smalltalk.addMethod(
  3489. smalltalk.method({
  3490. selector: "collectionWithDuplicates",
  3491. protocol: 'fixture',
  3492. fn: function (){
  3493. var self=this;
  3494. var $1;
  3495. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3496. return $1;
  3497. },
  3498. args: [],
  3499. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3500. messageSends: [],
  3501. referencedClasses: []
  3502. }),
  3503. globals.HashedCollectionTest);
  3504. smalltalk.addMethod(
  3505. smalltalk.method({
  3506. selector: "collectionWithNewValue",
  3507. protocol: 'fixture',
  3508. fn: function (){
  3509. var self=this;
  3510. var $1;
  3511. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3512. return $1;
  3513. },
  3514. args: [],
  3515. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3516. messageSends: [],
  3517. referencedClasses: []
  3518. }),
  3519. globals.HashedCollectionTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "sampleNewValueAsCollection",
  3523. protocol: 'fixture',
  3524. fn: function (){
  3525. var self=this;
  3526. var $1;
  3527. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3528. return $1;
  3529. },
  3530. args: [],
  3531. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3532. messageSends: [],
  3533. referencedClasses: []
  3534. }),
  3535. globals.HashedCollectionTest);
  3536. smalltalk.addMethod(
  3537. smalltalk.method({
  3538. selector: "testDynamicDictionaries",
  3539. protocol: 'tests',
  3540. fn: function (){
  3541. var self=this;
  3542. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3543. return smalltalk.withContext(function($ctx1) {
  3544. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3545. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3546. args: [],
  3547. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3548. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3549. referencedClasses: ["HashedCollection"]
  3550. }),
  3551. globals.HashedCollectionTest);
  3552. smalltalk.addMethod(
  3553. smalltalk.method({
  3554. selector: "collectionClass",
  3555. protocol: 'fixture',
  3556. fn: function (){
  3557. var self=this;
  3558. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3559. return $HashedCollection();
  3560. },
  3561. args: [],
  3562. source: "collectionClass\x0a\x09^ HashedCollection",
  3563. messageSends: [],
  3564. referencedClasses: ["HashedCollection"]
  3565. }),
  3566. globals.HashedCollectionTest.klass);
  3567. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "collectionFirst",
  3571. protocol: 'fixture',
  3572. fn: function (){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. self._subclassResponsibility();
  3576. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3577. args: [],
  3578. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3579. messageSends: ["subclassResponsibility"],
  3580. referencedClasses: []
  3581. }),
  3582. globals.SequenceableCollectionTest);
  3583. smalltalk.addMethod(
  3584. smalltalk.method({
  3585. selector: "collectionFirstTwo",
  3586. protocol: 'fixture',
  3587. fn: function (){
  3588. var self=this;
  3589. return smalltalk.withContext(function($ctx1) {
  3590. self._subclassResponsibility();
  3591. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3592. args: [],
  3593. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3594. messageSends: ["subclassResponsibility"],
  3595. referencedClasses: []
  3596. }),
  3597. globals.SequenceableCollectionTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "collectionLast",
  3601. protocol: 'fixture',
  3602. fn: function (){
  3603. var self=this;
  3604. return smalltalk.withContext(function($ctx1) {
  3605. self._subclassResponsibility();
  3606. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3607. args: [],
  3608. source: "collectionLast\x0a\x09self subclassResponsibility",
  3609. messageSends: ["subclassResponsibility"],
  3610. referencedClasses: []
  3611. }),
  3612. globals.SequenceableCollectionTest);
  3613. smalltalk.addMethod(
  3614. smalltalk.method({
  3615. selector: "collectionLastTwo",
  3616. protocol: 'fixture',
  3617. fn: function (){
  3618. var self=this;
  3619. return smalltalk.withContext(function($ctx1) {
  3620. self._subclassResponsibility();
  3621. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3622. args: [],
  3623. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3624. messageSends: ["subclassResponsibility"],
  3625. referencedClasses: []
  3626. }),
  3627. globals.SequenceableCollectionTest);
  3628. smalltalk.addMethod(
  3629. smalltalk.method({
  3630. selector: "nonIndexesDo:",
  3631. protocol: 'fixture',
  3632. fn: function (aBlock){
  3633. var self=this;
  3634. return smalltalk.withContext(function($ctx1) {
  3635. _st(aBlock)._value_((0));
  3636. $ctx1.sendIdx["value:"]=1;
  3637. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3638. $ctx1.sendIdx["value:"]=2;
  3639. _st(aBlock)._value_("z");
  3640. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3641. args: ["aBlock"],
  3642. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3643. messageSends: ["value:", "+", "collectionSize"],
  3644. referencedClasses: []
  3645. }),
  3646. globals.SequenceableCollectionTest);
  3647. smalltalk.addMethod(
  3648. smalltalk.method({
  3649. selector: "samplesDo:",
  3650. protocol: 'fixture',
  3651. fn: function (aBlock){
  3652. var self=this;
  3653. return smalltalk.withContext(function($ctx1) {
  3654. _st(aBlock)._value_value_((1),self._collectionFirst());
  3655. $ctx1.sendIdx["value:value:"]=1;
  3656. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3657. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3658. args: ["aBlock"],
  3659. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3660. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3661. referencedClasses: []
  3662. }),
  3663. globals.SequenceableCollectionTest);
  3664. smalltalk.addMethod(
  3665. smalltalk.method({
  3666. selector: "testBeginsWith",
  3667. protocol: 'tests',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) {
  3671. var $2,$1,$4,$5,$3,$7,$6;
  3672. $2=self._collection();
  3673. $ctx1.sendIdx["collection"]=1;
  3674. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3675. $ctx1.sendIdx["beginsWith:"]=1;
  3676. self._assert_($1);
  3677. $ctx1.sendIdx["assert:"]=1;
  3678. $4=self._collection();
  3679. $ctx1.sendIdx["collection"]=2;
  3680. $5=self._collection();
  3681. $ctx1.sendIdx["collection"]=3;
  3682. $3=_st($4)._beginsWith_($5);
  3683. $ctx1.sendIdx["beginsWith:"]=2;
  3684. self._assert_($3);
  3685. $ctx1.sendIdx["assert:"]=2;
  3686. $7=self._collection();
  3687. $ctx1.sendIdx["collection"]=4;
  3688. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3689. $ctx1.sendIdx["beginsWith:"]=3;
  3690. self._assert_($6);
  3691. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3693. args: [],
  3694. 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)",
  3695. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3696. referencedClasses: []
  3697. }),
  3698. globals.SequenceableCollectionTest);
  3699. smalltalk.addMethod(
  3700. smalltalk.method({
  3701. selector: "testEndsWith",
  3702. protocol: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. var $2,$1,$4,$5,$3,$7,$6;
  3707. $2=self._collection();
  3708. $ctx1.sendIdx["collection"]=1;
  3709. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3710. $ctx1.sendIdx["endsWith:"]=1;
  3711. self._assert_($1);
  3712. $ctx1.sendIdx["assert:"]=1;
  3713. $4=self._collection();
  3714. $ctx1.sendIdx["collection"]=2;
  3715. $5=self._collection();
  3716. $ctx1.sendIdx["collection"]=3;
  3717. $3=_st($4)._endsWith_($5);
  3718. $ctx1.sendIdx["endsWith:"]=2;
  3719. self._assert_($3);
  3720. $ctx1.sendIdx["assert:"]=2;
  3721. $7=self._collection();
  3722. $ctx1.sendIdx["collection"]=4;
  3723. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3724. $ctx1.sendIdx["endsWith:"]=3;
  3725. self._assert_($6);
  3726. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3727. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3728. args: [],
  3729. 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)",
  3730. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3731. referencedClasses: []
  3732. }),
  3733. globals.SequenceableCollectionTest);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "testFirst",
  3737. protocol: 'tests',
  3738. fn: function (){
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3742. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3743. args: [],
  3744. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3745. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3746. referencedClasses: []
  3747. }),
  3748. globals.SequenceableCollectionTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "testFirstN",
  3752. protocol: 'tests',
  3753. fn: function (){
  3754. var self=this;
  3755. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3756. return smalltalk.withContext(function($ctx1) {
  3757. var $2,$1,$4,$3,$6,$5,$7;
  3758. $2=self._collection();
  3759. $ctx1.sendIdx["collection"]=1;
  3760. $1=_st($2)._first_((2));
  3761. $ctx1.sendIdx["first:"]=1;
  3762. self._assert_equals_($1,self._collectionFirstTwo());
  3763. $ctx1.sendIdx["assert:equals:"]=1;
  3764. $4=self._collection();
  3765. $ctx1.sendIdx["collection"]=2;
  3766. $3=_st($4)._first_((0));
  3767. $ctx1.sendIdx["first:"]=2;
  3768. self._assert_equals_($3,_st(self._collectionClass())._new());
  3769. $ctx1.sendIdx["assert:equals:"]=2;
  3770. $6=self._collection();
  3771. $ctx1.sendIdx["collection"]=3;
  3772. $5=_st($6)._first_(self._collectionSize());
  3773. $ctx1.sendIdx["first:"]=3;
  3774. $7=self._collection();
  3775. $ctx1.sendIdx["collection"]=4;
  3776. self._assert_equals_($5,$7);
  3777. self._should_raise_((function(){
  3778. return smalltalk.withContext(function($ctx2) {
  3779. return _st(self._collection())._first_((33));
  3780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3782. args: [],
  3783. 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",
  3784. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3785. referencedClasses: ["Error"]
  3786. }),
  3787. globals.SequenceableCollectionTest);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "testFourth",
  3791. protocol: 'tests',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. var $2,$1;
  3796. $2=self._collection();
  3797. $ctx1.sendIdx["collection"]=1;
  3798. $1=_st($2)._fourth();
  3799. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3800. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3801. args: [],
  3802. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3803. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3804. referencedClasses: []
  3805. }),
  3806. globals.SequenceableCollectionTest);
  3807. smalltalk.addMethod(
  3808. smalltalk.method({
  3809. selector: "testIndexOfStartingAt",
  3810. protocol: 'tests',
  3811. fn: function (){
  3812. var self=this;
  3813. var jsNull;
  3814. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3815. return smalltalk.withContext(function($ctx1) {
  3816. var $2,$1,$4,$3;
  3817. jsNull=_st($JSON())._parse_("null");
  3818. self._samplesDo_((function(index,value){
  3819. return smalltalk.withContext(function($ctx2) {
  3820. $2=self._collection();
  3821. $ctx2.sendIdx["collection"]=1;
  3822. $1=_st($2)._indexOf_startingAt_(value,(1));
  3823. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3824. self._assert_equals_($1,index);
  3825. $ctx2.sendIdx["assert:equals:"]=1;
  3826. $4=self._collection();
  3827. $ctx2.sendIdx["collection"]=2;
  3828. $3=_st($4)._indexOf_startingAt_(value,index);
  3829. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3830. self._assert_equals_($3,index);
  3831. $ctx2.sendIdx["assert:equals:"]=2;
  3832. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3833. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3834. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3835. args: [],
  3836. 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 ]",
  3837. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3838. referencedClasses: ["JSON"]
  3839. }),
  3840. globals.SequenceableCollectionTest);
  3841. smalltalk.addMethod(
  3842. smalltalk.method({
  3843. selector: "testIndexOfStartingAtWithNull",
  3844. protocol: 'tests',
  3845. fn: function (){
  3846. var self=this;
  3847. var jsNull;
  3848. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3849. return smalltalk.withContext(function($ctx1) {
  3850. var $1,$2;
  3851. jsNull=_st($JSON())._parse_("null");
  3852. self._samplesDo_((function(index,value){
  3853. var collection;
  3854. return smalltalk.withContext(function($ctx2) {
  3855. collection=self._collection();
  3856. collection;
  3857. _st(collection)._at_put_(index,jsNull);
  3858. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3859. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3860. self._assert_equals_($1,index);
  3861. $ctx2.sendIdx["assert:equals:"]=1;
  3862. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3863. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3864. self._assert_equals_($2,index);
  3865. $ctx2.sendIdx["assert:equals:"]=2;
  3866. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3867. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3868. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3869. args: [],
  3870. 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 ]",
  3871. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3872. referencedClasses: ["JSON"]
  3873. }),
  3874. globals.SequenceableCollectionTest);
  3875. smalltalk.addMethod(
  3876. smalltalk.method({
  3877. selector: "testLast",
  3878. protocol: 'tests',
  3879. fn: function (){
  3880. var self=this;
  3881. return smalltalk.withContext(function($ctx1) {
  3882. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3883. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3884. args: [],
  3885. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3886. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3887. referencedClasses: []
  3888. }),
  3889. globals.SequenceableCollectionTest);
  3890. smalltalk.addMethod(
  3891. smalltalk.method({
  3892. selector: "testLastN",
  3893. protocol: 'tests',
  3894. fn: function (){
  3895. var self=this;
  3896. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3897. return smalltalk.withContext(function($ctx1) {
  3898. var $2,$1,$4,$3,$6,$5,$7;
  3899. $2=self._collection();
  3900. $ctx1.sendIdx["collection"]=1;
  3901. $1=_st($2)._last_((2));
  3902. $ctx1.sendIdx["last:"]=1;
  3903. self._assert_equals_($1,self._collectionLastTwo());
  3904. $ctx1.sendIdx["assert:equals:"]=1;
  3905. $4=self._collection();
  3906. $ctx1.sendIdx["collection"]=2;
  3907. $3=_st($4)._last_((0));
  3908. $ctx1.sendIdx["last:"]=2;
  3909. self._assert_equals_($3,_st(self._collectionClass())._new());
  3910. $ctx1.sendIdx["assert:equals:"]=2;
  3911. $6=self._collection();
  3912. $ctx1.sendIdx["collection"]=3;
  3913. $5=_st($6)._last_(self._collectionSize());
  3914. $ctx1.sendIdx["last:"]=3;
  3915. $7=self._collection();
  3916. $ctx1.sendIdx["collection"]=4;
  3917. self._assert_equals_($5,$7);
  3918. self._should_raise_((function(){
  3919. return smalltalk.withContext(function($ctx2) {
  3920. return _st(self._collection())._last_((33));
  3921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3922. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3923. args: [],
  3924. 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",
  3925. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3926. referencedClasses: ["Error"]
  3927. }),
  3928. globals.SequenceableCollectionTest);
  3929. smalltalk.addMethod(
  3930. smalltalk.method({
  3931. selector: "testSecond",
  3932. protocol: 'tests',
  3933. fn: function (){
  3934. var self=this;
  3935. return smalltalk.withContext(function($ctx1) {
  3936. var $2,$1;
  3937. $2=self._collection();
  3938. $ctx1.sendIdx["collection"]=1;
  3939. $1=_st($2)._second();
  3940. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3941. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3942. args: [],
  3943. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3944. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3945. referencedClasses: []
  3946. }),
  3947. globals.SequenceableCollectionTest);
  3948. smalltalk.addMethod(
  3949. smalltalk.method({
  3950. selector: "testThird",
  3951. protocol: 'tests',
  3952. fn: function (){
  3953. var self=this;
  3954. return smalltalk.withContext(function($ctx1) {
  3955. var $2,$1;
  3956. $2=self._collection();
  3957. $ctx1.sendIdx["collection"]=1;
  3958. $1=_st($2)._third();
  3959. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3960. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3961. args: [],
  3962. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3963. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3964. referencedClasses: []
  3965. }),
  3966. globals.SequenceableCollectionTest);
  3967. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3968. smalltalk.addMethod(
  3969. smalltalk.method({
  3970. selector: "collection",
  3971. protocol: 'fixture',
  3972. fn: function (){
  3973. var self=this;
  3974. var $1;
  3975. $1=[(1), (2), (3), (-4)];
  3976. return $1;
  3977. },
  3978. args: [],
  3979. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3980. messageSends: [],
  3981. referencedClasses: []
  3982. }),
  3983. globals.ArrayTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "collectionFirst",
  3987. protocol: 'fixture',
  3988. fn: function (){
  3989. var self=this;
  3990. return (1);
  3991. },
  3992. args: [],
  3993. source: "collectionFirst\x0a\x09^ 1",
  3994. messageSends: [],
  3995. referencedClasses: []
  3996. }),
  3997. globals.ArrayTest);
  3998. smalltalk.addMethod(
  3999. smalltalk.method({
  4000. selector: "collectionFirstTwo",
  4001. protocol: 'fixture',
  4002. fn: function (){
  4003. var self=this;
  4004. var $1;
  4005. $1=[(1), (2)];
  4006. return $1;
  4007. },
  4008. args: [],
  4009. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. globals.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLast",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. return (-4);
  4021. },
  4022. args: [],
  4023. source: "collectionLast\x0a\x09^ -4",
  4024. messageSends: [],
  4025. referencedClasses: []
  4026. }),
  4027. globals.ArrayTest);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "collectionLastTwo",
  4031. protocol: 'fixture',
  4032. fn: function (){
  4033. var self=this;
  4034. var $1;
  4035. $1=[(3), (-4)];
  4036. return $1;
  4037. },
  4038. args: [],
  4039. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. globals.ArrayTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "collectionOfPrintStrings",
  4047. protocol: 'fixture',
  4048. fn: function (){
  4049. var self=this;
  4050. var $1;
  4051. $1=["1", "2", "3", "-4"];
  4052. return $1;
  4053. },
  4054. args: [],
  4055. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. globals.ArrayTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "collectionSize",
  4063. protocol: 'fixture',
  4064. fn: function (){
  4065. var self=this;
  4066. return (4);
  4067. },
  4068. args: [],
  4069. source: "collectionSize\x0a\x09^ 4",
  4070. messageSends: [],
  4071. referencedClasses: []
  4072. }),
  4073. globals.ArrayTest);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "collectionWithDuplicates",
  4077. protocol: 'fixture',
  4078. fn: function (){
  4079. var self=this;
  4080. var $1;
  4081. $1=["a", "b", "c", (1), (2), (1), "a"];
  4082. return $1;
  4083. },
  4084. args: [],
  4085. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4086. messageSends: [],
  4087. referencedClasses: []
  4088. }),
  4089. globals.ArrayTest);
  4090. smalltalk.addMethod(
  4091. smalltalk.method({
  4092. selector: "collectionWithNewValue",
  4093. protocol: 'fixture',
  4094. fn: function (){
  4095. var self=this;
  4096. var $1;
  4097. $1=[(1), (2), (3), (-4), "N"];
  4098. return $1;
  4099. },
  4100. args: [],
  4101. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4102. messageSends: [],
  4103. referencedClasses: []
  4104. }),
  4105. globals.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "sampleNewIndex",
  4109. protocol: 'fixture',
  4110. fn: function (){
  4111. var self=this;
  4112. return (5);
  4113. },
  4114. args: [],
  4115. source: "sampleNewIndex\x0a\x09^ 5",
  4116. messageSends: [],
  4117. referencedClasses: []
  4118. }),
  4119. globals.ArrayTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "samplesDo:",
  4123. protocol: 'fixture',
  4124. fn: function (aBlock){
  4125. var self=this;
  4126. return smalltalk.withContext(function($ctx1) {
  4127. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4128. $ctx1.supercall = false;
  4129. _st(aBlock)._value_value_((3),(3));
  4130. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4131. args: ["aBlock"],
  4132. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4133. messageSends: ["samplesDo:", "value:value:"],
  4134. referencedClasses: []
  4135. }),
  4136. globals.ArrayTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "testAdd",
  4140. protocol: 'tests',
  4141. fn: function (){
  4142. var self=this;
  4143. var array;
  4144. return smalltalk.withContext(function($ctx1) {
  4145. array=self._collection();
  4146. _st(array)._add_((6));
  4147. self._assert_equals_(_st(array)._last(),(6));
  4148. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4149. args: [],
  4150. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4151. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4152. referencedClasses: []
  4153. }),
  4154. globals.ArrayTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testAddFirst",
  4158. protocol: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. var $1,$2;
  4163. $1=self._collection();
  4164. _st($1)._addFirst_((0));
  4165. $2=_st($1)._yourself();
  4166. self._assert_equals_(_st($2)._first(),(0));
  4167. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4168. args: [],
  4169. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4170. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4171. referencedClasses: []
  4172. }),
  4173. globals.ArrayTest);
  4174. smalltalk.addMethod(
  4175. smalltalk.method({
  4176. selector: "testPrintString",
  4177. protocol: 'tests',
  4178. fn: function (){
  4179. var self=this;
  4180. var array;
  4181. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4182. return smalltalk.withContext(function($ctx1) {
  4183. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4184. array=_st($Array())._new();
  4185. $1=_st(array)._printString();
  4186. $ctx1.sendIdx["printString"]=1;
  4187. self._assert_equals_($1,"an Array ()");
  4188. $ctx1.sendIdx["assert:equals:"]=1;
  4189. $2=array;
  4190. _st($2)._add_((1));
  4191. $ctx1.sendIdx["add:"]=1;
  4192. $3=_st($2)._add_((3));
  4193. $ctx1.sendIdx["add:"]=2;
  4194. $4=_st(array)._printString();
  4195. $ctx1.sendIdx["printString"]=2;
  4196. self._assert_equals_($4,"an Array (1 3)");
  4197. $ctx1.sendIdx["assert:equals:"]=2;
  4198. _st(array)._add_("foo");
  4199. $5=_st(array)._printString();
  4200. $ctx1.sendIdx["printString"]=3;
  4201. self._assert_equals_($5,"an Array (1 3 'foo')");
  4202. $ctx1.sendIdx["assert:equals:"]=3;
  4203. $6=array;
  4204. _st($6)._remove_((1));
  4205. $ctx1.sendIdx["remove:"]=1;
  4206. $7=_st($6)._remove_((3));
  4207. $8=_st(array)._printString();
  4208. $ctx1.sendIdx["printString"]=4;
  4209. self._assert_equals_($8,"an Array ('foo')");
  4210. $ctx1.sendIdx["assert:equals:"]=4;
  4211. _st(array)._addLast_((3));
  4212. $ctx1.sendIdx["addLast:"]=1;
  4213. $9=_st(array)._printString();
  4214. $ctx1.sendIdx["printString"]=5;
  4215. self._assert_equals_($9,"an Array ('foo' 3)");
  4216. $ctx1.sendIdx["assert:equals:"]=5;
  4217. _st(array)._addLast_((3));
  4218. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4219. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4220. args: [],
  4221. 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)'.",
  4222. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4223. referencedClasses: ["Array"]
  4224. }),
  4225. globals.ArrayTest);
  4226. smalltalk.addMethod(
  4227. smalltalk.method({
  4228. selector: "testRemove",
  4229. protocol: 'tests',
  4230. fn: function (){
  4231. var self=this;
  4232. var array;
  4233. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4234. return smalltalk.withContext(function($ctx1) {
  4235. array=[(1), (2), (3), (4), (5)];
  4236. _st(array)._remove_((3));
  4237. $ctx1.sendIdx["remove:"]=1;
  4238. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4239. self._should_raise_((function(){
  4240. return smalltalk.withContext(function($ctx2) {
  4241. return _st(array)._remove_((3));
  4242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4243. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4244. args: [],
  4245. 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",
  4246. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4247. referencedClasses: ["Error"]
  4248. }),
  4249. globals.ArrayTest);
  4250. smalltalk.addMethod(
  4251. smalltalk.method({
  4252. selector: "testRemoveFromTo",
  4253. protocol: 'tests',
  4254. fn: function (){
  4255. var self=this;
  4256. return smalltalk.withContext(function($ctx1) {
  4257. var $1,$2;
  4258. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4259. $ctx1.sendIdx["removeFrom:to:"]=1;
  4260. self._assert_equals_($1,[(4)]);
  4261. $ctx1.sendIdx["assert:equals:"]=1;
  4262. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4263. $ctx1.sendIdx["removeFrom:to:"]=2;
  4264. self._assert_equals_($2,[(1), (4)]);
  4265. $ctx1.sendIdx["assert:equals:"]=2;
  4266. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4267. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4268. args: [],
  4269. 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)",
  4270. messageSends: ["assert:equals:", "removeFrom:to:"],
  4271. referencedClasses: []
  4272. }),
  4273. globals.ArrayTest);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "testRemoveIndex",
  4277. protocol: 'tests',
  4278. fn: function (){
  4279. var self=this;
  4280. return smalltalk.withContext(function($ctx1) {
  4281. var $1,$2;
  4282. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4283. $ctx1.sendIdx["removeIndex:"]=1;
  4284. self._assert_equals_($1,[(1), (3), (4)]);
  4285. $ctx1.sendIdx["assert:equals:"]=1;
  4286. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4287. $ctx1.sendIdx["removeIndex:"]=2;
  4288. self._assert_equals_($2,[(2), (3), (4)]);
  4289. $ctx1.sendIdx["assert:equals:"]=2;
  4290. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4292. args: [],
  4293. 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: #()",
  4294. messageSends: ["assert:equals:", "removeIndex:"],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testRemoveLast",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. var array;
  4305. return smalltalk.withContext(function($ctx1) {
  4306. array=[(1), (2)];
  4307. _st(array)._removeLast();
  4308. self._assert_equals_(_st(array)._last(),(1));
  4309. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4310. args: [],
  4311. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4312. messageSends: ["removeLast", "assert:equals:", "last"],
  4313. referencedClasses: []
  4314. }),
  4315. globals.ArrayTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "testReversed",
  4319. protocol: 'tests',
  4320. fn: function (){
  4321. var self=this;
  4322. var array;
  4323. return smalltalk.withContext(function($ctx1) {
  4324. array=[(5), (4), (3), (2), (1)];
  4325. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4326. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4327. args: [],
  4328. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4329. messageSends: ["assert:equals:", "reversed"],
  4330. referencedClasses: []
  4331. }),
  4332. globals.ArrayTest);
  4333. smalltalk.addMethod(
  4334. smalltalk.method({
  4335. selector: "testSort",
  4336. protocol: 'tests',
  4337. fn: function (){
  4338. var self=this;
  4339. var array;
  4340. return smalltalk.withContext(function($ctx1) {
  4341. array=[(10), (1), (5)];
  4342. _st(array)._sort();
  4343. self._assert_equals_(array,[(1), (5), (10)]);
  4344. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4345. args: [],
  4346. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4347. messageSends: ["sort", "assert:equals:"],
  4348. referencedClasses: []
  4349. }),
  4350. globals.ArrayTest);
  4351. smalltalk.addMethod(
  4352. smalltalk.method({
  4353. selector: "collectionClass",
  4354. protocol: 'fixture',
  4355. fn: function (){
  4356. var self=this;
  4357. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4358. return $Array();
  4359. },
  4360. args: [],
  4361. source: "collectionClass\x0a\x09^ Array",
  4362. messageSends: [],
  4363. referencedClasses: ["Array"]
  4364. }),
  4365. globals.ArrayTest.klass);
  4366. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4367. smalltalk.addMethod(
  4368. smalltalk.method({
  4369. selector: "collection",
  4370. protocol: 'fixture',
  4371. fn: function (){
  4372. var self=this;
  4373. return "helLo";
  4374. },
  4375. args: [],
  4376. source: "collection\x0a\x09^ 'helLo'",
  4377. messageSends: [],
  4378. referencedClasses: []
  4379. }),
  4380. globals.StringTest);
  4381. smalltalk.addMethod(
  4382. smalltalk.method({
  4383. selector: "collectionFirst",
  4384. protocol: 'fixture',
  4385. fn: function (){
  4386. var self=this;
  4387. return "h";
  4388. },
  4389. args: [],
  4390. source: "collectionFirst\x0a\x09^ 'h'",
  4391. messageSends: [],
  4392. referencedClasses: []
  4393. }),
  4394. globals.StringTest);
  4395. smalltalk.addMethod(
  4396. smalltalk.method({
  4397. selector: "collectionFirstTwo",
  4398. protocol: 'fixture',
  4399. fn: function (){
  4400. var self=this;
  4401. return "he";
  4402. },
  4403. args: [],
  4404. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4405. messageSends: [],
  4406. referencedClasses: []
  4407. }),
  4408. globals.StringTest);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "collectionLast",
  4412. protocol: 'fixture',
  4413. fn: function (){
  4414. var self=this;
  4415. return "o";
  4416. },
  4417. args: [],
  4418. source: "collectionLast\x0a\x09^ 'o'",
  4419. messageSends: [],
  4420. referencedClasses: []
  4421. }),
  4422. globals.StringTest);
  4423. smalltalk.addMethod(
  4424. smalltalk.method({
  4425. selector: "collectionLastTwo",
  4426. protocol: 'fixture',
  4427. fn: function (){
  4428. var self=this;
  4429. return "Lo";
  4430. },
  4431. args: [],
  4432. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4433. messageSends: [],
  4434. referencedClasses: []
  4435. }),
  4436. globals.StringTest);
  4437. smalltalk.addMethod(
  4438. smalltalk.method({
  4439. selector: "collectionOfPrintStrings",
  4440. protocol: 'fixture',
  4441. fn: function (){
  4442. var self=this;
  4443. return "'h''e''l''L''o'";
  4444. },
  4445. args: [],
  4446. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4447. messageSends: [],
  4448. referencedClasses: []
  4449. }),
  4450. globals.StringTest);
  4451. smalltalk.addMethod(
  4452. smalltalk.method({
  4453. selector: "collectionSize",
  4454. protocol: 'fixture',
  4455. fn: function (){
  4456. var self=this;
  4457. return (5);
  4458. },
  4459. args: [],
  4460. source: "collectionSize\x0a\x09^ 5",
  4461. messageSends: [],
  4462. referencedClasses: []
  4463. }),
  4464. globals.StringTest);
  4465. smalltalk.addMethod(
  4466. smalltalk.method({
  4467. selector: "collectionWithDuplicates",
  4468. protocol: 'fixture',
  4469. fn: function (){
  4470. var self=this;
  4471. return "abbaerte";
  4472. },
  4473. args: [],
  4474. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4475. messageSends: [],
  4476. referencedClasses: []
  4477. }),
  4478. globals.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "collectionWithNewValue",
  4482. protocol: 'fixture',
  4483. fn: function (){
  4484. var self=this;
  4485. return "helLoN";
  4486. },
  4487. args: [],
  4488. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4489. messageSends: [],
  4490. referencedClasses: []
  4491. }),
  4492. globals.StringTest);
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "sampleNewValueAsCollection",
  4496. protocol: 'fixture',
  4497. fn: function (){
  4498. var self=this;
  4499. return "N";
  4500. },
  4501. args: [],
  4502. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4503. messageSends: [],
  4504. referencedClasses: []
  4505. }),
  4506. globals.StringTest);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "samplesDo:",
  4510. protocol: 'fixture',
  4511. fn: function (aBlock){
  4512. var self=this;
  4513. return smalltalk.withContext(function($ctx1) {
  4514. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4515. $ctx1.supercall = false;
  4516. _st(aBlock)._value_value_((3),"l");
  4517. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4518. args: ["aBlock"],
  4519. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4520. messageSends: ["samplesDo:", "value:value:"],
  4521. referencedClasses: []
  4522. }),
  4523. globals.StringTest);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "testAddAll",
  4527. protocol: 'tests',
  4528. fn: function (){
  4529. var self=this;
  4530. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4531. return smalltalk.withContext(function($ctx1) {
  4532. var $1;
  4533. self._should_raise_((function(){
  4534. return smalltalk.withContext(function($ctx2) {
  4535. $1=self._collection();
  4536. $ctx2.sendIdx["collection"]=1;
  4537. return _st($1)._addAll_(self._collection());
  4538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4539. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4540. args: [],
  4541. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4542. messageSends: ["should:raise:", "addAll:", "collection"],
  4543. referencedClasses: ["Error"]
  4544. }),
  4545. globals.StringTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testAddRemove",
  4549. protocol: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4553. return smalltalk.withContext(function($ctx1) {
  4554. self._should_raise_((function(){
  4555. return smalltalk.withContext(function($ctx2) {
  4556. return "hello"._add_("a");
  4557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4558. $ctx1.sendIdx["should:raise:"]=1;
  4559. self._should_raise_((function(){
  4560. return smalltalk.withContext(function($ctx2) {
  4561. return "hello"._remove_("h");
  4562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4564. args: [],
  4565. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4566. messageSends: ["should:raise:", "add:", "remove:"],
  4567. referencedClasses: ["Error"]
  4568. }),
  4569. globals.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testAsArray",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4578. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4579. args: [],
  4580. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4581. messageSends: ["assert:equals:", "asArray"],
  4582. referencedClasses: []
  4583. }),
  4584. globals.StringTest);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "testAsLowerCase",
  4588. protocol: 'tests',
  4589. fn: function (){
  4590. var self=this;
  4591. return smalltalk.withContext(function($ctx1) {
  4592. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4593. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4594. args: [],
  4595. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4596. messageSends: ["assert:equals:", "asLowercase"],
  4597. referencedClasses: []
  4598. }),
  4599. globals.StringTest);
  4600. smalltalk.addMethod(
  4601. smalltalk.method({
  4602. selector: "testAsNumber",
  4603. protocol: 'tests',
  4604. fn: function (){
  4605. var self=this;
  4606. return smalltalk.withContext(function($ctx1) {
  4607. var $1,$2;
  4608. $1="3"._asNumber();
  4609. $ctx1.sendIdx["asNumber"]=1;
  4610. self._assert_equals_($1,(3));
  4611. $ctx1.sendIdx["assert:equals:"]=1;
  4612. $2="-3"._asNumber();
  4613. $ctx1.sendIdx["asNumber"]=2;
  4614. self._assert_equals_($2,(-3));
  4615. $ctx1.sendIdx["assert:equals:"]=2;
  4616. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4617. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4618. args: [],
  4619. 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.",
  4620. messageSends: ["assert:equals:", "asNumber"],
  4621. referencedClasses: []
  4622. }),
  4623. globals.StringTest);
  4624. smalltalk.addMethod(
  4625. smalltalk.method({
  4626. selector: "testAsUpperCase",
  4627. protocol: 'tests',
  4628. fn: function (){
  4629. var self=this;
  4630. return smalltalk.withContext(function($ctx1) {
  4631. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4632. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4633. args: [],
  4634. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4635. messageSends: ["assert:equals:", "asUppercase"],
  4636. referencedClasses: []
  4637. }),
  4638. globals.StringTest);
  4639. smalltalk.addMethod(
  4640. smalltalk.method({
  4641. selector: "testAsciiValue",
  4642. protocol: 'tests',
  4643. fn: function (){
  4644. var self=this;
  4645. var characterA,characterU;
  4646. return smalltalk.withContext(function($ctx1) {
  4647. var $1;
  4648. characterA="A";
  4649. characterU="U";
  4650. $1=_st(characterA)._asciiValue();
  4651. $ctx1.sendIdx["asciiValue"]=1;
  4652. self._assert_equals_($1,(65));
  4653. $ctx1.sendIdx["assert:equals:"]=1;
  4654. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4655. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4656. args: [],
  4657. 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",
  4658. messageSends: ["assert:equals:", "asciiValue"],
  4659. referencedClasses: []
  4660. }),
  4661. globals.StringTest);
  4662. smalltalk.addMethod(
  4663. smalltalk.method({
  4664. selector: "testAtIfAbsentPut",
  4665. protocol: 'tests',
  4666. fn: function (){
  4667. var self=this;
  4668. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4669. return smalltalk.withContext(function($ctx1) {
  4670. self._should_raise_((function(){
  4671. return smalltalk.withContext(function($ctx2) {
  4672. return "hello"._at_ifAbsentPut_((6),(function(){
  4673. return "a";
  4674. }));
  4675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4676. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4677. args: [],
  4678. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4679. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4680. referencedClasses: ["Error"]
  4681. }),
  4682. globals.StringTest);
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "testAtPut",
  4686. protocol: 'tests',
  4687. fn: function (){
  4688. var self=this;
  4689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4690. return smalltalk.withContext(function($ctx1) {
  4691. self._should_raise_((function(){
  4692. return smalltalk.withContext(function($ctx2) {
  4693. return "hello"._at_put_((1),"a");
  4694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4695. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4696. args: [],
  4697. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4698. messageSends: ["should:raise:", "at:put:"],
  4699. referencedClasses: ["Error"]
  4700. }),
  4701. globals.StringTest);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "testCapitalized",
  4705. protocol: 'tests',
  4706. fn: function (){
  4707. var self=this;
  4708. return smalltalk.withContext(function($ctx1) {
  4709. var $1,$2,$3;
  4710. $1="test"._capitalized();
  4711. $ctx1.sendIdx["capitalized"]=1;
  4712. self._assert_equals_($1,"Test");
  4713. $ctx1.sendIdx["assert:equals:"]=1;
  4714. $2="Test"._capitalized();
  4715. $ctx1.sendIdx["capitalized"]=2;
  4716. self._assert_equals_($2,"Test");
  4717. $ctx1.sendIdx["assert:equals:"]=2;
  4718. self._assert_equals_(""._capitalized(),"");
  4719. $ctx1.sendIdx["assert:equals:"]=3;
  4720. $3="Test"._isCapitalized();
  4721. $ctx1.sendIdx["isCapitalized"]=1;
  4722. self._assert_equals_($3,true);
  4723. $ctx1.sendIdx["assert:equals:"]=4;
  4724. self._assert_equals_("test"._isCapitalized(),false);
  4725. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4726. args: [],
  4727. 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.",
  4728. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4729. referencedClasses: []
  4730. }),
  4731. globals.StringTest);
  4732. smalltalk.addMethod(
  4733. smalltalk.method({
  4734. selector: "testCharCodeAt",
  4735. protocol: 'tests',
  4736. fn: function (){
  4737. var self=this;
  4738. return smalltalk.withContext(function($ctx1) {
  4739. var $1,$2,$3,$4,$5;
  4740. $1="jackie"._charCodeAt_((1));
  4741. $ctx1.sendIdx["charCodeAt:"]=1;
  4742. self._assert_equals_($1,(106));
  4743. $ctx1.sendIdx["assert:equals:"]=1;
  4744. $2="jackie"._charCodeAt_((2));
  4745. $ctx1.sendIdx["charCodeAt:"]=2;
  4746. self._assert_equals_($2,(97));
  4747. $ctx1.sendIdx["assert:equals:"]=2;
  4748. $3="jackie"._charCodeAt_((3));
  4749. $ctx1.sendIdx["charCodeAt:"]=3;
  4750. self._assert_equals_($3,(99));
  4751. $ctx1.sendIdx["assert:equals:"]=3;
  4752. $4="jackie"._charCodeAt_((4));
  4753. $ctx1.sendIdx["charCodeAt:"]=4;
  4754. self._assert_equals_($4,(107));
  4755. $ctx1.sendIdx["assert:equals:"]=4;
  4756. $5="jackie"._charCodeAt_((5));
  4757. $ctx1.sendIdx["charCodeAt:"]=5;
  4758. self._assert_equals_($5,(105));
  4759. $ctx1.sendIdx["assert:equals:"]=5;
  4760. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4761. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4762. args: [],
  4763. 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",
  4764. messageSends: ["assert:equals:", "charCodeAt:"],
  4765. referencedClasses: []
  4766. }),
  4767. globals.StringTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "testCopyFromTo",
  4771. protocol: 'tests',
  4772. fn: function (){
  4773. var self=this;
  4774. return smalltalk.withContext(function($ctx1) {
  4775. var $1;
  4776. $1="jackie"._copyFrom_to_((1),(3));
  4777. $ctx1.sendIdx["copyFrom:to:"]=1;
  4778. self._assert_equals_($1,"jac");
  4779. $ctx1.sendIdx["assert:equals:"]=1;
  4780. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4781. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4782. args: [],
  4783. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4784. messageSends: ["assert:equals:", "copyFrom:to:"],
  4785. referencedClasses: []
  4786. }),
  4787. globals.StringTest);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "testCopyWithoutAll",
  4791. protocol: 'tests',
  4792. fn: function (){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4797. args: [],
  4798. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4799. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4800. referencedClasses: []
  4801. }),
  4802. globals.StringTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testEquality",
  4806. protocol: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1,$2,$3;
  4811. self._assert_equals_("hello","hello");
  4812. $ctx1.sendIdx["assert:equals:"]=1;
  4813. $1="hello".__eq("world");
  4814. $ctx1.sendIdx["="]=1;
  4815. self._deny_($1);
  4816. $ctx1.sendIdx["deny:"]=1;
  4817. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4818. })));
  4819. $ctx1.sendIdx["="]=2;
  4820. self._deny_($2);
  4821. $ctx1.sendIdx["deny:"]=2;
  4822. $3="hello"._yourself();
  4823. $ctx1.sendIdx["yourself"]=1;
  4824. self._assert_equals_("hello",$3);
  4825. $ctx1.sendIdx["assert:equals:"]=2;
  4826. self._assert_equals_("hello"._yourself(),"hello");
  4827. self._deny_("".__eq((0)));
  4828. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4829. args: [],
  4830. 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",
  4831. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4832. referencedClasses: []
  4833. }),
  4834. globals.StringTest);
  4835. smalltalk.addMethod(
  4836. smalltalk.method({
  4837. selector: "testIdentity",
  4838. protocol: 'tests',
  4839. fn: function (){
  4840. var self=this;
  4841. return smalltalk.withContext(function($ctx1) {
  4842. var $1,$2,$4,$3,$5;
  4843. $1="hello".__eq_eq("hello");
  4844. $ctx1.sendIdx["=="]=1;
  4845. self._assert_($1);
  4846. $ctx1.sendIdx["assert:"]=1;
  4847. $2="hello".__eq_eq("world");
  4848. $ctx1.sendIdx["=="]=2;
  4849. self._deny_($2);
  4850. $ctx1.sendIdx["deny:"]=1;
  4851. $4="hello"._yourself();
  4852. $ctx1.sendIdx["yourself"]=1;
  4853. $3="hello".__eq_eq($4);
  4854. $ctx1.sendIdx["=="]=3;
  4855. self._assert_($3);
  4856. $ctx1.sendIdx["assert:"]=2;
  4857. $5=_st("hello"._yourself()).__eq_eq("hello");
  4858. $ctx1.sendIdx["=="]=4;
  4859. self._assert_($5);
  4860. self._deny_("".__eq_eq((0)));
  4861. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4862. args: [],
  4863. 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",
  4864. messageSends: ["assert:", "==", "deny:", "yourself"],
  4865. referencedClasses: []
  4866. }),
  4867. globals.StringTest);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testIdentityHash",
  4871. protocol: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. return smalltalk.withContext(function($ctx1) {
  4875. var $1,$2,$4,$3;
  4876. $1="foo"._identityHash();
  4877. $ctx1.sendIdx["identityHash"]=1;
  4878. $2="foo"._identityHash();
  4879. $ctx1.sendIdx["identityHash"]=2;
  4880. self._assert_equals_($1,$2);
  4881. $4="foo"._identityHash();
  4882. $ctx1.sendIdx["identityHash"]=3;
  4883. $3=_st($4).__eq("bar"._identityHash());
  4884. self._deny_($3);
  4885. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4886. args: [],
  4887. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4888. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4889. referencedClasses: []
  4890. }),
  4891. globals.StringTest);
  4892. smalltalk.addMethod(
  4893. smalltalk.method({
  4894. selector: "testIncludesSubString",
  4895. protocol: 'tests',
  4896. fn: function (){
  4897. var self=this;
  4898. return smalltalk.withContext(function($ctx1) {
  4899. var $1;
  4900. $1="amber"._includesSubString_("ber");
  4901. $ctx1.sendIdx["includesSubString:"]=1;
  4902. self._assert_($1);
  4903. self._deny_("amber"._includesSubString_("zork"));
  4904. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4905. args: [],
  4906. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4907. messageSends: ["assert:", "includesSubString:", "deny:"],
  4908. referencedClasses: []
  4909. }),
  4910. globals.StringTest);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "testIndexOfStartingAtWithNull",
  4914. protocol: 'tests',
  4915. fn: function (){
  4916. var self=this;
  4917. return self},
  4918. args: [],
  4919. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4920. messageSends: [],
  4921. referencedClasses: []
  4922. }),
  4923. globals.StringTest);
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "testIndexOfWithNull",
  4927. protocol: 'tests',
  4928. fn: function (){
  4929. var self=this;
  4930. return self},
  4931. args: [],
  4932. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4933. messageSends: [],
  4934. referencedClasses: []
  4935. }),
  4936. globals.StringTest);
  4937. smalltalk.addMethod(
  4938. smalltalk.method({
  4939. selector: "testIsVowel",
  4940. protocol: 'tests',
  4941. fn: function (){
  4942. var self=this;
  4943. var vowel,consonant;
  4944. return smalltalk.withContext(function($ctx1) {
  4945. var $1;
  4946. vowel="u";
  4947. consonant="z";
  4948. $1=_st(vowel)._isVowel();
  4949. $ctx1.sendIdx["isVowel"]=1;
  4950. self._assert_equals_($1,true);
  4951. $ctx1.sendIdx["assert:equals:"]=1;
  4952. self._assert_equals_(_st(consonant)._isVowel(),false);
  4953. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4954. args: [],
  4955. 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",
  4956. messageSends: ["assert:equals:", "isVowel"],
  4957. referencedClasses: []
  4958. }),
  4959. globals.StringTest);
  4960. smalltalk.addMethod(
  4961. smalltalk.method({
  4962. selector: "testJoin",
  4963. protocol: 'tests',
  4964. fn: function (){
  4965. var self=this;
  4966. return smalltalk.withContext(function($ctx1) {
  4967. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4968. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4969. args: [],
  4970. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4971. messageSends: ["assert:equals:", "join:"],
  4972. referencedClasses: []
  4973. }),
  4974. globals.StringTest);
  4975. smalltalk.addMethod(
  4976. smalltalk.method({
  4977. selector: "testRemoveAll",
  4978. protocol: 'tests',
  4979. fn: function (){
  4980. var self=this;
  4981. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4982. return smalltalk.withContext(function($ctx1) {
  4983. self._should_raise_((function(){
  4984. return smalltalk.withContext(function($ctx2) {
  4985. return _st(self._collection())._removeAll();
  4986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4987. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4988. args: [],
  4989. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4990. messageSends: ["should:raise:", "removeAll", "collection"],
  4991. referencedClasses: ["Error"]
  4992. }),
  4993. globals.StringTest);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "testReversed",
  4997. protocol: 'tests',
  4998. fn: function (){
  4999. var self=this;
  5000. return smalltalk.withContext(function($ctx1) {
  5001. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5002. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  5003. args: [],
  5004. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5005. messageSends: ["assert:equals:", "reversed"],
  5006. referencedClasses: []
  5007. }),
  5008. globals.StringTest);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "testStreamContents",
  5012. protocol: 'tests',
  5013. fn: function (){
  5014. var self=this;
  5015. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5016. return smalltalk.withContext(function($ctx1) {
  5017. var $1;
  5018. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5019. return smalltalk.withContext(function($ctx2) {
  5020. _st(aStream)._nextPutAll_("hello");
  5021. $ctx2.sendIdx["nextPutAll:"]=1;
  5022. _st(aStream)._space();
  5023. $1=_st(aStream)._nextPutAll_("world");
  5024. return $1;
  5025. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5026. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  5027. args: [],
  5028. 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'",
  5029. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5030. referencedClasses: ["String"]
  5031. }),
  5032. globals.StringTest);
  5033. smalltalk.addMethod(
  5034. smalltalk.method({
  5035. selector: "testSubStrings",
  5036. protocol: 'tests',
  5037. fn: function (){
  5038. var self=this;
  5039. return smalltalk.withContext(function($ctx1) {
  5040. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5041. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5042. args: [],
  5043. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5044. messageSends: ["assert:equals:", "subStrings:"],
  5045. referencedClasses: []
  5046. }),
  5047. globals.StringTest);
  5048. smalltalk.addMethod(
  5049. smalltalk.method({
  5050. selector: "testTrim",
  5051. protocol: 'tests',
  5052. fn: function (){
  5053. var self=this;
  5054. return smalltalk.withContext(function($ctx1) {
  5055. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5056. $ctx1.sendIdx["assert:equals:"]=1;
  5057. self._assert_equals_("jackie "._trimRight(),"jackie");
  5058. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5059. args: [],
  5060. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5061. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5062. referencedClasses: []
  5063. }),
  5064. globals.StringTest);
  5065. smalltalk.addMethod(
  5066. smalltalk.method({
  5067. selector: "testValue",
  5068. protocol: 'tests',
  5069. fn: function (){
  5070. var self=this;
  5071. return smalltalk.withContext(function($ctx1) {
  5072. self._assert_equals_("asString"._value_((1)),"1");
  5073. $ctx1.sendIdx["assert:equals:"]=1;
  5074. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5075. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5076. args: [],
  5077. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  5078. messageSends: ["assert:equals:", "value:", "collect:"],
  5079. referencedClasses: []
  5080. }),
  5081. globals.StringTest);
  5082. smalltalk.addMethod(
  5083. smalltalk.method({
  5084. selector: "collectionClass",
  5085. protocol: 'fixture',
  5086. fn: function (){
  5087. var self=this;
  5088. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5089. return $String();
  5090. },
  5091. args: [],
  5092. source: "collectionClass\x0a\x09^ String",
  5093. messageSends: [],
  5094. referencedClasses: ["String"]
  5095. }),
  5096. globals.StringTest.klass);
  5097. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5098. smalltalk.addMethod(
  5099. smalltalk.method({
  5100. selector: "collection",
  5101. protocol: 'fixture',
  5102. fn: function (){
  5103. var self=this;
  5104. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5105. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5106. return smalltalk.withContext(function($ctx1) {
  5107. var $2,$3,$1;
  5108. $2=_st($Set())._new();
  5109. _st($2)._add_($Smalltalk());
  5110. $ctx1.sendIdx["add:"]=1;
  5111. _st($2)._add_(nil);
  5112. $ctx1.sendIdx["add:"]=2;
  5113. _st($2)._add_((3).__at((3)));
  5114. $ctx1.sendIdx["add:"]=3;
  5115. _st($2)._add_(false);
  5116. $3=_st($2)._yourself();
  5117. $1=$3;
  5118. return $1;
  5119. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5120. args: [],
  5121. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5122. messageSends: ["add:", "new", "@", "yourself"],
  5123. referencedClasses: ["Set", "Smalltalk"]
  5124. }),
  5125. globals.SetTest);
  5126. smalltalk.addMethod(
  5127. smalltalk.method({
  5128. selector: "collectionOfPrintStrings",
  5129. protocol: 'fixture',
  5130. fn: function (){
  5131. var self=this;
  5132. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5133. return smalltalk.withContext(function($ctx1) {
  5134. var $2,$3,$1;
  5135. $2=_st($Set())._new();
  5136. _st($2)._add_("a SmalltalkImage");
  5137. $ctx1.sendIdx["add:"]=1;
  5138. _st($2)._add_("nil");
  5139. $ctx1.sendIdx["add:"]=2;
  5140. _st($2)._add_("3@3");
  5141. $ctx1.sendIdx["add:"]=3;
  5142. _st($2)._add_("false");
  5143. $3=_st($2)._yourself();
  5144. $1=$3;
  5145. return $1;
  5146. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5147. args: [],
  5148. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5149. messageSends: ["add:", "new", "yourself"],
  5150. referencedClasses: ["Set"]
  5151. }),
  5152. globals.SetTest);
  5153. smalltalk.addMethod(
  5154. smalltalk.method({
  5155. selector: "collectionSize",
  5156. protocol: 'fixture',
  5157. fn: function (){
  5158. var self=this;
  5159. return (4);
  5160. },
  5161. args: [],
  5162. source: "collectionSize\x0a\x09^ 4",
  5163. messageSends: [],
  5164. referencedClasses: []
  5165. }),
  5166. globals.SetTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "collectionWithDuplicates",
  5170. protocol: 'fixture',
  5171. fn: function (){
  5172. var self=this;
  5173. return smalltalk.withContext(function($ctx1) {
  5174. var $2,$3,$1;
  5175. $2=self._collection();
  5176. _st($2)._add_((0));
  5177. $3=_st($2)._yourself();
  5178. $1=$3;
  5179. return $1;
  5180. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5181. args: [],
  5182. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5183. messageSends: ["add:", "collection", "yourself"],
  5184. referencedClasses: []
  5185. }),
  5186. globals.SetTest);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "collectionWithNewValue",
  5190. protocol: 'fixture',
  5191. fn: function (){
  5192. var self=this;
  5193. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5194. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5195. return smalltalk.withContext(function($ctx1) {
  5196. var $2,$3,$1;
  5197. $2=_st($Set())._new();
  5198. _st($2)._add_($Smalltalk());
  5199. $ctx1.sendIdx["add:"]=1;
  5200. _st($2)._add_(nil);
  5201. $ctx1.sendIdx["add:"]=2;
  5202. _st($2)._add_((3).__at((3)));
  5203. $ctx1.sendIdx["add:"]=3;
  5204. _st($2)._add_("N");
  5205. $ctx1.sendIdx["add:"]=4;
  5206. _st($2)._add_(false);
  5207. $3=_st($2)._yourself();
  5208. $1=$3;
  5209. return $1;
  5210. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5211. args: [],
  5212. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5213. messageSends: ["add:", "new", "@", "yourself"],
  5214. referencedClasses: ["Set", "Smalltalk"]
  5215. }),
  5216. globals.SetTest);
  5217. smalltalk.addMethod(
  5218. smalltalk.method({
  5219. selector: "testAddAll",
  5220. protocol: 'tests',
  5221. fn: function (){
  5222. var self=this;
  5223. return smalltalk.withContext(function($ctx1) {
  5224. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5225. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5226. $ctx1.supercall = false;
  5227. $2=self._collection();
  5228. $ctx1.sendIdx["collection"]=1;
  5229. $3=$2;
  5230. $4=self._collection();
  5231. $ctx1.sendIdx["collection"]=2;
  5232. _st($3)._addAll_($4);
  5233. $ctx1.sendIdx["addAll:"]=1;
  5234. $5=_st($2)._yourself();
  5235. $ctx1.sendIdx["yourself"]=1;
  5236. $1=$5;
  5237. $6=self._collection();
  5238. $ctx1.sendIdx["collection"]=3;
  5239. self._assert_equals_($1,$6);
  5240. $ctx1.sendIdx["assert:equals:"]=1;
  5241. $8=self._collection();
  5242. $ctx1.sendIdx["collection"]=4;
  5243. $9=$8;
  5244. $10=self._collectionWithNewValue();
  5245. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5246. _st($9)._addAll_($10);
  5247. $ctx1.sendIdx["addAll:"]=2;
  5248. $11=_st($8)._yourself();
  5249. $ctx1.sendIdx["yourself"]=2;
  5250. $7=$11;
  5251. $12=self._collectionWithNewValue();
  5252. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5253. self._assert_equals_($7,$12);
  5254. $ctx1.sendIdx["assert:equals:"]=2;
  5255. $14=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5257. _st($14)._addAll_(self._collection());
  5258. $15=_st($14)._yourself();
  5259. $13=$15;
  5260. self._assert_equals_($13,self._collectionWithNewValue());
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5262. args: [],
  5263. 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",
  5264. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5265. referencedClasses: []
  5266. }),
  5267. globals.SetTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "testAddRemove",
  5271. protocol: 'tests',
  5272. fn: function (){
  5273. var self=this;
  5274. var set;
  5275. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5276. return smalltalk.withContext(function($ctx1) {
  5277. var $1,$2;
  5278. set=_st($Set())._new();
  5279. self._assert_(_st(set)._isEmpty());
  5280. $ctx1.sendIdx["assert:"]=1;
  5281. _st(set)._add_((3));
  5282. $ctx1.sendIdx["add:"]=1;
  5283. $1=_st(set)._includes_((3));
  5284. $ctx1.sendIdx["includes:"]=1;
  5285. self._assert_($1);
  5286. $ctx1.sendIdx["assert:"]=2;
  5287. _st(set)._add_((5));
  5288. $2=_st(set)._includes_((5));
  5289. $ctx1.sendIdx["includes:"]=2;
  5290. self._assert_($2);
  5291. _st(set)._remove_((3));
  5292. self._deny_(_st(set)._includes_((3)));
  5293. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5294. args: [],
  5295. 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)",
  5296. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5297. referencedClasses: ["Set"]
  5298. }),
  5299. globals.SetTest);
  5300. smalltalk.addMethod(
  5301. smalltalk.method({
  5302. selector: "testAt",
  5303. protocol: 'tests',
  5304. fn: function (){
  5305. var self=this;
  5306. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5307. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5308. return smalltalk.withContext(function($ctx1) {
  5309. self._should_raise_((function(){
  5310. return smalltalk.withContext(function($ctx2) {
  5311. return _st(_st($Set())._new())._at_put_((1),(2));
  5312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5313. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5314. args: [],
  5315. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5316. messageSends: ["should:raise:", "at:put:", "new"],
  5317. referencedClasses: ["Set", "Error"]
  5318. }),
  5319. globals.SetTest);
  5320. smalltalk.addMethod(
  5321. smalltalk.method({
  5322. selector: "testCollect",
  5323. protocol: 'tests',
  5324. fn: function (){
  5325. var self=this;
  5326. return smalltalk.withContext(function($ctx1) {
  5327. var $2,$1;
  5328. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5329. $ctx1.supercall = false;
  5330. $2=[(5), (6), (8)]._asSet();
  5331. $ctx1.sendIdx["asSet"]=1;
  5332. $1=_st($2)._collect_((function(x){
  5333. return smalltalk.withContext(function($ctx2) {
  5334. return _st(x).__backslash_backslash((3));
  5335. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5336. self._assert_equals_($1,[(0), (2)]._asSet());
  5337. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5338. args: [],
  5339. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5340. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5341. referencedClasses: []
  5342. }),
  5343. globals.SetTest);
  5344. smalltalk.addMethod(
  5345. smalltalk.method({
  5346. selector: "testComma",
  5347. protocol: 'tests',
  5348. fn: function (){
  5349. var self=this;
  5350. return smalltalk.withContext(function($ctx1) {
  5351. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5352. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5353. $ctx1.supercall = false;
  5354. $2=self._collection();
  5355. $ctx1.sendIdx["collection"]=1;
  5356. $3=self._collection();
  5357. $ctx1.sendIdx["collection"]=2;
  5358. $1=_st($2).__comma($3);
  5359. $ctx1.sendIdx[","]=1;
  5360. $4=self._collection();
  5361. $ctx1.sendIdx["collection"]=3;
  5362. self._assert_equals_($1,$4);
  5363. $ctx1.sendIdx["assert:equals:"]=1;
  5364. $6=self._collection();
  5365. $ctx1.sendIdx["collection"]=4;
  5366. $7=self._collectionWithNewValue();
  5367. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5368. $5=_st($6).__comma($7);
  5369. $ctx1.sendIdx[","]=2;
  5370. $8=self._collectionWithNewValue();
  5371. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5372. self._assert_equals_($5,$8);
  5373. $ctx1.sendIdx["assert:equals:"]=2;
  5374. $10=self._collectionWithNewValue();
  5375. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5376. $9=_st($10).__comma(self._collection());
  5377. self._assert_equals_($9,self._collectionWithNewValue());
  5378. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5379. args: [],
  5380. 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",
  5381. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5382. referencedClasses: []
  5383. }),
  5384. globals.SetTest);
  5385. smalltalk.addMethod(
  5386. smalltalk.method({
  5387. selector: "testComparing",
  5388. protocol: 'tests',
  5389. fn: function (){
  5390. var self=this;
  5391. return smalltalk.withContext(function($ctx1) {
  5392. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5393. $1=[(0), (2)]._asSet();
  5394. $ctx1.sendIdx["asSet"]=1;
  5395. $2=[(0), (2)]._asSet();
  5396. $ctx1.sendIdx["asSet"]=2;
  5397. self._assert_equals_($1,$2);
  5398. $ctx1.sendIdx["assert:equals:"]=1;
  5399. $3=[(2), (0)]._asSet();
  5400. $ctx1.sendIdx["asSet"]=3;
  5401. $4=[(0), (2)]._asSet();
  5402. $ctx1.sendIdx["asSet"]=4;
  5403. self._assert_equals_($3,$4);
  5404. $6=[(0), (2), (3)]._asSet();
  5405. $ctx1.sendIdx["asSet"]=5;
  5406. $7=[(0), (2)]._asSet();
  5407. $ctx1.sendIdx["asSet"]=6;
  5408. $5=_st($6).__eq($7);
  5409. $ctx1.sendIdx["="]=1;
  5410. self._deny_($5);
  5411. $ctx1.sendIdx["deny:"]=1;
  5412. $9=[(1), (2)]._asSet();
  5413. $ctx1.sendIdx["asSet"]=7;
  5414. $8=_st($9).__eq([(0), (2)]._asSet());
  5415. self._deny_($8);
  5416. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5417. args: [],
  5418. 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",
  5419. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5420. referencedClasses: []
  5421. }),
  5422. globals.SetTest);
  5423. smalltalk.addMethod(
  5424. smalltalk.method({
  5425. selector: "testPrintString",
  5426. protocol: 'tests',
  5427. fn: function (){
  5428. var self=this;
  5429. var set;
  5430. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5431. return smalltalk.withContext(function($ctx1) {
  5432. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5433. set=_st($Set())._new();
  5434. $1=_st(set)._printString();
  5435. $ctx1.sendIdx["printString"]=1;
  5436. self._assert_equals_($1,"a Set ()");
  5437. $ctx1.sendIdx["assert:equals:"]=1;
  5438. $2=set;
  5439. _st($2)._add_((1));
  5440. $ctx1.sendIdx["add:"]=1;
  5441. $3=_st($2)._add_((3));
  5442. $ctx1.sendIdx["add:"]=2;
  5443. $4=_st(set)._printString();
  5444. $ctx1.sendIdx["printString"]=2;
  5445. self._assert_equals_($4,"a Set (1 3)");
  5446. $ctx1.sendIdx["assert:equals:"]=2;
  5447. _st(set)._add_("foo");
  5448. $ctx1.sendIdx["add:"]=3;
  5449. $5=_st(set)._printString();
  5450. $ctx1.sendIdx["printString"]=3;
  5451. self._assert_equals_($5,"a Set (1 3 'foo')");
  5452. $ctx1.sendIdx["assert:equals:"]=3;
  5453. $6=set;
  5454. _st($6)._remove_((1));
  5455. $ctx1.sendIdx["remove:"]=1;
  5456. $7=_st($6)._remove_((3));
  5457. $8=_st(set)._printString();
  5458. $ctx1.sendIdx["printString"]=4;
  5459. self._assert_equals_($8,"a Set ('foo')");
  5460. $ctx1.sendIdx["assert:equals:"]=4;
  5461. _st(set)._add_((3));
  5462. $ctx1.sendIdx["add:"]=4;
  5463. $9=_st(set)._printString();
  5464. $ctx1.sendIdx["printString"]=5;
  5465. self._assert_equals_($9,"a Set (3 'foo')");
  5466. $ctx1.sendIdx["assert:equals:"]=5;
  5467. _st(set)._add_((3));
  5468. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5469. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5470. args: [],
  5471. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5472. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5473. referencedClasses: ["Set"]
  5474. }),
  5475. globals.SetTest);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "testUnboxedObjects",
  5479. protocol: 'tests',
  5480. fn: function (){
  5481. var self=this;
  5482. return smalltalk.withContext(function($ctx1) {
  5483. var $4,$3,$2,$1;
  5484. $4="foo"._yourself();
  5485. $ctx1.sendIdx["yourself"]=1;
  5486. $3=[$4,"foo"._yourself()];
  5487. $2=_st($3)._asSet();
  5488. $1=_st($2)._asArray();
  5489. self._assert_equals_($1,["foo"]);
  5490. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5491. args: [],
  5492. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5493. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5494. referencedClasses: []
  5495. }),
  5496. globals.SetTest);
  5497. smalltalk.addMethod(
  5498. smalltalk.method({
  5499. selector: "testUnicity",
  5500. protocol: 'tests',
  5501. fn: function (){
  5502. var self=this;
  5503. var set;
  5504. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5505. return smalltalk.withContext(function($ctx1) {
  5506. var $1;
  5507. set=_st($Set())._new();
  5508. _st(set)._add_((21));
  5509. $ctx1.sendIdx["add:"]=1;
  5510. _st(set)._add_("hello");
  5511. $ctx1.sendIdx["add:"]=2;
  5512. _st(set)._add_((21));
  5513. $ctx1.sendIdx["add:"]=3;
  5514. $1=_st(set)._size();
  5515. $ctx1.sendIdx["size"]=1;
  5516. self._assert_equals_($1,(2));
  5517. $ctx1.sendIdx["assert:equals:"]=1;
  5518. _st(set)._add_("hello");
  5519. self._assert_equals_(_st(set)._size(),(2));
  5520. $ctx1.sendIdx["assert:equals:"]=2;
  5521. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5522. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5523. args: [],
  5524. 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')",
  5525. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5526. referencedClasses: ["Set"]
  5527. }),
  5528. globals.SetTest);
  5529. smalltalk.addMethod(
  5530. smalltalk.method({
  5531. selector: "collectionClass",
  5532. protocol: 'fixture',
  5533. fn: function (){
  5534. var self=this;
  5535. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5536. return $Set();
  5537. },
  5538. args: [],
  5539. source: "collectionClass\x0a\x09^ Set",
  5540. messageSends: [],
  5541. referencedClasses: ["Set"]
  5542. }),
  5543. globals.SetTest.klass);
  5544. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5545. smalltalk.addMethod(
  5546. smalltalk.method({
  5547. selector: "testShow",
  5548. protocol: 'tests',
  5549. fn: function (){
  5550. var self=this;
  5551. var originalTranscript;
  5552. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5553. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5554. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5555. return smalltalk.withContext(function($ctx1) {
  5556. originalTranscript=_st($Transcript())._current();
  5557. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5558. $ctx1.sendIdx["register:"]=1;
  5559. self._shouldnt_raise_((function(){
  5560. return smalltalk.withContext(function($ctx2) {
  5561. return _st($Transcript())._show_("Hello console!");
  5562. $ctx2.sendIdx["show:"]=1;
  5563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5564. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5565. self._shouldnt_raise_((function(){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. return _st($Transcript())._show_(console);
  5568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5569. _st($Transcript())._register_(originalTranscript);
  5570. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5571. args: [],
  5572. 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.",
  5573. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5574. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5575. }),
  5576. globals.ConsoleTranscriptTest);
  5577. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "jsNull",
  5581. protocol: 'accessing',
  5582. fn: function (){
  5583. var self=this;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. return null;
  5586. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)})},
  5587. args: [],
  5588. source: "jsNull\x0a\x09<return null>",
  5589. messageSends: [],
  5590. referencedClasses: []
  5591. }),
  5592. globals.JSObjectProxyTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "jsObject",
  5596. protocol: 'accessing',
  5597. fn: function (){
  5598. var self=this;
  5599. return smalltalk.withContext(function($ctx1) {
  5600. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5601. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5602. args: [],
  5603. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5604. messageSends: [],
  5605. referencedClasses: []
  5606. }),
  5607. globals.JSObjectProxyTest);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "jsUndefined",
  5611. protocol: 'accessing',
  5612. fn: function (){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. return;
  5616. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)})},
  5617. args: [],
  5618. source: "jsUndefined\x0a\x09<return>",
  5619. messageSends: [],
  5620. referencedClasses: []
  5621. }),
  5622. globals.JSObjectProxyTest);
  5623. smalltalk.addMethod(
  5624. smalltalk.method({
  5625. selector: "testAtIfAbsent",
  5626. protocol: 'tests',
  5627. fn: function (){
  5628. var self=this;
  5629. var testObject;
  5630. return smalltalk.withContext(function($ctx1) {
  5631. var $1,$2,$3;
  5632. testObject=self._jsObject();
  5633. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5634. return "Property does not exist";
  5635. }));
  5636. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5637. self._assert_equals_($1,"Property does not exist");
  5638. $ctx1.sendIdx["assert:equals:"]=1;
  5639. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5640. return "Property does not exist";
  5641. }));
  5642. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5643. self._assert_equals_($2,nil);
  5644. $ctx1.sendIdx["assert:equals:"]=2;
  5645. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5646. return "Property does not exist";
  5647. }));
  5648. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5649. self._assert_equals_($3,(1));
  5650. $ctx1.sendIdx["assert:equals:"]=3;
  5651. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5652. return "Property does not exist";
  5653. })),nil);
  5654. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5655. args: [],
  5656. 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.",
  5657. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5658. referencedClasses: []
  5659. }),
  5660. globals.JSObjectProxyTest);
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "testAtIfPresent",
  5664. protocol: 'tests',
  5665. fn: function (){
  5666. var self=this;
  5667. var testObject;
  5668. return smalltalk.withContext(function($ctx1) {
  5669. var $2,$1,$4,$3,$6,$5;
  5670. testObject=self._jsObject();
  5671. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5672. return smalltalk.withContext(function($ctx2) {
  5673. $2=_st(x)._asString();
  5674. $ctx2.sendIdx["asString"]=1;
  5675. return "hello ".__comma($2);
  5676. $ctx2.sendIdx[","]=1;
  5677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5678. $ctx1.sendIdx["at:ifPresent:"]=1;
  5679. self._assert_equals_($1,nil);
  5680. $ctx1.sendIdx["assert:equals:"]=1;
  5681. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5682. return smalltalk.withContext(function($ctx2) {
  5683. $4=_st(x)._asString();
  5684. $ctx2.sendIdx["asString"]=2;
  5685. return "hello ".__comma($4);
  5686. $ctx2.sendIdx[","]=2;
  5687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5688. $ctx1.sendIdx["at:ifPresent:"]=2;
  5689. self._assert_equals_($3,"hello nil");
  5690. $ctx1.sendIdx["assert:equals:"]=2;
  5691. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5692. return smalltalk.withContext(function($ctx2) {
  5693. $6=_st(x)._asString();
  5694. $ctx2.sendIdx["asString"]=3;
  5695. return "hello ".__comma($6);
  5696. $ctx2.sendIdx[","]=3;
  5697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5698. $ctx1.sendIdx["at:ifPresent:"]=3;
  5699. self._assert_equals_($5,"hello 1");
  5700. $ctx1.sendIdx["assert:equals:"]=3;
  5701. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5702. return smalltalk.withContext(function($ctx2) {
  5703. return "hello ".__comma(_st(x)._asString());
  5704. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5705. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5706. args: [],
  5707. 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'.",
  5708. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5709. referencedClasses: []
  5710. }),
  5711. globals.JSObjectProxyTest);
  5712. smalltalk.addMethod(
  5713. smalltalk.method({
  5714. selector: "testAtIfPresentIfAbsent",
  5715. protocol: 'tests',
  5716. fn: function (){
  5717. var self=this;
  5718. var testObject;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. var $2,$1,$4,$3,$6,$5;
  5721. testObject=self._jsObject();
  5722. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5723. return smalltalk.withContext(function($ctx2) {
  5724. $2=_st(x)._asString();
  5725. $ctx2.sendIdx["asString"]=1;
  5726. return "hello ".__comma($2);
  5727. $ctx2.sendIdx[","]=1;
  5728. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5729. return "not present";
  5730. }));
  5731. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5732. self._assert_equals_($1,"not present");
  5733. $ctx1.sendIdx["assert:equals:"]=1;
  5734. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5735. return smalltalk.withContext(function($ctx2) {
  5736. $4=_st(x)._asString();
  5737. $ctx2.sendIdx["asString"]=2;
  5738. return "hello ".__comma($4);
  5739. $ctx2.sendIdx[","]=2;
  5740. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5741. return "not present";
  5742. }));
  5743. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5744. self._assert_equals_($3,"hello nil");
  5745. $ctx1.sendIdx["assert:equals:"]=2;
  5746. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5747. return smalltalk.withContext(function($ctx2) {
  5748. $6=_st(x)._asString();
  5749. $ctx2.sendIdx["asString"]=3;
  5750. return "hello ".__comma($6);
  5751. $ctx2.sendIdx[","]=3;
  5752. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5753. return "not present";
  5754. }));
  5755. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5756. self._assert_equals_($5,"hello 1");
  5757. $ctx1.sendIdx["assert:equals:"]=3;
  5758. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5759. return smalltalk.withContext(function($ctx2) {
  5760. return "hello ".__comma(_st(x)._asString());
  5761. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5762. return "not present";
  5763. })),"hello nil");
  5764. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5765. args: [],
  5766. 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'.",
  5767. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5768. referencedClasses: []
  5769. }),
  5770. globals.JSObjectProxyTest);
  5771. smalltalk.addMethod(
  5772. smalltalk.method({
  5773. selector: "testAtPut",
  5774. protocol: 'tests',
  5775. fn: function (){
  5776. var self=this;
  5777. var testObject;
  5778. return smalltalk.withContext(function($ctx1) {
  5779. var $2,$1;
  5780. testObject=self._jsObject();
  5781. $2=_st(testObject)._at_("abc");
  5782. $ctx1.sendIdx["at:"]=1;
  5783. $1=_st($2).__tild_eq("xyz");
  5784. self._assert_($1);
  5785. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5786. $ctx1.sendIdx["assert:equals:"]=1;
  5787. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5788. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5789. args: [],
  5790. 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'",
  5791. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5792. referencedClasses: []
  5793. }),
  5794. globals.JSObjectProxyTest);
  5795. smalltalk.addMethod(
  5796. smalltalk.method({
  5797. selector: "testComparison",
  5798. protocol: 'tests',
  5799. fn: function (){
  5800. var self=this;
  5801. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5802. return smalltalk.withContext(function($ctx1) {
  5803. var $1,$2;
  5804. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5805. $1=_st(console).__eq(console);
  5806. $ctx1.sendIdx["="]=1;
  5807. self._assert_($1);
  5808. $2=_st(console).__eq(_st($Object())._new());
  5809. $ctx1.sendIdx["="]=2;
  5810. self._deny_($2);
  5811. $ctx1.sendIdx["deny:"]=1;
  5812. self._deny_(_st(console).__eq(self._jsObject()));
  5813. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5814. args: [],
  5815. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5816. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5817. referencedClasses: ["Object"]
  5818. }),
  5819. globals.JSObjectProxyTest);
  5820. smalltalk.addMethod(
  5821. smalltalk.method({
  5822. selector: "testDNU",
  5823. protocol: 'tests',
  5824. fn: function (){
  5825. var self=this;
  5826. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5827. return smalltalk.withContext(function($ctx1) {
  5828. self._should_raise_((function(){
  5829. return smalltalk.withContext(function($ctx2) {
  5830. return _st(self._jsObject())._foo();
  5831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5832. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5833. args: [],
  5834. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5835. messageSends: ["should:raise:", "foo", "jsObject"],
  5836. referencedClasses: ["MessageNotUnderstood"]
  5837. }),
  5838. globals.JSObjectProxyTest);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "testMessageSend",
  5842. protocol: 'tests',
  5843. fn: function (){
  5844. var self=this;
  5845. return smalltalk.withContext(function($ctx1) {
  5846. var $2,$1,$4,$3;
  5847. $2=self._jsObject();
  5848. $ctx1.sendIdx["jsObject"]=1;
  5849. $1=_st($2)._a();
  5850. self._assert_equals_($1,(1));
  5851. $ctx1.sendIdx["assert:equals:"]=1;
  5852. $4=self._jsObject();
  5853. $ctx1.sendIdx["jsObject"]=2;
  5854. $3=_st($4)._b();
  5855. self._assert_equals_($3,(2));
  5856. $ctx1.sendIdx["assert:equals:"]=2;
  5857. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5858. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5859. args: [],
  5860. 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",
  5861. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5862. referencedClasses: []
  5863. }),
  5864. globals.JSObjectProxyTest);
  5865. smalltalk.addMethod(
  5866. smalltalk.method({
  5867. selector: "testMethodWithArguments",
  5868. protocol: 'tests',
  5869. fn: function (){
  5870. var self=this;
  5871. return smalltalk.withContext(function($ctx1) {
  5872. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5873. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5874. args: [],
  5875. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5876. messageSends: ["assert:equals:", "c:", "jsObject"],
  5877. referencedClasses: []
  5878. }),
  5879. globals.JSObjectProxyTest);
  5880. smalltalk.addMethod(
  5881. smalltalk.method({
  5882. selector: "testPrinting",
  5883. protocol: 'tests',
  5884. fn: function (){
  5885. var self=this;
  5886. return smalltalk.withContext(function($ctx1) {
  5887. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5888. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5889. args: [],
  5890. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5891. messageSends: ["assert:equals:", "printString", "jsObject"],
  5892. referencedClasses: []
  5893. }),
  5894. globals.JSObjectProxyTest);
  5895. smalltalk.addMethod(
  5896. smalltalk.method({
  5897. selector: "testPropertyThatReturnsEmptyString",
  5898. protocol: 'tests',
  5899. fn: function (){
  5900. var self=this;
  5901. var object;
  5902. return smalltalk.withContext(function($ctx1) {
  5903. var $1;
  5904. object=self._jsObject();
  5905. $1=_st(object)._d();
  5906. $ctx1.sendIdx["d"]=1;
  5907. self._assert_equals_($1,"");
  5908. $ctx1.sendIdx["assert:equals:"]=1;
  5909. _st(object)._d_("hello");
  5910. self._assert_equals_(_st(object)._d(),"hello");
  5911. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5912. args: [],
  5913. 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'",
  5914. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5915. referencedClasses: []
  5916. }),
  5917. globals.JSObjectProxyTest);
  5918. smalltalk.addMethod(
  5919. smalltalk.method({
  5920. selector: "testPropertyThatReturnsUndefined",
  5921. protocol: 'tests',
  5922. fn: function (){
  5923. var self=this;
  5924. var object;
  5925. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5926. return smalltalk.withContext(function($ctx1) {
  5927. object=self._jsObject();
  5928. self._shouldnt_raise_((function(){
  5929. return smalltalk.withContext(function($ctx2) {
  5930. return _st(object)._e();
  5931. $ctx2.sendIdx["e"]=1;
  5932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5933. self._assert_(_st(_st(object)._e())._isNil());
  5934. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5935. args: [],
  5936. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5937. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5938. referencedClasses: ["MessageNotUnderstood"]
  5939. }),
  5940. globals.JSObjectProxyTest);
  5941. smalltalk.addMethod(
  5942. smalltalk.method({
  5943. selector: "testSetPropertyWithFalsyValue",
  5944. protocol: 'tests',
  5945. fn: function (){
  5946. var self=this;
  5947. var jsObject;
  5948. return smalltalk.withContext(function($ctx1) {
  5949. var $1,$2,$3,$4,$5;
  5950. jsObject=self._jsObject();
  5951. $1=_st(jsObject)._a();
  5952. $ctx1.sendIdx["a"]=1;
  5953. self._assert_equals_($1,(1));
  5954. $ctx1.sendIdx["assert:equals:"]=1;
  5955. _st(jsObject)._a_(self._jsNull());
  5956. $ctx1.sendIdx["a:"]=1;
  5957. $2=_st(jsObject)._a();
  5958. $ctx1.sendIdx["a"]=2;
  5959. self._assert_equals_($2,nil);
  5960. $ctx1.sendIdx["assert:equals:"]=2;
  5961. _st(jsObject)._a_((0));
  5962. $ctx1.sendIdx["a:"]=2;
  5963. $3=_st(jsObject)._a();
  5964. $ctx1.sendIdx["a"]=3;
  5965. self._assert_equals_($3,(0));
  5966. $ctx1.sendIdx["assert:equals:"]=3;
  5967. _st(jsObject)._a_(self._jsUndefined());
  5968. $ctx1.sendIdx["a:"]=3;
  5969. $4=_st(jsObject)._a();
  5970. $ctx1.sendIdx["a"]=4;
  5971. self._assert_equals_($4,nil);
  5972. $ctx1.sendIdx["assert:equals:"]=4;
  5973. _st(jsObject)._a_("");
  5974. $ctx1.sendIdx["a:"]=4;
  5975. $5=_st(jsObject)._a();
  5976. $ctx1.sendIdx["a"]=5;
  5977. self._assert_equals_($5,"");
  5978. $ctx1.sendIdx["assert:equals:"]=5;
  5979. _st(jsObject)._a_(false);
  5980. self._assert_equals_(_st(jsObject)._a(),false);
  5981. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5982. args: [],
  5983. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  5984. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  5985. referencedClasses: []
  5986. }),
  5987. globals.JSObjectProxyTest);
  5988. smalltalk.addMethod(
  5989. smalltalk.method({
  5990. selector: "testValue",
  5991. protocol: 'tests',
  5992. fn: function (){
  5993. var self=this;
  5994. var testObject;
  5995. return smalltalk.withContext(function($ctx1) {
  5996. testObject=self._jsObject();
  5997. _st(testObject)._at_put_("value","aValue");
  5998. self._assert_equals_(_st(testObject)._value(),"aValue");
  5999. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  6000. args: [],
  6001. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  6002. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  6003. referencedClasses: []
  6004. }),
  6005. globals.JSObjectProxyTest);
  6006. smalltalk.addMethod(
  6007. smalltalk.method({
  6008. selector: "testYourself",
  6009. protocol: 'tests',
  6010. fn: function (){
  6011. var self=this;
  6012. var object;
  6013. return smalltalk.withContext(function($ctx1) {
  6014. var $1,$2;
  6015. $1=self._jsObject();
  6016. _st($1)._d_("test");
  6017. $2=_st($1)._yourself();
  6018. object=$2;
  6019. self._assert_equals_(_st(object)._d(),"test");
  6020. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  6021. args: [],
  6022. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  6023. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  6024. referencedClasses: []
  6025. }),
  6026. globals.JSObjectProxyTest);
  6027. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  6028. smalltalk.addMethod(
  6029. smalltalk.method({
  6030. selector: "testCatchingException",
  6031. protocol: 'tests',
  6032. fn: function (){
  6033. var self=this;
  6034. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6035. return smalltalk.withContext(function($ctx1) {
  6036. _st((function(){
  6037. return smalltalk.withContext(function($ctx2) {
  6038. return self._throwException();
  6039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  6040. return smalltalk.withContext(function($ctx2) {
  6041. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  6042. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  6043. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  6044. args: [],
  6045. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  6046. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  6047. referencedClasses: ["Error"]
  6048. }),
  6049. globals.JavaScriptExceptionTest);
  6050. smalltalk.addMethod(
  6051. smalltalk.method({
  6052. selector: "testRaisingException",
  6053. protocol: 'tests',
  6054. fn: function (){
  6055. var self=this;
  6056. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6057. return smalltalk.withContext(function($ctx1) {
  6058. self._should_raise_((function(){
  6059. return smalltalk.withContext(function($ctx2) {
  6060. return self._throwException();
  6061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  6062. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  6063. args: [],
  6064. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  6065. messageSends: ["should:raise:", "throwException"],
  6066. referencedClasses: ["JavaScriptException"]
  6067. }),
  6068. globals.JavaScriptExceptionTest);
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "throwException",
  6072. protocol: 'helpers',
  6073. fn: function (){
  6074. var self=this;
  6075. return smalltalk.withContext(function($ctx1) {
  6076. throw 'test';
  6077. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  6078. args: [],
  6079. source: "throwException\x0a\x09<throw 'test'>",
  6080. messageSends: [],
  6081. referencedClasses: []
  6082. }),
  6083. globals.JavaScriptExceptionTest);
  6084. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  6085. smalltalk.addMethod(
  6086. smalltalk.method({
  6087. selector: "testValue",
  6088. protocol: 'tests',
  6089. fn: function (){
  6090. var self=this;
  6091. var messageSend;
  6092. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6093. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6094. return smalltalk.withContext(function($ctx1) {
  6095. var $1,$2;
  6096. $1=_st($MessageSend())._new();
  6097. $ctx1.sendIdx["new"]=1;
  6098. _st($1)._receiver_(_st($Object())._new());
  6099. _st($1)._selector_("asString");
  6100. $2=_st($1)._yourself();
  6101. messageSend=$2;
  6102. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6103. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  6104. args: [],
  6105. 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'",
  6106. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6107. referencedClasses: ["MessageSend", "Object"]
  6108. }),
  6109. globals.MessageSendTest);
  6110. smalltalk.addMethod(
  6111. smalltalk.method({
  6112. selector: "testValueWithArguments",
  6113. protocol: 'tests',
  6114. fn: function (){
  6115. var self=this;
  6116. var messageSend;
  6117. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6118. return smalltalk.withContext(function($ctx1) {
  6119. var $1,$2;
  6120. $1=_st($MessageSend())._new();
  6121. _st($1)._receiver_((2));
  6122. _st($1)._selector_("+");
  6123. $2=_st($1)._yourself();
  6124. messageSend=$2;
  6125. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6126. $ctx1.sendIdx["assert:equals:"]=1;
  6127. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6128. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6129. args: [],
  6130. 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",
  6131. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6132. referencedClasses: ["MessageSend"]
  6133. }),
  6134. globals.MessageSendTest);
  6135. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6136. smalltalk.addMethod(
  6137. smalltalk.method({
  6138. selector: "codeGeneratorClass",
  6139. protocol: 'accessing',
  6140. fn: function (){
  6141. var self=this;
  6142. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6143. return $CodeGenerator();
  6144. },
  6145. args: [],
  6146. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6147. messageSends: [],
  6148. referencedClasses: ["CodeGenerator"]
  6149. }),
  6150. globals.MethodInheritanceTest);
  6151. smalltalk.addMethod(
  6152. smalltalk.method({
  6153. selector: "compiler",
  6154. protocol: 'factory',
  6155. fn: function (){
  6156. var self=this;
  6157. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6158. return smalltalk.withContext(function($ctx1) {
  6159. var $2,$3,$1;
  6160. $2=_st($Compiler())._new();
  6161. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6162. $3=_st($2)._yourself();
  6163. $1=$3;
  6164. return $1;
  6165. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6166. args: [],
  6167. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6168. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6169. referencedClasses: ["Compiler"]
  6170. }),
  6171. globals.MethodInheritanceTest);
  6172. smalltalk.addMethod(
  6173. smalltalk.method({
  6174. selector: "deinstallBottom",
  6175. protocol: 'testing',
  6176. fn: function (){
  6177. var self=this;
  6178. return smalltalk.withContext(function($ctx1) {
  6179. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6180. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6181. args: [],
  6182. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6183. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6184. referencedClasses: []
  6185. }),
  6186. globals.MethodInheritanceTest);
  6187. smalltalk.addMethod(
  6188. smalltalk.method({
  6189. selector: "deinstallMiddle",
  6190. protocol: 'testing',
  6191. fn: function (){
  6192. var self=this;
  6193. return smalltalk.withContext(function($ctx1) {
  6194. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6195. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6196. args: [],
  6197. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6198. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6199. referencedClasses: []
  6200. }),
  6201. globals.MethodInheritanceTest);
  6202. smalltalk.addMethod(
  6203. smalltalk.method({
  6204. selector: "deinstallTop",
  6205. protocol: 'testing',
  6206. fn: function (){
  6207. var self=this;
  6208. return smalltalk.withContext(function($ctx1) {
  6209. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6210. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6211. args: [],
  6212. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6213. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6214. referencedClasses: []
  6215. }),
  6216. globals.MethodInheritanceTest);
  6217. smalltalk.addMethod(
  6218. smalltalk.method({
  6219. selector: "installBottom:",
  6220. protocol: 'testing',
  6221. fn: function (aString){
  6222. var self=this;
  6223. return smalltalk.withContext(function($ctx1) {
  6224. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6225. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6226. args: ["aString"],
  6227. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6228. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6229. referencedClasses: []
  6230. }),
  6231. globals.MethodInheritanceTest);
  6232. smalltalk.addMethod(
  6233. smalltalk.method({
  6234. selector: "installMiddle:",
  6235. protocol: 'testing',
  6236. fn: function (aString){
  6237. var self=this;
  6238. return smalltalk.withContext(function($ctx1) {
  6239. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6240. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6241. args: ["aString"],
  6242. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6243. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6244. referencedClasses: []
  6245. }),
  6246. globals.MethodInheritanceTest);
  6247. smalltalk.addMethod(
  6248. smalltalk.method({
  6249. selector: "installTop:",
  6250. protocol: 'testing',
  6251. fn: function (aString){
  6252. var self=this;
  6253. return smalltalk.withContext(function($ctx1) {
  6254. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6255. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6256. args: ["aString"],
  6257. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6258. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6259. referencedClasses: []
  6260. }),
  6261. globals.MethodInheritanceTest);
  6262. smalltalk.addMethod(
  6263. smalltalk.method({
  6264. selector: "setUp",
  6265. protocol: 'initialization',
  6266. fn: function (){
  6267. var self=this;
  6268. return smalltalk.withContext(function($ctx1) {
  6269. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6270. $ctx1.sendIdx["new"]=1;
  6271. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6272. $ctx1.sendIdx["new"]=2;
  6273. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6274. self["@method"]=nil;
  6275. self["@performBlock"]=(function(){
  6276. return smalltalk.withContext(function($ctx2) {
  6277. return self._error_("performBlock not initialized");
  6278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6279. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6280. args: [],
  6281. 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' ]",
  6282. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6283. referencedClasses: []
  6284. }),
  6285. globals.MethodInheritanceTest);
  6286. smalltalk.addMethod(
  6287. smalltalk.method({
  6288. selector: "shouldMNU",
  6289. protocol: 'testing',
  6290. fn: function (){
  6291. var self=this;
  6292. return smalltalk.withContext(function($ctx1) {
  6293. self._shouldMNUTop();
  6294. self._shouldMNUMiddle();
  6295. self._shouldMNUBottom();
  6296. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6297. args: [],
  6298. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6299. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6300. referencedClasses: []
  6301. }),
  6302. globals.MethodInheritanceTest);
  6303. smalltalk.addMethod(
  6304. smalltalk.method({
  6305. selector: "shouldMNUBottom",
  6306. protocol: 'testing',
  6307. fn: function (){
  6308. var self=this;
  6309. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6310. return smalltalk.withContext(function($ctx1) {
  6311. self._should_raise_((function(){
  6312. return smalltalk.withContext(function($ctx2) {
  6313. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6315. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6316. args: [],
  6317. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6318. messageSends: ["should:raise:", "value:"],
  6319. referencedClasses: ["MessageNotUnderstood"]
  6320. }),
  6321. globals.MethodInheritanceTest);
  6322. smalltalk.addMethod(
  6323. smalltalk.method({
  6324. selector: "shouldMNUMiddle",
  6325. protocol: 'testing',
  6326. fn: function (){
  6327. var self=this;
  6328. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6329. return smalltalk.withContext(function($ctx1) {
  6330. self._should_raise_((function(){
  6331. return smalltalk.withContext(function($ctx2) {
  6332. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6334. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6335. args: [],
  6336. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6337. messageSends: ["should:raise:", "value:"],
  6338. referencedClasses: ["MessageNotUnderstood"]
  6339. }),
  6340. globals.MethodInheritanceTest);
  6341. smalltalk.addMethod(
  6342. smalltalk.method({
  6343. selector: "shouldMNUTop",
  6344. protocol: 'testing',
  6345. fn: function (){
  6346. var self=this;
  6347. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6348. return smalltalk.withContext(function($ctx1) {
  6349. self._should_raise_((function(){
  6350. return smalltalk.withContext(function($ctx2) {
  6351. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6353. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6354. args: [],
  6355. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6356. messageSends: ["should:raise:", "value:"],
  6357. referencedClasses: ["MessageNotUnderstood"]
  6358. }),
  6359. globals.MethodInheritanceTest);
  6360. smalltalk.addMethod(
  6361. smalltalk.method({
  6362. selector: "shouldReturn:",
  6363. protocol: 'testing',
  6364. fn: function (anObject){
  6365. var self=this;
  6366. var result;
  6367. return smalltalk.withContext(function($ctx1) {
  6368. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6369. $ctx1.sendIdx["value:"]=1;
  6370. self._assert_equals_(["top",anObject],["top",result]);
  6371. $ctx1.sendIdx["assert:equals:"]=1;
  6372. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6373. $ctx1.sendIdx["value:"]=2;
  6374. self._assert_equals_(["middle",anObject],["middle",result]);
  6375. $ctx1.sendIdx["assert:equals:"]=2;
  6376. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6377. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6378. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6379. args: ["anObject"],
  6380. 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 }",
  6381. messageSends: ["value:", "assert:equals:"],
  6382. referencedClasses: []
  6383. }),
  6384. globals.MethodInheritanceTest);
  6385. smalltalk.addMethod(
  6386. smalltalk.method({
  6387. selector: "shouldReturn:and:and:",
  6388. protocol: 'testing',
  6389. fn: function (anObject,anObject2,anObject3){
  6390. var self=this;
  6391. var result;
  6392. return smalltalk.withContext(function($ctx1) {
  6393. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6394. $ctx1.sendIdx["value:"]=1;
  6395. self._assert_equals_(["top",anObject],["top",result]);
  6396. $ctx1.sendIdx["assert:equals:"]=1;
  6397. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6398. $ctx1.sendIdx["value:"]=2;
  6399. self._assert_equals_(["middle",anObject2],["middle",result]);
  6400. $ctx1.sendIdx["assert:equals:"]=2;
  6401. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6402. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6403. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6404. args: ["anObject", "anObject2", "anObject3"],
  6405. 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 }",
  6406. messageSends: ["value:", "assert:equals:"],
  6407. referencedClasses: []
  6408. }),
  6409. globals.MethodInheritanceTest);
  6410. smalltalk.addMethod(
  6411. smalltalk.method({
  6412. selector: "targetClassBottom",
  6413. protocol: 'accessing',
  6414. fn: function (){
  6415. var self=this;
  6416. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6417. return $JavaScriptException();
  6418. },
  6419. args: [],
  6420. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6421. messageSends: [],
  6422. referencedClasses: ["JavaScriptException"]
  6423. }),
  6424. globals.MethodInheritanceTest);
  6425. smalltalk.addMethod(
  6426. smalltalk.method({
  6427. selector: "targetClassMiddle",
  6428. protocol: 'accessing',
  6429. fn: function (){
  6430. var self=this;
  6431. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6432. return $Error();
  6433. },
  6434. args: [],
  6435. source: "targetClassMiddle\x0a\x09^ Error",
  6436. messageSends: [],
  6437. referencedClasses: ["Error"]
  6438. }),
  6439. globals.MethodInheritanceTest);
  6440. smalltalk.addMethod(
  6441. smalltalk.method({
  6442. selector: "targetClassTop",
  6443. protocol: 'accessing',
  6444. fn: function (){
  6445. var self=this;
  6446. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6447. return $Object();
  6448. },
  6449. args: [],
  6450. source: "targetClassTop\x0a\x09^ Object",
  6451. messageSends: [],
  6452. referencedClasses: ["Object"]
  6453. }),
  6454. globals.MethodInheritanceTest);
  6455. smalltalk.addMethod(
  6456. smalltalk.method({
  6457. selector: "tearDown",
  6458. protocol: 'initialization',
  6459. fn: function (){
  6460. var self=this;
  6461. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6462. return smalltalk.withContext(function($ctx1) {
  6463. _st((function(){
  6464. return smalltalk.withContext(function($ctx2) {
  6465. return self._deinstallTop();
  6466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6467. }));
  6468. $ctx1.sendIdx["on:do:"]=1;
  6469. _st((function(){
  6470. return smalltalk.withContext(function($ctx2) {
  6471. return self._deinstallMiddle();
  6472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6473. }));
  6474. $ctx1.sendIdx["on:do:"]=2;
  6475. _st((function(){
  6476. return smalltalk.withContext(function($ctx2) {
  6477. return self._deinstallBottom();
  6478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6479. }));
  6480. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6481. args: [],
  6482. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6483. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6484. referencedClasses: ["Error"]
  6485. }),
  6486. globals.MethodInheritanceTest);
  6487. smalltalk.addMethod(
  6488. smalltalk.method({
  6489. selector: "testMNU11",
  6490. protocol: 'tests',
  6491. fn: function (){
  6492. var self=this;
  6493. return smalltalk.withContext(function($ctx1) {
  6494. self["@performBlock"]=(function(x){
  6495. return smalltalk.withContext(function($ctx2) {
  6496. return _st(x)._foo();
  6497. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6498. self._shouldMNU();
  6499. $ctx1.sendIdx["shouldMNU"]=1;
  6500. self._installTop_("foo ^ false");
  6501. $ctx1.sendIdx["installTop:"]=1;
  6502. self._installTop_("foo ^ true");
  6503. self._deinstallTop();
  6504. self._shouldMNU();
  6505. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6506. args: [],
  6507. 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",
  6508. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6509. referencedClasses: []
  6510. }),
  6511. globals.MethodInheritanceTest);
  6512. smalltalk.addMethod(
  6513. smalltalk.method({
  6514. selector: "testMNU22",
  6515. protocol: 'tests',
  6516. fn: function (){
  6517. var self=this;
  6518. return smalltalk.withContext(function($ctx1) {
  6519. self["@performBlock"]=(function(x){
  6520. return smalltalk.withContext(function($ctx2) {
  6521. return _st(x)._foo();
  6522. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6523. self._shouldMNU();
  6524. $ctx1.sendIdx["shouldMNU"]=1;
  6525. self._installMiddle_("foo ^ false");
  6526. $ctx1.sendIdx["installMiddle:"]=1;
  6527. self._installMiddle_("foo ^ true");
  6528. self._deinstallMiddle();
  6529. self._shouldMNU();
  6530. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6531. args: [],
  6532. 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",
  6533. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6534. referencedClasses: []
  6535. }),
  6536. globals.MethodInheritanceTest);
  6537. smalltalk.addMethod(
  6538. smalltalk.method({
  6539. selector: "testReturns1",
  6540. protocol: 'tests',
  6541. fn: function (){
  6542. var self=this;
  6543. return smalltalk.withContext(function($ctx1) {
  6544. self["@performBlock"]=(function(x){
  6545. return smalltalk.withContext(function($ctx2) {
  6546. return _st(x)._foo();
  6547. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6548. self._installTop_("foo ^ false");
  6549. $ctx1.sendIdx["installTop:"]=1;
  6550. self._shouldReturn_(false);
  6551. $ctx1.sendIdx["shouldReturn:"]=1;
  6552. self._installTop_("foo ^ true");
  6553. self._shouldReturn_(true);
  6554. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6555. args: [],
  6556. 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",
  6557. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6558. referencedClasses: []
  6559. }),
  6560. globals.MethodInheritanceTest);
  6561. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6562. smalltalk.addMethod(
  6563. smalltalk.method({
  6564. selector: "testAbs",
  6565. protocol: 'tests',
  6566. fn: function (){
  6567. var self=this;
  6568. return smalltalk.withContext(function($ctx1) {
  6569. var $1;
  6570. $1=(4)._abs();
  6571. $ctx1.sendIdx["abs"]=1;
  6572. self._assert_equals_($1,(4));
  6573. $ctx1.sendIdx["assert:equals:"]=1;
  6574. self._assert_equals_((-4)._abs(),(4));
  6575. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6576. args: [],
  6577. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6578. messageSends: ["assert:equals:", "abs"],
  6579. referencedClasses: []
  6580. }),
  6581. globals.NumberTest);
  6582. smalltalk.addMethod(
  6583. smalltalk.method({
  6584. selector: "testArithmetic",
  6585. protocol: 'tests',
  6586. fn: function (){
  6587. var self=this;
  6588. return smalltalk.withContext(function($ctx1) {
  6589. var $1,$2,$3,$5,$4;
  6590. $1=(1.5).__plus((1));
  6591. $ctx1.sendIdx["+"]=1;
  6592. self._assert_equals_($1,(2.5));
  6593. $ctx1.sendIdx["assert:equals:"]=1;
  6594. $2=(2).__minus((1));
  6595. $ctx1.sendIdx["-"]=1;
  6596. self._assert_equals_($2,(1));
  6597. $ctx1.sendIdx["assert:equals:"]=2;
  6598. self._assert_equals_((-2).__minus((1)),(-3));
  6599. $ctx1.sendIdx["assert:equals:"]=3;
  6600. self._assert_equals_((12).__slash((2)),(6));
  6601. $ctx1.sendIdx["assert:equals:"]=4;
  6602. $3=(3).__star((4));
  6603. $ctx1.sendIdx["*"]=1;
  6604. self._assert_equals_($3,(12));
  6605. $ctx1.sendIdx["assert:equals:"]=5;
  6606. self._assert_equals_((7).__slash_slash((2)),(3));
  6607. $ctx1.sendIdx["assert:equals:"]=6;
  6608. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6609. $ctx1.sendIdx["assert:equals:"]=7;
  6610. $5=(1).__plus((2));
  6611. $ctx1.sendIdx["+"]=2;
  6612. $4=_st($5).__star((3));
  6613. $ctx1.sendIdx["*"]=2;
  6614. self._assert_equals_($4,(9));
  6615. $ctx1.sendIdx["assert:equals:"]=8;
  6616. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6617. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6618. args: [],
  6619. 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",
  6620. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6621. referencedClasses: []
  6622. }),
  6623. globals.NumberTest);
  6624. smalltalk.addMethod(
  6625. smalltalk.method({
  6626. selector: "testAsNumber",
  6627. protocol: 'tests',
  6628. fn: function (){
  6629. var self=this;
  6630. return smalltalk.withContext(function($ctx1) {
  6631. self._assert_equals_((3)._asNumber(),(3));
  6632. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6633. args: [],
  6634. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6635. messageSends: ["assert:equals:", "asNumber"],
  6636. referencedClasses: []
  6637. }),
  6638. globals.NumberTest);
  6639. smalltalk.addMethod(
  6640. smalltalk.method({
  6641. selector: "testCeiling",
  6642. protocol: 'tests',
  6643. fn: function (){
  6644. var self=this;
  6645. return smalltalk.withContext(function($ctx1) {
  6646. var $1,$2;
  6647. $1=(1.2)._ceiling();
  6648. $ctx1.sendIdx["ceiling"]=1;
  6649. self._assert_equals_($1,(2));
  6650. $ctx1.sendIdx["assert:equals:"]=1;
  6651. $2=(-1.2)._ceiling();
  6652. $ctx1.sendIdx["ceiling"]=2;
  6653. self._assert_equals_($2,(-1));
  6654. $ctx1.sendIdx["assert:equals:"]=2;
  6655. self._assert_equals_((1)._ceiling(),(1));
  6656. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6657. args: [],
  6658. 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.",
  6659. messageSends: ["assert:equals:", "ceiling"],
  6660. referencedClasses: []
  6661. }),
  6662. globals.NumberTest);
  6663. smalltalk.addMethod(
  6664. smalltalk.method({
  6665. selector: "testComparison",
  6666. protocol: 'tests',
  6667. fn: function (){
  6668. var self=this;
  6669. return smalltalk.withContext(function($ctx1) {
  6670. var $1,$2,$3,$4;
  6671. $1=(3).__gt((2));
  6672. $ctx1.sendIdx[">"]=1;
  6673. self._assert_($1);
  6674. $ctx1.sendIdx["assert:"]=1;
  6675. $2=(2).__lt((3));
  6676. $ctx1.sendIdx["<"]=1;
  6677. self._assert_($2);
  6678. $ctx1.sendIdx["assert:"]=2;
  6679. self._deny_((3).__lt((2)));
  6680. $ctx1.sendIdx["deny:"]=1;
  6681. self._deny_((2).__gt((3)));
  6682. $3=(3).__gt_eq((3));
  6683. $ctx1.sendIdx[">="]=1;
  6684. self._assert_($3);
  6685. $ctx1.sendIdx["assert:"]=3;
  6686. self._assert_((3.1).__gt_eq((3)));
  6687. $ctx1.sendIdx["assert:"]=4;
  6688. $4=(3).__lt_eq((3));
  6689. $ctx1.sendIdx["<="]=1;
  6690. self._assert_($4);
  6691. $ctx1.sendIdx["assert:"]=5;
  6692. self._assert_((3).__lt_eq((3.1)));
  6693. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6694. args: [],
  6695. 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",
  6696. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6697. referencedClasses: []
  6698. }),
  6699. globals.NumberTest);
  6700. smalltalk.addMethod(
  6701. smalltalk.method({
  6702. selector: "testCopying",
  6703. protocol: 'tests',
  6704. fn: function (){
  6705. var self=this;
  6706. return smalltalk.withContext(function($ctx1) {
  6707. var $1;
  6708. $1=_st((1)._copy()).__eq_eq((1));
  6709. $ctx1.sendIdx["=="]=1;
  6710. self._assert_($1);
  6711. $ctx1.sendIdx["assert:"]=1;
  6712. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6713. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6714. args: [],
  6715. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6716. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6717. referencedClasses: []
  6718. }),
  6719. globals.NumberTest);
  6720. smalltalk.addMethod(
  6721. smalltalk.method({
  6722. selector: "testEquality",
  6723. protocol: 'tests',
  6724. fn: function (){
  6725. var self=this;
  6726. return smalltalk.withContext(function($ctx1) {
  6727. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6728. $1=(1).__eq((1));
  6729. $ctx1.sendIdx["="]=1;
  6730. self._assert_($1);
  6731. $ctx1.sendIdx["assert:"]=1;
  6732. $2=(0).__eq((0));
  6733. $ctx1.sendIdx["="]=2;
  6734. self._assert_($2);
  6735. $ctx1.sendIdx["assert:"]=2;
  6736. $3=(1).__eq((0));
  6737. $ctx1.sendIdx["="]=3;
  6738. self._deny_($3);
  6739. $ctx1.sendIdx["deny:"]=1;
  6740. $5=(1)._yourself();
  6741. $ctx1.sendIdx["yourself"]=1;
  6742. $4=_st($5).__eq((1));
  6743. $ctx1.sendIdx["="]=4;
  6744. self._assert_($4);
  6745. $ctx1.sendIdx["assert:"]=3;
  6746. $7=(1)._yourself();
  6747. $ctx1.sendIdx["yourself"]=2;
  6748. $6=(1).__eq($7);
  6749. $ctx1.sendIdx["="]=5;
  6750. self._assert_($6);
  6751. $ctx1.sendIdx["assert:"]=4;
  6752. $9=(1)._yourself();
  6753. $ctx1.sendIdx["yourself"]=3;
  6754. $8=_st($9).__eq((1)._yourself());
  6755. $ctx1.sendIdx["="]=6;
  6756. self._assert_($8);
  6757. $10=(0).__eq(false);
  6758. $ctx1.sendIdx["="]=7;
  6759. self._deny_($10);
  6760. $ctx1.sendIdx["deny:"]=2;
  6761. $11=false.__eq((0));
  6762. $ctx1.sendIdx["="]=8;
  6763. self._deny_($11);
  6764. $ctx1.sendIdx["deny:"]=3;
  6765. $12="".__eq((0));
  6766. $ctx1.sendIdx["="]=9;
  6767. self._deny_($12);
  6768. $ctx1.sendIdx["deny:"]=4;
  6769. self._deny_((0).__eq(""));
  6770. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6771. args: [],
  6772. 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 = ''",
  6773. messageSends: ["assert:", "=", "deny:", "yourself"],
  6774. referencedClasses: []
  6775. }),
  6776. globals.NumberTest);
  6777. smalltalk.addMethod(
  6778. smalltalk.method({
  6779. selector: "testFloor",
  6780. protocol: 'tests',
  6781. fn: function (){
  6782. var self=this;
  6783. return smalltalk.withContext(function($ctx1) {
  6784. var $1,$2;
  6785. $1=(1.2)._floor();
  6786. $ctx1.sendIdx["floor"]=1;
  6787. self._assert_equals_($1,(1));
  6788. $ctx1.sendIdx["assert:equals:"]=1;
  6789. $2=(-1.2)._floor();
  6790. $ctx1.sendIdx["floor"]=2;
  6791. self._assert_equals_($2,(-2));
  6792. $ctx1.sendIdx["assert:equals:"]=2;
  6793. self._assert_equals_((1)._floor(),(1));
  6794. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6795. args: [],
  6796. 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.",
  6797. messageSends: ["assert:equals:", "floor"],
  6798. referencedClasses: []
  6799. }),
  6800. globals.NumberTest);
  6801. smalltalk.addMethod(
  6802. smalltalk.method({
  6803. selector: "testHexNumbers",
  6804. protocol: 'tests',
  6805. fn: function (){
  6806. var self=this;
  6807. return smalltalk.withContext(function($ctx1) {
  6808. var $1,$2,$3,$4,$5;
  6809. self._assert_equals_((9),(9));
  6810. $ctx1.sendIdx["assert:equals:"]=1;
  6811. $1=(10)._truncated();
  6812. $ctx1.sendIdx["truncated"]=1;
  6813. self._assert_equals_($1,(10));
  6814. $ctx1.sendIdx["assert:equals:"]=2;
  6815. $2=(11)._truncated();
  6816. $ctx1.sendIdx["truncated"]=2;
  6817. self._assert_equals_($2,(11));
  6818. $ctx1.sendIdx["assert:equals:"]=3;
  6819. $3=(12)._truncated();
  6820. $ctx1.sendIdx["truncated"]=3;
  6821. self._assert_equals_($3,(12));
  6822. $ctx1.sendIdx["assert:equals:"]=4;
  6823. $4=(13)._truncated();
  6824. $ctx1.sendIdx["truncated"]=4;
  6825. self._assert_equals_($4,(13));
  6826. $ctx1.sendIdx["assert:equals:"]=5;
  6827. $5=(14)._truncated();
  6828. $ctx1.sendIdx["truncated"]=5;
  6829. self._assert_equals_($5,(14));
  6830. $ctx1.sendIdx["assert:equals:"]=6;
  6831. self._assert_equals_((15)._truncated(),(15));
  6832. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6833. args: [],
  6834. 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",
  6835. messageSends: ["assert:equals:", "truncated"],
  6836. referencedClasses: []
  6837. }),
  6838. globals.NumberTest);
  6839. smalltalk.addMethod(
  6840. smalltalk.method({
  6841. selector: "testIdentity",
  6842. protocol: 'tests',
  6843. fn: function (){
  6844. var self=this;
  6845. return smalltalk.withContext(function($ctx1) {
  6846. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6847. $1=(1).__eq_eq((1));
  6848. $ctx1.sendIdx["=="]=1;
  6849. self._assert_($1);
  6850. $ctx1.sendIdx["assert:"]=1;
  6851. $2=(0).__eq_eq((0));
  6852. $ctx1.sendIdx["=="]=2;
  6853. self._assert_($2);
  6854. $ctx1.sendIdx["assert:"]=2;
  6855. $3=(1).__eq_eq((0));
  6856. $ctx1.sendIdx["=="]=3;
  6857. self._deny_($3);
  6858. $ctx1.sendIdx["deny:"]=1;
  6859. $5=(1)._yourself();
  6860. $ctx1.sendIdx["yourself"]=1;
  6861. $4=_st($5).__eq_eq((1));
  6862. $ctx1.sendIdx["=="]=4;
  6863. self._assert_($4);
  6864. $ctx1.sendIdx["assert:"]=3;
  6865. $7=(1)._yourself();
  6866. $ctx1.sendIdx["yourself"]=2;
  6867. $6=(1).__eq_eq($7);
  6868. $ctx1.sendIdx["=="]=5;
  6869. self._assert_($6);
  6870. $ctx1.sendIdx["assert:"]=4;
  6871. $9=(1)._yourself();
  6872. $ctx1.sendIdx["yourself"]=3;
  6873. $8=_st($9).__eq_eq((1)._yourself());
  6874. $ctx1.sendIdx["=="]=6;
  6875. self._assert_($8);
  6876. self._deny_((1).__eq_eq((2)));
  6877. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6878. args: [],
  6879. 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",
  6880. messageSends: ["assert:", "==", "deny:", "yourself"],
  6881. referencedClasses: []
  6882. }),
  6883. globals.NumberTest);
  6884. smalltalk.addMethod(
  6885. smalltalk.method({
  6886. selector: "testInvalidHexNumbers",
  6887. protocol: 'tests',
  6888. fn: function (){
  6889. var self=this;
  6890. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6891. return smalltalk.withContext(function($ctx1) {
  6892. self._should_raise_((function(){
  6893. return smalltalk.withContext(function($ctx2) {
  6894. return (16)._rG();
  6895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6896. $ctx1.sendIdx["should:raise:"]=1;
  6897. self._should_raise_((function(){
  6898. return smalltalk.withContext(function($ctx2) {
  6899. return (16)._rg();
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6901. $ctx1.sendIdx["should:raise:"]=2;
  6902. self._should_raise_((function(){
  6903. return smalltalk.withContext(function($ctx2) {
  6904. return (16)._rH();
  6905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6906. $ctx1.sendIdx["should:raise:"]=3;
  6907. self._should_raise_((function(){
  6908. return smalltalk.withContext(function($ctx2) {
  6909. return (16)._rh();
  6910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6911. $ctx1.sendIdx["should:raise:"]=4;
  6912. self._should_raise_((function(){
  6913. return smalltalk.withContext(function($ctx2) {
  6914. return (16)._rI();
  6915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6916. $ctx1.sendIdx["should:raise:"]=5;
  6917. self._should_raise_((function(){
  6918. return smalltalk.withContext(function($ctx2) {
  6919. return (16)._ri();
  6920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6921. $ctx1.sendIdx["should:raise:"]=6;
  6922. self._should_raise_((function(){
  6923. return smalltalk.withContext(function($ctx2) {
  6924. return (16)._rJ();
  6925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6926. $ctx1.sendIdx["should:raise:"]=7;
  6927. self._should_raise_((function(){
  6928. return smalltalk.withContext(function($ctx2) {
  6929. return (16)._rj();
  6930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6931. $ctx1.sendIdx["should:raise:"]=8;
  6932. self._should_raise_((function(){
  6933. return smalltalk.withContext(function($ctx2) {
  6934. return (16)._rK();
  6935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6936. $ctx1.sendIdx["should:raise:"]=9;
  6937. self._should_raise_((function(){
  6938. return smalltalk.withContext(function($ctx2) {
  6939. return (16)._rk();
  6940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6941. $ctx1.sendIdx["should:raise:"]=10;
  6942. self._should_raise_((function(){
  6943. return smalltalk.withContext(function($ctx2) {
  6944. return (16)._rL();
  6945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6946. $ctx1.sendIdx["should:raise:"]=11;
  6947. self._should_raise_((function(){
  6948. return smalltalk.withContext(function($ctx2) {
  6949. return (16)._rl();
  6950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6951. $ctx1.sendIdx["should:raise:"]=12;
  6952. self._should_raise_((function(){
  6953. return smalltalk.withContext(function($ctx2) {
  6954. return (16)._rM();
  6955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6956. $ctx1.sendIdx["should:raise:"]=13;
  6957. self._should_raise_((function(){
  6958. return smalltalk.withContext(function($ctx2) {
  6959. return (16)._rm();
  6960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6961. $ctx1.sendIdx["should:raise:"]=14;
  6962. self._should_raise_((function(){
  6963. return smalltalk.withContext(function($ctx2) {
  6964. return (16)._rN();
  6965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6966. $ctx1.sendIdx["should:raise:"]=15;
  6967. self._should_raise_((function(){
  6968. return smalltalk.withContext(function($ctx2) {
  6969. return (16)._rn();
  6970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6971. $ctx1.sendIdx["should:raise:"]=16;
  6972. self._should_raise_((function(){
  6973. return smalltalk.withContext(function($ctx2) {
  6974. return (16)._rO();
  6975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6976. $ctx1.sendIdx["should:raise:"]=17;
  6977. self._should_raise_((function(){
  6978. return smalltalk.withContext(function($ctx2) {
  6979. return (16)._ro();
  6980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6981. $ctx1.sendIdx["should:raise:"]=18;
  6982. self._should_raise_((function(){
  6983. return smalltalk.withContext(function($ctx2) {
  6984. return (16)._rP();
  6985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6986. $ctx1.sendIdx["should:raise:"]=19;
  6987. self._should_raise_((function(){
  6988. return smalltalk.withContext(function($ctx2) {
  6989. return (16)._rp();
  6990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6991. $ctx1.sendIdx["should:raise:"]=20;
  6992. self._should_raise_((function(){
  6993. return smalltalk.withContext(function($ctx2) {
  6994. return (16)._rQ();
  6995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6996. $ctx1.sendIdx["should:raise:"]=21;
  6997. self._should_raise_((function(){
  6998. return smalltalk.withContext(function($ctx2) {
  6999. return (16)._rq();
  7000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  7001. $ctx1.sendIdx["should:raise:"]=22;
  7002. self._should_raise_((function(){
  7003. return smalltalk.withContext(function($ctx2) {
  7004. return (16)._rR();
  7005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  7006. $ctx1.sendIdx["should:raise:"]=23;
  7007. self._should_raise_((function(){
  7008. return smalltalk.withContext(function($ctx2) {
  7009. return (16)._rr();
  7010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  7011. $ctx1.sendIdx["should:raise:"]=24;
  7012. self._should_raise_((function(){
  7013. return smalltalk.withContext(function($ctx2) {
  7014. return (16)._rS();
  7015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  7016. $ctx1.sendIdx["should:raise:"]=25;
  7017. self._should_raise_((function(){
  7018. return smalltalk.withContext(function($ctx2) {
  7019. return (16)._rs();
  7020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  7021. $ctx1.sendIdx["should:raise:"]=26;
  7022. self._should_raise_((function(){
  7023. return smalltalk.withContext(function($ctx2) {
  7024. return (16)._rT();
  7025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  7026. $ctx1.sendIdx["should:raise:"]=27;
  7027. self._should_raise_((function(){
  7028. return smalltalk.withContext(function($ctx2) {
  7029. return (16)._rt();
  7030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  7031. $ctx1.sendIdx["should:raise:"]=28;
  7032. self._should_raise_((function(){
  7033. return smalltalk.withContext(function($ctx2) {
  7034. return (16)._rU();
  7035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  7036. $ctx1.sendIdx["should:raise:"]=29;
  7037. self._should_raise_((function(){
  7038. return smalltalk.withContext(function($ctx2) {
  7039. return (16)._ru();
  7040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  7041. $ctx1.sendIdx["should:raise:"]=30;
  7042. self._should_raise_((function(){
  7043. return smalltalk.withContext(function($ctx2) {
  7044. return (16)._rV();
  7045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  7046. $ctx1.sendIdx["should:raise:"]=31;
  7047. self._should_raise_((function(){
  7048. return smalltalk.withContext(function($ctx2) {
  7049. return (16)._rv();
  7050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  7051. $ctx1.sendIdx["should:raise:"]=32;
  7052. self._should_raise_((function(){
  7053. return smalltalk.withContext(function($ctx2) {
  7054. return (16)._rW();
  7055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  7056. $ctx1.sendIdx["should:raise:"]=33;
  7057. self._should_raise_((function(){
  7058. return smalltalk.withContext(function($ctx2) {
  7059. return (16)._rw();
  7060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  7061. $ctx1.sendIdx["should:raise:"]=34;
  7062. self._should_raise_((function(){
  7063. return smalltalk.withContext(function($ctx2) {
  7064. return (16)._rX();
  7065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  7066. $ctx1.sendIdx["should:raise:"]=35;
  7067. self._should_raise_((function(){
  7068. return smalltalk.withContext(function($ctx2) {
  7069. return (16)._rx();
  7070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  7071. $ctx1.sendIdx["should:raise:"]=36;
  7072. self._should_raise_((function(){
  7073. return smalltalk.withContext(function($ctx2) {
  7074. return (16)._rY();
  7075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7076. $ctx1.sendIdx["should:raise:"]=37;
  7077. self._should_raise_((function(){
  7078. return smalltalk.withContext(function($ctx2) {
  7079. return (16)._ry();
  7080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7081. $ctx1.sendIdx["should:raise:"]=38;
  7082. self._should_raise_((function(){
  7083. return smalltalk.withContext(function($ctx2) {
  7084. return (16)._rZ();
  7085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7086. $ctx1.sendIdx["should:raise:"]=39;
  7087. self._should_raise_((function(){
  7088. return smalltalk.withContext(function($ctx2) {
  7089. return (16)._rz();
  7090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7091. $ctx1.sendIdx["should:raise:"]=40;
  7092. self._should_raise_((function(){
  7093. return smalltalk.withContext(function($ctx2) {
  7094. return (11259375)._Z();
  7095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7096. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  7097. args: [],
  7098. 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.",
  7099. 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"],
  7100. referencedClasses: ["MessageNotUnderstood"]
  7101. }),
  7102. globals.NumberTest);
  7103. smalltalk.addMethod(
  7104. smalltalk.method({
  7105. selector: "testLog",
  7106. protocol: 'tests',
  7107. fn: function (){
  7108. var self=this;
  7109. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7110. return smalltalk.withContext(function($ctx1) {
  7111. self._assert_equals_((10000)._log(),(4));
  7112. $ctx1.sendIdx["assert:equals:"]=1;
  7113. self._assert_equals_((512)._log_((2)),(9));
  7114. $ctx1.sendIdx["assert:equals:"]=2;
  7115. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7116. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7117. args: [],
  7118. 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.",
  7119. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7120. referencedClasses: ["Number"]
  7121. }),
  7122. globals.NumberTest);
  7123. smalltalk.addMethod(
  7124. smalltalk.method({
  7125. selector: "testMinMax",
  7126. protocol: 'tests',
  7127. fn: function (){
  7128. var self=this;
  7129. return smalltalk.withContext(function($ctx1) {
  7130. self._assert_equals_((2)._max_((5)),(5));
  7131. $ctx1.sendIdx["assert:equals:"]=1;
  7132. self._assert_equals_((2)._min_((5)),(2));
  7133. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7134. args: [],
  7135. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7136. messageSends: ["assert:equals:", "max:", "min:"],
  7137. referencedClasses: []
  7138. }),
  7139. globals.NumberTest);
  7140. smalltalk.addMethod(
  7141. smalltalk.method({
  7142. selector: "testNegated",
  7143. protocol: 'tests',
  7144. fn: function (){
  7145. var self=this;
  7146. return smalltalk.withContext(function($ctx1) {
  7147. var $1;
  7148. $1=(3)._negated();
  7149. $ctx1.sendIdx["negated"]=1;
  7150. self._assert_equals_($1,(-3));
  7151. $ctx1.sendIdx["assert:equals:"]=1;
  7152. self._assert_equals_((-3)._negated(),(3));
  7153. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7154. args: [],
  7155. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7156. messageSends: ["assert:equals:", "negated"],
  7157. referencedClasses: []
  7158. }),
  7159. globals.NumberTest);
  7160. smalltalk.addMethod(
  7161. smalltalk.method({
  7162. selector: "testPrintShowingDecimalPlaces",
  7163. protocol: 'tests',
  7164. fn: function (){
  7165. var self=this;
  7166. return smalltalk.withContext(function($ctx1) {
  7167. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7168. $1=(23)._printShowingDecimalPlaces_((2));
  7169. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7170. self._assert_equals_($1,"23.00");
  7171. $ctx1.sendIdx["assert:equals:"]=1;
  7172. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7173. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7174. self._assert_equals_($2,"23.57");
  7175. $ctx1.sendIdx["assert:equals:"]=2;
  7176. $4=(234.567)._negated();
  7177. $ctx1.sendIdx["negated"]=1;
  7178. $3=_st($4)._printShowingDecimalPlaces_((5));
  7179. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7180. self._assert_equals_($3,"-234.56700");
  7181. $ctx1.sendIdx["assert:equals:"]=3;
  7182. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7183. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7184. self._assert_equals_($5,"23");
  7185. $ctx1.sendIdx["assert:equals:"]=4;
  7186. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7187. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7188. self._assert_equals_($6,"24");
  7189. $ctx1.sendIdx["assert:equals:"]=5;
  7190. $8=(23.4567)._negated();
  7191. $ctx1.sendIdx["negated"]=2;
  7192. $7=_st($8)._printShowingDecimalPlaces_((0));
  7193. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7194. self._assert_equals_($7,"-23");
  7195. $ctx1.sendIdx["assert:equals:"]=6;
  7196. $10=(23.5567)._negated();
  7197. $ctx1.sendIdx["negated"]=3;
  7198. $9=_st($10)._printShowingDecimalPlaces_((0));
  7199. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7200. self._assert_equals_($9,"-24");
  7201. $ctx1.sendIdx["assert:equals:"]=7;
  7202. $11=(100000000)._printShowingDecimalPlaces_((1));
  7203. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7204. self._assert_equals_($11,"100000000.0");
  7205. $ctx1.sendIdx["assert:equals:"]=8;
  7206. $12=(0.98)._printShowingDecimalPlaces_((5));
  7207. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7208. self._assert_equals_($12,"0.98000");
  7209. $ctx1.sendIdx["assert:equals:"]=9;
  7210. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7211. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7212. self._assert_equals_($13,"-0.98");
  7213. $ctx1.sendIdx["assert:equals:"]=10;
  7214. $14=(2.567)._printShowingDecimalPlaces_((2));
  7215. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7216. self._assert_equals_($14,"2.57");
  7217. $ctx1.sendIdx["assert:equals:"]=11;
  7218. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7219. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7220. self._assert_equals_($15,"-2.57");
  7221. $ctx1.sendIdx["assert:equals:"]=12;
  7222. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7223. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7224. args: [],
  7225. 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'.",
  7226. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7227. referencedClasses: []
  7228. }),
  7229. globals.NumberTest);
  7230. smalltalk.addMethod(
  7231. smalltalk.method({
  7232. selector: "testRaisedTo",
  7233. protocol: 'tests',
  7234. fn: function (){
  7235. var self=this;
  7236. return smalltalk.withContext(function($ctx1) {
  7237. var $1,$2,$3;
  7238. $1=(2)._raisedTo_((4));
  7239. $ctx1.sendIdx["raisedTo:"]=1;
  7240. self._assert_equals_($1,(16));
  7241. $ctx1.sendIdx["assert:equals:"]=1;
  7242. $2=(2)._raisedTo_((0));
  7243. $ctx1.sendIdx["raisedTo:"]=2;
  7244. self._assert_equals_($2,(1));
  7245. $ctx1.sendIdx["assert:equals:"]=2;
  7246. $3=(2)._raisedTo_((-3));
  7247. $ctx1.sendIdx["raisedTo:"]=3;
  7248. self._assert_equals_($3,(0.125));
  7249. $ctx1.sendIdx["assert:equals:"]=3;
  7250. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7251. $ctx1.sendIdx["assert:equals:"]=4;
  7252. self._assert_equals_((2).__star_star((4)),(16));
  7253. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7254. args: [],
  7255. 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.",
  7256. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7257. referencedClasses: []
  7258. }),
  7259. globals.NumberTest);
  7260. smalltalk.addMethod(
  7261. smalltalk.method({
  7262. selector: "testRounded",
  7263. protocol: 'tests',
  7264. fn: function (){
  7265. var self=this;
  7266. return smalltalk.withContext(function($ctx1) {
  7267. var $1,$2;
  7268. $1=(3)._rounded();
  7269. $ctx1.sendIdx["rounded"]=1;
  7270. self._assert_equals_($1,(3));
  7271. $ctx1.sendIdx["assert:equals:"]=1;
  7272. $2=(3.212)._rounded();
  7273. $ctx1.sendIdx["rounded"]=2;
  7274. self._assert_equals_($2,(3));
  7275. $ctx1.sendIdx["assert:equals:"]=2;
  7276. self._assert_equals_((3.51)._rounded(),(4));
  7277. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7278. args: [],
  7279. 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",
  7280. messageSends: ["assert:equals:", "rounded"],
  7281. referencedClasses: []
  7282. }),
  7283. globals.NumberTest);
  7284. smalltalk.addMethod(
  7285. smalltalk.method({
  7286. selector: "testSign",
  7287. protocol: 'tests',
  7288. fn: function (){
  7289. var self=this;
  7290. return smalltalk.withContext(function($ctx1) {
  7291. var $1,$2;
  7292. $1=(5)._sign();
  7293. $ctx1.sendIdx["sign"]=1;
  7294. self._assert_equals_($1,(1));
  7295. $ctx1.sendIdx["assert:equals:"]=1;
  7296. $2=(0)._sign();
  7297. $ctx1.sendIdx["sign"]=2;
  7298. self._assert_equals_($2,(0));
  7299. $ctx1.sendIdx["assert:equals:"]=2;
  7300. self._assert_equals_((-1.4)._sign(),(-1));
  7301. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7302. args: [],
  7303. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7304. messageSends: ["assert:equals:", "sign"],
  7305. referencedClasses: []
  7306. }),
  7307. globals.NumberTest);
  7308. smalltalk.addMethod(
  7309. smalltalk.method({
  7310. selector: "testSqrt",
  7311. protocol: 'tests',
  7312. fn: function (){
  7313. var self=this;
  7314. return smalltalk.withContext(function($ctx1) {
  7315. var $1;
  7316. $1=(4)._sqrt();
  7317. $ctx1.sendIdx["sqrt"]=1;
  7318. self._assert_equals_($1,(2));
  7319. $ctx1.sendIdx["assert:equals:"]=1;
  7320. self._assert_equals_((16)._sqrt(),(4));
  7321. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7322. args: [],
  7323. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7324. messageSends: ["assert:equals:", "sqrt"],
  7325. referencedClasses: []
  7326. }),
  7327. globals.NumberTest);
  7328. smalltalk.addMethod(
  7329. smalltalk.method({
  7330. selector: "testSquared",
  7331. protocol: 'tests',
  7332. fn: function (){
  7333. var self=this;
  7334. return smalltalk.withContext(function($ctx1) {
  7335. self._assert_equals_((4)._squared(),(16));
  7336. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7337. args: [],
  7338. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7339. messageSends: ["assert:equals:", "squared"],
  7340. referencedClasses: []
  7341. }),
  7342. globals.NumberTest);
  7343. smalltalk.addMethod(
  7344. smalltalk.method({
  7345. selector: "testTimesRepeat",
  7346. protocol: 'tests',
  7347. fn: function (){
  7348. var self=this;
  7349. var i;
  7350. return smalltalk.withContext(function($ctx1) {
  7351. i=(0);
  7352. (0)._timesRepeat_((function(){
  7353. return smalltalk.withContext(function($ctx2) {
  7354. i=_st(i).__plus((1));
  7355. $ctx2.sendIdx["+"]=1;
  7356. return i;
  7357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7358. $ctx1.sendIdx["timesRepeat:"]=1;
  7359. self._assert_equals_(i,(0));
  7360. $ctx1.sendIdx["assert:equals:"]=1;
  7361. (5)._timesRepeat_((function(){
  7362. return smalltalk.withContext(function($ctx2) {
  7363. i=_st(i).__plus((1));
  7364. return i;
  7365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7366. self._assert_equals_(i,(5));
  7367. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7368. args: [],
  7369. 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",
  7370. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7371. referencedClasses: []
  7372. }),
  7373. globals.NumberTest);
  7374. smalltalk.addMethod(
  7375. smalltalk.method({
  7376. selector: "testTo",
  7377. protocol: 'tests',
  7378. fn: function (){
  7379. var self=this;
  7380. return smalltalk.withContext(function($ctx1) {
  7381. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7382. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7383. args: [],
  7384. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7385. messageSends: ["assert:equals:", "to:"],
  7386. referencedClasses: []
  7387. }),
  7388. globals.NumberTest);
  7389. smalltalk.addMethod(
  7390. smalltalk.method({
  7391. selector: "testToBy",
  7392. protocol: 'tests',
  7393. fn: function (){
  7394. var self=this;
  7395. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7396. return smalltalk.withContext(function($ctx1) {
  7397. var $1;
  7398. $1=(0)._to_by_((6),(2));
  7399. $ctx1.sendIdx["to:by:"]=1;
  7400. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7401. self._should_raise_((function(){
  7402. return smalltalk.withContext(function($ctx2) {
  7403. return (1)._to_by_((4),(0));
  7404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7405. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7406. args: [],
  7407. 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",
  7408. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7409. referencedClasses: ["Error"]
  7410. }),
  7411. globals.NumberTest);
  7412. smalltalk.addMethod(
  7413. smalltalk.method({
  7414. selector: "testTrigonometry",
  7415. protocol: 'tests',
  7416. fn: function (){
  7417. var self=this;
  7418. return smalltalk.withContext(function($ctx1) {
  7419. self._assert_equals_((0)._cos(),(1));
  7420. $ctx1.sendIdx["assert:equals:"]=1;
  7421. self._assert_equals_((0)._sin(),(0));
  7422. $ctx1.sendIdx["assert:equals:"]=2;
  7423. self._assert_equals_((0)._tan(),(0));
  7424. $ctx1.sendIdx["assert:equals:"]=3;
  7425. self._assert_equals_((1)._arcCos(),(0));
  7426. $ctx1.sendIdx["assert:equals:"]=4;
  7427. self._assert_equals_((0)._arcSin(),(0));
  7428. $ctx1.sendIdx["assert:equals:"]=5;
  7429. self._assert_equals_((0)._arcTan(),(0));
  7430. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7431. args: [],
  7432. 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.",
  7433. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7434. referencedClasses: []
  7435. }),
  7436. globals.NumberTest);
  7437. smalltalk.addMethod(
  7438. smalltalk.method({
  7439. selector: "testTruncated",
  7440. protocol: 'tests',
  7441. fn: function (){
  7442. var self=this;
  7443. return smalltalk.withContext(function($ctx1) {
  7444. var $1,$2;
  7445. $1=(3)._truncated();
  7446. $ctx1.sendIdx["truncated"]=1;
  7447. self._assert_equals_($1,(3));
  7448. $ctx1.sendIdx["assert:equals:"]=1;
  7449. $2=(3.212)._truncated();
  7450. $ctx1.sendIdx["truncated"]=2;
  7451. self._assert_equals_($2,(3));
  7452. $ctx1.sendIdx["assert:equals:"]=2;
  7453. self._assert_equals_((3.51)._truncated(),(3));
  7454. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7455. args: [],
  7456. 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",
  7457. messageSends: ["assert:equals:", "truncated"],
  7458. referencedClasses: []
  7459. }),
  7460. globals.NumberTest);
  7461. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7462. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7463. smalltalk.addMethod(
  7464. smalltalk.method({
  7465. selector: "foo",
  7466. protocol: 'not yet classified',
  7467. fn: function (){
  7468. var self=this;
  7469. var $1;
  7470. $1=self["@foo"];
  7471. return $1;
  7472. },
  7473. args: [],
  7474. source: "foo\x0a\x09^ foo",
  7475. messageSends: [],
  7476. referencedClasses: []
  7477. }),
  7478. globals.ObjectMock);
  7479. smalltalk.addMethod(
  7480. smalltalk.method({
  7481. selector: "foo:",
  7482. protocol: 'not yet classified',
  7483. fn: function (anObject){
  7484. var self=this;
  7485. self["@foo"]=anObject;
  7486. return self},
  7487. args: ["anObject"],
  7488. source: "foo: anObject\x0a\x09foo := anObject",
  7489. messageSends: [],
  7490. referencedClasses: []
  7491. }),
  7492. globals.ObjectMock);
  7493. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7494. smalltalk.addMethod(
  7495. smalltalk.method({
  7496. selector: "notDefined",
  7497. protocol: 'tests',
  7498. fn: function (){
  7499. var self=this;
  7500. return smalltalk.withContext(function($ctx1) {
  7501. return void 0;;
  7502. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7503. args: [],
  7504. source: "notDefined\x0a\x09<return void 0;>",
  7505. messageSends: [],
  7506. referencedClasses: []
  7507. }),
  7508. globals.ObjectTest);
  7509. smalltalk.addMethod(
  7510. smalltalk.method({
  7511. selector: "testBasicAccess",
  7512. protocol: 'tests',
  7513. fn: function (){
  7514. var self=this;
  7515. var o;
  7516. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7517. return smalltalk.withContext(function($ctx1) {
  7518. var $1;
  7519. o=_st($Object())._new();
  7520. _st(o)._basicAt_put_("a",(1));
  7521. $1=_st(o)._basicAt_("a");
  7522. $ctx1.sendIdx["basicAt:"]=1;
  7523. self._assert_equals_($1,(1));
  7524. $ctx1.sendIdx["assert:equals:"]=1;
  7525. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7526. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7527. args: [],
  7528. 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",
  7529. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7530. referencedClasses: ["Object"]
  7531. }),
  7532. globals.ObjectTest);
  7533. smalltalk.addMethod(
  7534. smalltalk.method({
  7535. selector: "testBasicPerform",
  7536. protocol: 'tests',
  7537. fn: function (){
  7538. var self=this;
  7539. var o;
  7540. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7541. return smalltalk.withContext(function($ctx1) {
  7542. o=_st($Object())._new();
  7543. _st(o)._basicAt_put_("func",(function(){
  7544. return "hello";
  7545. }));
  7546. $ctx1.sendIdx["basicAt:put:"]=1;
  7547. _st(o)._basicAt_put_("func2",(function(a){
  7548. return smalltalk.withContext(function($ctx2) {
  7549. return _st(a).__plus((1));
  7550. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7551. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7552. $ctx1.sendIdx["assert:equals:"]=1;
  7553. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7554. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7555. args: [],
  7556. 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",
  7557. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7558. referencedClasses: ["Object"]
  7559. }),
  7560. globals.ObjectTest);
  7561. smalltalk.addMethod(
  7562. smalltalk.method({
  7563. selector: "testDNU",
  7564. protocol: 'tests',
  7565. fn: function (){
  7566. var self=this;
  7567. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7568. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7569. return smalltalk.withContext(function($ctx1) {
  7570. self._should_raise_((function(){
  7571. return smalltalk.withContext(function($ctx2) {
  7572. return _st(_st($Object())._new())._foo();
  7573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7574. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7575. args: [],
  7576. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7577. messageSends: ["should:raise:", "foo", "new"],
  7578. referencedClasses: ["Object", "MessageNotUnderstood"]
  7579. }),
  7580. globals.ObjectTest);
  7581. smalltalk.addMethod(
  7582. smalltalk.method({
  7583. selector: "testEquality",
  7584. protocol: 'tests',
  7585. fn: function (){
  7586. var self=this;
  7587. var o;
  7588. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7589. return smalltalk.withContext(function($ctx1) {
  7590. var $1,$2,$4,$3;
  7591. o=_st($Object())._new();
  7592. $ctx1.sendIdx["new"]=1;
  7593. $1=_st(o).__eq(_st($Object())._new());
  7594. $ctx1.sendIdx["="]=1;
  7595. self._deny_($1);
  7596. $2=_st(o).__eq(o);
  7597. $ctx1.sendIdx["="]=2;
  7598. self._assert_($2);
  7599. $ctx1.sendIdx["assert:"]=1;
  7600. $4=_st(o)._yourself();
  7601. $ctx1.sendIdx["yourself"]=1;
  7602. $3=_st($4).__eq(o);
  7603. $ctx1.sendIdx["="]=3;
  7604. self._assert_($3);
  7605. $ctx1.sendIdx["assert:"]=2;
  7606. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7607. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7608. args: [],
  7609. 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)",
  7610. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7611. referencedClasses: ["Object"]
  7612. }),
  7613. globals.ObjectTest);
  7614. smalltalk.addMethod(
  7615. smalltalk.method({
  7616. selector: "testHalt",
  7617. protocol: 'tests',
  7618. fn: function (){
  7619. var self=this;
  7620. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7621. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7622. return smalltalk.withContext(function($ctx1) {
  7623. self._should_raise_((function(){
  7624. return smalltalk.withContext(function($ctx2) {
  7625. return _st(_st($Object())._new())._halt();
  7626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7627. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7628. args: [],
  7629. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7630. messageSends: ["should:raise:", "halt", "new"],
  7631. referencedClasses: ["Object", "Error"]
  7632. }),
  7633. globals.ObjectTest);
  7634. smalltalk.addMethod(
  7635. smalltalk.method({
  7636. selector: "testIdentity",
  7637. protocol: 'tests',
  7638. fn: function (){
  7639. var self=this;
  7640. var o;
  7641. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7642. return smalltalk.withContext(function($ctx1) {
  7643. var $1,$2,$4,$3;
  7644. o=_st($Object())._new();
  7645. $ctx1.sendIdx["new"]=1;
  7646. $1=_st(o).__eq_eq(_st($Object())._new());
  7647. $ctx1.sendIdx["=="]=1;
  7648. self._deny_($1);
  7649. $2=_st(o).__eq_eq(o);
  7650. $ctx1.sendIdx["=="]=2;
  7651. self._assert_($2);
  7652. $ctx1.sendIdx["assert:"]=1;
  7653. $4=_st(o)._yourself();
  7654. $ctx1.sendIdx["yourself"]=1;
  7655. $3=_st($4).__eq_eq(o);
  7656. $ctx1.sendIdx["=="]=3;
  7657. self._assert_($3);
  7658. $ctx1.sendIdx["assert:"]=2;
  7659. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7660. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7661. args: [],
  7662. 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",
  7663. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7664. referencedClasses: ["Object"]
  7665. }),
  7666. globals.ObjectTest);
  7667. smalltalk.addMethod(
  7668. smalltalk.method({
  7669. selector: "testIfNil",
  7670. protocol: 'tests',
  7671. fn: function (){
  7672. var self=this;
  7673. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7674. return smalltalk.withContext(function($ctx1) {
  7675. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7676. $2=_st($Object())._new();
  7677. $ctx1.sendIdx["new"]=1;
  7678. $1=_st($2)._isNil();
  7679. self._deny_($1);
  7680. $ctx1.sendIdx["deny:"]=1;
  7681. $5=_st($Object())._new();
  7682. $ctx1.sendIdx["new"]=2;
  7683. if(($receiver = $5) == null || $receiver.isNil){
  7684. $4=true;
  7685. } else {
  7686. $4=$5;
  7687. };
  7688. $3=_st($4).__eq(true);
  7689. self._deny_($3);
  7690. $7=_st($Object())._new();
  7691. $ctx1.sendIdx["new"]=3;
  7692. if(($receiver = $7) == null || $receiver.isNil){
  7693. $6=$7;
  7694. } else {
  7695. $6=true;
  7696. };
  7697. self._assert_equals_($6,true);
  7698. $ctx1.sendIdx["assert:equals:"]=1;
  7699. $9=_st($Object())._new();
  7700. $ctx1.sendIdx["new"]=4;
  7701. if(($receiver = $9) == null || $receiver.isNil){
  7702. $8=false;
  7703. } else {
  7704. $8=true;
  7705. };
  7706. self._assert_equals_($8,true);
  7707. $ctx1.sendIdx["assert:equals:"]=2;
  7708. $11=_st($Object())._new();
  7709. if(($receiver = $11) == null || $receiver.isNil){
  7710. $10=false;
  7711. } else {
  7712. $10=true;
  7713. };
  7714. self._assert_equals_($10,true);
  7715. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7716. args: [],
  7717. 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",
  7718. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7719. referencedClasses: ["Object"]
  7720. }),
  7721. globals.ObjectTest);
  7722. smalltalk.addMethod(
  7723. smalltalk.method({
  7724. selector: "testInstVars",
  7725. protocol: 'tests',
  7726. fn: function (){
  7727. var self=this;
  7728. var o;
  7729. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7730. return smalltalk.withContext(function($ctx1) {
  7731. var $1,$2;
  7732. o=_st($ObjectMock())._new();
  7733. $1=_st(o)._instVarAt_("foo");
  7734. $ctx1.sendIdx["instVarAt:"]=1;
  7735. self._assert_equals_($1,nil);
  7736. $ctx1.sendIdx["assert:equals:"]=1;
  7737. _st(o)._instVarAt_put_("foo",(1));
  7738. $2=_st(o)._instVarAt_("foo");
  7739. $ctx1.sendIdx["instVarAt:"]=2;
  7740. self._assert_equals_($2,(1));
  7741. $ctx1.sendIdx["assert:equals:"]=2;
  7742. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7743. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7744. args: [],
  7745. 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",
  7746. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7747. referencedClasses: ["ObjectMock"]
  7748. }),
  7749. globals.ObjectTest);
  7750. smalltalk.addMethod(
  7751. smalltalk.method({
  7752. selector: "testNilUndefined",
  7753. protocol: 'tests',
  7754. fn: function (){
  7755. var self=this;
  7756. return smalltalk.withContext(function($ctx1) {
  7757. self._assert_equals_(self._notDefined(),nil);
  7758. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7759. args: [],
  7760. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7761. messageSends: ["assert:equals:", "notDefined"],
  7762. referencedClasses: []
  7763. }),
  7764. globals.ObjectTest);
  7765. smalltalk.addMethod(
  7766. smalltalk.method({
  7767. selector: "testYourself",
  7768. protocol: 'tests',
  7769. fn: function (){
  7770. var self=this;
  7771. var o;
  7772. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7773. return smalltalk.withContext(function($ctx1) {
  7774. o=_st($ObjectMock())._new();
  7775. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7776. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7777. args: [],
  7778. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7779. messageSends: ["new", "assert:", "==", "yourself"],
  7780. referencedClasses: ["ObjectMock"]
  7781. }),
  7782. globals.ObjectTest);
  7783. smalltalk.addMethod(
  7784. smalltalk.method({
  7785. selector: "testidentityHash",
  7786. protocol: 'tests',
  7787. fn: function (){
  7788. var self=this;
  7789. var o1,o2;
  7790. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7791. return smalltalk.withContext(function($ctx1) {
  7792. var $2,$3,$1,$5,$4;
  7793. o1=_st($Object())._new();
  7794. $ctx1.sendIdx["new"]=1;
  7795. o2=_st($Object())._new();
  7796. $2=_st(o1)._identityHash();
  7797. $ctx1.sendIdx["identityHash"]=1;
  7798. $3=_st(o1)._identityHash();
  7799. $ctx1.sendIdx["identityHash"]=2;
  7800. $1=_st($2).__eq_eq($3);
  7801. $ctx1.sendIdx["=="]=1;
  7802. self._assert_($1);
  7803. $5=_st(o1)._identityHash();
  7804. $ctx1.sendIdx["identityHash"]=3;
  7805. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7806. self._deny_($4);
  7807. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7808. args: [],
  7809. 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",
  7810. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7811. referencedClasses: ["Object"]
  7812. }),
  7813. globals.ObjectTest);
  7814. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7815. smalltalk.addMethod(
  7816. smalltalk.method({
  7817. selector: "testAccessing",
  7818. protocol: 'tests',
  7819. fn: function (){
  7820. var self=this;
  7821. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7822. return smalltalk.withContext(function($ctx1) {
  7823. var $2,$1,$3,$6,$5,$4;
  7824. $2=_st($Point())._x_y_((3),(4));
  7825. $ctx1.sendIdx["x:y:"]=1;
  7826. $1=_st($2)._x();
  7827. $ctx1.sendIdx["x"]=1;
  7828. self._assert_equals_($1,(3));
  7829. $ctx1.sendIdx["assert:equals:"]=1;
  7830. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7831. $ctx1.sendIdx["y"]=1;
  7832. self._assert_equals_($3,(4));
  7833. $ctx1.sendIdx["assert:equals:"]=2;
  7834. $6=_st($Point())._new();
  7835. $ctx1.sendIdx["new"]=1;
  7836. $5=_st($6)._x_((3));
  7837. $4=_st($5)._x();
  7838. self._assert_equals_($4,(3));
  7839. $ctx1.sendIdx["assert:equals:"]=3;
  7840. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7841. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7842. args: [],
  7843. 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",
  7844. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7845. referencedClasses: ["Point"]
  7846. }),
  7847. globals.PointTest);
  7848. smalltalk.addMethod(
  7849. smalltalk.method({
  7850. selector: "testArithmetic",
  7851. protocol: 'tests',
  7852. fn: function (){
  7853. var self=this;
  7854. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7855. return smalltalk.withContext(function($ctx1) {
  7856. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7857. $2=(3).__at((4));
  7858. $ctx1.sendIdx["@"]=1;
  7859. $3=(3).__at((4));
  7860. $ctx1.sendIdx["@"]=2;
  7861. $1=_st($2).__star($3);
  7862. $4=_st($Point())._x_y_((9),(16));
  7863. $ctx1.sendIdx["x:y:"]=1;
  7864. self._assert_equals_($1,$4);
  7865. $ctx1.sendIdx["assert:equals:"]=1;
  7866. $6=(3).__at((4));
  7867. $ctx1.sendIdx["@"]=3;
  7868. $7=(3).__at((4));
  7869. $ctx1.sendIdx["@"]=4;
  7870. $5=_st($6).__plus($7);
  7871. $8=_st($Point())._x_y_((6),(8));
  7872. $ctx1.sendIdx["x:y:"]=2;
  7873. self._assert_equals_($5,$8);
  7874. $ctx1.sendIdx["assert:equals:"]=2;
  7875. $10=(3).__at((4));
  7876. $ctx1.sendIdx["@"]=5;
  7877. $11=(3).__at((4));
  7878. $ctx1.sendIdx["@"]=6;
  7879. $9=_st($10).__minus($11);
  7880. $12=_st($Point())._x_y_((0),(0));
  7881. $ctx1.sendIdx["x:y:"]=3;
  7882. self._assert_equals_($9,$12);
  7883. $ctx1.sendIdx["assert:equals:"]=3;
  7884. $14=(6).__at((8));
  7885. $ctx1.sendIdx["@"]=7;
  7886. $13=_st($14).__slash((3).__at((4)));
  7887. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7888. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7889. args: [],
  7890. 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)",
  7891. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7892. referencedClasses: ["Point"]
  7893. }),
  7894. globals.PointTest);
  7895. smalltalk.addMethod(
  7896. smalltalk.method({
  7897. selector: "testAt",
  7898. protocol: 'tests',
  7899. fn: function (){
  7900. var self=this;
  7901. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7902. return smalltalk.withContext(function($ctx1) {
  7903. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7904. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7905. args: [],
  7906. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7907. messageSends: ["assert:equals:", "@", "x:y:"],
  7908. referencedClasses: ["Point"]
  7909. }),
  7910. globals.PointTest);
  7911. smalltalk.addMethod(
  7912. smalltalk.method({
  7913. selector: "testComparison",
  7914. protocol: 'tests',
  7915. fn: function (){
  7916. var self=this;
  7917. return smalltalk.withContext(function($ctx1) {
  7918. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7919. $2=(3).__at((4));
  7920. $ctx1.sendIdx["@"]=1;
  7921. $3=(4).__at((5));
  7922. $ctx1.sendIdx["@"]=2;
  7923. $1=_st($2).__lt($3);
  7924. $ctx1.sendIdx["<"]=1;
  7925. self._assert_($1);
  7926. $ctx1.sendIdx["assert:"]=1;
  7927. $5=(3).__at((4));
  7928. $ctx1.sendIdx["@"]=3;
  7929. $6=(4).__at((4));
  7930. $ctx1.sendIdx["@"]=4;
  7931. $4=_st($5).__lt($6);
  7932. self._deny_($4);
  7933. $ctx1.sendIdx["deny:"]=1;
  7934. $8=(4).__at((5));
  7935. $ctx1.sendIdx["@"]=5;
  7936. $9=(4).__at((5));
  7937. $ctx1.sendIdx["@"]=6;
  7938. $7=_st($8).__lt_eq($9);
  7939. $ctx1.sendIdx["<="]=1;
  7940. self._assert_($7);
  7941. $ctx1.sendIdx["assert:"]=2;
  7942. $11=(4).__at((5));
  7943. $ctx1.sendIdx["@"]=7;
  7944. $12=(3).__at((5));
  7945. $ctx1.sendIdx["@"]=8;
  7946. $10=_st($11).__lt_eq($12);
  7947. self._deny_($10);
  7948. $ctx1.sendIdx["deny:"]=2;
  7949. $14=(5).__at((6));
  7950. $ctx1.sendIdx["@"]=9;
  7951. $15=(4).__at((5));
  7952. $ctx1.sendIdx["@"]=10;
  7953. $13=_st($14).__gt($15);
  7954. $ctx1.sendIdx[">"]=1;
  7955. self._assert_($13);
  7956. $ctx1.sendIdx["assert:"]=3;
  7957. $17=(5).__at((6));
  7958. $ctx1.sendIdx["@"]=11;
  7959. $18=(6).__at((6));
  7960. $ctx1.sendIdx["@"]=12;
  7961. $16=_st($17).__gt($18);
  7962. self._deny_($16);
  7963. $ctx1.sendIdx["deny:"]=3;
  7964. $20=(4).__at((5));
  7965. $ctx1.sendIdx["@"]=13;
  7966. $21=(4).__at((5));
  7967. $ctx1.sendIdx["@"]=14;
  7968. $19=_st($20).__gt_eq($21);
  7969. $ctx1.sendIdx[">="]=1;
  7970. self._assert_($19);
  7971. $23=(4).__at((5));
  7972. $ctx1.sendIdx["@"]=15;
  7973. $22=_st($23).__gt_eq((5).__at((5)));
  7974. self._deny_($22);
  7975. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  7976. args: [],
  7977. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  7978. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  7979. referencedClasses: []
  7980. }),
  7981. globals.PointTest);
  7982. smalltalk.addMethod(
  7983. smalltalk.method({
  7984. selector: "testEgality",
  7985. protocol: 'tests',
  7986. fn: function (){
  7987. var self=this;
  7988. return smalltalk.withContext(function($ctx1) {
  7989. var $2,$3,$1,$5,$4;
  7990. $2=(3).__at((4));
  7991. $ctx1.sendIdx["@"]=1;
  7992. $3=(3).__at((4));
  7993. $ctx1.sendIdx["@"]=2;
  7994. $1=_st($2).__eq($3);
  7995. $ctx1.sendIdx["="]=1;
  7996. self._assert_($1);
  7997. $5=(3).__at((5));
  7998. $ctx1.sendIdx["@"]=3;
  7999. $4=_st($5).__eq((3).__at((6)));
  8000. self._deny_($4);
  8001. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  8002. args: [],
  8003. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  8004. messageSends: ["assert:", "=", "@", "deny:"],
  8005. referencedClasses: []
  8006. }),
  8007. globals.PointTest);
  8008. smalltalk.addMethod(
  8009. smalltalk.method({
  8010. selector: "testNew",
  8011. protocol: 'tests',
  8012. fn: function (){
  8013. var self=this;
  8014. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  8015. return smalltalk.withContext(function($ctx1) {
  8016. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  8017. $3=_st($Point())._new();
  8018. $ctx1.sendIdx["new"]=1;
  8019. $2=_st($3)._x_((3));
  8020. $ctx1.sendIdx["x:"]=1;
  8021. $1=_st($2)._y();
  8022. $ctx1.sendIdx["y"]=1;
  8023. self._assert_equals_($1,nil);
  8024. $ctx1.sendIdx["assert:equals:"]=1;
  8025. $7=_st($Point())._new();
  8026. $ctx1.sendIdx["new"]=2;
  8027. $6=_st($7)._x_((3));
  8028. $5=_st($6)._x();
  8029. $ctx1.sendIdx["x"]=1;
  8030. $4=_st($5).__eq((0));
  8031. $ctx1.sendIdx["="]=1;
  8032. self._deny_($4);
  8033. $ctx1.sendIdx["deny:"]=1;
  8034. $10=_st($Point())._new();
  8035. $ctx1.sendIdx["new"]=3;
  8036. $9=_st($10)._y_((4));
  8037. $ctx1.sendIdx["y:"]=1;
  8038. $8=_st($9)._x();
  8039. self._assert_equals_($8,nil);
  8040. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  8041. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  8042. args: [],
  8043. 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",
  8044. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  8045. referencedClasses: ["Point"]
  8046. }),
  8047. globals.PointTest);
  8048. smalltalk.addMethod(
  8049. smalltalk.method({
  8050. selector: "testTranslateBy",
  8051. protocol: 'tests',
  8052. fn: function (){
  8053. var self=this;
  8054. return smalltalk.withContext(function($ctx1) {
  8055. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  8056. $2=(3).__at((3));
  8057. $ctx1.sendIdx["@"]=1;
  8058. $3=(0).__at((1));
  8059. $ctx1.sendIdx["@"]=2;
  8060. $1=_st($2)._translateBy_($3);
  8061. $ctx1.sendIdx["translateBy:"]=1;
  8062. $4=(3).__at((4));
  8063. $ctx1.sendIdx["@"]=3;
  8064. self._assert_equals_($1,$4);
  8065. $ctx1.sendIdx["assert:equals:"]=1;
  8066. $6=(3).__at((3));
  8067. $ctx1.sendIdx["@"]=4;
  8068. $8=(1)._negated();
  8069. $ctx1.sendIdx["negated"]=1;
  8070. $7=(0).__at($8);
  8071. $ctx1.sendIdx["@"]=5;
  8072. $5=_st($6)._translateBy_($7);
  8073. $ctx1.sendIdx["translateBy:"]=2;
  8074. $9=(3).__at((2));
  8075. $ctx1.sendIdx["@"]=6;
  8076. self._assert_equals_($5,$9);
  8077. $ctx1.sendIdx["assert:equals:"]=2;
  8078. $11=(3).__at((3));
  8079. $ctx1.sendIdx["@"]=7;
  8080. $12=(2).__at((3));
  8081. $ctx1.sendIdx["@"]=8;
  8082. $10=_st($11)._translateBy_($12);
  8083. $ctx1.sendIdx["translateBy:"]=3;
  8084. $13=(5).__at((6));
  8085. $ctx1.sendIdx["@"]=9;
  8086. self._assert_equals_($10,$13);
  8087. $ctx1.sendIdx["assert:equals:"]=3;
  8088. $15=(3).__at((3));
  8089. $ctx1.sendIdx["@"]=10;
  8090. $16=_st((3)._negated()).__at((0));
  8091. $ctx1.sendIdx["@"]=11;
  8092. $14=_st($15)._translateBy_($16);
  8093. self._assert_equals_($14,(0).__at((3)));
  8094. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  8095. args: [],
  8096. 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.",
  8097. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  8098. referencedClasses: []
  8099. }),
  8100. globals.PointTest);
  8101. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  8102. smalltalk.addMethod(
  8103. smalltalk.method({
  8104. selector: "testNextIfAbsent",
  8105. protocol: 'tests',
  8106. fn: function (){
  8107. var self=this;
  8108. var queue;
  8109. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8110. return smalltalk.withContext(function($ctx1) {
  8111. var $2,$1;
  8112. queue=_st($Queue())._new();
  8113. _st(queue)._nextPut_("index1");
  8114. $2=_st(queue)._nextIfAbsent_("empty");
  8115. $ctx1.sendIdx["nextIfAbsent:"]=1;
  8116. $1=_st($2).__eq("index1");
  8117. $ctx1.sendIdx["="]=1;
  8118. self._assert_($1);
  8119. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  8120. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  8121. args: [],
  8122. 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'",
  8123. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  8124. referencedClasses: ["Queue"]
  8125. }),
  8126. globals.QueueTest);
  8127. smalltalk.addMethod(
  8128. smalltalk.method({
  8129. selector: "testQueueNext",
  8130. protocol: 'tests',
  8131. fn: function (){
  8132. var self=this;
  8133. var queue;
  8134. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8135. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8136. return smalltalk.withContext(function($ctx1) {
  8137. var $1,$2,$4,$3,$6,$5;
  8138. queue=_st($Queue())._new();
  8139. $1=queue;
  8140. _st($1)._nextPut_("index1");
  8141. $ctx1.sendIdx["nextPut:"]=1;
  8142. $2=_st($1)._nextPut_("index2");
  8143. $4=_st(queue)._next();
  8144. $ctx1.sendIdx["next"]=1;
  8145. $3=_st($4).__eq("index1");
  8146. $ctx1.sendIdx["="]=1;
  8147. self._assert_($3);
  8148. $6=_st(queue)._next();
  8149. $ctx1.sendIdx["next"]=2;
  8150. $5=_st($6).__eq("index");
  8151. self._deny_($5);
  8152. self._should_raise_((function(){
  8153. return smalltalk.withContext(function($ctx2) {
  8154. return _st(queue)._next();
  8155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8156. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8157. args: [],
  8158. 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",
  8159. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8160. referencedClasses: ["Queue", "Error"]
  8161. }),
  8162. globals.QueueTest);
  8163. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8164. smalltalk.addMethod(
  8165. smalltalk.method({
  8166. selector: "testAtRandomNumber",
  8167. protocol: 'tests',
  8168. fn: function (){
  8169. var self=this;
  8170. var val;
  8171. return smalltalk.withContext(function($ctx1) {
  8172. (100)._timesRepeat_((function(){
  8173. return smalltalk.withContext(function($ctx2) {
  8174. val=(10)._atRandom();
  8175. val;
  8176. self._assert_(_st(val).__gt((0)));
  8177. $ctx2.sendIdx["assert:"]=1;
  8178. return self._assert_(_st(val).__lt((11)));
  8179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8180. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8181. args: [],
  8182. 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]",
  8183. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8184. referencedClasses: []
  8185. }),
  8186. globals.RandomTest);
  8187. smalltalk.addMethod(
  8188. smalltalk.method({
  8189. selector: "testAtRandomSequenceableCollection",
  8190. protocol: 'tests',
  8191. fn: function (){
  8192. var self=this;
  8193. var val;
  8194. return smalltalk.withContext(function($ctx1) {
  8195. var $3,$4,$2,$1;
  8196. (100)._timesRepeat_((function(){
  8197. return smalltalk.withContext(function($ctx2) {
  8198. val="abc"._atRandom();
  8199. val;
  8200. $3=_st(val).__eq("a");
  8201. $ctx2.sendIdx["="]=1;
  8202. $4=_st(val).__eq("b");
  8203. $ctx2.sendIdx["="]=2;
  8204. $2=_st($3).__or($4);
  8205. $1=_st($2).__or(_st(val).__eq("c"));
  8206. $ctx2.sendIdx["|"]=1;
  8207. return self._assert_($1);
  8208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8209. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8210. args: [],
  8211. 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].",
  8212. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8213. referencedClasses: []
  8214. }),
  8215. globals.RandomTest);
  8216. smalltalk.addMethod(
  8217. smalltalk.method({
  8218. selector: "textNext",
  8219. protocol: 'tests',
  8220. fn: function (){
  8221. var self=this;
  8222. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8223. return smalltalk.withContext(function($ctx1) {
  8224. var $1;
  8225. (10000)._timesRepeat_((function(){
  8226. var current,next;
  8227. return smalltalk.withContext(function($ctx2) {
  8228. next=_st(_st($Random())._new())._next();
  8229. next;
  8230. self._assert_(_st(next).__gt_eq((0)));
  8231. $ctx2.sendIdx["assert:"]=1;
  8232. self._assert_(_st(next).__lt((1)));
  8233. $1=_st(current).__eq(next);
  8234. $ctx2.sendIdx["="]=1;
  8235. self._deny_($1);
  8236. return _st(next).__eq(current);
  8237. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8238. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8239. args: [],
  8240. 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 ]",
  8241. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8242. referencedClasses: ["Random"]
  8243. }),
  8244. globals.RandomTest);
  8245. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8246. smalltalk.addMethod(
  8247. smalltalk.method({
  8248. selector: "collectionClass",
  8249. protocol: 'accessing',
  8250. fn: function (){
  8251. var self=this;
  8252. return smalltalk.withContext(function($ctx1) {
  8253. var $1;
  8254. $1=_st(self._class())._collectionClass();
  8255. return $1;
  8256. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8257. args: [],
  8258. source: "collectionClass\x0a\x09^ self class collectionClass",
  8259. messageSends: ["collectionClass", "class"],
  8260. referencedClasses: []
  8261. }),
  8262. globals.StreamTest);
  8263. smalltalk.addMethod(
  8264. smalltalk.method({
  8265. selector: "newCollection",
  8266. protocol: 'accessing',
  8267. fn: function (){
  8268. var self=this;
  8269. return smalltalk.withContext(function($ctx1) {
  8270. var $1;
  8271. $1=_st(self._collectionClass())._new();
  8272. return $1;
  8273. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8274. args: [],
  8275. source: "newCollection\x0a\x09^ self collectionClass new",
  8276. messageSends: ["new", "collectionClass"],
  8277. referencedClasses: []
  8278. }),
  8279. globals.StreamTest);
  8280. smalltalk.addMethod(
  8281. smalltalk.method({
  8282. selector: "newStream",
  8283. protocol: 'accessing',
  8284. fn: function (){
  8285. var self=this;
  8286. return smalltalk.withContext(function($ctx1) {
  8287. var $1;
  8288. $1=_st(_st(self._collectionClass())._new())._stream();
  8289. return $1;
  8290. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8291. args: [],
  8292. source: "newStream\x0a\x09^ self collectionClass new stream",
  8293. messageSends: ["stream", "new", "collectionClass"],
  8294. referencedClasses: []
  8295. }),
  8296. globals.StreamTest);
  8297. smalltalk.addMethod(
  8298. smalltalk.method({
  8299. selector: "testAtStartAtEnd",
  8300. protocol: 'tests',
  8301. fn: function (){
  8302. var self=this;
  8303. var stream;
  8304. return smalltalk.withContext(function($ctx1) {
  8305. var $1,$2,$3,$4;
  8306. stream=self._newStream();
  8307. $1=_st(stream)._atStart();
  8308. $ctx1.sendIdx["atStart"]=1;
  8309. self._assert_($1);
  8310. $ctx1.sendIdx["assert:"]=1;
  8311. $2=_st(stream)._atEnd();
  8312. $ctx1.sendIdx["atEnd"]=1;
  8313. self._assert_($2);
  8314. $ctx1.sendIdx["assert:"]=2;
  8315. _st(stream)._nextPutAll_(self._newCollection());
  8316. $3=_st(stream)._atEnd();
  8317. $ctx1.sendIdx["atEnd"]=2;
  8318. self._assert_($3);
  8319. $4=_st(stream)._atStart();
  8320. $ctx1.sendIdx["atStart"]=2;
  8321. self._deny_($4);
  8322. $ctx1.sendIdx["deny:"]=1;
  8323. _st(stream)._position_((1));
  8324. self._deny_(_st(stream)._atEnd());
  8325. $ctx1.sendIdx["deny:"]=2;
  8326. self._deny_(_st(stream)._atStart());
  8327. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8328. args: [],
  8329. 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",
  8330. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8331. referencedClasses: []
  8332. }),
  8333. globals.StreamTest);
  8334. smalltalk.addMethod(
  8335. smalltalk.method({
  8336. selector: "testContents",
  8337. protocol: 'tests',
  8338. fn: function (){
  8339. var self=this;
  8340. var stream;
  8341. return smalltalk.withContext(function($ctx1) {
  8342. var $1,$2;
  8343. stream=self._newStream();
  8344. $1=stream;
  8345. $2=self._newCollection();
  8346. $ctx1.sendIdx["newCollection"]=1;
  8347. _st($1)._nextPutAll_($2);
  8348. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8349. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8350. args: [],
  8351. 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",
  8352. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8353. referencedClasses: []
  8354. }),
  8355. globals.StreamTest);
  8356. smalltalk.addMethod(
  8357. smalltalk.method({
  8358. selector: "testIsEmpty",
  8359. protocol: 'tests',
  8360. fn: function (){
  8361. var self=this;
  8362. var stream;
  8363. return smalltalk.withContext(function($ctx1) {
  8364. var $1;
  8365. stream=self._newStream();
  8366. $1=_st(stream)._isEmpty();
  8367. $ctx1.sendIdx["isEmpty"]=1;
  8368. self._assert_($1);
  8369. _st(stream)._nextPutAll_(self._newCollection());
  8370. self._deny_(_st(stream)._isEmpty());
  8371. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8372. args: [],
  8373. 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",
  8374. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8375. referencedClasses: []
  8376. }),
  8377. globals.StreamTest);
  8378. smalltalk.addMethod(
  8379. smalltalk.method({
  8380. selector: "testPosition",
  8381. protocol: 'tests',
  8382. fn: function (){
  8383. var self=this;
  8384. var collection,stream;
  8385. return smalltalk.withContext(function($ctx1) {
  8386. var $1,$2,$3;
  8387. collection=self._newCollection();
  8388. stream=self._newStream();
  8389. _st(stream)._nextPutAll_(collection);
  8390. $1=_st(stream)._position();
  8391. $ctx1.sendIdx["position"]=1;
  8392. self._assert_equals_($1,_st(collection)._size());
  8393. $ctx1.sendIdx["assert:equals:"]=1;
  8394. _st(stream)._position_((0));
  8395. $2=_st(stream)._position();
  8396. $ctx1.sendIdx["position"]=2;
  8397. self._assert_equals_($2,(0));
  8398. $ctx1.sendIdx["assert:equals:"]=2;
  8399. _st(stream)._next();
  8400. $ctx1.sendIdx["next"]=1;
  8401. $3=_st(stream)._position();
  8402. $ctx1.sendIdx["position"]=3;
  8403. self._assert_equals_($3,(1));
  8404. $ctx1.sendIdx["assert:equals:"]=3;
  8405. _st(stream)._next();
  8406. self._assert_equals_(_st(stream)._position(),(2));
  8407. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8408. args: [],
  8409. 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",
  8410. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8411. referencedClasses: []
  8412. }),
  8413. globals.StreamTest);
  8414. smalltalk.addMethod(
  8415. smalltalk.method({
  8416. selector: "testReading",
  8417. protocol: 'tests',
  8418. fn: function (){
  8419. var self=this;
  8420. var stream,collection;
  8421. return smalltalk.withContext(function($ctx1) {
  8422. var $1,$2,$3;
  8423. collection=self._newCollection();
  8424. stream=self._newStream();
  8425. $1=stream;
  8426. _st($1)._nextPutAll_(collection);
  8427. $2=_st($1)._position_((0));
  8428. _st(collection)._do_((function(each){
  8429. return smalltalk.withContext(function($ctx2) {
  8430. $3=_st(stream)._next();
  8431. $ctx2.sendIdx["next"]=1;
  8432. return self._assert_equals_($3,each);
  8433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8434. self._assert_(_st(_st(stream)._next())._isNil());
  8435. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8436. args: [],
  8437. 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",
  8438. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8439. referencedClasses: []
  8440. }),
  8441. globals.StreamTest);
  8442. smalltalk.addMethod(
  8443. smalltalk.method({
  8444. selector: "testStreamContents",
  8445. protocol: 'tests',
  8446. fn: function (){
  8447. var self=this;
  8448. return self},
  8449. args: [],
  8450. source: "testStreamContents",
  8451. messageSends: [],
  8452. referencedClasses: []
  8453. }),
  8454. globals.StreamTest);
  8455. smalltalk.addMethod(
  8456. smalltalk.method({
  8457. selector: "testWrite",
  8458. protocol: 'tests',
  8459. fn: function (){
  8460. var self=this;
  8461. var stream,collection;
  8462. return smalltalk.withContext(function($ctx1) {
  8463. collection=self._newCollection();
  8464. stream=self._newStream();
  8465. _st(collection)._do_((function(each){
  8466. return smalltalk.withContext(function($ctx2) {
  8467. return _st(stream).__lt_lt(each);
  8468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8469. self._assert_equals_(_st(stream)._contents(),collection);
  8470. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8471. args: [],
  8472. 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",
  8473. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8474. referencedClasses: []
  8475. }),
  8476. globals.StreamTest);
  8477. smalltalk.addMethod(
  8478. smalltalk.method({
  8479. selector: "testWriting",
  8480. protocol: 'tests',
  8481. fn: function (){
  8482. var self=this;
  8483. var stream,collection;
  8484. return smalltalk.withContext(function($ctx1) {
  8485. var $1;
  8486. collection=self._newCollection();
  8487. stream=self._newStream();
  8488. $ctx1.sendIdx["newStream"]=1;
  8489. _st(collection)._do_((function(each){
  8490. return smalltalk.withContext(function($ctx2) {
  8491. return _st(stream)._nextPut_(each);
  8492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8493. $1=_st(stream)._contents();
  8494. $ctx1.sendIdx["contents"]=1;
  8495. self._assert_equals_($1,collection);
  8496. $ctx1.sendIdx["assert:equals:"]=1;
  8497. stream=self._newStream();
  8498. _st(stream)._nextPutAll_(collection);
  8499. self._assert_equals_(_st(stream)._contents(),collection);
  8500. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8501. args: [],
  8502. 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",
  8503. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8504. referencedClasses: []
  8505. }),
  8506. globals.StreamTest);
  8507. smalltalk.addMethod(
  8508. smalltalk.method({
  8509. selector: "collectionClass",
  8510. protocol: 'accessing',
  8511. fn: function (){
  8512. var self=this;
  8513. return nil;
  8514. },
  8515. args: [],
  8516. source: "collectionClass\x0a\x09^ nil",
  8517. messageSends: [],
  8518. referencedClasses: []
  8519. }),
  8520. globals.StreamTest.klass);
  8521. smalltalk.addMethod(
  8522. smalltalk.method({
  8523. selector: "isAbstract",
  8524. protocol: 'testing',
  8525. fn: function (){
  8526. var self=this;
  8527. return smalltalk.withContext(function($ctx1) {
  8528. var $1;
  8529. $1=_st(self._collectionClass())._isNil();
  8530. return $1;
  8531. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8532. args: [],
  8533. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8534. messageSends: ["isNil", "collectionClass"],
  8535. referencedClasses: []
  8536. }),
  8537. globals.StreamTest.klass);
  8538. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8539. smalltalk.addMethod(
  8540. smalltalk.method({
  8541. selector: "newCollection",
  8542. protocol: 'accessing',
  8543. fn: function (){
  8544. var self=this;
  8545. return smalltalk.withContext(function($ctx1) {
  8546. var $1;
  8547. $1=[true,(1),(3).__at((4)),"foo"];
  8548. return $1;
  8549. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8550. args: [],
  8551. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8552. messageSends: ["@"],
  8553. referencedClasses: []
  8554. }),
  8555. globals.ArrayStreamTest);
  8556. smalltalk.addMethod(
  8557. smalltalk.method({
  8558. selector: "collectionClass",
  8559. protocol: 'accessing',
  8560. fn: function (){
  8561. var self=this;
  8562. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8563. return $Array();
  8564. },
  8565. args: [],
  8566. source: "collectionClass\x0a\x09^ Array",
  8567. messageSends: [],
  8568. referencedClasses: ["Array"]
  8569. }),
  8570. globals.ArrayStreamTest.klass);
  8571. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8572. smalltalk.addMethod(
  8573. smalltalk.method({
  8574. selector: "newCollection",
  8575. protocol: 'accessing',
  8576. fn: function (){
  8577. var self=this;
  8578. return "hello world";
  8579. },
  8580. args: [],
  8581. source: "newCollection\x0a\x09^ 'hello world'",
  8582. messageSends: [],
  8583. referencedClasses: []
  8584. }),
  8585. globals.StringStreamTest);
  8586. smalltalk.addMethod(
  8587. smalltalk.method({
  8588. selector: "collectionClass",
  8589. protocol: 'accessing',
  8590. fn: function (){
  8591. var self=this;
  8592. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8593. return $String();
  8594. },
  8595. args: [],
  8596. source: "collectionClass\x0a\x09^ String",
  8597. messageSends: [],
  8598. referencedClasses: ["String"]
  8599. }),
  8600. globals.StringStreamTest.klass);
  8601. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8602. smalltalk.addMethod(
  8603. smalltalk.method({
  8604. selector: "testCopying",
  8605. protocol: 'tests',
  8606. fn: function (){
  8607. var self=this;
  8608. return smalltalk.withContext(function($ctx1) {
  8609. self._assert_equals_(nil._copy(),nil);
  8610. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8611. args: [],
  8612. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8613. messageSends: ["assert:equals:", "copy"],
  8614. referencedClasses: []
  8615. }),
  8616. globals.UndefinedTest);
  8617. smalltalk.addMethod(
  8618. smalltalk.method({
  8619. selector: "testDeepCopy",
  8620. protocol: 'tests',
  8621. fn: function (){
  8622. var self=this;
  8623. return smalltalk.withContext(function($ctx1) {
  8624. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8625. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8626. args: [],
  8627. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8628. messageSends: ["assert:", "=", "deepCopy"],
  8629. referencedClasses: []
  8630. }),
  8631. globals.UndefinedTest);
  8632. smalltalk.addMethod(
  8633. smalltalk.method({
  8634. selector: "testIfNil",
  8635. protocol: 'tests',
  8636. fn: function (){
  8637. var self=this;
  8638. return smalltalk.withContext(function($ctx1) {
  8639. var $1,$3,$2,$4,$6,$5,$receiver;
  8640. if(($receiver = nil) == null || $receiver.isNil){
  8641. $1=true;
  8642. } else {
  8643. $1=nil;
  8644. };
  8645. self._assert_equals_($1,true);
  8646. $ctx1.sendIdx["assert:equals:"]=1;
  8647. if(($receiver = nil) == null || $receiver.isNil){
  8648. $3=nil;
  8649. } else {
  8650. $3=true;
  8651. };
  8652. $2=_st($3).__eq(true);
  8653. $ctx1.sendIdx["="]=1;
  8654. self._deny_($2);
  8655. $ctx1.sendIdx["deny:"]=1;
  8656. if(($receiver = nil) == null || $receiver.isNil){
  8657. $4=true;
  8658. } else {
  8659. $4=false;
  8660. };
  8661. self._assert_equals_($4,true);
  8662. if(($receiver = nil) == null || $receiver.isNil){
  8663. $6=false;
  8664. } else {
  8665. $6=true;
  8666. };
  8667. $5=_st($6).__eq(true);
  8668. self._deny_($5);
  8669. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8670. args: [],
  8671. 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",
  8672. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8673. referencedClasses: []
  8674. }),
  8675. globals.UndefinedTest);
  8676. smalltalk.addMethod(
  8677. smalltalk.method({
  8678. selector: "testIsNil",
  8679. protocol: 'tests',
  8680. fn: function (){
  8681. var self=this;
  8682. return smalltalk.withContext(function($ctx1) {
  8683. self._assert_(nil._isNil());
  8684. self._deny_(nil._notNil());
  8685. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8686. args: [],
  8687. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8688. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8689. referencedClasses: []
  8690. }),
  8691. globals.UndefinedTest);
  8692. });