Kernel-Tests.js 332 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfAbsentPut",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var newCollection;
  2334. return smalltalk.withContext(function($ctx1) {
  2335. var $1;
  2336. newCollection=self._collection();
  2337. $ctx1.sendIdx["collection"]=1;
  2338. self._samplesDo_((function(index,value){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2341. return smalltalk.withContext(function($ctx3) {
  2342. return self._sampleNewValue();
  2343. $ctx3.sendIdx["sampleNewValue"]=1;
  2344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2345. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2346. return self._assert_equals_($1,value);
  2347. $ctx2.sendIdx["assert:equals:"]=1;
  2348. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2349. self._assert_equals_(newCollection,self._collection());
  2350. $ctx1.sendIdx["assert:equals:"]=2;
  2351. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2352. return smalltalk.withContext(function($ctx2) {
  2353. return self._sampleNewValue();
  2354. $ctx2.sendIdx["sampleNewValue"]=2;
  2355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2356. $ctx1.sendIdx["assert:equals:"]=3;
  2357. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2358. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2359. args: [],
  2360. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2361. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2362. referencedClasses: []
  2363. }),
  2364. smalltalk.IndexableCollectionTest);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "testAtIfPresent",
  2368. protocol: 'tests',
  2369. fn: function (){
  2370. var self=this;
  2371. var visited,sentinel;
  2372. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2373. return smalltalk.withContext(function($ctx1) {
  2374. var $2,$1,$4,$3;
  2375. sentinel=_st($Object())._new();
  2376. self._nonIndexesDo_((function(each){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. visited=nil;
  2379. visited;
  2380. $2=self._collection();
  2381. $ctx2.sendIdx["collection"]=1;
  2382. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2383. return smalltalk.withContext(function($ctx3) {
  2384. visited=value1;
  2385. visited;
  2386. return sentinel;
  2387. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2388. $ctx2.sendIdx["at:ifPresent:"]=1;
  2389. self._assert_equals_($1,nil);
  2390. $ctx2.sendIdx["assert:equals:"]=1;
  2391. return self._assert_(_st(visited)._isNil());
  2392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2393. self._samplesDo_((function(index,value){
  2394. return smalltalk.withContext(function($ctx2) {
  2395. visited=nil;
  2396. visited;
  2397. $4=self._collection();
  2398. $ctx2.sendIdx["collection"]=2;
  2399. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2400. return smalltalk.withContext(function($ctx3) {
  2401. visited=value2;
  2402. visited;
  2403. return sentinel;
  2404. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2405. self._assert_equals_($3,sentinel);
  2406. $ctx2.sendIdx["assert:equals:"]=2;
  2407. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2408. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2409. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2410. args: [],
  2411. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2412. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2413. referencedClasses: ["Object"]
  2414. }),
  2415. smalltalk.IndexableCollectionTest);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "testAtIfPresentIfAbsent",
  2419. protocol: 'tests',
  2420. fn: function (){
  2421. var self=this;
  2422. var visited,sentinel;
  2423. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2424. return smalltalk.withContext(function($ctx1) {
  2425. var $2,$1,$3,$5,$4;
  2426. sentinel=_st($Object())._new();
  2427. self._nonIndexesDo_((function(each){
  2428. return smalltalk.withContext(function($ctx2) {
  2429. visited=nil;
  2430. visited;
  2431. $2=self._collection();
  2432. $ctx2.sendIdx["collection"]=1;
  2433. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2434. return smalltalk.withContext(function($ctx3) {
  2435. visited=value1;
  2436. visited;
  2437. return sentinel;
  2438. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2439. return smalltalk.withContext(function($ctx3) {
  2440. return self._sampleNewValue();
  2441. $ctx3.sendIdx["sampleNewValue"]=1;
  2442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2443. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2444. $3=self._sampleNewValue();
  2445. $ctx2.sendIdx["sampleNewValue"]=2;
  2446. self._assert_equals_($1,$3);
  2447. $ctx2.sendIdx["assert:equals:"]=1;
  2448. return self._assert_(_st(visited)._isNil());
  2449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2450. self._samplesDo_((function(index,value){
  2451. return smalltalk.withContext(function($ctx2) {
  2452. visited=nil;
  2453. visited;
  2454. $5=self._collection();
  2455. $ctx2.sendIdx["collection"]=2;
  2456. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2457. return smalltalk.withContext(function($ctx3) {
  2458. visited=value2;
  2459. visited;
  2460. return sentinel;
  2461. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2462. return smalltalk.withContext(function($ctx3) {
  2463. return self._sampleNewValue();
  2464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2465. self._assert_equals_($4,sentinel);
  2466. $ctx2.sendIdx["assert:equals:"]=2;
  2467. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2470. args: [],
  2471. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. smalltalk.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtPut",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var newCollection;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. newCollection=self._collection();
  2485. $ctx1.sendIdx["collection"]=1;
  2486. self._samplesDo_((function(index,value){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return _st(newCollection)._at_put_(index,value);
  2489. $ctx2.sendIdx["at:put:"]=1;
  2490. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2491. self._assert_equals_(newCollection,self._collection());
  2492. $ctx1.sendIdx["assert:equals:"]=1;
  2493. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2494. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2495. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2496. args: [],
  2497. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2498. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2499. referencedClasses: []
  2500. }),
  2501. smalltalk.IndexableCollectionTest);
  2502. smalltalk.addMethod(
  2503. smalltalk.method({
  2504. selector: "testIndexOf",
  2505. protocol: 'tests',
  2506. fn: function (){
  2507. var self=this;
  2508. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2509. return smalltalk.withContext(function($ctx1) {
  2510. var $1;
  2511. self._should_raise_((function(){
  2512. return smalltalk.withContext(function($ctx2) {
  2513. $1=self._collection();
  2514. $ctx2.sendIdx["collection"]=1;
  2515. return _st($1)._indexOf_(self._sampleNewValue());
  2516. $ctx2.sendIdx["indexOf:"]=1;
  2517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2518. self._samplesDo_((function(index,value){
  2519. return smalltalk.withContext(function($ctx2) {
  2520. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2521. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2522. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2523. args: [],
  2524. 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 ]",
  2525. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2526. referencedClasses: ["Error"]
  2527. }),
  2528. smalltalk.IndexableCollectionTest);
  2529. smalltalk.addMethod(
  2530. smalltalk.method({
  2531. selector: "testIndexOfWithNull",
  2532. protocol: 'tests',
  2533. fn: function (){
  2534. var self=this;
  2535. var jsNull;
  2536. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2537. return smalltalk.withContext(function($ctx1) {
  2538. var $1,$2;
  2539. jsNull=_st($JSON())._parse_("null");
  2540. self._samplesDo_((function(index,value){
  2541. return smalltalk.withContext(function($ctx2) {
  2542. $1=self._collection();
  2543. _st($1)._at_put_(index,jsNull);
  2544. $2=_st($1)._indexOf_(jsNull);
  2545. return self._assert_equals_($2,index);
  2546. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2547. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},smalltalk.IndexableCollectionTest)})},
  2548. args: [],
  2549. 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 ]",
  2550. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2551. referencedClasses: ["JSON"]
  2552. }),
  2553. smalltalk.IndexableCollectionTest);
  2554. smalltalk.addMethod(
  2555. smalltalk.method({
  2556. selector: "testWithIndexDo",
  2557. protocol: 'tests',
  2558. fn: function (){
  2559. var self=this;
  2560. var collection;
  2561. return smalltalk.withContext(function($ctx1) {
  2562. collection=self._collection();
  2563. $ctx1.sendIdx["collection"]=1;
  2564. _st(self._collection())._withIndexDo_((function(each,index){
  2565. return smalltalk.withContext(function($ctx2) {
  2566. return self._assert_equals_(_st(collection)._at_(index),each);
  2567. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2568. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2569. args: [],
  2570. 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 ]",
  2571. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2572. referencedClasses: []
  2573. }),
  2574. smalltalk.IndexableCollectionTest);
  2575. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2576. smalltalk.addMethod(
  2577. smalltalk.method({
  2578. selector: "collection",
  2579. protocol: 'fixture',
  2580. fn: function (){
  2581. var self=this;
  2582. return smalltalk.withContext(function($ctx1) {
  2583. var $2,$3,$4,$1;
  2584. $2="b".__minus_gt((1));
  2585. $ctx1.sendIdx["->"]=1;
  2586. $3="a".__minus_gt((2));
  2587. $ctx1.sendIdx["->"]=2;
  2588. $4="c".__minus_gt((3));
  2589. $ctx1.sendIdx["->"]=3;
  2590. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2591. return $1;
  2592. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2593. args: [],
  2594. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2595. messageSends: ["->"],
  2596. referencedClasses: []
  2597. }),
  2598. smalltalk.HashedCollectionTest);
  2599. smalltalk.addMethod(
  2600. smalltalk.method({
  2601. selector: "collectionOfPrintStrings",
  2602. protocol: 'fixture',
  2603. fn: function (){
  2604. var self=this;
  2605. return smalltalk.withContext(function($ctx1) {
  2606. var $2,$3,$4,$1;
  2607. $2="b".__minus_gt("1");
  2608. $ctx1.sendIdx["->"]=1;
  2609. $3="a".__minus_gt("2");
  2610. $ctx1.sendIdx["->"]=2;
  2611. $4="c".__minus_gt("3");
  2612. $ctx1.sendIdx["->"]=3;
  2613. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2614. return $1;
  2615. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2616. args: [],
  2617. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2618. messageSends: ["->"],
  2619. referencedClasses: []
  2620. }),
  2621. smalltalk.HashedCollectionTest);
  2622. smalltalk.addMethod(
  2623. smalltalk.method({
  2624. selector: "collectionSize",
  2625. protocol: 'fixture',
  2626. fn: function (){
  2627. var self=this;
  2628. return smalltalk.withContext(function($ctx1) {
  2629. return (4);
  2630. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2631. args: [],
  2632. source: "collectionSize\x0a\x09^ 4",
  2633. messageSends: [],
  2634. referencedClasses: []
  2635. }),
  2636. smalltalk.HashedCollectionTest);
  2637. smalltalk.addMethod(
  2638. smalltalk.method({
  2639. selector: "collectionWithDuplicates",
  2640. protocol: 'fixture',
  2641. fn: function (){
  2642. var self=this;
  2643. return smalltalk.withContext(function($ctx1) {
  2644. var $2,$3,$4,$5,$6,$7,$1;
  2645. $2="b".__minus_gt((1));
  2646. $ctx1.sendIdx["->"]=1;
  2647. $3="a".__minus_gt((2));
  2648. $ctx1.sendIdx["->"]=2;
  2649. $4="c".__minus_gt((3));
  2650. $ctx1.sendIdx["->"]=3;
  2651. $5="d".__minus_gt((-4));
  2652. $ctx1.sendIdx["->"]=4;
  2653. $6="e".__minus_gt((1));
  2654. $ctx1.sendIdx["->"]=5;
  2655. $7="f".__minus_gt((2));
  2656. $ctx1.sendIdx["->"]=6;
  2657. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2658. return $1;
  2659. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2660. args: [],
  2661. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2662. messageSends: ["->"],
  2663. referencedClasses: []
  2664. }),
  2665. smalltalk.HashedCollectionTest);
  2666. smalltalk.addMethod(
  2667. smalltalk.method({
  2668. selector: "collectionWithNewValue",
  2669. protocol: 'fixture',
  2670. fn: function (){
  2671. var self=this;
  2672. return smalltalk.withContext(function($ctx1) {
  2673. var $2,$3,$4,$5,$1;
  2674. $2="b".__minus_gt((1));
  2675. $ctx1.sendIdx["->"]=1;
  2676. $3="a".__minus_gt((2));
  2677. $ctx1.sendIdx["->"]=2;
  2678. $4="c".__minus_gt((3));
  2679. $ctx1.sendIdx["->"]=3;
  2680. $5="d".__minus_gt((-4));
  2681. $ctx1.sendIdx["->"]=4;
  2682. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2683. return $1;
  2684. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2685. args: [],
  2686. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2687. messageSends: ["->"],
  2688. referencedClasses: []
  2689. }),
  2690. smalltalk.HashedCollectionTest);
  2691. smalltalk.addMethod(
  2692. smalltalk.method({
  2693. selector: "nonIndexesDo:",
  2694. protocol: 'fixture',
  2695. fn: function (aBlock){
  2696. var self=this;
  2697. return smalltalk.withContext(function($ctx1) {
  2698. _st(aBlock)._value_((5));
  2699. $ctx1.sendIdx["value:"]=1;
  2700. _st(aBlock)._value_("z");
  2701. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2702. args: ["aBlock"],
  2703. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2704. messageSends: ["value:"],
  2705. referencedClasses: []
  2706. }),
  2707. smalltalk.HashedCollectionTest);
  2708. smalltalk.addMethod(
  2709. smalltalk.method({
  2710. selector: "sampleNewIndex",
  2711. protocol: 'fixture',
  2712. fn: function (){
  2713. var self=this;
  2714. return smalltalk.withContext(function($ctx1) {
  2715. return "new";
  2716. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2717. args: [],
  2718. source: "sampleNewIndex\x0a\x09^ 'new'",
  2719. messageSends: [],
  2720. referencedClasses: []
  2721. }),
  2722. smalltalk.HashedCollectionTest);
  2723. smalltalk.addMethod(
  2724. smalltalk.method({
  2725. selector: "sampleNewValueAsCollection",
  2726. protocol: 'fixture',
  2727. fn: function (){
  2728. var self=this;
  2729. return smalltalk.withContext(function($ctx1) {
  2730. var $1;
  2731. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2732. return $1;
  2733. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2734. args: [],
  2735. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2736. messageSends: ["->"],
  2737. referencedClasses: []
  2738. }),
  2739. smalltalk.HashedCollectionTest);
  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},smalltalk.HashedCollectionTest)})},
  2749. args: ["aBlock"],
  2750. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2751. messageSends: ["value:value:"],
  2752. referencedClasses: []
  2753. }),
  2754. smalltalk.HashedCollectionTest);
  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. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2764. $2=self._collection();
  2765. $ctx1.sendIdx["collection"]=1;
  2766. $3=$2;
  2767. $4=self._collection();
  2768. $ctx1.sendIdx["collection"]=2;
  2769. _st($3)._addAll_($4);
  2770. $ctx1.sendIdx["addAll:"]=1;
  2771. $5=_st($2)._yourself();
  2772. $ctx1.sendIdx["yourself"]=1;
  2773. $1=$5;
  2774. $6=self._collection();
  2775. $ctx1.sendIdx["collection"]=3;
  2776. self._assert_equals_($1,$6);
  2777. $ctx1.sendIdx["assert:equals:"]=1;
  2778. $8=self._collection();
  2779. $ctx1.sendIdx["collection"]=4;
  2780. $9=$8;
  2781. $10=self._collectionWithNewValue();
  2782. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2783. _st($9)._addAll_($10);
  2784. $ctx1.sendIdx["addAll:"]=2;
  2785. $11=_st($8)._yourself();
  2786. $ctx1.sendIdx["yourself"]=2;
  2787. $7=$11;
  2788. $12=self._collectionWithNewValue();
  2789. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2790. self._assert_equals_($7,$12);
  2791. $ctx1.sendIdx["assert:equals:"]=2;
  2792. $14=self._collectionWithNewValue();
  2793. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2794. _st($14)._addAll_(self._collection());
  2795. $15=_st($14)._yourself();
  2796. $13=$15;
  2797. self._assert_equals_($13,self._collectionWithNewValue());
  2798. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2799. args: [],
  2800. 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",
  2801. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2802. referencedClasses: []
  2803. }),
  2804. smalltalk.HashedCollectionTest);
  2805. smalltalk.addMethod(
  2806. smalltalk.method({
  2807. selector: "testAsDictionary",
  2808. protocol: 'tests',
  2809. fn: function (){
  2810. var self=this;
  2811. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2812. return smalltalk.withContext(function($ctx1) {
  2813. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2814. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2815. args: [],
  2816. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2817. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2818. referencedClasses: ["Dictionary"]
  2819. }),
  2820. smalltalk.HashedCollectionTest);
  2821. smalltalk.addMethod(
  2822. smalltalk.method({
  2823. selector: "testComma",
  2824. protocol: 'tests',
  2825. fn: function (){
  2826. var self=this;
  2827. return smalltalk.withContext(function($ctx1) {
  2828. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2829. smalltalk.HashedCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2830. $2=self._collection();
  2831. $ctx1.sendIdx["collection"]=1;
  2832. $3=self._collection();
  2833. $ctx1.sendIdx["collection"]=2;
  2834. $1=_st($2).__comma($3);
  2835. $ctx1.sendIdx[","]=1;
  2836. $4=self._collection();
  2837. $ctx1.sendIdx["collection"]=3;
  2838. self._assert_equals_($1,$4);
  2839. $ctx1.sendIdx["assert:equals:"]=1;
  2840. $6=self._collection();
  2841. $ctx1.sendIdx["collection"]=4;
  2842. $7=self._collectionWithNewValue();
  2843. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2844. $5=_st($6).__comma($7);
  2845. $ctx1.sendIdx[","]=2;
  2846. $8=self._collectionWithNewValue();
  2847. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2848. self._assert_equals_($5,$8);
  2849. $ctx1.sendIdx["assert:equals:"]=2;
  2850. $10=self._collectionWithNewValue();
  2851. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2852. $9=_st($10).__comma(self._collection());
  2853. self._assert_equals_($9,self._collectionWithNewValue());
  2854. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2855. args: [],
  2856. 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",
  2857. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2858. referencedClasses: []
  2859. }),
  2860. smalltalk.HashedCollectionTest);
  2861. smalltalk.addMethod(
  2862. smalltalk.method({
  2863. selector: "testFrom",
  2864. protocol: 'tests',
  2865. fn: function (){
  2866. var self=this;
  2867. var associations;
  2868. return smalltalk.withContext(function($ctx1) {
  2869. var $1,$2,$3,$5,$4;
  2870. $1="a".__minus_gt((1));
  2871. $ctx1.sendIdx["->"]=1;
  2872. $2="b".__minus_gt((2));
  2873. $ctx1.sendIdx["->"]=2;
  2874. associations=[$1,$2];
  2875. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2876. $5="a".__minus_gt((1));
  2877. $ctx1.sendIdx["->"]=3;
  2878. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2879. self._assertSameContents_as_($3,$4);
  2880. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2881. args: [],
  2882. 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 }.",
  2883. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2884. referencedClasses: []
  2885. }),
  2886. smalltalk.HashedCollectionTest);
  2887. smalltalk.addMethod(
  2888. smalltalk.method({
  2889. selector: "testNewFromPairs",
  2890. protocol: 'tests',
  2891. fn: function (){
  2892. var self=this;
  2893. var flattenedAssociations;
  2894. return smalltalk.withContext(function($ctx1) {
  2895. var $1,$3,$2;
  2896. flattenedAssociations=["a",(1),"b",(2)];
  2897. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2898. $3="a".__minus_gt((1));
  2899. $ctx1.sendIdx["->"]=1;
  2900. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2901. self._assertSameContents_as_($1,$2);
  2902. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2903. args: [],
  2904. 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 }.",
  2905. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2906. referencedClasses: []
  2907. }),
  2908. smalltalk.HashedCollectionTest);
  2909. smalltalk.addMethod(
  2910. smalltalk.method({
  2911. selector: "collectionClass",
  2912. protocol: 'fixture',
  2913. fn: function (){
  2914. var self=this;
  2915. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2916. return smalltalk.withContext(function($ctx1) {
  2917. return $HashedCollection();
  2918. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2919. args: [],
  2920. source: "collectionClass\x0a\x09^ HashedCollection",
  2921. messageSends: [],
  2922. referencedClasses: ["HashedCollection"]
  2923. }),
  2924. smalltalk.HashedCollectionTest.klass);
  2925. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2926. smalltalk.addMethod(
  2927. smalltalk.method({
  2928. selector: "collection",
  2929. protocol: 'fixture',
  2930. fn: function (){
  2931. var self=this;
  2932. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2933. return smalltalk.withContext(function($ctx1) {
  2934. var $2,$3,$1;
  2935. $2=_st($Dictionary())._new();
  2936. _st($2)._at_put_((1),(1));
  2937. $ctx1.sendIdx["at:put:"]=1;
  2938. _st($2)._at_put_("a",(2));
  2939. $ctx1.sendIdx["at:put:"]=2;
  2940. _st($2)._at_put_(true,(3));
  2941. $ctx1.sendIdx["at:put:"]=3;
  2942. _st($2)._at_put_((1).__at((3)),(-4));
  2943. $3=_st($2)._yourself();
  2944. $1=$3;
  2945. return $1;
  2946. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2947. args: [],
  2948. 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",
  2949. messageSends: ["at:put:", "new", "@", "yourself"],
  2950. referencedClasses: ["Dictionary"]
  2951. }),
  2952. smalltalk.DictionaryTest);
  2953. smalltalk.addMethod(
  2954. smalltalk.method({
  2955. selector: "collectionOfPrintStrings",
  2956. protocol: 'fixture',
  2957. fn: function (){
  2958. var self=this;
  2959. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2960. return smalltalk.withContext(function($ctx1) {
  2961. var $2,$3,$1;
  2962. $2=_st($Dictionary())._new();
  2963. _st($2)._at_put_((1),"1");
  2964. $ctx1.sendIdx["at:put:"]=1;
  2965. _st($2)._at_put_("a","2");
  2966. $ctx1.sendIdx["at:put:"]=2;
  2967. _st($2)._at_put_(true,"3");
  2968. $ctx1.sendIdx["at:put:"]=3;
  2969. _st($2)._at_put_((1).__at((3)),"-4");
  2970. $3=_st($2)._yourself();
  2971. $1=$3;
  2972. return $1;
  2973. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2974. args: [],
  2975. 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",
  2976. messageSends: ["at:put:", "new", "@", "yourself"],
  2977. referencedClasses: ["Dictionary"]
  2978. }),
  2979. smalltalk.DictionaryTest);
  2980. smalltalk.addMethod(
  2981. smalltalk.method({
  2982. selector: "collectionSize",
  2983. protocol: 'fixture',
  2984. fn: function (){
  2985. var self=this;
  2986. return smalltalk.withContext(function($ctx1) {
  2987. return (4);
  2988. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2989. args: [],
  2990. source: "collectionSize\x0a\x09^ 4",
  2991. messageSends: [],
  2992. referencedClasses: []
  2993. }),
  2994. smalltalk.DictionaryTest);
  2995. smalltalk.addMethod(
  2996. smalltalk.method({
  2997. selector: "collectionWithDuplicates",
  2998. protocol: 'fixture',
  2999. fn: function (){
  3000. var self=this;
  3001. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3002. return smalltalk.withContext(function($ctx1) {
  3003. var $2,$3,$1;
  3004. $2=_st($Dictionary())._new();
  3005. _st($2)._at_put_((1),(1));
  3006. $ctx1.sendIdx["at:put:"]=1;
  3007. _st($2)._at_put_("a",(2));
  3008. $ctx1.sendIdx["at:put:"]=2;
  3009. _st($2)._at_put_(true,(3));
  3010. $ctx1.sendIdx["at:put:"]=3;
  3011. _st($2)._at_put_((4),(-4));
  3012. $ctx1.sendIdx["at:put:"]=4;
  3013. _st($2)._at_put_("b",(1));
  3014. $ctx1.sendIdx["at:put:"]=5;
  3015. _st($2)._at_put_((3),(3));
  3016. $ctx1.sendIdx["at:put:"]=6;
  3017. _st($2)._at_put_(false,(12));
  3018. $3=_st($2)._yourself();
  3019. $1=$3;
  3020. return $1;
  3021. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  3022. args: [],
  3023. 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",
  3024. messageSends: ["at:put:", "new", "yourself"],
  3025. referencedClasses: ["Dictionary"]
  3026. }),
  3027. smalltalk.DictionaryTest);
  3028. smalltalk.addMethod(
  3029. smalltalk.method({
  3030. selector: "collectionWithNewValue",
  3031. protocol: 'fixture',
  3032. fn: function (){
  3033. var self=this;
  3034. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3035. return smalltalk.withContext(function($ctx1) {
  3036. var $2,$3,$1;
  3037. $2=_st($Dictionary())._new();
  3038. _st($2)._at_put_((1),(1));
  3039. $ctx1.sendIdx["at:put:"]=1;
  3040. _st($2)._at_put_("a",(2));
  3041. $ctx1.sendIdx["at:put:"]=2;
  3042. _st($2)._at_put_(true,(3));
  3043. $ctx1.sendIdx["at:put:"]=3;
  3044. _st($2)._at_put_((1).__at((3)),(-4));
  3045. $ctx1.sendIdx["at:put:"]=4;
  3046. _st($2)._at_put_("new","N");
  3047. $3=_st($2)._yourself();
  3048. $1=$3;
  3049. return $1;
  3050. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3051. args: [],
  3052. 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",
  3053. messageSends: ["at:put:", "new", "@", "yourself"],
  3054. referencedClasses: ["Dictionary"]
  3055. }),
  3056. smalltalk.DictionaryTest);
  3057. smalltalk.addMethod(
  3058. smalltalk.method({
  3059. selector: "sampleNewValueAsCollection",
  3060. protocol: 'fixture',
  3061. fn: function (){
  3062. var self=this;
  3063. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3064. return smalltalk.withContext(function($ctx1) {
  3065. var $2,$3,$1;
  3066. $2=_st($Dictionary())._new();
  3067. _st($2)._at_put_("new","N");
  3068. $3=_st($2)._yourself();
  3069. $1=$3;
  3070. return $1;
  3071. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3072. args: [],
  3073. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3074. messageSends: ["at:put:", "new", "yourself"],
  3075. referencedClasses: ["Dictionary"]
  3076. }),
  3077. smalltalk.DictionaryTest);
  3078. smalltalk.addMethod(
  3079. smalltalk.method({
  3080. selector: "samplesDo:",
  3081. protocol: 'fixture',
  3082. fn: function (aBlock){
  3083. var self=this;
  3084. return smalltalk.withContext(function($ctx1) {
  3085. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3086. _st(aBlock)._value_value_(true,(3));
  3087. $ctx1.sendIdx["value:value:"]=1;
  3088. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3089. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3090. args: ["aBlock"],
  3091. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3092. messageSends: ["samplesDo:", "value:value:", "@"],
  3093. referencedClasses: []
  3094. }),
  3095. smalltalk.DictionaryTest);
  3096. smalltalk.addMethod(
  3097. smalltalk.method({
  3098. selector: "testAccessing",
  3099. protocol: 'tests',
  3100. fn: function (){
  3101. var self=this;
  3102. var d;
  3103. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3104. return smalltalk.withContext(function($ctx1) {
  3105. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3106. d=_st($Dictionary())._new();
  3107. _st(d)._at_put_("hello","world");
  3108. $ctx1.sendIdx["at:put:"]=1;
  3109. $1=_st(d)._at_("hello");
  3110. $ctx1.sendIdx["at:"]=1;
  3111. self._assert_equals_($1,"world");
  3112. $ctx1.sendIdx["assert:equals:"]=1;
  3113. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3114. return smalltalk.withContext(function($ctx2) {
  3115. return nil;
  3116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3117. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3118. self._assert_equals_($2,"world");
  3119. $ctx1.sendIdx["assert:equals:"]=2;
  3120. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3121. return smalltalk.withContext(function($ctx2) {
  3122. return nil;
  3123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3124. $ctx1.sendIdx["deny:"]=1;
  3125. $3=_st(d)._includesKey_("hello");
  3126. $ctx1.sendIdx["includesKey:"]=1;
  3127. self._assert_($3);
  3128. $ctx1.sendIdx["assert:"]=1;
  3129. $4=_st(d)._includesKey_("foo");
  3130. $ctx1.sendIdx["includesKey:"]=2;
  3131. self._deny_($4);
  3132. $ctx1.sendIdx["deny:"]=2;
  3133. _st(d)._at_put_((1),(2));
  3134. $ctx1.sendIdx["at:put:"]=2;
  3135. $5=_st(d)._at_((1));
  3136. $ctx1.sendIdx["at:"]=2;
  3137. self._assert_equals_($5,(2));
  3138. $ctx1.sendIdx["assert:equals:"]=3;
  3139. $6=d;
  3140. $7=(1).__at((3));
  3141. $ctx1.sendIdx["@"]=1;
  3142. _st($6)._at_put_($7,(3));
  3143. $9=d;
  3144. $10=(1).__at((3));
  3145. $ctx1.sendIdx["@"]=2;
  3146. $8=_st($9)._at_($10);
  3147. self._assert_equals_($8,(3));
  3148. $12=d;
  3149. $13=(1).__at((3));
  3150. $ctx1.sendIdx["@"]=3;
  3151. $11=_st($12)._includesKey_($13);
  3152. $ctx1.sendIdx["includesKey:"]=3;
  3153. self._assert_($11);
  3154. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3155. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3156. args: [],
  3157. 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)",
  3158. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3159. referencedClasses: ["Dictionary"]
  3160. }),
  3161. smalltalk.DictionaryTest);
  3162. smalltalk.addMethod(
  3163. smalltalk.method({
  3164. selector: "testAsHashedCollection",
  3165. protocol: 'tests',
  3166. fn: function (){
  3167. var self=this;
  3168. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3169. return smalltalk.withContext(function($ctx1) {
  3170. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3171. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3172. args: [],
  3173. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3174. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3175. referencedClasses: ["HashedCollection"]
  3176. }),
  3177. smalltalk.DictionaryTest);
  3178. smalltalk.addMethod(
  3179. smalltalk.method({
  3180. selector: "testDynamicDictionaries",
  3181. protocol: 'tests',
  3182. fn: function (){
  3183. var self=this;
  3184. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3185. return smalltalk.withContext(function($ctx1) {
  3186. var $3,$2,$1;
  3187. $3="hello".__minus_gt((1));
  3188. $ctx1.sendIdx["->"]=1;
  3189. $2=smalltalk.HashedCollection._from_([$3]);
  3190. $1=_st($2)._asDictionary();
  3191. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3192. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3193. args: [],
  3194. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3195. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3196. referencedClasses: ["Dictionary"]
  3197. }),
  3198. smalltalk.DictionaryTest);
  3199. smalltalk.addMethod(
  3200. smalltalk.method({
  3201. selector: "testEquality",
  3202. protocol: 'tests',
  3203. fn: function (){
  3204. var self=this;
  3205. var d1,d2;
  3206. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3207. return smalltalk.withContext(function($ctx1) {
  3208. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3209. $2=_st($Dictionary())._new();
  3210. $ctx1.sendIdx["new"]=1;
  3211. $3=_st($Dictionary())._new();
  3212. $ctx1.sendIdx["new"]=2;
  3213. $1=_st($2).__eq($3);
  3214. $ctx1.sendIdx["="]=1;
  3215. self._assert_($1);
  3216. $ctx1.sendIdx["assert:"]=1;
  3217. $4=_st($Dictionary())._new();
  3218. $ctx1.sendIdx["new"]=3;
  3219. _st($4)._at_put_((1),(2));
  3220. $ctx1.sendIdx["at:put:"]=1;
  3221. $5=_st($4)._yourself();
  3222. $ctx1.sendIdx["yourself"]=1;
  3223. d1=$5;
  3224. $6=_st($Dictionary())._new();
  3225. $ctx1.sendIdx["new"]=4;
  3226. _st($6)._at_put_((1),(2));
  3227. $ctx1.sendIdx["at:put:"]=2;
  3228. $7=_st($6)._yourself();
  3229. $ctx1.sendIdx["yourself"]=2;
  3230. d2=$7;
  3231. $8=_st(d1).__eq(d2);
  3232. $ctx1.sendIdx["="]=2;
  3233. self._assert_($8);
  3234. $9=_st($Dictionary())._new();
  3235. $ctx1.sendIdx["new"]=5;
  3236. _st($9)._at_put_((1),(3));
  3237. $ctx1.sendIdx["at:put:"]=3;
  3238. $10=_st($9)._yourself();
  3239. $ctx1.sendIdx["yourself"]=3;
  3240. d2=$10;
  3241. $11=_st(d1).__eq(d2);
  3242. $ctx1.sendIdx["="]=3;
  3243. self._deny_($11);
  3244. $ctx1.sendIdx["deny:"]=1;
  3245. $12=_st($Dictionary())._new();
  3246. $ctx1.sendIdx["new"]=6;
  3247. _st($12)._at_put_((2),(2));
  3248. $ctx1.sendIdx["at:put:"]=4;
  3249. $13=_st($12)._yourself();
  3250. $ctx1.sendIdx["yourself"]=4;
  3251. d2=$13;
  3252. $14=_st(d1).__eq(d2);
  3253. $ctx1.sendIdx["="]=4;
  3254. self._deny_($14);
  3255. $ctx1.sendIdx["deny:"]=2;
  3256. $15=_st($Dictionary())._new();
  3257. _st($15)._at_put_((1),(2));
  3258. $ctx1.sendIdx["at:put:"]=5;
  3259. _st($15)._at_put_((3),(4));
  3260. $16=_st($15)._yourself();
  3261. d2=$16;
  3262. self._deny_(_st(d1).__eq(d2));
  3263. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3264. args: [],
  3265. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  3266. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3267. referencedClasses: ["Dictionary"]
  3268. }),
  3269. smalltalk.DictionaryTest);
  3270. smalltalk.addMethod(
  3271. smalltalk.method({
  3272. selector: "testKeys",
  3273. protocol: 'tests',
  3274. fn: function (){
  3275. var self=this;
  3276. var d;
  3277. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3278. return smalltalk.withContext(function($ctx1) {
  3279. d=_st($Dictionary())._new();
  3280. _st(d)._at_put_((1),(2));
  3281. $ctx1.sendIdx["at:put:"]=1;
  3282. _st(d)._at_put_((2),(3));
  3283. $ctx1.sendIdx["at:put:"]=2;
  3284. _st(d)._at_put_((3),(4));
  3285. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3286. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3287. args: [],
  3288. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  3289. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3290. referencedClasses: ["Dictionary"]
  3291. }),
  3292. smalltalk.DictionaryTest);
  3293. smalltalk.addMethod(
  3294. smalltalk.method({
  3295. selector: "testPointKey",
  3296. protocol: 'tests',
  3297. fn: function (){
  3298. var self=this;
  3299. var d;
  3300. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3301. return smalltalk.withContext(function($ctx1) {
  3302. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3303. d=_st($Dictionary())._new();
  3304. $1=d;
  3305. $2=(1).__at((1));
  3306. $ctx1.sendIdx["@"]=1;
  3307. _st($1)._at_put_($2,"foo");
  3308. $ctx1.sendIdx["at:put:"]=1;
  3309. $4=d;
  3310. $5=(1).__at((1));
  3311. $ctx1.sendIdx["@"]=2;
  3312. $3=_st($4)._at_($5);
  3313. $ctx1.sendIdx["at:"]=1;
  3314. self._assert_equals_($3,"foo");
  3315. $ctx1.sendIdx["assert:equals:"]=1;
  3316. $6=d;
  3317. $7=(1).__at((1));
  3318. $ctx1.sendIdx["@"]=3;
  3319. _st($6)._at_put_($7,"bar");
  3320. $9=d;
  3321. $10=(1).__at((1));
  3322. $ctx1.sendIdx["@"]=4;
  3323. $8=_st($9)._at_($10);
  3324. self._assert_equals_($8,"bar");
  3325. $ctx1.sendIdx["assert:equals:"]=2;
  3326. $11=d;
  3327. $12=(1).__at((1));
  3328. $ctx1.sendIdx["@"]=5;
  3329. _st($11)._removeKey_($12);
  3330. $14=d;
  3331. $15=(1).__at((1));
  3332. $ctx1.sendIdx["@"]=6;
  3333. $13=_st($14)._at_ifAbsent_($15,(function(){
  3334. return smalltalk.withContext(function($ctx2) {
  3335. return "baz";
  3336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3337. self._assert_equals_($13,"baz");
  3338. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3339. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3340. args: [],
  3341. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  3342. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3343. referencedClasses: ["Dictionary"]
  3344. }),
  3345. smalltalk.DictionaryTest);
  3346. smalltalk.addMethod(
  3347. smalltalk.method({
  3348. selector: "testPrintString",
  3349. protocol: 'tests',
  3350. fn: function (){
  3351. var self=this;
  3352. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3353. return smalltalk.withContext(function($ctx1) {
  3354. var $2,$3,$1;
  3355. $2=_st($Dictionary())._new();
  3356. _st($2)._at_put_("firstname","James");
  3357. $ctx1.sendIdx["at:put:"]=1;
  3358. _st($2)._at_put_("lastname","Bond");
  3359. $3=_st($2)._printString();
  3360. $1=$3;
  3361. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3362. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3363. args: [],
  3364. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3365. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3366. referencedClasses: ["Dictionary"]
  3367. }),
  3368. smalltalk.DictionaryTest);
  3369. smalltalk.addMethod(
  3370. smalltalk.method({
  3371. selector: "testRemoveKey",
  3372. protocol: 'tests',
  3373. fn: function (){
  3374. var self=this;
  3375. var d,key;
  3376. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3377. return smalltalk.withContext(function($ctx1) {
  3378. var $1;
  3379. d=_st($Dictionary())._new();
  3380. _st(d)._at_put_((1),(2));
  3381. $ctx1.sendIdx["at:put:"]=1;
  3382. _st(d)._at_put_((2),(3));
  3383. $ctx1.sendIdx["at:put:"]=2;
  3384. _st(d)._at_put_((3),(4));
  3385. key=(2);
  3386. $1=_st(d)._keys();
  3387. $ctx1.sendIdx["keys"]=1;
  3388. self._assert_equals_($1,[(1), (2), (3)]);
  3389. $ctx1.sendIdx["assert:equals:"]=1;
  3390. _st(d)._removeKey_(key);
  3391. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3392. $ctx1.sendIdx["assert:equals:"]=2;
  3393. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3394. self._deny_(_st(d)._includesKey_((2)));
  3395. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3396. args: [],
  3397. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3398. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3399. referencedClasses: ["Dictionary"]
  3400. }),
  3401. smalltalk.DictionaryTest);
  3402. smalltalk.addMethod(
  3403. smalltalk.method({
  3404. selector: "testRemoveKeyIfAbsent",
  3405. protocol: 'tests',
  3406. fn: function (){
  3407. var self=this;
  3408. var d,key;
  3409. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3410. return smalltalk.withContext(function($ctx1) {
  3411. var $1;
  3412. d=_st($Dictionary())._new();
  3413. _st(d)._at_put_((1),(2));
  3414. $ctx1.sendIdx["at:put:"]=1;
  3415. _st(d)._at_put_((2),(3));
  3416. $ctx1.sendIdx["at:put:"]=2;
  3417. _st(d)._at_put_((3),(4));
  3418. key=(2);
  3419. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3420. $ctx1.sendIdx["assert:equals:"]=1;
  3421. key=(3);
  3422. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3423. return smalltalk.withContext(function($ctx2) {
  3424. return (42);
  3425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3426. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3427. self._assert_equals_($1,(4));
  3428. $ctx1.sendIdx["assert:equals:"]=2;
  3429. key="why";
  3430. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3431. return smalltalk.withContext(function($ctx2) {
  3432. return (42);
  3433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3434. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3435. args: [],
  3436. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3437. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3438. referencedClasses: ["Dictionary"]
  3439. }),
  3440. smalltalk.DictionaryTest);
  3441. smalltalk.addMethod(
  3442. smalltalk.method({
  3443. selector: "testValues",
  3444. protocol: 'tests',
  3445. fn: function (){
  3446. var self=this;
  3447. var d;
  3448. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3449. return smalltalk.withContext(function($ctx1) {
  3450. d=_st($Dictionary())._new();
  3451. _st(d)._at_put_((1),(2));
  3452. $ctx1.sendIdx["at:put:"]=1;
  3453. _st(d)._at_put_((2),(3));
  3454. $ctx1.sendIdx["at:put:"]=2;
  3455. _st(d)._at_put_((3),(4));
  3456. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3457. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3458. args: [],
  3459. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3460. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3461. referencedClasses: ["Dictionary"]
  3462. }),
  3463. smalltalk.DictionaryTest);
  3464. smalltalk.addMethod(
  3465. smalltalk.method({
  3466. selector: "collectionClass",
  3467. protocol: 'fixture',
  3468. fn: function (){
  3469. var self=this;
  3470. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3471. return smalltalk.withContext(function($ctx1) {
  3472. return $Dictionary();
  3473. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3474. args: [],
  3475. source: "collectionClass\x0a\x09^ Dictionary",
  3476. messageSends: [],
  3477. referencedClasses: ["Dictionary"]
  3478. }),
  3479. smalltalk.DictionaryTest.klass);
  3480. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3481. smalltalk.addMethod(
  3482. smalltalk.method({
  3483. selector: "collectionFirst",
  3484. protocol: 'fixture',
  3485. fn: function (){
  3486. var self=this;
  3487. return smalltalk.withContext(function($ctx1) {
  3488. self._subclassResponsibility();
  3489. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3490. args: [],
  3491. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3492. messageSends: ["subclassResponsibility"],
  3493. referencedClasses: []
  3494. }),
  3495. smalltalk.SequenceableCollectionTest);
  3496. smalltalk.addMethod(
  3497. smalltalk.method({
  3498. selector: "collectionFirstTwo",
  3499. protocol: 'fixture',
  3500. fn: function (){
  3501. var self=this;
  3502. return smalltalk.withContext(function($ctx1) {
  3503. self._subclassResponsibility();
  3504. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3505. args: [],
  3506. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3507. messageSends: ["subclassResponsibility"],
  3508. referencedClasses: []
  3509. }),
  3510. smalltalk.SequenceableCollectionTest);
  3511. smalltalk.addMethod(
  3512. smalltalk.method({
  3513. selector: "collectionLast",
  3514. protocol: 'fixture',
  3515. fn: function (){
  3516. var self=this;
  3517. return smalltalk.withContext(function($ctx1) {
  3518. self._subclassResponsibility();
  3519. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3520. args: [],
  3521. source: "collectionLast\x0a\x09self subclassResponsibility",
  3522. messageSends: ["subclassResponsibility"],
  3523. referencedClasses: []
  3524. }),
  3525. smalltalk.SequenceableCollectionTest);
  3526. smalltalk.addMethod(
  3527. smalltalk.method({
  3528. selector: "collectionLastTwo",
  3529. protocol: 'fixture',
  3530. fn: function (){
  3531. var self=this;
  3532. return smalltalk.withContext(function($ctx1) {
  3533. self._subclassResponsibility();
  3534. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3535. args: [],
  3536. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3537. messageSends: ["subclassResponsibility"],
  3538. referencedClasses: []
  3539. }),
  3540. smalltalk.SequenceableCollectionTest);
  3541. smalltalk.addMethod(
  3542. smalltalk.method({
  3543. selector: "nonIndexesDo:",
  3544. protocol: 'fixture',
  3545. fn: function (aBlock){
  3546. var self=this;
  3547. return smalltalk.withContext(function($ctx1) {
  3548. _st(aBlock)._value_((0));
  3549. $ctx1.sendIdx["value:"]=1;
  3550. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3551. $ctx1.sendIdx["value:"]=2;
  3552. _st(aBlock)._value_("z");
  3553. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3554. args: ["aBlock"],
  3555. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3556. messageSends: ["value:", "+", "collectionSize"],
  3557. referencedClasses: []
  3558. }),
  3559. smalltalk.SequenceableCollectionTest);
  3560. smalltalk.addMethod(
  3561. smalltalk.method({
  3562. selector: "samplesDo:",
  3563. protocol: 'fixture',
  3564. fn: function (aBlock){
  3565. var self=this;
  3566. return smalltalk.withContext(function($ctx1) {
  3567. _st(aBlock)._value_value_((1),self._collectionFirst());
  3568. $ctx1.sendIdx["value:value:"]=1;
  3569. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3570. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3571. args: ["aBlock"],
  3572. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3573. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3574. referencedClasses: []
  3575. }),
  3576. smalltalk.SequenceableCollectionTest);
  3577. smalltalk.addMethod(
  3578. smalltalk.method({
  3579. selector: "testBeginsWith",
  3580. protocol: 'tests',
  3581. fn: function (){
  3582. var self=this;
  3583. return smalltalk.withContext(function($ctx1) {
  3584. var $2,$1,$4,$5,$3,$7,$6;
  3585. $2=self._collection();
  3586. $ctx1.sendIdx["collection"]=1;
  3587. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3588. $ctx1.sendIdx["beginsWith:"]=1;
  3589. self._assert_($1);
  3590. $ctx1.sendIdx["assert:"]=1;
  3591. $4=self._collection();
  3592. $ctx1.sendIdx["collection"]=2;
  3593. $5=self._collection();
  3594. $ctx1.sendIdx["collection"]=3;
  3595. $3=_st($4)._beginsWith_($5);
  3596. $ctx1.sendIdx["beginsWith:"]=2;
  3597. self._assert_($3);
  3598. $ctx1.sendIdx["assert:"]=2;
  3599. $7=self._collection();
  3600. $ctx1.sendIdx["collection"]=4;
  3601. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3602. $ctx1.sendIdx["beginsWith:"]=3;
  3603. self._assert_($6);
  3604. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3605. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3606. args: [],
  3607. 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)",
  3608. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3609. referencedClasses: []
  3610. }),
  3611. smalltalk.SequenceableCollectionTest);
  3612. smalltalk.addMethod(
  3613. smalltalk.method({
  3614. selector: "testEndsWith",
  3615. protocol: 'tests',
  3616. fn: function (){
  3617. var self=this;
  3618. return smalltalk.withContext(function($ctx1) {
  3619. var $2,$1,$4,$5,$3,$7,$6;
  3620. $2=self._collection();
  3621. $ctx1.sendIdx["collection"]=1;
  3622. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3623. $ctx1.sendIdx["endsWith:"]=1;
  3624. self._assert_($1);
  3625. $ctx1.sendIdx["assert:"]=1;
  3626. $4=self._collection();
  3627. $ctx1.sendIdx["collection"]=2;
  3628. $5=self._collection();
  3629. $ctx1.sendIdx["collection"]=3;
  3630. $3=_st($4)._endsWith_($5);
  3631. $ctx1.sendIdx["endsWith:"]=2;
  3632. self._assert_($3);
  3633. $ctx1.sendIdx["assert:"]=2;
  3634. $7=self._collection();
  3635. $ctx1.sendIdx["collection"]=4;
  3636. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3637. $ctx1.sendIdx["endsWith:"]=3;
  3638. self._assert_($6);
  3639. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3640. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3641. args: [],
  3642. 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)",
  3643. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3644. referencedClasses: []
  3645. }),
  3646. smalltalk.SequenceableCollectionTest);
  3647. smalltalk.addMethod(
  3648. smalltalk.method({
  3649. selector: "testFirst",
  3650. protocol: 'tests',
  3651. fn: function (){
  3652. var self=this;
  3653. return smalltalk.withContext(function($ctx1) {
  3654. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3655. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3656. args: [],
  3657. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3658. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3659. referencedClasses: []
  3660. }),
  3661. smalltalk.SequenceableCollectionTest);
  3662. smalltalk.addMethod(
  3663. smalltalk.method({
  3664. selector: "testFirstN",
  3665. protocol: 'tests',
  3666. fn: function (){
  3667. var self=this;
  3668. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3669. return smalltalk.withContext(function($ctx1) {
  3670. var $2,$1,$4,$3,$6,$5,$7;
  3671. $2=self._collection();
  3672. $ctx1.sendIdx["collection"]=1;
  3673. $1=_st($2)._first_((2));
  3674. $ctx1.sendIdx["first:"]=1;
  3675. self._assert_equals_($1,self._collectionFirstTwo());
  3676. $ctx1.sendIdx["assert:equals:"]=1;
  3677. $4=self._collection();
  3678. $ctx1.sendIdx["collection"]=2;
  3679. $3=_st($4)._first_((0));
  3680. $ctx1.sendIdx["first:"]=2;
  3681. self._assert_equals_($3,_st(self._collectionClass())._new());
  3682. $ctx1.sendIdx["assert:equals:"]=2;
  3683. $6=self._collection();
  3684. $ctx1.sendIdx["collection"]=3;
  3685. $5=_st($6)._first_(self._collectionSize());
  3686. $ctx1.sendIdx["first:"]=3;
  3687. $7=self._collection();
  3688. $ctx1.sendIdx["collection"]=4;
  3689. self._assert_equals_($5,$7);
  3690. self._should_raise_((function(){
  3691. return smalltalk.withContext(function($ctx2) {
  3692. return _st(self._collection())._first_((33));
  3693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3694. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3695. args: [],
  3696. 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",
  3697. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3698. referencedClasses: ["Error"]
  3699. }),
  3700. smalltalk.SequenceableCollectionTest);
  3701. smalltalk.addMethod(
  3702. smalltalk.method({
  3703. selector: "testFourth",
  3704. protocol: 'tests',
  3705. fn: function (){
  3706. var self=this;
  3707. return smalltalk.withContext(function($ctx1) {
  3708. var $2,$1;
  3709. $2=self._collection();
  3710. $ctx1.sendIdx["collection"]=1;
  3711. $1=_st($2)._fourth();
  3712. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3713. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3714. args: [],
  3715. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3716. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3717. referencedClasses: []
  3718. }),
  3719. smalltalk.SequenceableCollectionTest);
  3720. smalltalk.addMethod(
  3721. smalltalk.method({
  3722. selector: "testIndexOfStartingAt",
  3723. protocol: 'tests',
  3724. fn: function (){
  3725. var self=this;
  3726. var jsNull;
  3727. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3728. return smalltalk.withContext(function($ctx1) {
  3729. var $2,$1,$4,$3;
  3730. jsNull=_st($JSON())._parse_("null");
  3731. self._samplesDo_((function(index,value){
  3732. return smalltalk.withContext(function($ctx2) {
  3733. $2=self._collection();
  3734. $ctx2.sendIdx["collection"]=1;
  3735. $1=_st($2)._indexOf_startingAt_(value,(1));
  3736. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3737. self._assert_equals_($1,index);
  3738. $ctx2.sendIdx["assert:equals:"]=1;
  3739. $4=self._collection();
  3740. $ctx2.sendIdx["collection"]=2;
  3741. $3=_st($4)._indexOf_startingAt_(value,index);
  3742. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3743. self._assert_equals_($3,index);
  3744. $ctx2.sendIdx["assert:equals:"]=2;
  3745. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3746. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3747. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3748. args: [],
  3749. 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 ]",
  3750. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3751. referencedClasses: ["JSON"]
  3752. }),
  3753. smalltalk.SequenceableCollectionTest);
  3754. smalltalk.addMethod(
  3755. smalltalk.method({
  3756. selector: "testIndexOfStartingAtWithNull",
  3757. protocol: 'tests',
  3758. fn: function (){
  3759. var self=this;
  3760. var jsNull;
  3761. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3762. return smalltalk.withContext(function($ctx1) {
  3763. var $1,$2;
  3764. jsNull=_st($JSON())._parse_("null");
  3765. self._samplesDo_((function(index,value){
  3766. var collection;
  3767. return smalltalk.withContext(function($ctx2) {
  3768. collection=self._collection();
  3769. collection;
  3770. _st(collection)._at_put_(index,jsNull);
  3771. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3772. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3773. self._assert_equals_($1,index);
  3774. $ctx2.sendIdx["assert:equals:"]=1;
  3775. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3776. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3777. self._assert_equals_($2,index);
  3778. $ctx2.sendIdx["assert:equals:"]=2;
  3779. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3780. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3782. args: [],
  3783. 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 ]",
  3784. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3785. referencedClasses: ["JSON"]
  3786. }),
  3787. smalltalk.SequenceableCollectionTest);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "testLast",
  3791. protocol: 'tests',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3796. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3797. args: [],
  3798. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3799. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3800. referencedClasses: []
  3801. }),
  3802. smalltalk.SequenceableCollectionTest);
  3803. smalltalk.addMethod(
  3804. smalltalk.method({
  3805. selector: "testLastN",
  3806. protocol: 'tests',
  3807. fn: function (){
  3808. var self=this;
  3809. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3810. return smalltalk.withContext(function($ctx1) {
  3811. var $2,$1,$4,$3,$6,$5,$7;
  3812. $2=self._collection();
  3813. $ctx1.sendIdx["collection"]=1;
  3814. $1=_st($2)._last_((2));
  3815. $ctx1.sendIdx["last:"]=1;
  3816. self._assert_equals_($1,self._collectionLastTwo());
  3817. $ctx1.sendIdx["assert:equals:"]=1;
  3818. $4=self._collection();
  3819. $ctx1.sendIdx["collection"]=2;
  3820. $3=_st($4)._last_((0));
  3821. $ctx1.sendIdx["last:"]=2;
  3822. self._assert_equals_($3,_st(self._collectionClass())._new());
  3823. $ctx1.sendIdx["assert:equals:"]=2;
  3824. $6=self._collection();
  3825. $ctx1.sendIdx["collection"]=3;
  3826. $5=_st($6)._last_(self._collectionSize());
  3827. $ctx1.sendIdx["last:"]=3;
  3828. $7=self._collection();
  3829. $ctx1.sendIdx["collection"]=4;
  3830. self._assert_equals_($5,$7);
  3831. self._should_raise_((function(){
  3832. return smalltalk.withContext(function($ctx2) {
  3833. return _st(self._collection())._last_((33));
  3834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3835. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3836. args: [],
  3837. 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",
  3838. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3839. referencedClasses: ["Error"]
  3840. }),
  3841. smalltalk.SequenceableCollectionTest);
  3842. smalltalk.addMethod(
  3843. smalltalk.method({
  3844. selector: "testSecond",
  3845. protocol: 'tests',
  3846. fn: function (){
  3847. var self=this;
  3848. return smalltalk.withContext(function($ctx1) {
  3849. var $2,$1;
  3850. $2=self._collection();
  3851. $ctx1.sendIdx["collection"]=1;
  3852. $1=_st($2)._second();
  3853. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3854. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3855. args: [],
  3856. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3857. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3858. referencedClasses: []
  3859. }),
  3860. smalltalk.SequenceableCollectionTest);
  3861. smalltalk.addMethod(
  3862. smalltalk.method({
  3863. selector: "testThird",
  3864. protocol: 'tests',
  3865. fn: function (){
  3866. var self=this;
  3867. return smalltalk.withContext(function($ctx1) {
  3868. var $2,$1;
  3869. $2=self._collection();
  3870. $ctx1.sendIdx["collection"]=1;
  3871. $1=_st($2)._third();
  3872. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3873. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3874. args: [],
  3875. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3876. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3877. referencedClasses: []
  3878. }),
  3879. smalltalk.SequenceableCollectionTest);
  3880. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3881. smalltalk.addMethod(
  3882. smalltalk.method({
  3883. selector: "collection",
  3884. protocol: 'fixture',
  3885. fn: function (){
  3886. var self=this;
  3887. return smalltalk.withContext(function($ctx1) {
  3888. var $1;
  3889. $1=[(1), (2), (3), (-4)];
  3890. return $1;
  3891. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3892. args: [],
  3893. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3894. messageSends: [],
  3895. referencedClasses: []
  3896. }),
  3897. smalltalk.ArrayTest);
  3898. smalltalk.addMethod(
  3899. smalltalk.method({
  3900. selector: "collectionFirst",
  3901. protocol: 'fixture',
  3902. fn: function (){
  3903. var self=this;
  3904. return smalltalk.withContext(function($ctx1) {
  3905. return (1);
  3906. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3907. args: [],
  3908. source: "collectionFirst\x0a\x09^ 1",
  3909. messageSends: [],
  3910. referencedClasses: []
  3911. }),
  3912. smalltalk.ArrayTest);
  3913. smalltalk.addMethod(
  3914. smalltalk.method({
  3915. selector: "collectionFirstTwo",
  3916. protocol: 'fixture',
  3917. fn: function (){
  3918. var self=this;
  3919. return smalltalk.withContext(function($ctx1) {
  3920. var $1;
  3921. $1=[(1), (2)];
  3922. return $1;
  3923. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3924. args: [],
  3925. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3926. messageSends: [],
  3927. referencedClasses: []
  3928. }),
  3929. smalltalk.ArrayTest);
  3930. smalltalk.addMethod(
  3931. smalltalk.method({
  3932. selector: "collectionLast",
  3933. protocol: 'fixture',
  3934. fn: function (){
  3935. var self=this;
  3936. return smalltalk.withContext(function($ctx1) {
  3937. return (-4);
  3938. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3939. args: [],
  3940. source: "collectionLast\x0a\x09^ -4",
  3941. messageSends: [],
  3942. referencedClasses: []
  3943. }),
  3944. smalltalk.ArrayTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "collectionLastTwo",
  3948. protocol: 'fixture',
  3949. fn: function (){
  3950. var self=this;
  3951. return smalltalk.withContext(function($ctx1) {
  3952. var $1;
  3953. $1=[(3), (-4)];
  3954. return $1;
  3955. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3956. args: [],
  3957. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3958. messageSends: [],
  3959. referencedClasses: []
  3960. }),
  3961. smalltalk.ArrayTest);
  3962. smalltalk.addMethod(
  3963. smalltalk.method({
  3964. selector: "collectionOfPrintStrings",
  3965. protocol: 'fixture',
  3966. fn: function (){
  3967. var self=this;
  3968. return smalltalk.withContext(function($ctx1) {
  3969. var $1;
  3970. $1=["1", "2", "3", "-4"];
  3971. return $1;
  3972. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3973. args: [],
  3974. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3975. messageSends: [],
  3976. referencedClasses: []
  3977. }),
  3978. smalltalk.ArrayTest);
  3979. smalltalk.addMethod(
  3980. smalltalk.method({
  3981. selector: "collectionSize",
  3982. protocol: 'fixture',
  3983. fn: function (){
  3984. var self=this;
  3985. return smalltalk.withContext(function($ctx1) {
  3986. return (4);
  3987. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3988. args: [],
  3989. source: "collectionSize\x0a\x09^ 4",
  3990. messageSends: [],
  3991. referencedClasses: []
  3992. }),
  3993. smalltalk.ArrayTest);
  3994. smalltalk.addMethod(
  3995. smalltalk.method({
  3996. selector: "collectionWithDuplicates",
  3997. protocol: 'fixture',
  3998. fn: function (){
  3999. var self=this;
  4000. return smalltalk.withContext(function($ctx1) {
  4001. var $1;
  4002. $1=["a", "b", "c", (1), (2), (1), "a"];
  4003. return $1;
  4004. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  4005. args: [],
  4006. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4007. messageSends: [],
  4008. referencedClasses: []
  4009. }),
  4010. smalltalk.ArrayTest);
  4011. smalltalk.addMethod(
  4012. smalltalk.method({
  4013. selector: "collectionWithNewValue",
  4014. protocol: 'fixture',
  4015. fn: function (){
  4016. var self=this;
  4017. return smalltalk.withContext(function($ctx1) {
  4018. var $1;
  4019. $1=[(1), (2), (3), (-4), "N"];
  4020. return $1;
  4021. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  4022. args: [],
  4023. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4024. messageSends: [],
  4025. referencedClasses: []
  4026. }),
  4027. smalltalk.ArrayTest);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "sampleNewIndex",
  4031. protocol: 'fixture',
  4032. fn: function (){
  4033. var self=this;
  4034. return smalltalk.withContext(function($ctx1) {
  4035. return (5);
  4036. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  4037. args: [],
  4038. source: "sampleNewIndex\x0a\x09^ 5",
  4039. messageSends: [],
  4040. referencedClasses: []
  4041. }),
  4042. smalltalk.ArrayTest);
  4043. smalltalk.addMethod(
  4044. smalltalk.method({
  4045. selector: "samplesDo:",
  4046. protocol: 'fixture',
  4047. fn: function (aBlock){
  4048. var self=this;
  4049. return smalltalk.withContext(function($ctx1) {
  4050. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4051. _st(aBlock)._value_value_((3),(3));
  4052. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  4053. args: ["aBlock"],
  4054. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4055. messageSends: ["samplesDo:", "value:value:"],
  4056. referencedClasses: []
  4057. }),
  4058. smalltalk.ArrayTest);
  4059. smalltalk.addMethod(
  4060. smalltalk.method({
  4061. selector: "testAdd",
  4062. protocol: 'tests',
  4063. fn: function (){
  4064. var self=this;
  4065. var array;
  4066. return smalltalk.withContext(function($ctx1) {
  4067. array=self._collection();
  4068. _st(array)._add_((6));
  4069. self._assert_equals_(_st(array)._last(),(6));
  4070. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  4071. args: [],
  4072. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4073. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4074. referencedClasses: []
  4075. }),
  4076. smalltalk.ArrayTest);
  4077. smalltalk.addMethod(
  4078. smalltalk.method({
  4079. selector: "testAddFirst",
  4080. protocol: 'tests',
  4081. fn: function (){
  4082. var self=this;
  4083. return smalltalk.withContext(function($ctx1) {
  4084. var $1,$2;
  4085. $1=self._collection();
  4086. _st($1)._addFirst_((0));
  4087. $2=_st($1)._yourself();
  4088. self._assert_equals_(_st($2)._first(),(0));
  4089. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  4090. args: [],
  4091. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4092. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4093. referencedClasses: []
  4094. }),
  4095. smalltalk.ArrayTest);
  4096. smalltalk.addMethod(
  4097. smalltalk.method({
  4098. selector: "testPrintString",
  4099. protocol: 'tests',
  4100. fn: function (){
  4101. var self=this;
  4102. var array;
  4103. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4104. return smalltalk.withContext(function($ctx1) {
  4105. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4106. array=_st($Array())._new();
  4107. $1=_st(array)._printString();
  4108. $ctx1.sendIdx["printString"]=1;
  4109. self._assert_equals_($1,"an Array ()");
  4110. $ctx1.sendIdx["assert:equals:"]=1;
  4111. $2=array;
  4112. _st($2)._add_((1));
  4113. $ctx1.sendIdx["add:"]=1;
  4114. $3=_st($2)._add_((3));
  4115. $ctx1.sendIdx["add:"]=2;
  4116. $4=_st(array)._printString();
  4117. $ctx1.sendIdx["printString"]=2;
  4118. self._assert_equals_($4,"an Array (1 3)");
  4119. $ctx1.sendIdx["assert:equals:"]=2;
  4120. _st(array)._add_("foo");
  4121. $5=_st(array)._printString();
  4122. $ctx1.sendIdx["printString"]=3;
  4123. self._assert_equals_($5,"an Array (1 3 'foo')");
  4124. $ctx1.sendIdx["assert:equals:"]=3;
  4125. $6=array;
  4126. _st($6)._remove_((1));
  4127. $ctx1.sendIdx["remove:"]=1;
  4128. $7=_st($6)._remove_((3));
  4129. $8=_st(array)._printString();
  4130. $ctx1.sendIdx["printString"]=4;
  4131. self._assert_equals_($8,"an Array ('foo')");
  4132. $ctx1.sendIdx["assert:equals:"]=4;
  4133. _st(array)._addLast_((3));
  4134. $ctx1.sendIdx["addLast:"]=1;
  4135. $9=_st(array)._printString();
  4136. $ctx1.sendIdx["printString"]=5;
  4137. self._assert_equals_($9,"an Array ('foo' 3)");
  4138. $ctx1.sendIdx["assert:equals:"]=5;
  4139. _st(array)._addLast_((3));
  4140. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4141. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4142. args: [],
  4143. 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)'.",
  4144. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4145. referencedClasses: ["Array"]
  4146. }),
  4147. smalltalk.ArrayTest);
  4148. smalltalk.addMethod(
  4149. smalltalk.method({
  4150. selector: "testRemove",
  4151. protocol: 'tests',
  4152. fn: function (){
  4153. var self=this;
  4154. var array;
  4155. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4156. return smalltalk.withContext(function($ctx1) {
  4157. array=[(1), (2), (3), (4), (5)];
  4158. _st(array)._remove_((3));
  4159. $ctx1.sendIdx["remove:"]=1;
  4160. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4161. self._should_raise_((function(){
  4162. return smalltalk.withContext(function($ctx2) {
  4163. return _st(array)._remove_((3));
  4164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4165. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4166. args: [],
  4167. 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",
  4168. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4169. referencedClasses: ["Error"]
  4170. }),
  4171. smalltalk.ArrayTest);
  4172. smalltalk.addMethod(
  4173. smalltalk.method({
  4174. selector: "testRemoveFromTo",
  4175. protocol: 'tests',
  4176. fn: function (){
  4177. var self=this;
  4178. return smalltalk.withContext(function($ctx1) {
  4179. var $1,$2;
  4180. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4181. $ctx1.sendIdx["removeFrom:to:"]=1;
  4182. self._assert_equals_($1,[(4)]);
  4183. $ctx1.sendIdx["assert:equals:"]=1;
  4184. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4185. $ctx1.sendIdx["removeFrom:to:"]=2;
  4186. self._assert_equals_($2,[(1), (4)]);
  4187. $ctx1.sendIdx["assert:equals:"]=2;
  4188. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4189. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4190. args: [],
  4191. 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)",
  4192. messageSends: ["assert:equals:", "removeFrom:to:"],
  4193. referencedClasses: []
  4194. }),
  4195. smalltalk.ArrayTest);
  4196. smalltalk.addMethod(
  4197. smalltalk.method({
  4198. selector: "testRemoveIndex",
  4199. protocol: 'tests',
  4200. fn: function (){
  4201. var self=this;
  4202. return smalltalk.withContext(function($ctx1) {
  4203. var $1,$2;
  4204. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4205. $ctx1.sendIdx["removeIndex:"]=1;
  4206. self._assert_equals_($1,[(1), (3), (4)]);
  4207. $ctx1.sendIdx["assert:equals:"]=1;
  4208. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4209. $ctx1.sendIdx["removeIndex:"]=2;
  4210. self._assert_equals_($2,[(2), (3), (4)]);
  4211. $ctx1.sendIdx["assert:equals:"]=2;
  4212. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4213. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4214. args: [],
  4215. 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: #()",
  4216. messageSends: ["assert:equals:", "removeIndex:"],
  4217. referencedClasses: []
  4218. }),
  4219. smalltalk.ArrayTest);
  4220. smalltalk.addMethod(
  4221. smalltalk.method({
  4222. selector: "testRemoveLast",
  4223. protocol: 'tests',
  4224. fn: function (){
  4225. var self=this;
  4226. var array;
  4227. return smalltalk.withContext(function($ctx1) {
  4228. array=[(1), (2)];
  4229. _st(array)._removeLast();
  4230. self._assert_equals_(_st(array)._last(),(1));
  4231. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4232. args: [],
  4233. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4234. messageSends: ["removeLast", "assert:equals:", "last"],
  4235. referencedClasses: []
  4236. }),
  4237. smalltalk.ArrayTest);
  4238. smalltalk.addMethod(
  4239. smalltalk.method({
  4240. selector: "testReversed",
  4241. protocol: 'tests',
  4242. fn: function (){
  4243. var self=this;
  4244. var array;
  4245. return smalltalk.withContext(function($ctx1) {
  4246. array=[(5), (4), (3), (2), (1)];
  4247. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4248. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4249. args: [],
  4250. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4251. messageSends: ["assert:equals:", "reversed"],
  4252. referencedClasses: []
  4253. }),
  4254. smalltalk.ArrayTest);
  4255. smalltalk.addMethod(
  4256. smalltalk.method({
  4257. selector: "testSort",
  4258. protocol: 'tests',
  4259. fn: function (){
  4260. var self=this;
  4261. var array;
  4262. return smalltalk.withContext(function($ctx1) {
  4263. array=[(3), (1), (4), (5), (2)];
  4264. _st(array)._sort();
  4265. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4266. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4267. args: [],
  4268. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4269. messageSends: ["sort", "assert:equals:"],
  4270. referencedClasses: []
  4271. }),
  4272. smalltalk.ArrayTest);
  4273. smalltalk.addMethod(
  4274. smalltalk.method({
  4275. selector: "collectionClass",
  4276. protocol: 'fixture',
  4277. fn: function (){
  4278. var self=this;
  4279. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4280. return smalltalk.withContext(function($ctx1) {
  4281. return $Array();
  4282. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4283. args: [],
  4284. source: "collectionClass\x0a\x09^ Array",
  4285. messageSends: [],
  4286. referencedClasses: ["Array"]
  4287. }),
  4288. smalltalk.ArrayTest.klass);
  4289. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "collection",
  4293. protocol: 'fixture',
  4294. fn: function (){
  4295. var self=this;
  4296. return smalltalk.withContext(function($ctx1) {
  4297. return "helLo";
  4298. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4299. args: [],
  4300. source: "collection\x0a\x09^ 'helLo'",
  4301. messageSends: [],
  4302. referencedClasses: []
  4303. }),
  4304. smalltalk.StringTest);
  4305. smalltalk.addMethod(
  4306. smalltalk.method({
  4307. selector: "collectionFirst",
  4308. protocol: 'fixture',
  4309. fn: function (){
  4310. var self=this;
  4311. return smalltalk.withContext(function($ctx1) {
  4312. return "h";
  4313. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4314. args: [],
  4315. source: "collectionFirst\x0a\x09^ 'h'",
  4316. messageSends: [],
  4317. referencedClasses: []
  4318. }),
  4319. smalltalk.StringTest);
  4320. smalltalk.addMethod(
  4321. smalltalk.method({
  4322. selector: "collectionFirstTwo",
  4323. protocol: 'fixture',
  4324. fn: function (){
  4325. var self=this;
  4326. return smalltalk.withContext(function($ctx1) {
  4327. return "he";
  4328. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4329. args: [],
  4330. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4331. messageSends: [],
  4332. referencedClasses: []
  4333. }),
  4334. smalltalk.StringTest);
  4335. smalltalk.addMethod(
  4336. smalltalk.method({
  4337. selector: "collectionLast",
  4338. protocol: 'fixture',
  4339. fn: function (){
  4340. var self=this;
  4341. return smalltalk.withContext(function($ctx1) {
  4342. return "o";
  4343. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4344. args: [],
  4345. source: "collectionLast\x0a\x09^ 'o'",
  4346. messageSends: [],
  4347. referencedClasses: []
  4348. }),
  4349. smalltalk.StringTest);
  4350. smalltalk.addMethod(
  4351. smalltalk.method({
  4352. selector: "collectionLastTwo",
  4353. protocol: 'fixture',
  4354. fn: function (){
  4355. var self=this;
  4356. return smalltalk.withContext(function($ctx1) {
  4357. return "Lo";
  4358. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4359. args: [],
  4360. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4361. messageSends: [],
  4362. referencedClasses: []
  4363. }),
  4364. smalltalk.StringTest);
  4365. smalltalk.addMethod(
  4366. smalltalk.method({
  4367. selector: "collectionOfPrintStrings",
  4368. protocol: 'fixture',
  4369. fn: function (){
  4370. var self=this;
  4371. return smalltalk.withContext(function($ctx1) {
  4372. return "'h''e''l''L''o'";
  4373. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4374. args: [],
  4375. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4376. messageSends: [],
  4377. referencedClasses: []
  4378. }),
  4379. smalltalk.StringTest);
  4380. smalltalk.addMethod(
  4381. smalltalk.method({
  4382. selector: "collectionSize",
  4383. protocol: 'fixture',
  4384. fn: function (){
  4385. var self=this;
  4386. return smalltalk.withContext(function($ctx1) {
  4387. return (5);
  4388. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4389. args: [],
  4390. source: "collectionSize\x0a\x09^ 5",
  4391. messageSends: [],
  4392. referencedClasses: []
  4393. }),
  4394. smalltalk.StringTest);
  4395. smalltalk.addMethod(
  4396. smalltalk.method({
  4397. selector: "collectionWithDuplicates",
  4398. protocol: 'fixture',
  4399. fn: function (){
  4400. var self=this;
  4401. return smalltalk.withContext(function($ctx1) {
  4402. return "abbaerte";
  4403. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4404. args: [],
  4405. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4406. messageSends: [],
  4407. referencedClasses: []
  4408. }),
  4409. smalltalk.StringTest);
  4410. smalltalk.addMethod(
  4411. smalltalk.method({
  4412. selector: "collectionWithNewValue",
  4413. protocol: 'fixture',
  4414. fn: function (){
  4415. var self=this;
  4416. return smalltalk.withContext(function($ctx1) {
  4417. return "helLoN";
  4418. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4419. args: [],
  4420. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4421. messageSends: [],
  4422. referencedClasses: []
  4423. }),
  4424. smalltalk.StringTest);
  4425. smalltalk.addMethod(
  4426. smalltalk.method({
  4427. selector: "sampleNewValueAsCollection",
  4428. protocol: 'fixture',
  4429. fn: function (){
  4430. var self=this;
  4431. return smalltalk.withContext(function($ctx1) {
  4432. return "N";
  4433. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4434. args: [],
  4435. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4436. messageSends: [],
  4437. referencedClasses: []
  4438. }),
  4439. smalltalk.StringTest);
  4440. smalltalk.addMethod(
  4441. smalltalk.method({
  4442. selector: "samplesDo:",
  4443. protocol: 'fixture',
  4444. fn: function (aBlock){
  4445. var self=this;
  4446. return smalltalk.withContext(function($ctx1) {
  4447. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4448. _st(aBlock)._value_value_((3),"l");
  4449. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4450. args: ["aBlock"],
  4451. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4452. messageSends: ["samplesDo:", "value:value:"],
  4453. referencedClasses: []
  4454. }),
  4455. smalltalk.StringTest);
  4456. smalltalk.addMethod(
  4457. smalltalk.method({
  4458. selector: "testAddAll",
  4459. protocol: 'tests',
  4460. fn: function (){
  4461. var self=this;
  4462. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4463. return smalltalk.withContext(function($ctx1) {
  4464. var $1;
  4465. self._should_raise_((function(){
  4466. return smalltalk.withContext(function($ctx2) {
  4467. $1=self._collection();
  4468. $ctx2.sendIdx["collection"]=1;
  4469. return _st($1)._addAll_(self._collection());
  4470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4471. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4472. args: [],
  4473. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4474. messageSends: ["should:raise:", "addAll:", "collection"],
  4475. referencedClasses: ["Error"]
  4476. }),
  4477. smalltalk.StringTest);
  4478. smalltalk.addMethod(
  4479. smalltalk.method({
  4480. selector: "testAddRemove",
  4481. protocol: 'tests',
  4482. fn: function (){
  4483. var self=this;
  4484. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4485. return smalltalk.withContext(function($ctx1) {
  4486. self._should_raise_((function(){
  4487. return smalltalk.withContext(function($ctx2) {
  4488. return "hello"._add_("a");
  4489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4490. $ctx1.sendIdx["should:raise:"]=1;
  4491. self._should_raise_((function(){
  4492. return smalltalk.withContext(function($ctx2) {
  4493. return "hello"._remove_("h");
  4494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4495. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4496. args: [],
  4497. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4498. messageSends: ["should:raise:", "add:", "remove:"],
  4499. referencedClasses: ["Error"]
  4500. }),
  4501. smalltalk.StringTest);
  4502. smalltalk.addMethod(
  4503. smalltalk.method({
  4504. selector: "testAsArray",
  4505. protocol: 'tests',
  4506. fn: function (){
  4507. var self=this;
  4508. return smalltalk.withContext(function($ctx1) {
  4509. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4510. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4511. args: [],
  4512. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4513. messageSends: ["assert:equals:", "asArray"],
  4514. referencedClasses: []
  4515. }),
  4516. smalltalk.StringTest);
  4517. smalltalk.addMethod(
  4518. smalltalk.method({
  4519. selector: "testAsLowerCase",
  4520. protocol: 'tests',
  4521. fn: function (){
  4522. var self=this;
  4523. return smalltalk.withContext(function($ctx1) {
  4524. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4525. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4526. args: [],
  4527. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4528. messageSends: ["assert:equals:", "asLowercase"],
  4529. referencedClasses: []
  4530. }),
  4531. smalltalk.StringTest);
  4532. smalltalk.addMethod(
  4533. smalltalk.method({
  4534. selector: "testAsNumber",
  4535. protocol: 'tests',
  4536. fn: function (){
  4537. var self=this;
  4538. return smalltalk.withContext(function($ctx1) {
  4539. var $1,$2;
  4540. $1="3"._asNumber();
  4541. $ctx1.sendIdx["asNumber"]=1;
  4542. self._assert_equals_($1,(3));
  4543. $ctx1.sendIdx["assert:equals:"]=1;
  4544. $2="-3"._asNumber();
  4545. $ctx1.sendIdx["asNumber"]=2;
  4546. self._assert_equals_($2,(-3));
  4547. $ctx1.sendIdx["assert:equals:"]=2;
  4548. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4549. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4550. args: [],
  4551. 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.",
  4552. messageSends: ["assert:equals:", "asNumber"],
  4553. referencedClasses: []
  4554. }),
  4555. smalltalk.StringTest);
  4556. smalltalk.addMethod(
  4557. smalltalk.method({
  4558. selector: "testAsUpperCase",
  4559. protocol: 'tests',
  4560. fn: function (){
  4561. var self=this;
  4562. return smalltalk.withContext(function($ctx1) {
  4563. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4564. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4565. args: [],
  4566. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4567. messageSends: ["assert:equals:", "asUppercase"],
  4568. referencedClasses: []
  4569. }),
  4570. smalltalk.StringTest);
  4571. smalltalk.addMethod(
  4572. smalltalk.method({
  4573. selector: "testAsciiValue",
  4574. protocol: 'tests',
  4575. fn: function (){
  4576. var self=this;
  4577. var characterA,characterU;
  4578. return smalltalk.withContext(function($ctx1) {
  4579. var $1;
  4580. characterA="A";
  4581. characterU="U";
  4582. $1=_st(characterA)._asciiValue();
  4583. $ctx1.sendIdx["asciiValue"]=1;
  4584. self._assert_equals_($1,(65));
  4585. $ctx1.sendIdx["assert:equals:"]=1;
  4586. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4587. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4588. args: [],
  4589. 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",
  4590. messageSends: ["assert:equals:", "asciiValue"],
  4591. referencedClasses: []
  4592. }),
  4593. smalltalk.StringTest);
  4594. smalltalk.addMethod(
  4595. smalltalk.method({
  4596. selector: "testAtIfAbsentPut",
  4597. protocol: 'tests',
  4598. fn: function (){
  4599. var self=this;
  4600. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4601. return smalltalk.withContext(function($ctx1) {
  4602. self._should_raise_((function(){
  4603. return smalltalk.withContext(function($ctx2) {
  4604. return "hello"._at_ifAbsentPut_((6),(function(){
  4605. return smalltalk.withContext(function($ctx3) {
  4606. return "a";
  4607. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4609. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4610. args: [],
  4611. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4612. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4613. referencedClasses: ["Error"]
  4614. }),
  4615. smalltalk.StringTest);
  4616. smalltalk.addMethod(
  4617. smalltalk.method({
  4618. selector: "testAtPut",
  4619. protocol: 'tests',
  4620. fn: function (){
  4621. var self=this;
  4622. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4623. return smalltalk.withContext(function($ctx1) {
  4624. self._should_raise_((function(){
  4625. return smalltalk.withContext(function($ctx2) {
  4626. return "hello"._at_put_((1),"a");
  4627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4628. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4629. args: [],
  4630. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4631. messageSends: ["should:raise:", "at:put:"],
  4632. referencedClasses: ["Error"]
  4633. }),
  4634. smalltalk.StringTest);
  4635. smalltalk.addMethod(
  4636. smalltalk.method({
  4637. selector: "testCapitalized",
  4638. protocol: 'tests',
  4639. fn: function (){
  4640. var self=this;
  4641. return smalltalk.withContext(function($ctx1) {
  4642. var $1,$2,$3;
  4643. $1="test"._capitalized();
  4644. $ctx1.sendIdx["capitalized"]=1;
  4645. self._assert_equals_($1,"Test");
  4646. $ctx1.sendIdx["assert:equals:"]=1;
  4647. $2="Test"._capitalized();
  4648. $ctx1.sendIdx["capitalized"]=2;
  4649. self._assert_equals_($2,"Test");
  4650. $ctx1.sendIdx["assert:equals:"]=2;
  4651. self._assert_equals_(""._capitalized(),"");
  4652. $ctx1.sendIdx["assert:equals:"]=3;
  4653. $3="Test"._isCapitalized();
  4654. $ctx1.sendIdx["isCapitalized"]=1;
  4655. self._assert_equals_($3,true);
  4656. $ctx1.sendIdx["assert:equals:"]=4;
  4657. self._assert_equals_("test"._isCapitalized(),false);
  4658. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4659. args: [],
  4660. 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.",
  4661. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4662. referencedClasses: []
  4663. }),
  4664. smalltalk.StringTest);
  4665. smalltalk.addMethod(
  4666. smalltalk.method({
  4667. selector: "testCharCodeAt",
  4668. protocol: 'tests',
  4669. fn: function (){
  4670. var self=this;
  4671. return smalltalk.withContext(function($ctx1) {
  4672. var $1,$2,$3,$4,$5;
  4673. $1="jackie"._charCodeAt_((1));
  4674. $ctx1.sendIdx["charCodeAt:"]=1;
  4675. self._assert_equals_($1,(106));
  4676. $ctx1.sendIdx["assert:equals:"]=1;
  4677. $2="jackie"._charCodeAt_((2));
  4678. $ctx1.sendIdx["charCodeAt:"]=2;
  4679. self._assert_equals_($2,(97));
  4680. $ctx1.sendIdx["assert:equals:"]=2;
  4681. $3="jackie"._charCodeAt_((3));
  4682. $ctx1.sendIdx["charCodeAt:"]=3;
  4683. self._assert_equals_($3,(99));
  4684. $ctx1.sendIdx["assert:equals:"]=3;
  4685. $4="jackie"._charCodeAt_((4));
  4686. $ctx1.sendIdx["charCodeAt:"]=4;
  4687. self._assert_equals_($4,(107));
  4688. $ctx1.sendIdx["assert:equals:"]=4;
  4689. $5="jackie"._charCodeAt_((5));
  4690. $ctx1.sendIdx["charCodeAt:"]=5;
  4691. self._assert_equals_($5,(105));
  4692. $ctx1.sendIdx["assert:equals:"]=5;
  4693. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4694. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4695. args: [],
  4696. 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",
  4697. messageSends: ["assert:equals:", "charCodeAt:"],
  4698. referencedClasses: []
  4699. }),
  4700. smalltalk.StringTest);
  4701. smalltalk.addMethod(
  4702. smalltalk.method({
  4703. selector: "testCopyFromTo",
  4704. protocol: 'tests',
  4705. fn: function (){
  4706. var self=this;
  4707. return smalltalk.withContext(function($ctx1) {
  4708. var $1;
  4709. $1="jackie"._copyFrom_to_((1),(3));
  4710. $ctx1.sendIdx["copyFrom:to:"]=1;
  4711. self._assert_equals_($1,"jac");
  4712. $ctx1.sendIdx["assert:equals:"]=1;
  4713. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4714. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4715. args: [],
  4716. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4717. messageSends: ["assert:equals:", "copyFrom:to:"],
  4718. referencedClasses: []
  4719. }),
  4720. smalltalk.StringTest);
  4721. smalltalk.addMethod(
  4722. smalltalk.method({
  4723. selector: "testCopyWithoutAll",
  4724. protocol: 'tests',
  4725. fn: function (){
  4726. var self=this;
  4727. return smalltalk.withContext(function($ctx1) {
  4728. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4729. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4730. args: [],
  4731. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4732. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4733. referencedClasses: []
  4734. }),
  4735. smalltalk.StringTest);
  4736. smalltalk.addMethod(
  4737. smalltalk.method({
  4738. selector: "testEquality",
  4739. protocol: 'tests',
  4740. fn: function (){
  4741. var self=this;
  4742. return smalltalk.withContext(function($ctx1) {
  4743. var $1,$2,$3;
  4744. self._assert_equals_("hello","hello");
  4745. $ctx1.sendIdx["assert:equals:"]=1;
  4746. $1="hello".__eq("world");
  4747. $ctx1.sendIdx["="]=1;
  4748. self._deny_($1);
  4749. $ctx1.sendIdx["deny:"]=1;
  4750. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4751. return smalltalk.withContext(function($ctx2) {
  4752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4753. $ctx1.sendIdx["="]=2;
  4754. self._deny_($2);
  4755. $ctx1.sendIdx["deny:"]=2;
  4756. $3="hello"._yourself();
  4757. $ctx1.sendIdx["yourself"]=1;
  4758. self._assert_equals_("hello",$3);
  4759. $ctx1.sendIdx["assert:equals:"]=2;
  4760. self._assert_equals_("hello"._yourself(),"hello");
  4761. self._deny_("".__eq((0)));
  4762. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4763. args: [],
  4764. 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",
  4765. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4766. referencedClasses: []
  4767. }),
  4768. smalltalk.StringTest);
  4769. smalltalk.addMethod(
  4770. smalltalk.method({
  4771. selector: "testIdentity",
  4772. protocol: 'tests',
  4773. fn: function (){
  4774. var self=this;
  4775. return smalltalk.withContext(function($ctx1) {
  4776. var $1,$2,$4,$3,$5;
  4777. $1="hello".__eq_eq("hello");
  4778. $ctx1.sendIdx["=="]=1;
  4779. self._assert_($1);
  4780. $ctx1.sendIdx["assert:"]=1;
  4781. $2="hello".__eq_eq("world");
  4782. $ctx1.sendIdx["=="]=2;
  4783. self._deny_($2);
  4784. $ctx1.sendIdx["deny:"]=1;
  4785. $4="hello"._yourself();
  4786. $ctx1.sendIdx["yourself"]=1;
  4787. $3="hello".__eq_eq($4);
  4788. $ctx1.sendIdx["=="]=3;
  4789. self._assert_($3);
  4790. $ctx1.sendIdx["assert:"]=2;
  4791. $5=_st("hello"._yourself()).__eq_eq("hello");
  4792. $ctx1.sendIdx["=="]=4;
  4793. self._assert_($5);
  4794. self._deny_("".__eq_eq((0)));
  4795. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4796. args: [],
  4797. 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",
  4798. messageSends: ["assert:", "==", "deny:", "yourself"],
  4799. referencedClasses: []
  4800. }),
  4801. smalltalk.StringTest);
  4802. smalltalk.addMethod(
  4803. smalltalk.method({
  4804. selector: "testIdentityHash",
  4805. protocol: 'tests',
  4806. fn: function (){
  4807. var self=this;
  4808. return smalltalk.withContext(function($ctx1) {
  4809. var $1,$2,$4,$3;
  4810. $1="foo"._identityHash();
  4811. $ctx1.sendIdx["identityHash"]=1;
  4812. $2="foo"._identityHash();
  4813. $ctx1.sendIdx["identityHash"]=2;
  4814. self._assert_equals_($1,$2);
  4815. $4="foo"._identityHash();
  4816. $ctx1.sendIdx["identityHash"]=3;
  4817. $3=_st($4).__eq("bar"._identityHash());
  4818. self._deny_($3);
  4819. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4820. args: [],
  4821. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4822. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4823. referencedClasses: []
  4824. }),
  4825. smalltalk.StringTest);
  4826. smalltalk.addMethod(
  4827. smalltalk.method({
  4828. selector: "testIncludesSubString",
  4829. protocol: 'tests',
  4830. fn: function (){
  4831. var self=this;
  4832. return smalltalk.withContext(function($ctx1) {
  4833. var $1;
  4834. $1="amber"._includesSubString_("ber");
  4835. $ctx1.sendIdx["includesSubString:"]=1;
  4836. self._assert_($1);
  4837. self._deny_("amber"._includesSubString_("zork"));
  4838. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4839. args: [],
  4840. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4841. messageSends: ["assert:", "includesSubString:", "deny:"],
  4842. referencedClasses: []
  4843. }),
  4844. smalltalk.StringTest);
  4845. smalltalk.addMethod(
  4846. smalltalk.method({
  4847. selector: "testIndexOfStartingAtWithNull",
  4848. protocol: 'tests',
  4849. fn: function (){
  4850. var self=this;
  4851. return smalltalk.withContext(function($ctx1) {
  4852. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{},smalltalk.StringTest)})},
  4853. args: [],
  4854. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4855. messageSends: [],
  4856. referencedClasses: []
  4857. }),
  4858. smalltalk.StringTest);
  4859. smalltalk.addMethod(
  4860. smalltalk.method({
  4861. selector: "testIndexOfWithNull",
  4862. protocol: 'tests',
  4863. fn: function (){
  4864. var self=this;
  4865. return smalltalk.withContext(function($ctx1) {
  4866. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{},smalltalk.StringTest)})},
  4867. args: [],
  4868. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4869. messageSends: [],
  4870. referencedClasses: []
  4871. }),
  4872. smalltalk.StringTest);
  4873. smalltalk.addMethod(
  4874. smalltalk.method({
  4875. selector: "testIsVowel",
  4876. protocol: 'tests',
  4877. fn: function (){
  4878. var self=this;
  4879. var vowel,consonant;
  4880. return smalltalk.withContext(function($ctx1) {
  4881. var $1;
  4882. vowel="u";
  4883. consonant="z";
  4884. $1=_st(vowel)._isVowel();
  4885. $ctx1.sendIdx["isVowel"]=1;
  4886. self._assert_equals_($1,true);
  4887. $ctx1.sendIdx["assert:equals:"]=1;
  4888. self._assert_equals_(_st(consonant)._isVowel(),false);
  4889. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4890. args: [],
  4891. 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",
  4892. messageSends: ["assert:equals:", "isVowel"],
  4893. referencedClasses: []
  4894. }),
  4895. smalltalk.StringTest);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "testJoin",
  4899. protocol: 'tests',
  4900. fn: function (){
  4901. var self=this;
  4902. return smalltalk.withContext(function($ctx1) {
  4903. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4904. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4905. args: [],
  4906. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4907. messageSends: ["assert:equals:", "join:"],
  4908. referencedClasses: []
  4909. }),
  4910. smalltalk.StringTest);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "testRemoveAll",
  4914. protocol: 'tests',
  4915. fn: function (){
  4916. var self=this;
  4917. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4918. return smalltalk.withContext(function($ctx1) {
  4919. self._should_raise_((function(){
  4920. return smalltalk.withContext(function($ctx2) {
  4921. return _st(self._collection())._removeAll();
  4922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4923. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4924. args: [],
  4925. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4926. messageSends: ["should:raise:", "removeAll", "collection"],
  4927. referencedClasses: ["Error"]
  4928. }),
  4929. smalltalk.StringTest);
  4930. smalltalk.addMethod(
  4931. smalltalk.method({
  4932. selector: "testReversed",
  4933. protocol: 'tests',
  4934. fn: function (){
  4935. var self=this;
  4936. return smalltalk.withContext(function($ctx1) {
  4937. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4938. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4939. args: [],
  4940. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4941. messageSends: ["assert:equals:", "reversed"],
  4942. referencedClasses: []
  4943. }),
  4944. smalltalk.StringTest);
  4945. smalltalk.addMethod(
  4946. smalltalk.method({
  4947. selector: "testStreamContents",
  4948. protocol: 'tests',
  4949. fn: function (){
  4950. var self=this;
  4951. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4952. return smalltalk.withContext(function($ctx1) {
  4953. var $1;
  4954. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4955. return smalltalk.withContext(function($ctx2) {
  4956. _st(aStream)._nextPutAll_("hello");
  4957. $ctx2.sendIdx["nextPutAll:"]=1;
  4958. _st(aStream)._space();
  4959. $1=_st(aStream)._nextPutAll_("world");
  4960. return $1;
  4961. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4962. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4963. args: [],
  4964. 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'",
  4965. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4966. referencedClasses: ["String"]
  4967. }),
  4968. smalltalk.StringTest);
  4969. smalltalk.addMethod(
  4970. smalltalk.method({
  4971. selector: "testSubStrings",
  4972. protocol: 'tests',
  4973. fn: function (){
  4974. var self=this;
  4975. return smalltalk.withContext(function($ctx1) {
  4976. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4977. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4978. args: [],
  4979. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4980. messageSends: ["assert:equals:", "subStrings:"],
  4981. referencedClasses: []
  4982. }),
  4983. smalltalk.StringTest);
  4984. smalltalk.addMethod(
  4985. smalltalk.method({
  4986. selector: "testTrim",
  4987. protocol: 'tests',
  4988. fn: function (){
  4989. var self=this;
  4990. return smalltalk.withContext(function($ctx1) {
  4991. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4992. $ctx1.sendIdx["assert:equals:"]=1;
  4993. self._assert_equals_("jackie "._trimRight(),"jackie");
  4994. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4995. args: [],
  4996. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4997. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4998. referencedClasses: []
  4999. }),
  5000. smalltalk.StringTest);
  5001. smalltalk.addMethod(
  5002. smalltalk.method({
  5003. selector: "collectionClass",
  5004. protocol: 'fixture',
  5005. fn: function (){
  5006. var self=this;
  5007. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5008. return smalltalk.withContext(function($ctx1) {
  5009. return $String();
  5010. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  5011. args: [],
  5012. source: "collectionClass\x0a\x09^ String",
  5013. messageSends: [],
  5014. referencedClasses: ["String"]
  5015. }),
  5016. smalltalk.StringTest.klass);
  5017. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  5018. smalltalk.addMethod(
  5019. smalltalk.method({
  5020. selector: "collection",
  5021. protocol: 'fixture',
  5022. fn: function (){
  5023. var self=this;
  5024. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5025. return smalltalk.withContext(function($ctx1) {
  5026. var $2,$3,$1;
  5027. $2=_st($Set())._new();
  5028. _st($2)._add_((1));
  5029. $ctx1.sendIdx["add:"]=1;
  5030. _st($2)._add_((2));
  5031. $ctx1.sendIdx["add:"]=2;
  5032. _st($2)._add_((3));
  5033. $ctx1.sendIdx["add:"]=3;
  5034. _st($2)._add_((-4));
  5035. $3=_st($2)._yourself();
  5036. $1=$3;
  5037. return $1;
  5038. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  5039. args: [],
  5040. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  5041. messageSends: ["add:", "new", "yourself"],
  5042. referencedClasses: ["Set"]
  5043. }),
  5044. smalltalk.SetTest);
  5045. smalltalk.addMethod(
  5046. smalltalk.method({
  5047. selector: "collectionOfPrintStrings",
  5048. protocol: 'fixture',
  5049. fn: function (){
  5050. var self=this;
  5051. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5052. return smalltalk.withContext(function($ctx1) {
  5053. var $2,$3,$1;
  5054. $2=_st($Set())._new();
  5055. _st($2)._add_("1");
  5056. $ctx1.sendIdx["add:"]=1;
  5057. _st($2)._add_("2");
  5058. $ctx1.sendIdx["add:"]=2;
  5059. _st($2)._add_("3");
  5060. $ctx1.sendIdx["add:"]=3;
  5061. _st($2)._add_("-4");
  5062. $3=_st($2)._yourself();
  5063. $1=$3;
  5064. return $1;
  5065. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  5066. args: [],
  5067. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  5068. messageSends: ["add:", "new", "yourself"],
  5069. referencedClasses: ["Set"]
  5070. }),
  5071. smalltalk.SetTest);
  5072. smalltalk.addMethod(
  5073. smalltalk.method({
  5074. selector: "collectionSize",
  5075. protocol: 'fixture',
  5076. fn: function (){
  5077. var self=this;
  5078. return smalltalk.withContext(function($ctx1) {
  5079. return (4);
  5080. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  5081. args: [],
  5082. source: "collectionSize\x0a\x09^ 4",
  5083. messageSends: [],
  5084. referencedClasses: []
  5085. }),
  5086. smalltalk.SetTest);
  5087. smalltalk.addMethod(
  5088. smalltalk.method({
  5089. selector: "collectionWithDuplicates",
  5090. protocol: 'fixture',
  5091. fn: function (){
  5092. var self=this;
  5093. return smalltalk.withContext(function($ctx1) {
  5094. var $2,$3,$1;
  5095. $2=self._collection();
  5096. _st($2)._add_("yet another");
  5097. $3=_st($2)._yourself();
  5098. $1=$3;
  5099. return $1;
  5100. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  5101. args: [],
  5102. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  5103. messageSends: ["add:", "collection", "yourself"],
  5104. referencedClasses: []
  5105. }),
  5106. smalltalk.SetTest);
  5107. smalltalk.addMethod(
  5108. smalltalk.method({
  5109. selector: "collectionWithNewValue",
  5110. protocol: 'fixture',
  5111. fn: function (){
  5112. var self=this;
  5113. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5114. return smalltalk.withContext(function($ctx1) {
  5115. var $2,$3,$1;
  5116. $2=_st($Set())._new();
  5117. _st($2)._add_((1));
  5118. $ctx1.sendIdx["add:"]=1;
  5119. _st($2)._add_((2));
  5120. $ctx1.sendIdx["add:"]=2;
  5121. _st($2)._add_((3));
  5122. $ctx1.sendIdx["add:"]=3;
  5123. _st($2)._add_("N");
  5124. $ctx1.sendIdx["add:"]=4;
  5125. _st($2)._add_((-4));
  5126. $3=_st($2)._yourself();
  5127. $1=$3;
  5128. return $1;
  5129. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5130. args: [],
  5131. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  5132. messageSends: ["add:", "new", "yourself"],
  5133. referencedClasses: ["Set"]
  5134. }),
  5135. smalltalk.SetTest);
  5136. smalltalk.addMethod(
  5137. smalltalk.method({
  5138. selector: "testAddAll",
  5139. protocol: 'tests',
  5140. fn: function (){
  5141. var self=this;
  5142. return smalltalk.withContext(function($ctx1) {
  5143. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5144. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5145. $2=self._collection();
  5146. $ctx1.sendIdx["collection"]=1;
  5147. $3=$2;
  5148. $4=self._collection();
  5149. $ctx1.sendIdx["collection"]=2;
  5150. _st($3)._addAll_($4);
  5151. $ctx1.sendIdx["addAll:"]=1;
  5152. $5=_st($2)._yourself();
  5153. $ctx1.sendIdx["yourself"]=1;
  5154. $1=$5;
  5155. $6=self._collection();
  5156. $ctx1.sendIdx["collection"]=3;
  5157. self._assert_equals_($1,$6);
  5158. $ctx1.sendIdx["assert:equals:"]=1;
  5159. $8=self._collection();
  5160. $ctx1.sendIdx["collection"]=4;
  5161. $9=$8;
  5162. $10=self._collectionWithNewValue();
  5163. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5164. _st($9)._addAll_($10);
  5165. $ctx1.sendIdx["addAll:"]=2;
  5166. $11=_st($8)._yourself();
  5167. $ctx1.sendIdx["yourself"]=2;
  5168. $7=$11;
  5169. $12=self._collectionWithNewValue();
  5170. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5171. self._assert_equals_($7,$12);
  5172. $ctx1.sendIdx["assert:equals:"]=2;
  5173. $14=self._collectionWithNewValue();
  5174. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5175. _st($14)._addAll_(self._collection());
  5176. $15=_st($14)._yourself();
  5177. $13=$15;
  5178. self._assert_equals_($13,self._collectionWithNewValue());
  5179. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5180. args: [],
  5181. 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",
  5182. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5183. referencedClasses: []
  5184. }),
  5185. smalltalk.SetTest);
  5186. smalltalk.addMethod(
  5187. smalltalk.method({
  5188. selector: "testAddRemove",
  5189. protocol: 'tests',
  5190. fn: function (){
  5191. var self=this;
  5192. var set;
  5193. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5194. return smalltalk.withContext(function($ctx1) {
  5195. var $1,$2;
  5196. set=_st($Set())._new();
  5197. self._assert_(_st(set)._isEmpty());
  5198. $ctx1.sendIdx["assert:"]=1;
  5199. _st(set)._add_((3));
  5200. $ctx1.sendIdx["add:"]=1;
  5201. $1=_st(set)._includes_((3));
  5202. $ctx1.sendIdx["includes:"]=1;
  5203. self._assert_($1);
  5204. $ctx1.sendIdx["assert:"]=2;
  5205. _st(set)._add_((5));
  5206. $2=_st(set)._includes_((5));
  5207. $ctx1.sendIdx["includes:"]=2;
  5208. self._assert_($2);
  5209. _st(set)._remove_((3));
  5210. self._deny_(_st(set)._includes_((3)));
  5211. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5212. args: [],
  5213. 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)",
  5214. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5215. referencedClasses: ["Set"]
  5216. }),
  5217. smalltalk.SetTest);
  5218. smalltalk.addMethod(
  5219. smalltalk.method({
  5220. selector: "testAt",
  5221. protocol: 'tests',
  5222. fn: function (){
  5223. var self=this;
  5224. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5225. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5226. return smalltalk.withContext(function($ctx1) {
  5227. self._should_raise_((function(){
  5228. return smalltalk.withContext(function($ctx2) {
  5229. return _st(_st($Set())._new())._at_put_((1),(2));
  5230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5231. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5232. args: [],
  5233. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5234. messageSends: ["should:raise:", "at:put:", "new"],
  5235. referencedClasses: ["Set", "Error"]
  5236. }),
  5237. smalltalk.SetTest);
  5238. smalltalk.addMethod(
  5239. smalltalk.method({
  5240. selector: "testCollect",
  5241. protocol: 'tests',
  5242. fn: function (){
  5243. var self=this;
  5244. return smalltalk.withContext(function($ctx1) {
  5245. var $2,$1;
  5246. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5247. $2=[(5), (6), (8)]._asSet();
  5248. $ctx1.sendIdx["asSet"]=1;
  5249. $1=_st($2)._collect_((function(x){
  5250. return smalltalk.withContext(function($ctx2) {
  5251. return _st(x).__backslash_backslash((3));
  5252. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5253. self._assert_equals_($1,[(0), (2)]._asSet());
  5254. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5255. args: [],
  5256. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5257. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5258. referencedClasses: []
  5259. }),
  5260. smalltalk.SetTest);
  5261. smalltalk.addMethod(
  5262. smalltalk.method({
  5263. selector: "testComma",
  5264. protocol: 'tests',
  5265. fn: function (){
  5266. var self=this;
  5267. return smalltalk.withContext(function($ctx1) {
  5268. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5269. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5270. $2=self._collection();
  5271. $ctx1.sendIdx["collection"]=1;
  5272. $3=self._collection();
  5273. $ctx1.sendIdx["collection"]=2;
  5274. $1=_st($2).__comma($3);
  5275. $ctx1.sendIdx[","]=1;
  5276. $4=self._collection();
  5277. $ctx1.sendIdx["collection"]=3;
  5278. self._assert_equals_($1,$4);
  5279. $ctx1.sendIdx["assert:equals:"]=1;
  5280. $6=self._collection();
  5281. $ctx1.sendIdx["collection"]=4;
  5282. $7=self._collectionWithNewValue();
  5283. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5284. $5=_st($6).__comma($7);
  5285. $ctx1.sendIdx[","]=2;
  5286. $8=self._collectionWithNewValue();
  5287. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5288. self._assert_equals_($5,$8);
  5289. $ctx1.sendIdx["assert:equals:"]=2;
  5290. $10=self._collectionWithNewValue();
  5291. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5292. $9=_st($10).__comma(self._collection());
  5293. self._assert_equals_($9,self._collectionWithNewValue());
  5294. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5295. args: [],
  5296. 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",
  5297. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5298. referencedClasses: []
  5299. }),
  5300. smalltalk.SetTest);
  5301. smalltalk.addMethod(
  5302. smalltalk.method({
  5303. selector: "testComparing",
  5304. protocol: 'tests',
  5305. fn: function (){
  5306. var self=this;
  5307. return smalltalk.withContext(function($ctx1) {
  5308. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5309. $1=[(0), (2)]._asSet();
  5310. $ctx1.sendIdx["asSet"]=1;
  5311. $2=[(0), (2)]._asSet();
  5312. $ctx1.sendIdx["asSet"]=2;
  5313. self._assert_equals_($1,$2);
  5314. $ctx1.sendIdx["assert:equals:"]=1;
  5315. $3=[(2), (0)]._asSet();
  5316. $ctx1.sendIdx["asSet"]=3;
  5317. $4=[(0), (2)]._asSet();
  5318. $ctx1.sendIdx["asSet"]=4;
  5319. self._assert_equals_($3,$4);
  5320. $6=[(0), (2), (3)]._asSet();
  5321. $ctx1.sendIdx["asSet"]=5;
  5322. $7=[(0), (2)]._asSet();
  5323. $ctx1.sendIdx["asSet"]=6;
  5324. $5=_st($6).__eq($7);
  5325. $ctx1.sendIdx["="]=1;
  5326. self._deny_($5);
  5327. $ctx1.sendIdx["deny:"]=1;
  5328. $9=[(1), (2)]._asSet();
  5329. $ctx1.sendIdx["asSet"]=7;
  5330. $8=_st($9).__eq([(0), (2)]._asSet());
  5331. self._deny_($8);
  5332. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5333. args: [],
  5334. 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",
  5335. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5336. referencedClasses: []
  5337. }),
  5338. smalltalk.SetTest);
  5339. smalltalk.addMethod(
  5340. smalltalk.method({
  5341. selector: "testPrintString",
  5342. protocol: 'tests',
  5343. fn: function (){
  5344. var self=this;
  5345. var set;
  5346. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5347. return smalltalk.withContext(function($ctx1) {
  5348. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5349. set=_st($Set())._new();
  5350. $1=_st(set)._printString();
  5351. $ctx1.sendIdx["printString"]=1;
  5352. self._assert_equals_($1,"a Set ()");
  5353. $ctx1.sendIdx["assert:equals:"]=1;
  5354. $2=set;
  5355. _st($2)._add_((1));
  5356. $ctx1.sendIdx["add:"]=1;
  5357. $3=_st($2)._add_((3));
  5358. $ctx1.sendIdx["add:"]=2;
  5359. $4=_st(set)._printString();
  5360. $ctx1.sendIdx["printString"]=2;
  5361. self._assert_equals_($4,"a Set (1 3)");
  5362. $ctx1.sendIdx["assert:equals:"]=2;
  5363. _st(set)._add_("foo");
  5364. $ctx1.sendIdx["add:"]=3;
  5365. $5=_st(set)._printString();
  5366. $ctx1.sendIdx["printString"]=3;
  5367. self._assert_equals_($5,"a Set (1 3 'foo')");
  5368. $ctx1.sendIdx["assert:equals:"]=3;
  5369. $6=set;
  5370. _st($6)._remove_((1));
  5371. $ctx1.sendIdx["remove:"]=1;
  5372. $7=_st($6)._remove_((3));
  5373. $8=_st(set)._printString();
  5374. $ctx1.sendIdx["printString"]=4;
  5375. self._assert_equals_($8,"a Set ('foo')");
  5376. $ctx1.sendIdx["assert:equals:"]=4;
  5377. _st(set)._add_((3));
  5378. $ctx1.sendIdx["add:"]=4;
  5379. $9=_st(set)._printString();
  5380. $ctx1.sendIdx["printString"]=5;
  5381. self._assert_equals_($9,"a Set ('foo' 3)");
  5382. $ctx1.sendIdx["assert:equals:"]=5;
  5383. _st(set)._add_((3));
  5384. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5385. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5386. args: [],
  5387. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  5388. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5389. referencedClasses: ["Set"]
  5390. }),
  5391. smalltalk.SetTest);
  5392. smalltalk.addMethod(
  5393. smalltalk.method({
  5394. selector: "testUnboxedObjects",
  5395. protocol: 'tests',
  5396. fn: function (){
  5397. var self=this;
  5398. return smalltalk.withContext(function($ctx1) {
  5399. var $4,$3,$2,$1;
  5400. $4="foo"._yourself();
  5401. $ctx1.sendIdx["yourself"]=1;
  5402. $3=[$4,"foo"._yourself()];
  5403. $2=_st($3)._asSet();
  5404. $1=_st($2)._asArray();
  5405. self._assert_equals_($1,["foo"]);
  5406. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5407. args: [],
  5408. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5409. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5410. referencedClasses: []
  5411. }),
  5412. smalltalk.SetTest);
  5413. smalltalk.addMethod(
  5414. smalltalk.method({
  5415. selector: "testUnicity",
  5416. protocol: 'tests',
  5417. fn: function (){
  5418. var self=this;
  5419. var set;
  5420. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5421. return smalltalk.withContext(function($ctx1) {
  5422. var $1;
  5423. set=_st($Set())._new();
  5424. _st(set)._add_((21));
  5425. $ctx1.sendIdx["add:"]=1;
  5426. _st(set)._add_("hello");
  5427. $ctx1.sendIdx["add:"]=2;
  5428. _st(set)._add_((21));
  5429. $ctx1.sendIdx["add:"]=3;
  5430. $1=_st(set)._size();
  5431. $ctx1.sendIdx["size"]=1;
  5432. self._assert_equals_($1,(2));
  5433. $ctx1.sendIdx["assert:equals:"]=1;
  5434. _st(set)._add_("hello");
  5435. self._assert_equals_(_st(set)._size(),(2));
  5436. $ctx1.sendIdx["assert:equals:"]=2;
  5437. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5438. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5439. args: [],
  5440. 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')",
  5441. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5442. referencedClasses: ["Set"]
  5443. }),
  5444. smalltalk.SetTest);
  5445. smalltalk.addMethod(
  5446. smalltalk.method({
  5447. selector: "collectionClass",
  5448. protocol: 'fixture',
  5449. fn: function (){
  5450. var self=this;
  5451. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5452. return smalltalk.withContext(function($ctx1) {
  5453. return $Set();
  5454. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5455. args: [],
  5456. source: "collectionClass\x0a\x09^ Set",
  5457. messageSends: [],
  5458. referencedClasses: ["Set"]
  5459. }),
  5460. smalltalk.SetTest.klass);
  5461. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5462. smalltalk.addMethod(
  5463. smalltalk.method({
  5464. selector: "testShow",
  5465. protocol: 'tests',
  5466. fn: function (){
  5467. var self=this;
  5468. var originalTranscript;
  5469. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5470. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5471. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5472. return smalltalk.withContext(function($ctx1) {
  5473. originalTranscript=_st($Transcript())._current();
  5474. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5475. $ctx1.sendIdx["register:"]=1;
  5476. self._shouldnt_raise_((function(){
  5477. return smalltalk.withContext(function($ctx2) {
  5478. return _st($Transcript())._show_("Hello console!");
  5479. $ctx2.sendIdx["show:"]=1;
  5480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5481. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5482. self._shouldnt_raise_((function(){
  5483. return smalltalk.withContext(function($ctx2) {
  5484. return _st($Transcript())._show_(console);
  5485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5486. _st($Transcript())._register_(originalTranscript);
  5487. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5488. args: [],
  5489. 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.",
  5490. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5491. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5492. }),
  5493. smalltalk.ConsoleTranscriptTest);
  5494. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5495. smalltalk.addMethod(
  5496. smalltalk.method({
  5497. selector: "jsObject",
  5498. protocol: 'accessing',
  5499. fn: function (){
  5500. var self=this;
  5501. return smalltalk.withContext(function($ctx1) {
  5502. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5503. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5504. args: [],
  5505. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5506. messageSends: [],
  5507. referencedClasses: []
  5508. }),
  5509. smalltalk.JSObjectProxyTest);
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "testAtIfAbsent",
  5513. protocol: 'tests',
  5514. fn: function (){
  5515. var self=this;
  5516. var testObject;
  5517. return smalltalk.withContext(function($ctx1) {
  5518. var $1,$2,$3;
  5519. testObject=self._jsObject();
  5520. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5521. return smalltalk.withContext(function($ctx2) {
  5522. return "Property does not exist";
  5523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5524. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5525. self._assert_equals_($1,"Property does not exist");
  5526. $ctx1.sendIdx["assert:equals:"]=1;
  5527. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5528. return smalltalk.withContext(function($ctx2) {
  5529. return "Property does not exist";
  5530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5531. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5532. self._assert_equals_($2,nil);
  5533. $ctx1.sendIdx["assert:equals:"]=2;
  5534. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5535. return smalltalk.withContext(function($ctx2) {
  5536. return "Property does not exist";
  5537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5538. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5539. self._assert_equals_($3,(1));
  5540. $ctx1.sendIdx["assert:equals:"]=3;
  5541. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5542. return smalltalk.withContext(function($ctx2) {
  5543. return "Property does not exist";
  5544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5545. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5546. args: [],
  5547. 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.",
  5548. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5549. referencedClasses: []
  5550. }),
  5551. smalltalk.JSObjectProxyTest);
  5552. smalltalk.addMethod(
  5553. smalltalk.method({
  5554. selector: "testAtIfPresent",
  5555. protocol: 'tests',
  5556. fn: function (){
  5557. var self=this;
  5558. var testObject;
  5559. return smalltalk.withContext(function($ctx1) {
  5560. var $2,$1,$4,$3,$6,$5;
  5561. testObject=self._jsObject();
  5562. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. $2=_st(x)._asString();
  5565. $ctx2.sendIdx["asString"]=1;
  5566. return "hello ".__comma($2);
  5567. $ctx2.sendIdx[","]=1;
  5568. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5569. $ctx1.sendIdx["at:ifPresent:"]=1;
  5570. self._assert_equals_($1,nil);
  5571. $ctx1.sendIdx["assert:equals:"]=1;
  5572. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5573. return smalltalk.withContext(function($ctx2) {
  5574. $4=_st(x)._asString();
  5575. $ctx2.sendIdx["asString"]=2;
  5576. return "hello ".__comma($4);
  5577. $ctx2.sendIdx[","]=2;
  5578. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5579. $ctx1.sendIdx["at:ifPresent:"]=2;
  5580. self._assert_equals_($3,"hello nil");
  5581. $ctx1.sendIdx["assert:equals:"]=2;
  5582. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5583. return smalltalk.withContext(function($ctx2) {
  5584. $6=_st(x)._asString();
  5585. $ctx2.sendIdx["asString"]=3;
  5586. return "hello ".__comma($6);
  5587. $ctx2.sendIdx[","]=3;
  5588. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5589. $ctx1.sendIdx["at:ifPresent:"]=3;
  5590. self._assert_equals_($5,"hello 1");
  5591. $ctx1.sendIdx["assert:equals:"]=3;
  5592. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5593. return smalltalk.withContext(function($ctx2) {
  5594. return "hello ".__comma(_st(x)._asString());
  5595. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5596. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5597. args: [],
  5598. 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'.",
  5599. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5600. referencedClasses: []
  5601. }),
  5602. smalltalk.JSObjectProxyTest);
  5603. smalltalk.addMethod(
  5604. smalltalk.method({
  5605. selector: "testAtIfPresentIfAbsent",
  5606. protocol: 'tests',
  5607. fn: function (){
  5608. var self=this;
  5609. var testObject;
  5610. return smalltalk.withContext(function($ctx1) {
  5611. var $2,$1,$4,$3,$6,$5;
  5612. testObject=self._jsObject();
  5613. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5614. return smalltalk.withContext(function($ctx2) {
  5615. $2=_st(x)._asString();
  5616. $ctx2.sendIdx["asString"]=1;
  5617. return "hello ".__comma($2);
  5618. $ctx2.sendIdx[","]=1;
  5619. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5620. return smalltalk.withContext(function($ctx2) {
  5621. return "not present";
  5622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5623. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5624. self._assert_equals_($1,"not present");
  5625. $ctx1.sendIdx["assert:equals:"]=1;
  5626. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5627. return smalltalk.withContext(function($ctx2) {
  5628. $4=_st(x)._asString();
  5629. $ctx2.sendIdx["asString"]=2;
  5630. return "hello ".__comma($4);
  5631. $ctx2.sendIdx[","]=2;
  5632. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5633. return smalltalk.withContext(function($ctx2) {
  5634. return "not present";
  5635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5636. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5637. self._assert_equals_($3,"hello nil");
  5638. $ctx1.sendIdx["assert:equals:"]=2;
  5639. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5640. return smalltalk.withContext(function($ctx2) {
  5641. $6=_st(x)._asString();
  5642. $ctx2.sendIdx["asString"]=3;
  5643. return "hello ".__comma($6);
  5644. $ctx2.sendIdx[","]=3;
  5645. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5646. return smalltalk.withContext(function($ctx2) {
  5647. return "not present";
  5648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5649. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5650. self._assert_equals_($5,"hello 1");
  5651. $ctx1.sendIdx["assert:equals:"]=3;
  5652. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5653. return smalltalk.withContext(function($ctx2) {
  5654. return "hello ".__comma(_st(x)._asString());
  5655. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5656. return smalltalk.withContext(function($ctx2) {
  5657. return "not present";
  5658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5659. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5660. args: [],
  5661. 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'.",
  5662. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5663. referencedClasses: []
  5664. }),
  5665. smalltalk.JSObjectProxyTest);
  5666. smalltalk.addMethod(
  5667. smalltalk.method({
  5668. selector: "testAtPut",
  5669. protocol: 'tests',
  5670. fn: function (){
  5671. var self=this;
  5672. var testObject;
  5673. return smalltalk.withContext(function($ctx1) {
  5674. var $2,$1;
  5675. testObject=self._jsObject();
  5676. $2=_st(testObject)._at_("abc");
  5677. $ctx1.sendIdx["at:"]=1;
  5678. $1=_st($2).__tild_eq("xyz");
  5679. self._assert_($1);
  5680. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5681. $ctx1.sendIdx["assert:equals:"]=1;
  5682. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5683. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5684. args: [],
  5685. 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'",
  5686. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5687. referencedClasses: []
  5688. }),
  5689. smalltalk.JSObjectProxyTest);
  5690. smalltalk.addMethod(
  5691. smalltalk.method({
  5692. selector: "testDNU",
  5693. protocol: 'tests',
  5694. fn: function (){
  5695. var self=this;
  5696. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5697. return smalltalk.withContext(function($ctx1) {
  5698. self._should_raise_((function(){
  5699. return smalltalk.withContext(function($ctx2) {
  5700. return _st(self._jsObject())._foo();
  5701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5702. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5703. args: [],
  5704. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5705. messageSends: ["should:raise:", "foo", "jsObject"],
  5706. referencedClasses: ["MessageNotUnderstood"]
  5707. }),
  5708. smalltalk.JSObjectProxyTest);
  5709. smalltalk.addMethod(
  5710. smalltalk.method({
  5711. selector: "testMessageSend",
  5712. protocol: 'tests',
  5713. fn: function (){
  5714. var self=this;
  5715. return smalltalk.withContext(function($ctx1) {
  5716. var $2,$1,$4,$3;
  5717. $2=self._jsObject();
  5718. $ctx1.sendIdx["jsObject"]=1;
  5719. $1=_st($2)._a();
  5720. self._assert_equals_($1,(1));
  5721. $ctx1.sendIdx["assert:equals:"]=1;
  5722. $4=self._jsObject();
  5723. $ctx1.sendIdx["jsObject"]=2;
  5724. $3=_st($4)._b();
  5725. self._assert_equals_($3,(2));
  5726. $ctx1.sendIdx["assert:equals:"]=2;
  5727. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5728. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5729. args: [],
  5730. 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",
  5731. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5732. referencedClasses: []
  5733. }),
  5734. smalltalk.JSObjectProxyTest);
  5735. smalltalk.addMethod(
  5736. smalltalk.method({
  5737. selector: "testMethodWithArguments",
  5738. protocol: 'tests',
  5739. fn: function (){
  5740. var self=this;
  5741. return smalltalk.withContext(function($ctx1) {
  5742. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5743. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5744. args: [],
  5745. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5746. messageSends: ["assert:equals:", "c:", "jsObject"],
  5747. referencedClasses: []
  5748. }),
  5749. smalltalk.JSObjectProxyTest);
  5750. smalltalk.addMethod(
  5751. smalltalk.method({
  5752. selector: "testPrinting",
  5753. protocol: 'tests',
  5754. fn: function (){
  5755. var self=this;
  5756. return smalltalk.withContext(function($ctx1) {
  5757. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5758. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5759. args: [],
  5760. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5761. messageSends: ["assert:equals:", "printString", "jsObject"],
  5762. referencedClasses: []
  5763. }),
  5764. smalltalk.JSObjectProxyTest);
  5765. smalltalk.addMethod(
  5766. smalltalk.method({
  5767. selector: "testPropertyThatReturnsEmptyString",
  5768. protocol: 'tests',
  5769. fn: function (){
  5770. var self=this;
  5771. var object;
  5772. return smalltalk.withContext(function($ctx1) {
  5773. var $1;
  5774. object=self._jsObject();
  5775. $1=_st(object)._d();
  5776. $ctx1.sendIdx["d"]=1;
  5777. self._assert_equals_($1,"");
  5778. $ctx1.sendIdx["assert:equals:"]=1;
  5779. _st(object)._d_("hello");
  5780. self._assert_equals_(_st(object)._d(),"hello");
  5781. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5782. args: [],
  5783. 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'",
  5784. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5785. referencedClasses: []
  5786. }),
  5787. smalltalk.JSObjectProxyTest);
  5788. smalltalk.addMethod(
  5789. smalltalk.method({
  5790. selector: "testPropertyThatReturnsUndefined",
  5791. protocol: 'tests',
  5792. fn: function (){
  5793. var self=this;
  5794. var object;
  5795. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5796. return smalltalk.withContext(function($ctx1) {
  5797. object=self._jsObject();
  5798. self._shouldnt_raise_((function(){
  5799. return smalltalk.withContext(function($ctx2) {
  5800. return _st(object)._e();
  5801. $ctx2.sendIdx["e"]=1;
  5802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5803. self._assert_(_st(_st(object)._e())._isNil());
  5804. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5805. args: [],
  5806. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5807. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5808. referencedClasses: ["MessageNotUnderstood"]
  5809. }),
  5810. smalltalk.JSObjectProxyTest);
  5811. smalltalk.addMethod(
  5812. smalltalk.method({
  5813. selector: "testValue",
  5814. protocol: 'tests',
  5815. fn: function (){
  5816. var self=this;
  5817. var testObject;
  5818. return smalltalk.withContext(function($ctx1) {
  5819. testObject=self._jsObject();
  5820. _st(testObject)._at_put_("value","aValue");
  5821. self._assert_equals_(_st(testObject)._value(),"aValue");
  5822. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5823. args: [],
  5824. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5825. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5826. referencedClasses: []
  5827. }),
  5828. smalltalk.JSObjectProxyTest);
  5829. smalltalk.addMethod(
  5830. smalltalk.method({
  5831. selector: "testYourself",
  5832. protocol: 'tests',
  5833. fn: function (){
  5834. var self=this;
  5835. var object;
  5836. return smalltalk.withContext(function($ctx1) {
  5837. var $1,$2;
  5838. $1=self._jsObject();
  5839. _st($1)._d_("test");
  5840. $2=_st($1)._yourself();
  5841. object=$2;
  5842. self._assert_equals_(_st(object)._d(),"test");
  5843. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5844. args: [],
  5845. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5846. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5847. referencedClasses: []
  5848. }),
  5849. smalltalk.JSObjectProxyTest);
  5850. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5851. smalltalk.addMethod(
  5852. smalltalk.method({
  5853. selector: "testCatchingException",
  5854. protocol: 'tests',
  5855. fn: function (){
  5856. var self=this;
  5857. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5858. return smalltalk.withContext(function($ctx1) {
  5859. _st((function(){
  5860. return smalltalk.withContext(function($ctx2) {
  5861. return self._throwException();
  5862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5863. return smalltalk.withContext(function($ctx2) {
  5864. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5865. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5866. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5867. args: [],
  5868. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5869. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5870. referencedClasses: ["Error"]
  5871. }),
  5872. smalltalk.JavaScriptExceptionTest);
  5873. smalltalk.addMethod(
  5874. smalltalk.method({
  5875. selector: "testRaisingException",
  5876. protocol: 'tests',
  5877. fn: function (){
  5878. var self=this;
  5879. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5880. return smalltalk.withContext(function($ctx1) {
  5881. self._should_raise_((function(){
  5882. return smalltalk.withContext(function($ctx2) {
  5883. return self._throwException();
  5884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5885. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5886. args: [],
  5887. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5888. messageSends: ["should:raise:", "throwException"],
  5889. referencedClasses: ["JavaScriptException"]
  5890. }),
  5891. smalltalk.JavaScriptExceptionTest);
  5892. smalltalk.addMethod(
  5893. smalltalk.method({
  5894. selector: "throwException",
  5895. protocol: 'helpers',
  5896. fn: function (){
  5897. var self=this;
  5898. return smalltalk.withContext(function($ctx1) {
  5899. throw 'test';
  5900. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5901. args: [],
  5902. source: "throwException\x0a\x09<throw 'test'>",
  5903. messageSends: [],
  5904. referencedClasses: []
  5905. }),
  5906. smalltalk.JavaScriptExceptionTest);
  5907. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5908. smalltalk.addMethod(
  5909. smalltalk.method({
  5910. selector: "testValue",
  5911. protocol: 'tests',
  5912. fn: function (){
  5913. var self=this;
  5914. var messageSend;
  5915. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5916. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5917. return smalltalk.withContext(function($ctx1) {
  5918. var $1,$2;
  5919. $1=_st($MessageSend())._new();
  5920. $ctx1.sendIdx["new"]=1;
  5921. _st($1)._receiver_(_st($Object())._new());
  5922. _st($1)._selector_("asString");
  5923. $2=_st($1)._yourself();
  5924. messageSend=$2;
  5925. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5926. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5927. args: [],
  5928. 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'",
  5929. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5930. referencedClasses: ["MessageSend", "Object"]
  5931. }),
  5932. smalltalk.MessageSendTest);
  5933. smalltalk.addMethod(
  5934. smalltalk.method({
  5935. selector: "testValueWithArguments",
  5936. protocol: 'tests',
  5937. fn: function (){
  5938. var self=this;
  5939. var messageSend;
  5940. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5941. return smalltalk.withContext(function($ctx1) {
  5942. var $1,$2;
  5943. $1=_st($MessageSend())._new();
  5944. _st($1)._receiver_((2));
  5945. _st($1)._selector_("+");
  5946. $2=_st($1)._yourself();
  5947. messageSend=$2;
  5948. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5949. $ctx1.sendIdx["assert:equals:"]=1;
  5950. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5951. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5952. args: [],
  5953. 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",
  5954. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5955. referencedClasses: ["MessageSend"]
  5956. }),
  5957. smalltalk.MessageSendTest);
  5958. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5959. smalltalk.addMethod(
  5960. smalltalk.method({
  5961. selector: "codeGeneratorClass",
  5962. protocol: 'accessing',
  5963. fn: function (){
  5964. var self=this;
  5965. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5966. return smalltalk.withContext(function($ctx1) {
  5967. return $CodeGenerator();
  5968. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5969. args: [],
  5970. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5971. messageSends: [],
  5972. referencedClasses: ["CodeGenerator"]
  5973. }),
  5974. smalltalk.MethodInheritanceTest);
  5975. smalltalk.addMethod(
  5976. smalltalk.method({
  5977. selector: "compiler",
  5978. protocol: 'factory',
  5979. fn: function (){
  5980. var self=this;
  5981. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5982. return smalltalk.withContext(function($ctx1) {
  5983. var $2,$3,$1;
  5984. $2=_st($Compiler())._new();
  5985. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5986. $3=_st($2)._yourself();
  5987. $1=$3;
  5988. return $1;
  5989. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5990. args: [],
  5991. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5992. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5993. referencedClasses: ["Compiler"]
  5994. }),
  5995. smalltalk.MethodInheritanceTest);
  5996. smalltalk.addMethod(
  5997. smalltalk.method({
  5998. selector: "deinstallBottom",
  5999. protocol: 'testing',
  6000. fn: function (){
  6001. var self=this;
  6002. return smalltalk.withContext(function($ctx1) {
  6003. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6004. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  6005. args: [],
  6006. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6007. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6008. referencedClasses: []
  6009. }),
  6010. smalltalk.MethodInheritanceTest);
  6011. smalltalk.addMethod(
  6012. smalltalk.method({
  6013. selector: "deinstallMiddle",
  6014. protocol: 'testing',
  6015. fn: function (){
  6016. var self=this;
  6017. return smalltalk.withContext(function($ctx1) {
  6018. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6019. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  6020. args: [],
  6021. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6022. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6023. referencedClasses: []
  6024. }),
  6025. smalltalk.MethodInheritanceTest);
  6026. smalltalk.addMethod(
  6027. smalltalk.method({
  6028. selector: "deinstallTop",
  6029. protocol: 'testing',
  6030. fn: function (){
  6031. var self=this;
  6032. return smalltalk.withContext(function($ctx1) {
  6033. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6034. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  6035. args: [],
  6036. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6037. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6038. referencedClasses: []
  6039. }),
  6040. smalltalk.MethodInheritanceTest);
  6041. smalltalk.addMethod(
  6042. smalltalk.method({
  6043. selector: "installBottom:",
  6044. protocol: 'testing',
  6045. fn: function (aString){
  6046. var self=this;
  6047. return smalltalk.withContext(function($ctx1) {
  6048. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6049. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6050. args: ["aString"],
  6051. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6052. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6053. referencedClasses: []
  6054. }),
  6055. smalltalk.MethodInheritanceTest);
  6056. smalltalk.addMethod(
  6057. smalltalk.method({
  6058. selector: "installMiddle:",
  6059. protocol: 'testing',
  6060. fn: function (aString){
  6061. var self=this;
  6062. return smalltalk.withContext(function($ctx1) {
  6063. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6064. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6065. args: ["aString"],
  6066. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6067. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6068. referencedClasses: []
  6069. }),
  6070. smalltalk.MethodInheritanceTest);
  6071. smalltalk.addMethod(
  6072. smalltalk.method({
  6073. selector: "installTop:",
  6074. protocol: 'testing',
  6075. fn: function (aString){
  6076. var self=this;
  6077. return smalltalk.withContext(function($ctx1) {
  6078. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6079. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6080. args: ["aString"],
  6081. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6082. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6083. referencedClasses: []
  6084. }),
  6085. smalltalk.MethodInheritanceTest);
  6086. smalltalk.addMethod(
  6087. smalltalk.method({
  6088. selector: "setUp",
  6089. protocol: 'initialization',
  6090. fn: function (){
  6091. var self=this;
  6092. return smalltalk.withContext(function($ctx1) {
  6093. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6094. $ctx1.sendIdx["new"]=1;
  6095. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6096. $ctx1.sendIdx["new"]=2;
  6097. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6098. self["@method"]=nil;
  6099. self["@performBlock"]=(function(){
  6100. return smalltalk.withContext(function($ctx2) {
  6101. return self._error_("performBlock not initialized");
  6102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6103. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  6104. args: [],
  6105. 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' ]",
  6106. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6107. referencedClasses: []
  6108. }),
  6109. smalltalk.MethodInheritanceTest);
  6110. smalltalk.addMethod(
  6111. smalltalk.method({
  6112. selector: "shouldMNU",
  6113. protocol: 'testing',
  6114. fn: function (){
  6115. var self=this;
  6116. return smalltalk.withContext(function($ctx1) {
  6117. self._shouldMNUTop();
  6118. self._shouldMNUMiddle();
  6119. self._shouldMNUBottom();
  6120. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6121. args: [],
  6122. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6123. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6124. referencedClasses: []
  6125. }),
  6126. smalltalk.MethodInheritanceTest);
  6127. smalltalk.addMethod(
  6128. smalltalk.method({
  6129. selector: "shouldMNUBottom",
  6130. protocol: 'testing',
  6131. fn: function (){
  6132. var self=this;
  6133. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6134. return smalltalk.withContext(function($ctx1) {
  6135. self._should_raise_((function(){
  6136. return smalltalk.withContext(function($ctx2) {
  6137. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6139. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6140. args: [],
  6141. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6142. messageSends: ["should:raise:", "value:"],
  6143. referencedClasses: ["MessageNotUnderstood"]
  6144. }),
  6145. smalltalk.MethodInheritanceTest);
  6146. smalltalk.addMethod(
  6147. smalltalk.method({
  6148. selector: "shouldMNUMiddle",
  6149. protocol: 'testing',
  6150. fn: function (){
  6151. var self=this;
  6152. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6153. return smalltalk.withContext(function($ctx1) {
  6154. self._should_raise_((function(){
  6155. return smalltalk.withContext(function($ctx2) {
  6156. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6158. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6159. args: [],
  6160. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6161. messageSends: ["should:raise:", "value:"],
  6162. referencedClasses: ["MessageNotUnderstood"]
  6163. }),
  6164. smalltalk.MethodInheritanceTest);
  6165. smalltalk.addMethod(
  6166. smalltalk.method({
  6167. selector: "shouldMNUTop",
  6168. protocol: 'testing',
  6169. fn: function (){
  6170. var self=this;
  6171. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6172. return smalltalk.withContext(function($ctx1) {
  6173. self._should_raise_((function(){
  6174. return smalltalk.withContext(function($ctx2) {
  6175. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6177. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6178. args: [],
  6179. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6180. messageSends: ["should:raise:", "value:"],
  6181. referencedClasses: ["MessageNotUnderstood"]
  6182. }),
  6183. smalltalk.MethodInheritanceTest);
  6184. smalltalk.addMethod(
  6185. smalltalk.method({
  6186. selector: "shouldReturn:",
  6187. protocol: 'testing',
  6188. fn: function (anObject){
  6189. var self=this;
  6190. var result;
  6191. return smalltalk.withContext(function($ctx1) {
  6192. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6193. $ctx1.sendIdx["value:"]=1;
  6194. self._assert_equals_(["top",anObject],["top",result]);
  6195. $ctx1.sendIdx["assert:equals:"]=1;
  6196. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6197. $ctx1.sendIdx["value:"]=2;
  6198. self._assert_equals_(["middle",anObject],["middle",result]);
  6199. $ctx1.sendIdx["assert:equals:"]=2;
  6200. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6201. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6202. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6203. args: ["anObject"],
  6204. 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 }",
  6205. messageSends: ["value:", "assert:equals:"],
  6206. referencedClasses: []
  6207. }),
  6208. smalltalk.MethodInheritanceTest);
  6209. smalltalk.addMethod(
  6210. smalltalk.method({
  6211. selector: "shouldReturn:and:and:",
  6212. protocol: 'testing',
  6213. fn: function (anObject,anObject2,anObject3){
  6214. var self=this;
  6215. var result;
  6216. return smalltalk.withContext(function($ctx1) {
  6217. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6218. $ctx1.sendIdx["value:"]=1;
  6219. self._assert_equals_(["top",anObject],["top",result]);
  6220. $ctx1.sendIdx["assert:equals:"]=1;
  6221. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6222. $ctx1.sendIdx["value:"]=2;
  6223. self._assert_equals_(["middle",anObject2],["middle",result]);
  6224. $ctx1.sendIdx["assert:equals:"]=2;
  6225. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6226. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6227. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6228. args: ["anObject", "anObject2", "anObject3"],
  6229. 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 }",
  6230. messageSends: ["value:", "assert:equals:"],
  6231. referencedClasses: []
  6232. }),
  6233. smalltalk.MethodInheritanceTest);
  6234. smalltalk.addMethod(
  6235. smalltalk.method({
  6236. selector: "targetClassBottom",
  6237. protocol: 'accessing',
  6238. fn: function (){
  6239. var self=this;
  6240. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6241. return smalltalk.withContext(function($ctx1) {
  6242. return $JavaScriptException();
  6243. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6244. args: [],
  6245. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6246. messageSends: [],
  6247. referencedClasses: ["JavaScriptException"]
  6248. }),
  6249. smalltalk.MethodInheritanceTest);
  6250. smalltalk.addMethod(
  6251. smalltalk.method({
  6252. selector: "targetClassMiddle",
  6253. protocol: 'accessing',
  6254. fn: function (){
  6255. var self=this;
  6256. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6257. return smalltalk.withContext(function($ctx1) {
  6258. return $Error();
  6259. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6260. args: [],
  6261. source: "targetClassMiddle\x0a\x09^ Error",
  6262. messageSends: [],
  6263. referencedClasses: ["Error"]
  6264. }),
  6265. smalltalk.MethodInheritanceTest);
  6266. smalltalk.addMethod(
  6267. smalltalk.method({
  6268. selector: "targetClassTop",
  6269. protocol: 'accessing',
  6270. fn: function (){
  6271. var self=this;
  6272. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6273. return smalltalk.withContext(function($ctx1) {
  6274. return $Object();
  6275. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6276. args: [],
  6277. source: "targetClassTop\x0a\x09^ Object",
  6278. messageSends: [],
  6279. referencedClasses: ["Object"]
  6280. }),
  6281. smalltalk.MethodInheritanceTest);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "tearDown",
  6285. protocol: 'initialization',
  6286. fn: function (){
  6287. var self=this;
  6288. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6289. return smalltalk.withContext(function($ctx1) {
  6290. _st((function(){
  6291. return smalltalk.withContext(function($ctx2) {
  6292. return self._deinstallTop();
  6293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6294. return smalltalk.withContext(function($ctx2) {
  6295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6296. $ctx1.sendIdx["on:do:"]=1;
  6297. _st((function(){
  6298. return smalltalk.withContext(function($ctx2) {
  6299. return self._deinstallMiddle();
  6300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6301. return smalltalk.withContext(function($ctx2) {
  6302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6303. $ctx1.sendIdx["on:do:"]=2;
  6304. _st((function(){
  6305. return smalltalk.withContext(function($ctx2) {
  6306. return self._deinstallBottom();
  6307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6308. return smalltalk.withContext(function($ctx2) {
  6309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6310. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6311. args: [],
  6312. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6313. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6314. referencedClasses: ["Error"]
  6315. }),
  6316. smalltalk.MethodInheritanceTest);
  6317. smalltalk.addMethod(
  6318. smalltalk.method({
  6319. selector: "testMNU11",
  6320. protocol: 'tests',
  6321. fn: function (){
  6322. var self=this;
  6323. return smalltalk.withContext(function($ctx1) {
  6324. self["@performBlock"]=(function(x){
  6325. return smalltalk.withContext(function($ctx2) {
  6326. return _st(x)._foo();
  6327. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6328. self._shouldMNU();
  6329. $ctx1.sendIdx["shouldMNU"]=1;
  6330. self._installTop_("foo ^ false");
  6331. $ctx1.sendIdx["installTop:"]=1;
  6332. self._installTop_("foo ^ true");
  6333. self._deinstallTop();
  6334. self._shouldMNU();
  6335. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6336. args: [],
  6337. 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",
  6338. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6339. referencedClasses: []
  6340. }),
  6341. smalltalk.MethodInheritanceTest);
  6342. smalltalk.addMethod(
  6343. smalltalk.method({
  6344. selector: "testMNU22",
  6345. protocol: 'tests',
  6346. fn: function (){
  6347. var self=this;
  6348. return smalltalk.withContext(function($ctx1) {
  6349. self["@performBlock"]=(function(x){
  6350. return smalltalk.withContext(function($ctx2) {
  6351. return _st(x)._foo();
  6352. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6353. self._shouldMNU();
  6354. $ctx1.sendIdx["shouldMNU"]=1;
  6355. self._installMiddle_("foo ^ false");
  6356. $ctx1.sendIdx["installMiddle:"]=1;
  6357. self._installMiddle_("foo ^ true");
  6358. self._deinstallMiddle();
  6359. self._shouldMNU();
  6360. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6361. args: [],
  6362. 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",
  6363. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6364. referencedClasses: []
  6365. }),
  6366. smalltalk.MethodInheritanceTest);
  6367. smalltalk.addMethod(
  6368. smalltalk.method({
  6369. selector: "testReturns1",
  6370. protocol: 'tests',
  6371. fn: function (){
  6372. var self=this;
  6373. return smalltalk.withContext(function($ctx1) {
  6374. self["@performBlock"]=(function(x){
  6375. return smalltalk.withContext(function($ctx2) {
  6376. return _st(x)._foo();
  6377. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6378. self._installTop_("foo ^ false");
  6379. $ctx1.sendIdx["installTop:"]=1;
  6380. self._shouldReturn_(false);
  6381. $ctx1.sendIdx["shouldReturn:"]=1;
  6382. self._installTop_("foo ^ true");
  6383. self._shouldReturn_(true);
  6384. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6385. args: [],
  6386. 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",
  6387. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6388. referencedClasses: []
  6389. }),
  6390. smalltalk.MethodInheritanceTest);
  6391. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6392. smalltalk.addMethod(
  6393. smalltalk.method({
  6394. selector: "testAbs",
  6395. protocol: 'tests',
  6396. fn: function (){
  6397. var self=this;
  6398. return smalltalk.withContext(function($ctx1) {
  6399. var $1;
  6400. $1=(4)._abs();
  6401. $ctx1.sendIdx["abs"]=1;
  6402. self._assert_equals_($1,(4));
  6403. $ctx1.sendIdx["assert:equals:"]=1;
  6404. self._assert_equals_((-4)._abs(),(4));
  6405. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6406. args: [],
  6407. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6408. messageSends: ["assert:equals:", "abs"],
  6409. referencedClasses: []
  6410. }),
  6411. smalltalk.NumberTest);
  6412. smalltalk.addMethod(
  6413. smalltalk.method({
  6414. selector: "testArithmetic",
  6415. protocol: 'tests',
  6416. fn: function (){
  6417. var self=this;
  6418. return smalltalk.withContext(function($ctx1) {
  6419. var $1,$2,$3,$5,$4;
  6420. $1=(1.5).__plus((1));
  6421. $ctx1.sendIdx["+"]=1;
  6422. self._assert_equals_($1,(2.5));
  6423. $ctx1.sendIdx["assert:equals:"]=1;
  6424. $2=(2).__minus((1));
  6425. $ctx1.sendIdx["-"]=1;
  6426. self._assert_equals_($2,(1));
  6427. $ctx1.sendIdx["assert:equals:"]=2;
  6428. self._assert_equals_((-2).__minus((1)),(-3));
  6429. $ctx1.sendIdx["assert:equals:"]=3;
  6430. self._assert_equals_((12).__slash((2)),(6));
  6431. $ctx1.sendIdx["assert:equals:"]=4;
  6432. $3=(3).__star((4));
  6433. $ctx1.sendIdx["*"]=1;
  6434. self._assert_equals_($3,(12));
  6435. $ctx1.sendIdx["assert:equals:"]=5;
  6436. self._assert_equals_((7).__slash_slash((2)),(3));
  6437. $ctx1.sendIdx["assert:equals:"]=6;
  6438. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6439. $ctx1.sendIdx["assert:equals:"]=7;
  6440. $5=(1).__plus((2));
  6441. $ctx1.sendIdx["+"]=2;
  6442. $4=_st($5).__star((3));
  6443. $ctx1.sendIdx["*"]=2;
  6444. self._assert_equals_($4,(9));
  6445. $ctx1.sendIdx["assert:equals:"]=8;
  6446. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6447. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6448. args: [],
  6449. 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",
  6450. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6451. referencedClasses: []
  6452. }),
  6453. smalltalk.NumberTest);
  6454. smalltalk.addMethod(
  6455. smalltalk.method({
  6456. selector: "testAsNumber",
  6457. protocol: 'tests',
  6458. fn: function (){
  6459. var self=this;
  6460. return smalltalk.withContext(function($ctx1) {
  6461. self._assert_equals_((3)._asNumber(),(3));
  6462. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6463. args: [],
  6464. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6465. messageSends: ["assert:equals:", "asNumber"],
  6466. referencedClasses: []
  6467. }),
  6468. smalltalk.NumberTest);
  6469. smalltalk.addMethod(
  6470. smalltalk.method({
  6471. selector: "testCeiling",
  6472. protocol: 'tests',
  6473. fn: function (){
  6474. var self=this;
  6475. return smalltalk.withContext(function($ctx1) {
  6476. var $1,$2;
  6477. $1=(1.2)._ceiling();
  6478. $ctx1.sendIdx["ceiling"]=1;
  6479. self._assert_equals_($1,(2));
  6480. $ctx1.sendIdx["assert:equals:"]=1;
  6481. $2=(-1.2)._ceiling();
  6482. $ctx1.sendIdx["ceiling"]=2;
  6483. self._assert_equals_($2,(-1));
  6484. $ctx1.sendIdx["assert:equals:"]=2;
  6485. self._assert_equals_((1)._ceiling(),(1));
  6486. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6487. args: [],
  6488. 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.",
  6489. messageSends: ["assert:equals:", "ceiling"],
  6490. referencedClasses: []
  6491. }),
  6492. smalltalk.NumberTest);
  6493. smalltalk.addMethod(
  6494. smalltalk.method({
  6495. selector: "testComparison",
  6496. protocol: 'tests',
  6497. fn: function (){
  6498. var self=this;
  6499. return smalltalk.withContext(function($ctx1) {
  6500. var $1,$2,$3,$4;
  6501. $1=(3).__gt((2));
  6502. $ctx1.sendIdx[">"]=1;
  6503. self._assert_($1);
  6504. $ctx1.sendIdx["assert:"]=1;
  6505. $2=(2).__lt((3));
  6506. $ctx1.sendIdx["<"]=1;
  6507. self._assert_($2);
  6508. $ctx1.sendIdx["assert:"]=2;
  6509. self._deny_((3).__lt((2)));
  6510. $ctx1.sendIdx["deny:"]=1;
  6511. self._deny_((2).__gt((3)));
  6512. $3=(3).__gt_eq((3));
  6513. $ctx1.sendIdx[">="]=1;
  6514. self._assert_($3);
  6515. $ctx1.sendIdx["assert:"]=3;
  6516. self._assert_((3.1).__gt_eq((3)));
  6517. $ctx1.sendIdx["assert:"]=4;
  6518. $4=(3).__lt_eq((3));
  6519. $ctx1.sendIdx["<="]=1;
  6520. self._assert_($4);
  6521. $ctx1.sendIdx["assert:"]=5;
  6522. self._assert_((3).__lt_eq((3.1)));
  6523. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6524. args: [],
  6525. 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",
  6526. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6527. referencedClasses: []
  6528. }),
  6529. smalltalk.NumberTest);
  6530. smalltalk.addMethod(
  6531. smalltalk.method({
  6532. selector: "testCopying",
  6533. protocol: 'tests',
  6534. fn: function (){
  6535. var self=this;
  6536. return smalltalk.withContext(function($ctx1) {
  6537. var $1;
  6538. $1=_st((1)._copy()).__eq_eq((1));
  6539. $ctx1.sendIdx["=="]=1;
  6540. self._assert_($1);
  6541. $ctx1.sendIdx["assert:"]=1;
  6542. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6543. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6544. args: [],
  6545. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6546. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6547. referencedClasses: []
  6548. }),
  6549. smalltalk.NumberTest);
  6550. smalltalk.addMethod(
  6551. smalltalk.method({
  6552. selector: "testEquality",
  6553. protocol: 'tests',
  6554. fn: function (){
  6555. var self=this;
  6556. return smalltalk.withContext(function($ctx1) {
  6557. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6558. $1=(1).__eq((1));
  6559. $ctx1.sendIdx["="]=1;
  6560. self._assert_($1);
  6561. $ctx1.sendIdx["assert:"]=1;
  6562. $2=(0).__eq((0));
  6563. $ctx1.sendIdx["="]=2;
  6564. self._assert_($2);
  6565. $ctx1.sendIdx["assert:"]=2;
  6566. $3=(1).__eq((0));
  6567. $ctx1.sendIdx["="]=3;
  6568. self._deny_($3);
  6569. $ctx1.sendIdx["deny:"]=1;
  6570. $5=(1)._yourself();
  6571. $ctx1.sendIdx["yourself"]=1;
  6572. $4=_st($5).__eq((1));
  6573. $ctx1.sendIdx["="]=4;
  6574. self._assert_($4);
  6575. $ctx1.sendIdx["assert:"]=3;
  6576. $7=(1)._yourself();
  6577. $ctx1.sendIdx["yourself"]=2;
  6578. $6=(1).__eq($7);
  6579. $ctx1.sendIdx["="]=5;
  6580. self._assert_($6);
  6581. $ctx1.sendIdx["assert:"]=4;
  6582. $9=(1)._yourself();
  6583. $ctx1.sendIdx["yourself"]=3;
  6584. $8=_st($9).__eq((1)._yourself());
  6585. $ctx1.sendIdx["="]=6;
  6586. self._assert_($8);
  6587. $10=(0).__eq(false);
  6588. $ctx1.sendIdx["="]=7;
  6589. self._deny_($10);
  6590. $ctx1.sendIdx["deny:"]=2;
  6591. $11=false.__eq((0));
  6592. $ctx1.sendIdx["="]=8;
  6593. self._deny_($11);
  6594. $ctx1.sendIdx["deny:"]=3;
  6595. $12="".__eq((0));
  6596. $ctx1.sendIdx["="]=9;
  6597. self._deny_($12);
  6598. $ctx1.sendIdx["deny:"]=4;
  6599. self._deny_((0).__eq(""));
  6600. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6601. args: [],
  6602. 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 = ''",
  6603. messageSends: ["assert:", "=", "deny:", "yourself"],
  6604. referencedClasses: []
  6605. }),
  6606. smalltalk.NumberTest);
  6607. smalltalk.addMethod(
  6608. smalltalk.method({
  6609. selector: "testFloor",
  6610. protocol: 'tests',
  6611. fn: function (){
  6612. var self=this;
  6613. return smalltalk.withContext(function($ctx1) {
  6614. var $1,$2;
  6615. $1=(1.2)._floor();
  6616. $ctx1.sendIdx["floor"]=1;
  6617. self._assert_equals_($1,(1));
  6618. $ctx1.sendIdx["assert:equals:"]=1;
  6619. $2=(-1.2)._floor();
  6620. $ctx1.sendIdx["floor"]=2;
  6621. self._assert_equals_($2,(-2));
  6622. $ctx1.sendIdx["assert:equals:"]=2;
  6623. self._assert_equals_((1)._floor(),(1));
  6624. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6625. args: [],
  6626. 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.",
  6627. messageSends: ["assert:equals:", "floor"],
  6628. referencedClasses: []
  6629. }),
  6630. smalltalk.NumberTest);
  6631. smalltalk.addMethod(
  6632. smalltalk.method({
  6633. selector: "testHexNumbers",
  6634. protocol: 'tests',
  6635. fn: function (){
  6636. var self=this;
  6637. return smalltalk.withContext(function($ctx1) {
  6638. var $1,$2,$3,$4,$5;
  6639. self._assert_equals_((9),(9));
  6640. $ctx1.sendIdx["assert:equals:"]=1;
  6641. $1=(10)._truncated();
  6642. $ctx1.sendIdx["truncated"]=1;
  6643. self._assert_equals_($1,(10));
  6644. $ctx1.sendIdx["assert:equals:"]=2;
  6645. $2=(11)._truncated();
  6646. $ctx1.sendIdx["truncated"]=2;
  6647. self._assert_equals_($2,(11));
  6648. $ctx1.sendIdx["assert:equals:"]=3;
  6649. $3=(12)._truncated();
  6650. $ctx1.sendIdx["truncated"]=3;
  6651. self._assert_equals_($3,(12));
  6652. $ctx1.sendIdx["assert:equals:"]=4;
  6653. $4=(13)._truncated();
  6654. $ctx1.sendIdx["truncated"]=4;
  6655. self._assert_equals_($4,(13));
  6656. $ctx1.sendIdx["assert:equals:"]=5;
  6657. $5=(14)._truncated();
  6658. $ctx1.sendIdx["truncated"]=5;
  6659. self._assert_equals_($5,(14));
  6660. $ctx1.sendIdx["assert:equals:"]=6;
  6661. self._assert_equals_((15)._truncated(),(15));
  6662. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6663. args: [],
  6664. 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",
  6665. messageSends: ["assert:equals:", "truncated"],
  6666. referencedClasses: []
  6667. }),
  6668. smalltalk.NumberTest);
  6669. smalltalk.addMethod(
  6670. smalltalk.method({
  6671. selector: "testIdentity",
  6672. protocol: 'tests',
  6673. fn: function (){
  6674. var self=this;
  6675. return smalltalk.withContext(function($ctx1) {
  6676. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6677. $1=(1).__eq_eq((1));
  6678. $ctx1.sendIdx["=="]=1;
  6679. self._assert_($1);
  6680. $ctx1.sendIdx["assert:"]=1;
  6681. $2=(0).__eq_eq((0));
  6682. $ctx1.sendIdx["=="]=2;
  6683. self._assert_($2);
  6684. $ctx1.sendIdx["assert:"]=2;
  6685. $3=(1).__eq_eq((0));
  6686. $ctx1.sendIdx["=="]=3;
  6687. self._deny_($3);
  6688. $ctx1.sendIdx["deny:"]=1;
  6689. $5=(1)._yourself();
  6690. $ctx1.sendIdx["yourself"]=1;
  6691. $4=_st($5).__eq_eq((1));
  6692. $ctx1.sendIdx["=="]=4;
  6693. self._assert_($4);
  6694. $ctx1.sendIdx["assert:"]=3;
  6695. $7=(1)._yourself();
  6696. $ctx1.sendIdx["yourself"]=2;
  6697. $6=(1).__eq_eq($7);
  6698. $ctx1.sendIdx["=="]=5;
  6699. self._assert_($6);
  6700. $ctx1.sendIdx["assert:"]=4;
  6701. $9=(1)._yourself();
  6702. $ctx1.sendIdx["yourself"]=3;
  6703. $8=_st($9).__eq_eq((1)._yourself());
  6704. $ctx1.sendIdx["=="]=6;
  6705. self._assert_($8);
  6706. self._deny_((1).__eq_eq((2)));
  6707. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6708. args: [],
  6709. 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",
  6710. messageSends: ["assert:", "==", "deny:", "yourself"],
  6711. referencedClasses: []
  6712. }),
  6713. smalltalk.NumberTest);
  6714. smalltalk.addMethod(
  6715. smalltalk.method({
  6716. selector: "testInvalidHexNumbers",
  6717. protocol: 'tests',
  6718. fn: function (){
  6719. var self=this;
  6720. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6721. return smalltalk.withContext(function($ctx1) {
  6722. self._should_raise_((function(){
  6723. return smalltalk.withContext(function($ctx2) {
  6724. return (16)._rG();
  6725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6726. $ctx1.sendIdx["should:raise:"]=1;
  6727. self._should_raise_((function(){
  6728. return smalltalk.withContext(function($ctx2) {
  6729. return (16)._rg();
  6730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6731. $ctx1.sendIdx["should:raise:"]=2;
  6732. self._should_raise_((function(){
  6733. return smalltalk.withContext(function($ctx2) {
  6734. return (16)._rH();
  6735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6736. $ctx1.sendIdx["should:raise:"]=3;
  6737. self._should_raise_((function(){
  6738. return smalltalk.withContext(function($ctx2) {
  6739. return (16)._rh();
  6740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6741. $ctx1.sendIdx["should:raise:"]=4;
  6742. self._should_raise_((function(){
  6743. return smalltalk.withContext(function($ctx2) {
  6744. return (16)._rI();
  6745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6746. $ctx1.sendIdx["should:raise:"]=5;
  6747. self._should_raise_((function(){
  6748. return smalltalk.withContext(function($ctx2) {
  6749. return (16)._ri();
  6750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6751. $ctx1.sendIdx["should:raise:"]=6;
  6752. self._should_raise_((function(){
  6753. return smalltalk.withContext(function($ctx2) {
  6754. return (16)._rJ();
  6755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6756. $ctx1.sendIdx["should:raise:"]=7;
  6757. self._should_raise_((function(){
  6758. return smalltalk.withContext(function($ctx2) {
  6759. return (16)._rj();
  6760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6761. $ctx1.sendIdx["should:raise:"]=8;
  6762. self._should_raise_((function(){
  6763. return smalltalk.withContext(function($ctx2) {
  6764. return (16)._rK();
  6765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6766. $ctx1.sendIdx["should:raise:"]=9;
  6767. self._should_raise_((function(){
  6768. return smalltalk.withContext(function($ctx2) {
  6769. return (16)._rk();
  6770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6771. $ctx1.sendIdx["should:raise:"]=10;
  6772. self._should_raise_((function(){
  6773. return smalltalk.withContext(function($ctx2) {
  6774. return (16)._rL();
  6775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6776. $ctx1.sendIdx["should:raise:"]=11;
  6777. self._should_raise_((function(){
  6778. return smalltalk.withContext(function($ctx2) {
  6779. return (16)._rl();
  6780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6781. $ctx1.sendIdx["should:raise:"]=12;
  6782. self._should_raise_((function(){
  6783. return smalltalk.withContext(function($ctx2) {
  6784. return (16)._rM();
  6785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6786. $ctx1.sendIdx["should:raise:"]=13;
  6787. self._should_raise_((function(){
  6788. return smalltalk.withContext(function($ctx2) {
  6789. return (16)._rm();
  6790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6791. $ctx1.sendIdx["should:raise:"]=14;
  6792. self._should_raise_((function(){
  6793. return smalltalk.withContext(function($ctx2) {
  6794. return (16)._rN();
  6795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6796. $ctx1.sendIdx["should:raise:"]=15;
  6797. self._should_raise_((function(){
  6798. return smalltalk.withContext(function($ctx2) {
  6799. return (16)._rn();
  6800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6801. $ctx1.sendIdx["should:raise:"]=16;
  6802. self._should_raise_((function(){
  6803. return smalltalk.withContext(function($ctx2) {
  6804. return (16)._rO();
  6805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6806. $ctx1.sendIdx["should:raise:"]=17;
  6807. self._should_raise_((function(){
  6808. return smalltalk.withContext(function($ctx2) {
  6809. return (16)._ro();
  6810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6811. $ctx1.sendIdx["should:raise:"]=18;
  6812. self._should_raise_((function(){
  6813. return smalltalk.withContext(function($ctx2) {
  6814. return (16)._rP();
  6815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6816. $ctx1.sendIdx["should:raise:"]=19;
  6817. self._should_raise_((function(){
  6818. return smalltalk.withContext(function($ctx2) {
  6819. return (16)._rp();
  6820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6821. $ctx1.sendIdx["should:raise:"]=20;
  6822. self._should_raise_((function(){
  6823. return smalltalk.withContext(function($ctx2) {
  6824. return (16)._rQ();
  6825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6826. $ctx1.sendIdx["should:raise:"]=21;
  6827. self._should_raise_((function(){
  6828. return smalltalk.withContext(function($ctx2) {
  6829. return (16)._rq();
  6830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6831. $ctx1.sendIdx["should:raise:"]=22;
  6832. self._should_raise_((function(){
  6833. return smalltalk.withContext(function($ctx2) {
  6834. return (16)._rR();
  6835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6836. $ctx1.sendIdx["should:raise:"]=23;
  6837. self._should_raise_((function(){
  6838. return smalltalk.withContext(function($ctx2) {
  6839. return (16)._rr();
  6840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6841. $ctx1.sendIdx["should:raise:"]=24;
  6842. self._should_raise_((function(){
  6843. return smalltalk.withContext(function($ctx2) {
  6844. return (16)._rS();
  6845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6846. $ctx1.sendIdx["should:raise:"]=25;
  6847. self._should_raise_((function(){
  6848. return smalltalk.withContext(function($ctx2) {
  6849. return (16)._rs();
  6850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6851. $ctx1.sendIdx["should:raise:"]=26;
  6852. self._should_raise_((function(){
  6853. return smalltalk.withContext(function($ctx2) {
  6854. return (16)._rT();
  6855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6856. $ctx1.sendIdx["should:raise:"]=27;
  6857. self._should_raise_((function(){
  6858. return smalltalk.withContext(function($ctx2) {
  6859. return (16)._rt();
  6860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6861. $ctx1.sendIdx["should:raise:"]=28;
  6862. self._should_raise_((function(){
  6863. return smalltalk.withContext(function($ctx2) {
  6864. return (16)._rU();
  6865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6866. $ctx1.sendIdx["should:raise:"]=29;
  6867. self._should_raise_((function(){
  6868. return smalltalk.withContext(function($ctx2) {
  6869. return (16)._ru();
  6870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6871. $ctx1.sendIdx["should:raise:"]=30;
  6872. self._should_raise_((function(){
  6873. return smalltalk.withContext(function($ctx2) {
  6874. return (16)._rV();
  6875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6876. $ctx1.sendIdx["should:raise:"]=31;
  6877. self._should_raise_((function(){
  6878. return smalltalk.withContext(function($ctx2) {
  6879. return (16)._rv();
  6880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6881. $ctx1.sendIdx["should:raise:"]=32;
  6882. self._should_raise_((function(){
  6883. return smalltalk.withContext(function($ctx2) {
  6884. return (16)._rW();
  6885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6886. $ctx1.sendIdx["should:raise:"]=33;
  6887. self._should_raise_((function(){
  6888. return smalltalk.withContext(function($ctx2) {
  6889. return (16)._rw();
  6890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6891. $ctx1.sendIdx["should:raise:"]=34;
  6892. self._should_raise_((function(){
  6893. return smalltalk.withContext(function($ctx2) {
  6894. return (16)._rX();
  6895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6896. $ctx1.sendIdx["should:raise:"]=35;
  6897. self._should_raise_((function(){
  6898. return smalltalk.withContext(function($ctx2) {
  6899. return (16)._rx();
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6901. $ctx1.sendIdx["should:raise:"]=36;
  6902. self._should_raise_((function(){
  6903. return smalltalk.withContext(function($ctx2) {
  6904. return (16)._rY();
  6905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6906. $ctx1.sendIdx["should:raise:"]=37;
  6907. self._should_raise_((function(){
  6908. return smalltalk.withContext(function($ctx2) {
  6909. return (16)._ry();
  6910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6911. $ctx1.sendIdx["should:raise:"]=38;
  6912. self._should_raise_((function(){
  6913. return smalltalk.withContext(function($ctx2) {
  6914. return (16)._rZ();
  6915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6916. $ctx1.sendIdx["should:raise:"]=39;
  6917. self._should_raise_((function(){
  6918. return smalltalk.withContext(function($ctx2) {
  6919. return (16)._rz();
  6920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6921. $ctx1.sendIdx["should:raise:"]=40;
  6922. self._should_raise_((function(){
  6923. return smalltalk.withContext(function($ctx2) {
  6924. return (11259375)._Z();
  6925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6926. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6927. args: [],
  6928. 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.",
  6929. 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"],
  6930. referencedClasses: ["MessageNotUnderstood"]
  6931. }),
  6932. smalltalk.NumberTest);
  6933. smalltalk.addMethod(
  6934. smalltalk.method({
  6935. selector: "testLog",
  6936. protocol: 'tests',
  6937. fn: function (){
  6938. var self=this;
  6939. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6940. return smalltalk.withContext(function($ctx1) {
  6941. self._assert_equals_((10000)._log(),(4));
  6942. $ctx1.sendIdx["assert:equals:"]=1;
  6943. self._assert_equals_((512)._log_((2)),(9));
  6944. $ctx1.sendIdx["assert:equals:"]=2;
  6945. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6946. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6947. args: [],
  6948. 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.",
  6949. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6950. referencedClasses: ["Number"]
  6951. }),
  6952. smalltalk.NumberTest);
  6953. smalltalk.addMethod(
  6954. smalltalk.method({
  6955. selector: "testMinMax",
  6956. protocol: 'tests',
  6957. fn: function (){
  6958. var self=this;
  6959. return smalltalk.withContext(function($ctx1) {
  6960. self._assert_equals_((2)._max_((5)),(5));
  6961. $ctx1.sendIdx["assert:equals:"]=1;
  6962. self._assert_equals_((2)._min_((5)),(2));
  6963. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6964. args: [],
  6965. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6966. messageSends: ["assert:equals:", "max:", "min:"],
  6967. referencedClasses: []
  6968. }),
  6969. smalltalk.NumberTest);
  6970. smalltalk.addMethod(
  6971. smalltalk.method({
  6972. selector: "testNegated",
  6973. protocol: 'tests',
  6974. fn: function (){
  6975. var self=this;
  6976. return smalltalk.withContext(function($ctx1) {
  6977. var $1;
  6978. $1=(3)._negated();
  6979. $ctx1.sendIdx["negated"]=1;
  6980. self._assert_equals_($1,(-3));
  6981. $ctx1.sendIdx["assert:equals:"]=1;
  6982. self._assert_equals_((-3)._negated(),(3));
  6983. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6984. args: [],
  6985. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6986. messageSends: ["assert:equals:", "negated"],
  6987. referencedClasses: []
  6988. }),
  6989. smalltalk.NumberTest);
  6990. smalltalk.addMethod(
  6991. smalltalk.method({
  6992. selector: "testPrintShowingDecimalPlaces",
  6993. protocol: 'tests',
  6994. fn: function (){
  6995. var self=this;
  6996. return smalltalk.withContext(function($ctx1) {
  6997. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6998. $1=(23)._printShowingDecimalPlaces_((2));
  6999. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7000. self._assert_equals_($1,"23.00");
  7001. $ctx1.sendIdx["assert:equals:"]=1;
  7002. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7003. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7004. self._assert_equals_($2,"23.57");
  7005. $ctx1.sendIdx["assert:equals:"]=2;
  7006. $4=(234.567)._negated();
  7007. $ctx1.sendIdx["negated"]=1;
  7008. $3=_st($4)._printShowingDecimalPlaces_((5));
  7009. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7010. self._assert_equals_($3,"-234.56700");
  7011. $ctx1.sendIdx["assert:equals:"]=3;
  7012. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7013. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7014. self._assert_equals_($5,"23");
  7015. $ctx1.sendIdx["assert:equals:"]=4;
  7016. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7017. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7018. self._assert_equals_($6,"24");
  7019. $ctx1.sendIdx["assert:equals:"]=5;
  7020. $8=(23.4567)._negated();
  7021. $ctx1.sendIdx["negated"]=2;
  7022. $7=_st($8)._printShowingDecimalPlaces_((0));
  7023. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7024. self._assert_equals_($7,"-23");
  7025. $ctx1.sendIdx["assert:equals:"]=6;
  7026. $10=(23.5567)._negated();
  7027. $ctx1.sendIdx["negated"]=3;
  7028. $9=_st($10)._printShowingDecimalPlaces_((0));
  7029. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7030. self._assert_equals_($9,"-24");
  7031. $ctx1.sendIdx["assert:equals:"]=7;
  7032. $11=(100000000)._printShowingDecimalPlaces_((1));
  7033. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7034. self._assert_equals_($11,"100000000.0");
  7035. $ctx1.sendIdx["assert:equals:"]=8;
  7036. $12=(0.98)._printShowingDecimalPlaces_((5));
  7037. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7038. self._assert_equals_($12,"0.98000");
  7039. $ctx1.sendIdx["assert:equals:"]=9;
  7040. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7041. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7042. self._assert_equals_($13,"-0.98");
  7043. $ctx1.sendIdx["assert:equals:"]=10;
  7044. $14=(2.567)._printShowingDecimalPlaces_((2));
  7045. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7046. self._assert_equals_($14,"2.57");
  7047. $ctx1.sendIdx["assert:equals:"]=11;
  7048. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7049. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7050. self._assert_equals_($15,"-2.57");
  7051. $ctx1.sendIdx["assert:equals:"]=12;
  7052. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7053. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  7054. args: [],
  7055. 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'.",
  7056. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7057. referencedClasses: []
  7058. }),
  7059. smalltalk.NumberTest);
  7060. smalltalk.addMethod(
  7061. smalltalk.method({
  7062. selector: "testRaisedTo",
  7063. protocol: 'tests',
  7064. fn: function (){
  7065. var self=this;
  7066. return smalltalk.withContext(function($ctx1) {
  7067. var $1,$2,$3;
  7068. $1=(2)._raisedTo_((4));
  7069. $ctx1.sendIdx["raisedTo:"]=1;
  7070. self._assert_equals_($1,(16));
  7071. $ctx1.sendIdx["assert:equals:"]=1;
  7072. $2=(2)._raisedTo_((0));
  7073. $ctx1.sendIdx["raisedTo:"]=2;
  7074. self._assert_equals_($2,(1));
  7075. $ctx1.sendIdx["assert:equals:"]=2;
  7076. $3=(2)._raisedTo_((-3));
  7077. $ctx1.sendIdx["raisedTo:"]=3;
  7078. self._assert_equals_($3,(0.125));
  7079. $ctx1.sendIdx["assert:equals:"]=3;
  7080. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7081. $ctx1.sendIdx["assert:equals:"]=4;
  7082. self._assert_equals_((2).__star_star((4)),(16));
  7083. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  7084. args: [],
  7085. 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.",
  7086. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7087. referencedClasses: []
  7088. }),
  7089. smalltalk.NumberTest);
  7090. smalltalk.addMethod(
  7091. smalltalk.method({
  7092. selector: "testRounded",
  7093. protocol: 'tests',
  7094. fn: function (){
  7095. var self=this;
  7096. return smalltalk.withContext(function($ctx1) {
  7097. var $1,$2;
  7098. $1=(3)._rounded();
  7099. $ctx1.sendIdx["rounded"]=1;
  7100. self._assert_equals_($1,(3));
  7101. $ctx1.sendIdx["assert:equals:"]=1;
  7102. $2=(3.212)._rounded();
  7103. $ctx1.sendIdx["rounded"]=2;
  7104. self._assert_equals_($2,(3));
  7105. $ctx1.sendIdx["assert:equals:"]=2;
  7106. self._assert_equals_((3.51)._rounded(),(4));
  7107. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  7108. args: [],
  7109. 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",
  7110. messageSends: ["assert:equals:", "rounded"],
  7111. referencedClasses: []
  7112. }),
  7113. smalltalk.NumberTest);
  7114. smalltalk.addMethod(
  7115. smalltalk.method({
  7116. selector: "testSign",
  7117. protocol: 'tests',
  7118. fn: function (){
  7119. var self=this;
  7120. return smalltalk.withContext(function($ctx1) {
  7121. var $1,$2;
  7122. $1=(5)._sign();
  7123. $ctx1.sendIdx["sign"]=1;
  7124. self._assert_equals_($1,(1));
  7125. $ctx1.sendIdx["assert:equals:"]=1;
  7126. $2=(0)._sign();
  7127. $ctx1.sendIdx["sign"]=2;
  7128. self._assert_equals_($2,(0));
  7129. $ctx1.sendIdx["assert:equals:"]=2;
  7130. self._assert_equals_((-1.4)._sign(),(-1));
  7131. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7132. args: [],
  7133. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7134. messageSends: ["assert:equals:", "sign"],
  7135. referencedClasses: []
  7136. }),
  7137. smalltalk.NumberTest);
  7138. smalltalk.addMethod(
  7139. smalltalk.method({
  7140. selector: "testSqrt",
  7141. protocol: 'tests',
  7142. fn: function (){
  7143. var self=this;
  7144. return smalltalk.withContext(function($ctx1) {
  7145. var $1;
  7146. $1=(4)._sqrt();
  7147. $ctx1.sendIdx["sqrt"]=1;
  7148. self._assert_equals_($1,(2));
  7149. $ctx1.sendIdx["assert:equals:"]=1;
  7150. self._assert_equals_((16)._sqrt(),(4));
  7151. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7152. args: [],
  7153. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7154. messageSends: ["assert:equals:", "sqrt"],
  7155. referencedClasses: []
  7156. }),
  7157. smalltalk.NumberTest);
  7158. smalltalk.addMethod(
  7159. smalltalk.method({
  7160. selector: "testSquared",
  7161. protocol: 'tests',
  7162. fn: function (){
  7163. var self=this;
  7164. return smalltalk.withContext(function($ctx1) {
  7165. self._assert_equals_((4)._squared(),(16));
  7166. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7167. args: [],
  7168. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7169. messageSends: ["assert:equals:", "squared"],
  7170. referencedClasses: []
  7171. }),
  7172. smalltalk.NumberTest);
  7173. smalltalk.addMethod(
  7174. smalltalk.method({
  7175. selector: "testTimesRepeat",
  7176. protocol: 'tests',
  7177. fn: function (){
  7178. var self=this;
  7179. var i;
  7180. return smalltalk.withContext(function($ctx1) {
  7181. i=(0);
  7182. (0)._timesRepeat_((function(){
  7183. return smalltalk.withContext(function($ctx2) {
  7184. i=_st(i).__plus((1));
  7185. $ctx2.sendIdx["+"]=1;
  7186. return i;
  7187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7188. $ctx1.sendIdx["timesRepeat:"]=1;
  7189. self._assert_equals_(i,(0));
  7190. $ctx1.sendIdx["assert:equals:"]=1;
  7191. (5)._timesRepeat_((function(){
  7192. return smalltalk.withContext(function($ctx2) {
  7193. i=_st(i).__plus((1));
  7194. return i;
  7195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7196. self._assert_equals_(i,(5));
  7197. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7198. args: [],
  7199. 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",
  7200. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7201. referencedClasses: []
  7202. }),
  7203. smalltalk.NumberTest);
  7204. smalltalk.addMethod(
  7205. smalltalk.method({
  7206. selector: "testTo",
  7207. protocol: 'tests',
  7208. fn: function (){
  7209. var self=this;
  7210. return smalltalk.withContext(function($ctx1) {
  7211. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7212. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7213. args: [],
  7214. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7215. messageSends: ["assert:equals:", "to:"],
  7216. referencedClasses: []
  7217. }),
  7218. smalltalk.NumberTest);
  7219. smalltalk.addMethod(
  7220. smalltalk.method({
  7221. selector: "testToBy",
  7222. protocol: 'tests',
  7223. fn: function (){
  7224. var self=this;
  7225. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7226. return smalltalk.withContext(function($ctx1) {
  7227. var $1;
  7228. $1=(0)._to_by_((6),(2));
  7229. $ctx1.sendIdx["to:by:"]=1;
  7230. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7231. self._should_raise_((function(){
  7232. return smalltalk.withContext(function($ctx2) {
  7233. return (1)._to_by_((4),(0));
  7234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7235. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7236. args: [],
  7237. 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",
  7238. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7239. referencedClasses: ["Error"]
  7240. }),
  7241. smalltalk.NumberTest);
  7242. smalltalk.addMethod(
  7243. smalltalk.method({
  7244. selector: "testTrigonometry",
  7245. protocol: 'tests',
  7246. fn: function (){
  7247. var self=this;
  7248. return smalltalk.withContext(function($ctx1) {
  7249. self._assert_equals_((0)._cos(),(1));
  7250. $ctx1.sendIdx["assert:equals:"]=1;
  7251. self._assert_equals_((0)._sin(),(0));
  7252. $ctx1.sendIdx["assert:equals:"]=2;
  7253. self._assert_equals_((0)._tan(),(0));
  7254. $ctx1.sendIdx["assert:equals:"]=3;
  7255. self._assert_equals_((1)._arcCos(),(0));
  7256. $ctx1.sendIdx["assert:equals:"]=4;
  7257. self._assert_equals_((0)._arcSin(),(0));
  7258. $ctx1.sendIdx["assert:equals:"]=5;
  7259. self._assert_equals_((0)._arcTan(),(0));
  7260. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7261. args: [],
  7262. 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.",
  7263. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7264. referencedClasses: []
  7265. }),
  7266. smalltalk.NumberTest);
  7267. smalltalk.addMethod(
  7268. smalltalk.method({
  7269. selector: "testTruncated",
  7270. protocol: 'tests',
  7271. fn: function (){
  7272. var self=this;
  7273. return smalltalk.withContext(function($ctx1) {
  7274. var $1,$2;
  7275. $1=(3)._truncated();
  7276. $ctx1.sendIdx["truncated"]=1;
  7277. self._assert_equals_($1,(3));
  7278. $ctx1.sendIdx["assert:equals:"]=1;
  7279. $2=(3.212)._truncated();
  7280. $ctx1.sendIdx["truncated"]=2;
  7281. self._assert_equals_($2,(3));
  7282. $ctx1.sendIdx["assert:equals:"]=2;
  7283. self._assert_equals_((3.51)._truncated(),(3));
  7284. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7285. args: [],
  7286. 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",
  7287. messageSends: ["assert:equals:", "truncated"],
  7288. referencedClasses: []
  7289. }),
  7290. smalltalk.NumberTest);
  7291. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7292. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7293. smalltalk.addMethod(
  7294. smalltalk.method({
  7295. selector: "foo",
  7296. protocol: 'not yet classified',
  7297. fn: function (){
  7298. var self=this;
  7299. return smalltalk.withContext(function($ctx1) {
  7300. var $1;
  7301. $1=self["@foo"];
  7302. return $1;
  7303. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7304. args: [],
  7305. source: "foo\x0a\x09^ foo",
  7306. messageSends: [],
  7307. referencedClasses: []
  7308. }),
  7309. smalltalk.ObjectMock);
  7310. smalltalk.addMethod(
  7311. smalltalk.method({
  7312. selector: "foo:",
  7313. protocol: 'not yet classified',
  7314. fn: function (anObject){
  7315. var self=this;
  7316. return smalltalk.withContext(function($ctx1) {
  7317. self["@foo"]=anObject;
  7318. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7319. args: ["anObject"],
  7320. source: "foo: anObject\x0a\x09foo := anObject",
  7321. messageSends: [],
  7322. referencedClasses: []
  7323. }),
  7324. smalltalk.ObjectMock);
  7325. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7326. smalltalk.addMethod(
  7327. smalltalk.method({
  7328. selector: "notDefined",
  7329. protocol: 'tests',
  7330. fn: function (){
  7331. var self=this;
  7332. return smalltalk.withContext(function($ctx1) {
  7333. return void 0;;
  7334. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7335. args: [],
  7336. source: "notDefined\x0a\x09<return void 0;>",
  7337. messageSends: [],
  7338. referencedClasses: []
  7339. }),
  7340. smalltalk.ObjectTest);
  7341. smalltalk.addMethod(
  7342. smalltalk.method({
  7343. selector: "testBasicAccess",
  7344. protocol: 'tests',
  7345. fn: function (){
  7346. var self=this;
  7347. var o;
  7348. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7349. return smalltalk.withContext(function($ctx1) {
  7350. var $1;
  7351. o=_st($Object())._new();
  7352. _st(o)._basicAt_put_("a",(1));
  7353. $1=_st(o)._basicAt_("a");
  7354. $ctx1.sendIdx["basicAt:"]=1;
  7355. self._assert_equals_($1,(1));
  7356. $ctx1.sendIdx["assert:equals:"]=1;
  7357. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7358. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7359. args: [],
  7360. 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",
  7361. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7362. referencedClasses: ["Object"]
  7363. }),
  7364. smalltalk.ObjectTest);
  7365. smalltalk.addMethod(
  7366. smalltalk.method({
  7367. selector: "testBasicPerform",
  7368. protocol: 'tests',
  7369. fn: function (){
  7370. var self=this;
  7371. var o;
  7372. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7373. return smalltalk.withContext(function($ctx1) {
  7374. o=_st($Object())._new();
  7375. _st(o)._basicAt_put_("func",(function(){
  7376. return smalltalk.withContext(function($ctx2) {
  7377. return "hello";
  7378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7379. $ctx1.sendIdx["basicAt:put:"]=1;
  7380. _st(o)._basicAt_put_("func2",(function(a){
  7381. return smalltalk.withContext(function($ctx2) {
  7382. return _st(a).__plus((1));
  7383. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7384. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7385. $ctx1.sendIdx["assert:equals:"]=1;
  7386. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7387. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7388. args: [],
  7389. 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",
  7390. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7391. referencedClasses: ["Object"]
  7392. }),
  7393. smalltalk.ObjectTest);
  7394. smalltalk.addMethod(
  7395. smalltalk.method({
  7396. selector: "testDNU",
  7397. protocol: 'tests',
  7398. fn: function (){
  7399. var self=this;
  7400. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7401. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7402. return smalltalk.withContext(function($ctx1) {
  7403. self._should_raise_((function(){
  7404. return smalltalk.withContext(function($ctx2) {
  7405. return _st(_st($Object())._new())._foo();
  7406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7407. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7408. args: [],
  7409. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7410. messageSends: ["should:raise:", "foo", "new"],
  7411. referencedClasses: ["Object", "MessageNotUnderstood"]
  7412. }),
  7413. smalltalk.ObjectTest);
  7414. smalltalk.addMethod(
  7415. smalltalk.method({
  7416. selector: "testEquality",
  7417. protocol: 'tests',
  7418. fn: function (){
  7419. var self=this;
  7420. var o;
  7421. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7422. return smalltalk.withContext(function($ctx1) {
  7423. var $1,$2,$4,$3;
  7424. o=_st($Object())._new();
  7425. $ctx1.sendIdx["new"]=1;
  7426. $1=_st(o).__eq(_st($Object())._new());
  7427. $ctx1.sendIdx["="]=1;
  7428. self._deny_($1);
  7429. $2=_st(o).__eq(o);
  7430. $ctx1.sendIdx["="]=2;
  7431. self._assert_($2);
  7432. $ctx1.sendIdx["assert:"]=1;
  7433. $4=_st(o)._yourself();
  7434. $ctx1.sendIdx["yourself"]=1;
  7435. $3=_st($4).__eq(o);
  7436. $ctx1.sendIdx["="]=3;
  7437. self._assert_($3);
  7438. $ctx1.sendIdx["assert:"]=2;
  7439. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7440. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7441. args: [],
  7442. 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)",
  7443. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7444. referencedClasses: ["Object"]
  7445. }),
  7446. smalltalk.ObjectTest);
  7447. smalltalk.addMethod(
  7448. smalltalk.method({
  7449. selector: "testHalt",
  7450. protocol: 'tests',
  7451. fn: function (){
  7452. var self=this;
  7453. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7454. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7455. return smalltalk.withContext(function($ctx1) {
  7456. self._should_raise_((function(){
  7457. return smalltalk.withContext(function($ctx2) {
  7458. return _st(_st($Object())._new())._halt();
  7459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7460. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7461. args: [],
  7462. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7463. messageSends: ["should:raise:", "halt", "new"],
  7464. referencedClasses: ["Object", "Error"]
  7465. }),
  7466. smalltalk.ObjectTest);
  7467. smalltalk.addMethod(
  7468. smalltalk.method({
  7469. selector: "testIdentity",
  7470. protocol: 'tests',
  7471. fn: function (){
  7472. var self=this;
  7473. var o;
  7474. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7475. return smalltalk.withContext(function($ctx1) {
  7476. var $1,$2,$4,$3;
  7477. o=_st($Object())._new();
  7478. $ctx1.sendIdx["new"]=1;
  7479. $1=_st(o).__eq_eq(_st($Object())._new());
  7480. $ctx1.sendIdx["=="]=1;
  7481. self._deny_($1);
  7482. $2=_st(o).__eq_eq(o);
  7483. $ctx1.sendIdx["=="]=2;
  7484. self._assert_($2);
  7485. $ctx1.sendIdx["assert:"]=1;
  7486. $4=_st(o)._yourself();
  7487. $ctx1.sendIdx["yourself"]=1;
  7488. $3=_st($4).__eq_eq(o);
  7489. $ctx1.sendIdx["=="]=3;
  7490. self._assert_($3);
  7491. $ctx1.sendIdx["assert:"]=2;
  7492. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7493. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7494. args: [],
  7495. 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",
  7496. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7497. referencedClasses: ["Object"]
  7498. }),
  7499. smalltalk.ObjectTest);
  7500. smalltalk.addMethod(
  7501. smalltalk.method({
  7502. selector: "testIfNil",
  7503. protocol: 'tests',
  7504. fn: function (){
  7505. var self=this;
  7506. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7507. return smalltalk.withContext(function($ctx1) {
  7508. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7509. $2=_st($Object())._new();
  7510. $ctx1.sendIdx["new"]=1;
  7511. $1=_st($2)._isNil();
  7512. self._deny_($1);
  7513. $ctx1.sendIdx["deny:"]=1;
  7514. $5=_st($Object())._new();
  7515. $ctx1.sendIdx["new"]=2;
  7516. if(($receiver = $5) == nil || $receiver == null){
  7517. $4=true;
  7518. } else {
  7519. $4=$5;
  7520. };
  7521. $3=_st($4).__eq(true);
  7522. self._deny_($3);
  7523. $7=_st($Object())._new();
  7524. $ctx1.sendIdx["new"]=3;
  7525. if(($receiver = $7) == nil || $receiver == null){
  7526. $6=$7;
  7527. } else {
  7528. $6=true;
  7529. };
  7530. self._assert_equals_($6,true);
  7531. $ctx1.sendIdx["assert:equals:"]=1;
  7532. $9=_st($Object())._new();
  7533. $ctx1.sendIdx["new"]=4;
  7534. if(($receiver = $9) == nil || $receiver == null){
  7535. $8=false;
  7536. } else {
  7537. $8=true;
  7538. };
  7539. self._assert_equals_($8,true);
  7540. $ctx1.sendIdx["assert:equals:"]=2;
  7541. $11=_st($Object())._new();
  7542. if(($receiver = $11) == nil || $receiver == null){
  7543. $10=false;
  7544. } else {
  7545. $10=true;
  7546. };
  7547. self._assert_equals_($10,true);
  7548. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7549. args: [],
  7550. 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",
  7551. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7552. referencedClasses: ["Object"]
  7553. }),
  7554. smalltalk.ObjectTest);
  7555. smalltalk.addMethod(
  7556. smalltalk.method({
  7557. selector: "testInstVars",
  7558. protocol: 'tests',
  7559. fn: function (){
  7560. var self=this;
  7561. var o;
  7562. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7563. return smalltalk.withContext(function($ctx1) {
  7564. var $1,$2;
  7565. o=_st($ObjectMock())._new();
  7566. $1=_st(o)._instVarAt_("foo");
  7567. $ctx1.sendIdx["instVarAt:"]=1;
  7568. self._assert_equals_($1,nil);
  7569. $ctx1.sendIdx["assert:equals:"]=1;
  7570. _st(o)._instVarAt_put_("foo",(1));
  7571. $2=_st(o)._instVarAt_("foo");
  7572. $ctx1.sendIdx["instVarAt:"]=2;
  7573. self._assert_equals_($2,(1));
  7574. $ctx1.sendIdx["assert:equals:"]=2;
  7575. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7576. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7577. args: [],
  7578. 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",
  7579. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7580. referencedClasses: ["ObjectMock"]
  7581. }),
  7582. smalltalk.ObjectTest);
  7583. smalltalk.addMethod(
  7584. smalltalk.method({
  7585. selector: "testNilUndefined",
  7586. protocol: 'tests',
  7587. fn: function (){
  7588. var self=this;
  7589. return smalltalk.withContext(function($ctx1) {
  7590. self._assert_equals_(self._notDefined(),nil);
  7591. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7592. args: [],
  7593. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7594. messageSends: ["assert:equals:", "notDefined"],
  7595. referencedClasses: []
  7596. }),
  7597. smalltalk.ObjectTest);
  7598. smalltalk.addMethod(
  7599. smalltalk.method({
  7600. selector: "testYourself",
  7601. protocol: 'tests',
  7602. fn: function (){
  7603. var self=this;
  7604. var o;
  7605. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7606. return smalltalk.withContext(function($ctx1) {
  7607. o=_st($ObjectMock())._new();
  7608. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7609. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7610. args: [],
  7611. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7612. messageSends: ["new", "assert:", "==", "yourself"],
  7613. referencedClasses: ["ObjectMock"]
  7614. }),
  7615. smalltalk.ObjectTest);
  7616. smalltalk.addMethod(
  7617. smalltalk.method({
  7618. selector: "testidentityHash",
  7619. protocol: 'tests',
  7620. fn: function (){
  7621. var self=this;
  7622. var o1,o2;
  7623. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7624. return smalltalk.withContext(function($ctx1) {
  7625. var $2,$3,$1,$5,$4;
  7626. o1=_st($Object())._new();
  7627. $ctx1.sendIdx["new"]=1;
  7628. o2=_st($Object())._new();
  7629. $2=_st(o1)._identityHash();
  7630. $ctx1.sendIdx["identityHash"]=1;
  7631. $3=_st(o1)._identityHash();
  7632. $ctx1.sendIdx["identityHash"]=2;
  7633. $1=_st($2).__eq_eq($3);
  7634. $ctx1.sendIdx["=="]=1;
  7635. self._assert_($1);
  7636. $5=_st(o1)._identityHash();
  7637. $ctx1.sendIdx["identityHash"]=3;
  7638. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7639. self._deny_($4);
  7640. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7641. args: [],
  7642. 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",
  7643. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7644. referencedClasses: ["Object"]
  7645. }),
  7646. smalltalk.ObjectTest);
  7647. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7648. smalltalk.addMethod(
  7649. smalltalk.method({
  7650. selector: "testAccessing",
  7651. protocol: 'tests',
  7652. fn: function (){
  7653. var self=this;
  7654. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7655. return smalltalk.withContext(function($ctx1) {
  7656. var $2,$1,$3,$6,$5,$4;
  7657. $2=_st($Point())._x_y_((3),(4));
  7658. $ctx1.sendIdx["x:y:"]=1;
  7659. $1=_st($2)._x();
  7660. $ctx1.sendIdx["x"]=1;
  7661. self._assert_equals_($1,(3));
  7662. $ctx1.sendIdx["assert:equals:"]=1;
  7663. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7664. $ctx1.sendIdx["y"]=1;
  7665. self._assert_equals_($3,(4));
  7666. $ctx1.sendIdx["assert:equals:"]=2;
  7667. $6=_st($Point())._new();
  7668. $ctx1.sendIdx["new"]=1;
  7669. $5=_st($6)._x_((3));
  7670. $4=_st($5)._x();
  7671. self._assert_equals_($4,(3));
  7672. $ctx1.sendIdx["assert:equals:"]=3;
  7673. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7674. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7675. args: [],
  7676. 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",
  7677. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7678. referencedClasses: ["Point"]
  7679. }),
  7680. smalltalk.PointTest);
  7681. smalltalk.addMethod(
  7682. smalltalk.method({
  7683. selector: "testArithmetic",
  7684. protocol: 'tests',
  7685. fn: function (){
  7686. var self=this;
  7687. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7688. return smalltalk.withContext(function($ctx1) {
  7689. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7690. $2=(3).__at((4));
  7691. $ctx1.sendIdx["@"]=1;
  7692. $3=(3).__at((4));
  7693. $ctx1.sendIdx["@"]=2;
  7694. $1=_st($2).__star($3);
  7695. $4=_st($Point())._x_y_((9),(16));
  7696. $ctx1.sendIdx["x:y:"]=1;
  7697. self._assert_equals_($1,$4);
  7698. $ctx1.sendIdx["assert:equals:"]=1;
  7699. $6=(3).__at((4));
  7700. $ctx1.sendIdx["@"]=3;
  7701. $7=(3).__at((4));
  7702. $ctx1.sendIdx["@"]=4;
  7703. $5=_st($6).__plus($7);
  7704. $8=_st($Point())._x_y_((6),(8));
  7705. $ctx1.sendIdx["x:y:"]=2;
  7706. self._assert_equals_($5,$8);
  7707. $ctx1.sendIdx["assert:equals:"]=2;
  7708. $10=(3).__at((4));
  7709. $ctx1.sendIdx["@"]=5;
  7710. $11=(3).__at((4));
  7711. $ctx1.sendIdx["@"]=6;
  7712. $9=_st($10).__minus($11);
  7713. $12=_st($Point())._x_y_((0),(0));
  7714. $ctx1.sendIdx["x:y:"]=3;
  7715. self._assert_equals_($9,$12);
  7716. $ctx1.sendIdx["assert:equals:"]=3;
  7717. $14=(6).__at((8));
  7718. $ctx1.sendIdx["@"]=7;
  7719. $13=_st($14).__slash((3).__at((4)));
  7720. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7721. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7722. args: [],
  7723. 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)",
  7724. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7725. referencedClasses: ["Point"]
  7726. }),
  7727. smalltalk.PointTest);
  7728. smalltalk.addMethod(
  7729. smalltalk.method({
  7730. selector: "testAt",
  7731. protocol: 'tests',
  7732. fn: function (){
  7733. var self=this;
  7734. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7735. return smalltalk.withContext(function($ctx1) {
  7736. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7737. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7738. args: [],
  7739. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7740. messageSends: ["assert:equals:", "@", "x:y:"],
  7741. referencedClasses: ["Point"]
  7742. }),
  7743. smalltalk.PointTest);
  7744. smalltalk.addMethod(
  7745. smalltalk.method({
  7746. selector: "testEgality",
  7747. protocol: 'tests',
  7748. fn: function (){
  7749. var self=this;
  7750. return smalltalk.withContext(function($ctx1) {
  7751. var $2,$3,$1,$5,$4;
  7752. $2=(3).__at((4));
  7753. $ctx1.sendIdx["@"]=1;
  7754. $3=(3).__at((4));
  7755. $ctx1.sendIdx["@"]=2;
  7756. $1=_st($2).__eq($3);
  7757. $ctx1.sendIdx["="]=1;
  7758. self._assert_($1);
  7759. $5=(3).__at((5));
  7760. $ctx1.sendIdx["@"]=3;
  7761. $4=_st($5).__eq((3).__at((6)));
  7762. self._deny_($4);
  7763. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7764. args: [],
  7765. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7766. messageSends: ["assert:", "=", "@", "deny:"],
  7767. referencedClasses: []
  7768. }),
  7769. smalltalk.PointTest);
  7770. smalltalk.addMethod(
  7771. smalltalk.method({
  7772. selector: "testNew",
  7773. protocol: 'tests',
  7774. fn: function (){
  7775. var self=this;
  7776. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7777. return smalltalk.withContext(function($ctx1) {
  7778. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7779. $3=_st($Point())._new();
  7780. $ctx1.sendIdx["new"]=1;
  7781. $2=_st($3)._x_((3));
  7782. $ctx1.sendIdx["x:"]=1;
  7783. $1=_st($2)._y();
  7784. $ctx1.sendIdx["y"]=1;
  7785. self._assert_equals_($1,nil);
  7786. $ctx1.sendIdx["assert:equals:"]=1;
  7787. $7=_st($Point())._new();
  7788. $ctx1.sendIdx["new"]=2;
  7789. $6=_st($7)._x_((3));
  7790. $5=_st($6)._x();
  7791. $ctx1.sendIdx["x"]=1;
  7792. $4=_st($5).__eq((0));
  7793. $ctx1.sendIdx["="]=1;
  7794. self._deny_($4);
  7795. $ctx1.sendIdx["deny:"]=1;
  7796. $10=_st($Point())._new();
  7797. $ctx1.sendIdx["new"]=3;
  7798. $9=_st($10)._y_((4));
  7799. $ctx1.sendIdx["y:"]=1;
  7800. $8=_st($9)._x();
  7801. self._assert_equals_($8,nil);
  7802. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7803. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7804. args: [],
  7805. 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",
  7806. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7807. referencedClasses: ["Point"]
  7808. }),
  7809. smalltalk.PointTest);
  7810. smalltalk.addMethod(
  7811. smalltalk.method({
  7812. selector: "testTranslateBy",
  7813. protocol: 'tests',
  7814. fn: function (){
  7815. var self=this;
  7816. return smalltalk.withContext(function($ctx1) {
  7817. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7818. $2=(3).__at((3));
  7819. $ctx1.sendIdx["@"]=1;
  7820. $3=(0).__at((1));
  7821. $ctx1.sendIdx["@"]=2;
  7822. $1=_st($2)._translateBy_($3);
  7823. $ctx1.sendIdx["translateBy:"]=1;
  7824. $4=(3).__at((4));
  7825. $ctx1.sendIdx["@"]=3;
  7826. self._assert_equals_($1,$4);
  7827. $ctx1.sendIdx["assert:equals:"]=1;
  7828. $6=(3).__at((3));
  7829. $ctx1.sendIdx["@"]=4;
  7830. $8=(1)._negated();
  7831. $ctx1.sendIdx["negated"]=1;
  7832. $7=(0).__at($8);
  7833. $ctx1.sendIdx["@"]=5;
  7834. $5=_st($6)._translateBy_($7);
  7835. $ctx1.sendIdx["translateBy:"]=2;
  7836. $9=(3).__at((2));
  7837. $ctx1.sendIdx["@"]=6;
  7838. self._assert_equals_($5,$9);
  7839. $ctx1.sendIdx["assert:equals:"]=2;
  7840. $11=(3).__at((3));
  7841. $ctx1.sendIdx["@"]=7;
  7842. $12=(2).__at((3));
  7843. $ctx1.sendIdx["@"]=8;
  7844. $10=_st($11)._translateBy_($12);
  7845. $ctx1.sendIdx["translateBy:"]=3;
  7846. $13=(5).__at((6));
  7847. $ctx1.sendIdx["@"]=9;
  7848. self._assert_equals_($10,$13);
  7849. $ctx1.sendIdx["assert:equals:"]=3;
  7850. $15=(3).__at((3));
  7851. $ctx1.sendIdx["@"]=10;
  7852. $16=_st((3)._negated()).__at((0));
  7853. $ctx1.sendIdx["@"]=11;
  7854. $14=_st($15)._translateBy_($16);
  7855. self._assert_equals_($14,(0).__at((3)));
  7856. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7857. args: [],
  7858. 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.",
  7859. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7860. referencedClasses: []
  7861. }),
  7862. smalltalk.PointTest);
  7863. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7864. smalltalk.addMethod(
  7865. smalltalk.method({
  7866. selector: "testNextIfAbsent",
  7867. protocol: 'tests',
  7868. fn: function (){
  7869. var self=this;
  7870. var queue;
  7871. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7872. return smalltalk.withContext(function($ctx1) {
  7873. var $2,$1;
  7874. queue=_st($Queue())._new();
  7875. _st(queue)._nextPut_("index1");
  7876. $2=_st(queue)._nextIfAbsent_("empty");
  7877. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7878. $1=_st($2).__eq("index1");
  7879. $ctx1.sendIdx["="]=1;
  7880. self._assert_($1);
  7881. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7882. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7883. args: [],
  7884. 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'",
  7885. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7886. referencedClasses: ["Queue"]
  7887. }),
  7888. smalltalk.QueueTest);
  7889. smalltalk.addMethod(
  7890. smalltalk.method({
  7891. selector: "testQueueNext",
  7892. protocol: 'tests',
  7893. fn: function (){
  7894. var self=this;
  7895. var queue;
  7896. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7897. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7898. return smalltalk.withContext(function($ctx1) {
  7899. var $1,$2,$4,$3,$6,$5;
  7900. queue=_st($Queue())._new();
  7901. $1=queue;
  7902. _st($1)._nextPut_("index1");
  7903. $ctx1.sendIdx["nextPut:"]=1;
  7904. $2=_st($1)._nextPut_("index2");
  7905. $4=_st(queue)._next();
  7906. $ctx1.sendIdx["next"]=1;
  7907. $3=_st($4).__eq("index1");
  7908. $ctx1.sendIdx["="]=1;
  7909. self._assert_($3);
  7910. $6=_st(queue)._next();
  7911. $ctx1.sendIdx["next"]=2;
  7912. $5=_st($6).__eq("index");
  7913. self._deny_($5);
  7914. self._should_raise_((function(){
  7915. return smalltalk.withContext(function($ctx2) {
  7916. return _st(queue)._next();
  7917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7918. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7919. args: [],
  7920. 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",
  7921. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7922. referencedClasses: ["Queue", "Error"]
  7923. }),
  7924. smalltalk.QueueTest);
  7925. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7926. smalltalk.addMethod(
  7927. smalltalk.method({
  7928. selector: "testAtRandomNumber",
  7929. protocol: 'tests',
  7930. fn: function (){
  7931. var self=this;
  7932. var val;
  7933. return smalltalk.withContext(function($ctx1) {
  7934. (100)._timesRepeat_((function(){
  7935. return smalltalk.withContext(function($ctx2) {
  7936. val=(10)._atRandom();
  7937. val;
  7938. self._assert_(_st(val).__gt((0)));
  7939. $ctx2.sendIdx["assert:"]=1;
  7940. return self._assert_(_st(val).__lt((11)));
  7941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7942. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7943. args: [],
  7944. 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]",
  7945. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7946. referencedClasses: []
  7947. }),
  7948. smalltalk.RandomTest);
  7949. smalltalk.addMethod(
  7950. smalltalk.method({
  7951. selector: "testAtRandomSequenceableCollection",
  7952. protocol: 'tests',
  7953. fn: function (){
  7954. var self=this;
  7955. var val;
  7956. return smalltalk.withContext(function($ctx1) {
  7957. var $3,$4,$2,$1;
  7958. (100)._timesRepeat_((function(){
  7959. return smalltalk.withContext(function($ctx2) {
  7960. val="abc"._atRandom();
  7961. val;
  7962. $3=_st(val).__eq("a");
  7963. $ctx2.sendIdx["="]=1;
  7964. $4=_st(val).__eq("b");
  7965. $ctx2.sendIdx["="]=2;
  7966. $2=_st($3).__or($4);
  7967. $1=_st($2).__or(_st(val).__eq("c"));
  7968. $ctx2.sendIdx["|"]=1;
  7969. return self._assert_($1);
  7970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7971. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7972. args: [],
  7973. 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].",
  7974. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7975. referencedClasses: []
  7976. }),
  7977. smalltalk.RandomTest);
  7978. smalltalk.addMethod(
  7979. smalltalk.method({
  7980. selector: "textNext",
  7981. protocol: 'tests',
  7982. fn: function (){
  7983. var self=this;
  7984. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7985. return smalltalk.withContext(function($ctx1) {
  7986. var $1;
  7987. (10000)._timesRepeat_((function(){
  7988. var current,next;
  7989. return smalltalk.withContext(function($ctx2) {
  7990. next=_st(_st($Random())._new())._next();
  7991. next;
  7992. self._assert_(_st(next).__gt_eq((0)));
  7993. $ctx2.sendIdx["assert:"]=1;
  7994. self._assert_(_st(next).__lt((1)));
  7995. $1=_st(current).__eq(next);
  7996. $ctx2.sendIdx["="]=1;
  7997. self._deny_($1);
  7998. return _st(next).__eq(current);
  7999. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8000. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  8001. args: [],
  8002. 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 ]",
  8003. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8004. referencedClasses: ["Random"]
  8005. }),
  8006. smalltalk.RandomTest);
  8007. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8008. smalltalk.addMethod(
  8009. smalltalk.method({
  8010. selector: "collectionClass",
  8011. protocol: 'accessing',
  8012. fn: function (){
  8013. var self=this;
  8014. return smalltalk.withContext(function($ctx1) {
  8015. var $1;
  8016. $1=_st(self._class())._collectionClass();
  8017. return $1;
  8018. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  8019. args: [],
  8020. source: "collectionClass\x0a\x09^ self class collectionClass",
  8021. messageSends: ["collectionClass", "class"],
  8022. referencedClasses: []
  8023. }),
  8024. smalltalk.StreamTest);
  8025. smalltalk.addMethod(
  8026. smalltalk.method({
  8027. selector: "newCollection",
  8028. protocol: 'accessing',
  8029. fn: function (){
  8030. var self=this;
  8031. return smalltalk.withContext(function($ctx1) {
  8032. var $1;
  8033. $1=_st(self._collectionClass())._new();
  8034. return $1;
  8035. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  8036. args: [],
  8037. source: "newCollection\x0a\x09^ self collectionClass new",
  8038. messageSends: ["new", "collectionClass"],
  8039. referencedClasses: []
  8040. }),
  8041. smalltalk.StreamTest);
  8042. smalltalk.addMethod(
  8043. smalltalk.method({
  8044. selector: "newStream",
  8045. protocol: 'accessing',
  8046. fn: function (){
  8047. var self=this;
  8048. return smalltalk.withContext(function($ctx1) {
  8049. var $1;
  8050. $1=_st(_st(self._collectionClass())._new())._stream();
  8051. return $1;
  8052. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  8053. args: [],
  8054. source: "newStream\x0a\x09^ self collectionClass new stream",
  8055. messageSends: ["stream", "new", "collectionClass"],
  8056. referencedClasses: []
  8057. }),
  8058. smalltalk.StreamTest);
  8059. smalltalk.addMethod(
  8060. smalltalk.method({
  8061. selector: "testAtStartAtEnd",
  8062. protocol: 'tests',
  8063. fn: function (){
  8064. var self=this;
  8065. var stream;
  8066. return smalltalk.withContext(function($ctx1) {
  8067. var $1,$2,$3,$4;
  8068. stream=self._newStream();
  8069. $1=_st(stream)._atStart();
  8070. $ctx1.sendIdx["atStart"]=1;
  8071. self._assert_($1);
  8072. $ctx1.sendIdx["assert:"]=1;
  8073. $2=_st(stream)._atEnd();
  8074. $ctx1.sendIdx["atEnd"]=1;
  8075. self._assert_($2);
  8076. $ctx1.sendIdx["assert:"]=2;
  8077. _st(stream)._nextPutAll_(self._newCollection());
  8078. $3=_st(stream)._atEnd();
  8079. $ctx1.sendIdx["atEnd"]=2;
  8080. self._assert_($3);
  8081. $4=_st(stream)._atStart();
  8082. $ctx1.sendIdx["atStart"]=2;
  8083. self._deny_($4);
  8084. $ctx1.sendIdx["deny:"]=1;
  8085. _st(stream)._position_((1));
  8086. self._deny_(_st(stream)._atEnd());
  8087. $ctx1.sendIdx["deny:"]=2;
  8088. self._deny_(_st(stream)._atStart());
  8089. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  8090. args: [],
  8091. 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",
  8092. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8093. referencedClasses: []
  8094. }),
  8095. smalltalk.StreamTest);
  8096. smalltalk.addMethod(
  8097. smalltalk.method({
  8098. selector: "testContents",
  8099. protocol: 'tests',
  8100. fn: function (){
  8101. var self=this;
  8102. var stream;
  8103. return smalltalk.withContext(function($ctx1) {
  8104. var $1,$2;
  8105. stream=self._newStream();
  8106. $1=stream;
  8107. $2=self._newCollection();
  8108. $ctx1.sendIdx["newCollection"]=1;
  8109. _st($1)._nextPutAll_($2);
  8110. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8111. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  8112. args: [],
  8113. 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",
  8114. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8115. referencedClasses: []
  8116. }),
  8117. smalltalk.StreamTest);
  8118. smalltalk.addMethod(
  8119. smalltalk.method({
  8120. selector: "testIsEmpty",
  8121. protocol: 'tests',
  8122. fn: function (){
  8123. var self=this;
  8124. var stream;
  8125. return smalltalk.withContext(function($ctx1) {
  8126. var $1;
  8127. stream=self._newStream();
  8128. $1=_st(stream)._isEmpty();
  8129. $ctx1.sendIdx["isEmpty"]=1;
  8130. self._assert_($1);
  8131. _st(stream)._nextPutAll_(self._newCollection());
  8132. self._deny_(_st(stream)._isEmpty());
  8133. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8134. args: [],
  8135. 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",
  8136. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8137. referencedClasses: []
  8138. }),
  8139. smalltalk.StreamTest);
  8140. smalltalk.addMethod(
  8141. smalltalk.method({
  8142. selector: "testPosition",
  8143. protocol: 'tests',
  8144. fn: function (){
  8145. var self=this;
  8146. var collection,stream;
  8147. return smalltalk.withContext(function($ctx1) {
  8148. var $1,$2,$3;
  8149. collection=self._newCollection();
  8150. stream=self._newStream();
  8151. _st(stream)._nextPutAll_(collection);
  8152. $1=_st(stream)._position();
  8153. $ctx1.sendIdx["position"]=1;
  8154. self._assert_equals_($1,_st(collection)._size());
  8155. $ctx1.sendIdx["assert:equals:"]=1;
  8156. _st(stream)._position_((0));
  8157. $2=_st(stream)._position();
  8158. $ctx1.sendIdx["position"]=2;
  8159. self._assert_equals_($2,(0));
  8160. $ctx1.sendIdx["assert:equals:"]=2;
  8161. _st(stream)._next();
  8162. $ctx1.sendIdx["next"]=1;
  8163. $3=_st(stream)._position();
  8164. $ctx1.sendIdx["position"]=3;
  8165. self._assert_equals_($3,(1));
  8166. $ctx1.sendIdx["assert:equals:"]=3;
  8167. _st(stream)._next();
  8168. self._assert_equals_(_st(stream)._position(),(2));
  8169. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8170. args: [],
  8171. 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",
  8172. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8173. referencedClasses: []
  8174. }),
  8175. smalltalk.StreamTest);
  8176. smalltalk.addMethod(
  8177. smalltalk.method({
  8178. selector: "testReading",
  8179. protocol: 'tests',
  8180. fn: function (){
  8181. var self=this;
  8182. var stream,collection;
  8183. return smalltalk.withContext(function($ctx1) {
  8184. var $1,$2,$3;
  8185. collection=self._newCollection();
  8186. stream=self._newStream();
  8187. $1=stream;
  8188. _st($1)._nextPutAll_(collection);
  8189. $2=_st($1)._position_((0));
  8190. _st(collection)._do_((function(each){
  8191. return smalltalk.withContext(function($ctx2) {
  8192. $3=_st(stream)._next();
  8193. $ctx2.sendIdx["next"]=1;
  8194. return self._assert_equals_($3,each);
  8195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8196. self._assert_(_st(_st(stream)._next())._isNil());
  8197. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8198. args: [],
  8199. 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",
  8200. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8201. referencedClasses: []
  8202. }),
  8203. smalltalk.StreamTest);
  8204. smalltalk.addMethod(
  8205. smalltalk.method({
  8206. selector: "testStreamContents",
  8207. protocol: 'tests',
  8208. fn: function (){
  8209. var self=this;
  8210. return smalltalk.withContext(function($ctx1) {
  8211. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8212. args: [],
  8213. source: "testStreamContents",
  8214. messageSends: [],
  8215. referencedClasses: []
  8216. }),
  8217. smalltalk.StreamTest);
  8218. smalltalk.addMethod(
  8219. smalltalk.method({
  8220. selector: "testWrite",
  8221. protocol: 'tests',
  8222. fn: function (){
  8223. var self=this;
  8224. var stream,collection;
  8225. return smalltalk.withContext(function($ctx1) {
  8226. collection=self._newCollection();
  8227. stream=self._newStream();
  8228. _st(collection)._do_((function(each){
  8229. return smalltalk.withContext(function($ctx2) {
  8230. return _st(stream).__lt_lt(each);
  8231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8232. self._assert_equals_(_st(stream)._contents(),collection);
  8233. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8234. args: [],
  8235. 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",
  8236. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8237. referencedClasses: []
  8238. }),
  8239. smalltalk.StreamTest);
  8240. smalltalk.addMethod(
  8241. smalltalk.method({
  8242. selector: "testWriting",
  8243. protocol: 'tests',
  8244. fn: function (){
  8245. var self=this;
  8246. var stream,collection;
  8247. return smalltalk.withContext(function($ctx1) {
  8248. var $1;
  8249. collection=self._newCollection();
  8250. stream=self._newStream();
  8251. $ctx1.sendIdx["newStream"]=1;
  8252. _st(collection)._do_((function(each){
  8253. return smalltalk.withContext(function($ctx2) {
  8254. return _st(stream)._nextPut_(each);
  8255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8256. $1=_st(stream)._contents();
  8257. $ctx1.sendIdx["contents"]=1;
  8258. self._assert_equals_($1,collection);
  8259. $ctx1.sendIdx["assert:equals:"]=1;
  8260. stream=self._newStream();
  8261. _st(stream)._nextPutAll_(collection);
  8262. self._assert_equals_(_st(stream)._contents(),collection);
  8263. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8264. args: [],
  8265. 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",
  8266. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8267. referencedClasses: []
  8268. }),
  8269. smalltalk.StreamTest);
  8270. smalltalk.addMethod(
  8271. smalltalk.method({
  8272. selector: "collectionClass",
  8273. protocol: 'accessing',
  8274. fn: function (){
  8275. var self=this;
  8276. return smalltalk.withContext(function($ctx1) {
  8277. return nil;
  8278. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8279. args: [],
  8280. source: "collectionClass\x0a\x09^ nil",
  8281. messageSends: [],
  8282. referencedClasses: []
  8283. }),
  8284. smalltalk.StreamTest.klass);
  8285. smalltalk.addMethod(
  8286. smalltalk.method({
  8287. selector: "isAbstract",
  8288. protocol: 'testing',
  8289. fn: function (){
  8290. var self=this;
  8291. return smalltalk.withContext(function($ctx1) {
  8292. var $1;
  8293. $1=_st(self._collectionClass())._isNil();
  8294. return $1;
  8295. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8296. args: [],
  8297. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8298. messageSends: ["isNil", "collectionClass"],
  8299. referencedClasses: []
  8300. }),
  8301. smalltalk.StreamTest.klass);
  8302. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8303. smalltalk.addMethod(
  8304. smalltalk.method({
  8305. selector: "newCollection",
  8306. protocol: 'accessing',
  8307. fn: function (){
  8308. var self=this;
  8309. return smalltalk.withContext(function($ctx1) {
  8310. var $1;
  8311. $1=[true,(1),(3).__at((4)),"foo"];
  8312. return $1;
  8313. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8314. args: [],
  8315. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8316. messageSends: ["@"],
  8317. referencedClasses: []
  8318. }),
  8319. smalltalk.ArrayStreamTest);
  8320. smalltalk.addMethod(
  8321. smalltalk.method({
  8322. selector: "collectionClass",
  8323. protocol: 'accessing',
  8324. fn: function (){
  8325. var self=this;
  8326. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8327. return smalltalk.withContext(function($ctx1) {
  8328. return $Array();
  8329. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8330. args: [],
  8331. source: "collectionClass\x0a\x09^ Array",
  8332. messageSends: [],
  8333. referencedClasses: ["Array"]
  8334. }),
  8335. smalltalk.ArrayStreamTest.klass);
  8336. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8337. smalltalk.addMethod(
  8338. smalltalk.method({
  8339. selector: "newCollection",
  8340. protocol: 'accessing',
  8341. fn: function (){
  8342. var self=this;
  8343. return smalltalk.withContext(function($ctx1) {
  8344. return "hello world";
  8345. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8346. args: [],
  8347. source: "newCollection\x0a\x09^ 'hello world'",
  8348. messageSends: [],
  8349. referencedClasses: []
  8350. }),
  8351. smalltalk.StringStreamTest);
  8352. smalltalk.addMethod(
  8353. smalltalk.method({
  8354. selector: "collectionClass",
  8355. protocol: 'accessing',
  8356. fn: function (){
  8357. var self=this;
  8358. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8359. return smalltalk.withContext(function($ctx1) {
  8360. return $String();
  8361. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8362. args: [],
  8363. source: "collectionClass\x0a\x09^ String",
  8364. messageSends: [],
  8365. referencedClasses: ["String"]
  8366. }),
  8367. smalltalk.StringStreamTest.klass);
  8368. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8369. smalltalk.addMethod(
  8370. smalltalk.method({
  8371. selector: "testCopying",
  8372. protocol: 'tests',
  8373. fn: function (){
  8374. var self=this;
  8375. return smalltalk.withContext(function($ctx1) {
  8376. self._assert_equals_(nil._copy(),nil);
  8377. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8378. args: [],
  8379. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8380. messageSends: ["assert:equals:", "copy"],
  8381. referencedClasses: []
  8382. }),
  8383. smalltalk.UndefinedTest);
  8384. smalltalk.addMethod(
  8385. smalltalk.method({
  8386. selector: "testDeepCopy",
  8387. protocol: 'tests',
  8388. fn: function (){
  8389. var self=this;
  8390. return smalltalk.withContext(function($ctx1) {
  8391. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8392. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8393. args: [],
  8394. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8395. messageSends: ["assert:", "=", "deepCopy"],
  8396. referencedClasses: []
  8397. }),
  8398. smalltalk.UndefinedTest);
  8399. smalltalk.addMethod(
  8400. smalltalk.method({
  8401. selector: "testIfNil",
  8402. protocol: 'tests',
  8403. fn: function (){
  8404. var self=this;
  8405. return smalltalk.withContext(function($ctx1) {
  8406. var $1,$3,$2,$4,$6,$5;
  8407. if(($receiver = nil) == nil || $receiver == null){
  8408. $1=true;
  8409. } else {
  8410. $1=nil;
  8411. };
  8412. self._assert_equals_($1,true);
  8413. $ctx1.sendIdx["assert:equals:"]=1;
  8414. if(($receiver = nil) == nil || $receiver == null){
  8415. $3=nil;
  8416. } else {
  8417. $3=true;
  8418. };
  8419. $2=_st($3).__eq(true);
  8420. $ctx1.sendIdx["="]=1;
  8421. self._deny_($2);
  8422. $ctx1.sendIdx["deny:"]=1;
  8423. if(($receiver = nil) == nil || $receiver == null){
  8424. $4=true;
  8425. } else {
  8426. $4=false;
  8427. };
  8428. self._assert_equals_($4,true);
  8429. if(($receiver = nil) == nil || $receiver == null){
  8430. $6=false;
  8431. } else {
  8432. $6=true;
  8433. };
  8434. $5=_st($6).__eq(true);
  8435. self._deny_($5);
  8436. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8437. args: [],
  8438. 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",
  8439. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8440. referencedClasses: []
  8441. }),
  8442. smalltalk.UndefinedTest);
  8443. smalltalk.addMethod(
  8444. smalltalk.method({
  8445. selector: "testIsNil",
  8446. protocol: 'tests',
  8447. fn: function (){
  8448. var self=this;
  8449. return smalltalk.withContext(function($ctx1) {
  8450. self._assert_(nil._isNil());
  8451. self._deny_(nil._notNil());
  8452. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8453. args: [],
  8454. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8455. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8456. referencedClasses: []
  8457. }),
  8458. smalltalk.UndefinedTest);
  8459. });