Kernel-Tests.js 285 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568
  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: "collectionWithDuplicates",
  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,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times.\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "isCollectionReadOnly",
  1275. protocol: 'testing',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. return false;
  1280. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "isCollectionReadOnly\x0a\x09^ false",
  1283. messageSends: [],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "sampleNonValue",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. return (999);
  1295. }, function($ctx1) {$ctx1.fill(self,"sampleNonValue",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "sampleNonValue\x0a\x09\x22Answer value that is guaranteed\x0a\x09not to be contained by self collection\x22\x0a\x09\x0a\x09^ 999",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "testAllSatisfy",
  1305. protocol: 'tests',
  1306. fn: function (){
  1307. var self=this;
  1308. var collection,anyOne;
  1309. return smalltalk.withContext(function($ctx1) {
  1310. var $1;
  1311. collection=self._collection();
  1312. anyOne=_st(collection)._anyOne();
  1313. $1=_st(collection)._allSatisfy_((function(each){
  1314. return smalltalk.withContext(function($ctx2) {
  1315. return _st(collection)._includes_(each);
  1316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1317. $ctx1.sendIdx["allSatisfy:"]=1;
  1318. self._assert_($1);
  1319. self._deny_(_st(collection)._allSatisfy_((function(each){
  1320. return smalltalk.withContext(function($ctx2) {
  1321. return _st(each).__tild_eq(anyOne);
  1322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1323. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1324. args: [],
  1325. 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 ])",
  1326. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1327. referencedClasses: []
  1328. }),
  1329. smalltalk.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "testAnyOne",
  1333. protocol: 'tests',
  1334. fn: function (){
  1335. var self=this;
  1336. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1337. return smalltalk.withContext(function($ctx1) {
  1338. var $2,$1;
  1339. self._should_raise_((function(){
  1340. return smalltalk.withContext(function($ctx2) {
  1341. return _st(_st(self._collectionClass())._new())._anyOne();
  1342. $ctx2.sendIdx["anyOne"]=1;
  1343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1344. $2=self._collection();
  1345. $ctx1.sendIdx["collection"]=1;
  1346. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1347. self._assert_($1);
  1348. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1349. args: [],
  1350. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1351. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1352. referencedClasses: ["Error"]
  1353. }),
  1354. smalltalk.CollectionTest);
  1355. smalltalk.addMethod(
  1356. smalltalk.method({
  1357. selector: "testAnySatisfy",
  1358. protocol: 'tests',
  1359. fn: function (){
  1360. var self=this;
  1361. var anyOne;
  1362. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1363. return smalltalk.withContext(function($ctx1) {
  1364. var $1,$3,$2;
  1365. $1=self._collection();
  1366. $ctx1.sendIdx["collection"]=1;
  1367. anyOne=_st($1)._anyOne();
  1368. $3=self._collection();
  1369. $ctx1.sendIdx["collection"]=2;
  1370. $2=_st($3)._anySatisfy_((function(each){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. return _st(each).__eq(anyOne);
  1373. $ctx2.sendIdx["="]=1;
  1374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1375. $ctx1.sendIdx["anySatisfy:"]=1;
  1376. self._assert_($2);
  1377. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1378. return smalltalk.withContext(function($ctx2) {
  1379. return _st(each).__eq(_st($Object())._new());
  1380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1381. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1382. args: [],
  1383. 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 ])",
  1384. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1385. referencedClasses: ["Object"]
  1386. }),
  1387. smalltalk.CollectionTest);
  1388. smalltalk.addMethod(
  1389. smalltalk.method({
  1390. selector: "testAsArray",
  1391. protocol: 'tests',
  1392. fn: function (){
  1393. var self=this;
  1394. return smalltalk.withContext(function($ctx1) {
  1395. var $1;
  1396. $1=self._collection();
  1397. $ctx1.sendIdx["collection"]=1;
  1398. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1399. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1400. args: [],
  1401. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1402. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1403. referencedClasses: []
  1404. }),
  1405. smalltalk.CollectionTest);
  1406. smalltalk.addMethod(
  1407. smalltalk.method({
  1408. selector: "testAsOrderedCollection",
  1409. protocol: 'tests',
  1410. fn: function (){
  1411. var self=this;
  1412. return smalltalk.withContext(function($ctx1) {
  1413. var $1;
  1414. $1=self._collection();
  1415. $ctx1.sendIdx["collection"]=1;
  1416. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1417. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1418. args: [],
  1419. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1420. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1421. referencedClasses: []
  1422. }),
  1423. smalltalk.CollectionTest);
  1424. smalltalk.addMethod(
  1425. smalltalk.method({
  1426. selector: "testAsSet",
  1427. protocol: 'tests',
  1428. fn: function (){
  1429. var self=this;
  1430. var c,set;
  1431. return smalltalk.withContext(function($ctx1) {
  1432. c=self._collectionWithDuplicates();
  1433. set=_st(c)._asSet();
  1434. self._assert_equals_(_st(set)._size(),(5));
  1435. _st(c)._do_((function(each){
  1436. return smalltalk.withContext(function($ctx2) {
  1437. return self._assert_(_st(set)._includes_(each));
  1438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1439. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1440. args: [],
  1441. 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) ]",
  1442. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1443. referencedClasses: []
  1444. }),
  1445. smalltalk.CollectionTest);
  1446. smalltalk.addMethod(
  1447. smalltalk.method({
  1448. selector: "testCollect",
  1449. protocol: 'tests',
  1450. fn: function (){
  1451. var self=this;
  1452. var newCollection;
  1453. return smalltalk.withContext(function($ctx1) {
  1454. newCollection=[(1), (2), (3), (4)];
  1455. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(each)._abs();
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1459. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1460. args: [],
  1461. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
  1462. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1463. referencedClasses: []
  1464. }),
  1465. smalltalk.CollectionTest);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "testDetect",
  1469. protocol: 'tests',
  1470. fn: function (){
  1471. var self=this;
  1472. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1473. return smalltalk.withContext(function($ctx1) {
  1474. var $2,$1;
  1475. $2=self._collection();
  1476. $ctx1.sendIdx["collection"]=1;
  1477. $1=_st($2)._detect_((function(each){
  1478. return smalltalk.withContext(function($ctx2) {
  1479. return _st(each).__lt((0));
  1480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1481. $ctx1.sendIdx["detect:"]=1;
  1482. self._assert_equals_($1,(-4));
  1483. self._should_raise_((function(){
  1484. return smalltalk.withContext(function($ctx2) {
  1485. return _st(self._collection())._detect_((function(each){
  1486. return smalltalk.withContext(function($ctx3) {
  1487. return _st(each).__eq((6));
  1488. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1493. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testDo",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var newCollection;
  1504. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1;
  1507. newCollection=_st($OrderedCollection())._new();
  1508. $1=self._collection();
  1509. $ctx1.sendIdx["collection"]=1;
  1510. _st($1)._do_((function(each){
  1511. return smalltalk.withContext(function($ctx2) {
  1512. return _st(newCollection)._add_(each);
  1513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1514. self._assertSameContents_as_(self._collection(),newCollection);
  1515. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1516. args: [],
  1517. 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",
  1518. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1519. referencedClasses: ["OrderedCollection"]
  1520. }),
  1521. smalltalk.CollectionTest);
  1522. smalltalk.addMethod(
  1523. smalltalk.method({
  1524. selector: "testIfEmptyFamily",
  1525. protocol: 'tests',
  1526. fn: function (){
  1527. var self=this;
  1528. return smalltalk.withContext(function($ctx1) {
  1529. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1530. $3=self._collectionClass();
  1531. $ctx1.sendIdx["collectionClass"]=1;
  1532. $2=_st($3)._new();
  1533. $ctx1.sendIdx["new"]=1;
  1534. $1=_st($2)._ifEmpty_((function(){
  1535. return smalltalk.withContext(function($ctx2) {
  1536. return (42);
  1537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1538. $ctx1.sendIdx["ifEmpty:"]=1;
  1539. self._assert_equals_($1,(42));
  1540. $ctx1.sendIdx["assert:equals:"]=1;
  1541. $5=self._collection();
  1542. $ctx1.sendIdx["collection"]=1;
  1543. $4=_st($5)._ifEmpty_((function(){
  1544. return smalltalk.withContext(function($ctx2) {
  1545. return (42);
  1546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1547. $6=self._collection();
  1548. $ctx1.sendIdx["collection"]=2;
  1549. self._assert_equals_($4,$6);
  1550. $ctx1.sendIdx["assert:equals:"]=2;
  1551. $9=self._collectionClass();
  1552. $ctx1.sendIdx["collectionClass"]=2;
  1553. $8=_st($9)._new();
  1554. $ctx1.sendIdx["new"]=2;
  1555. $7=_st($8)._ifNotEmpty_((function(){
  1556. return smalltalk.withContext(function($ctx2) {
  1557. return (42);
  1558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1559. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1560. $11=self._collectionClass();
  1561. $ctx1.sendIdx["collectionClass"]=3;
  1562. $10=_st($11)._new();
  1563. $ctx1.sendIdx["new"]=3;
  1564. self._assert_equals_($7,$10);
  1565. $ctx1.sendIdx["assert:equals:"]=3;
  1566. $13=self._collection();
  1567. $ctx1.sendIdx["collection"]=3;
  1568. $12=_st($13)._ifNotEmpty_((function(){
  1569. return smalltalk.withContext(function($ctx2) {
  1570. return (42);
  1571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1572. self._assert_equals_($12,(42));
  1573. $ctx1.sendIdx["assert:equals:"]=4;
  1574. $16=self._collectionClass();
  1575. $ctx1.sendIdx["collectionClass"]=4;
  1576. $15=_st($16)._new();
  1577. $ctx1.sendIdx["new"]=4;
  1578. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1579. return smalltalk.withContext(function($ctx2) {
  1580. return (42);
  1581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1582. return smalltalk.withContext(function($ctx2) {
  1583. return (999);
  1584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1585. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1586. self._assert_equals_($14,(42));
  1587. $ctx1.sendIdx["assert:equals:"]=5;
  1588. $18=self._collection();
  1589. $ctx1.sendIdx["collection"]=4;
  1590. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1591. return smalltalk.withContext(function($ctx2) {
  1592. return (42);
  1593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1594. return smalltalk.withContext(function($ctx2) {
  1595. return (999);
  1596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1597. self._assert_equals_($17,(999));
  1598. $ctx1.sendIdx["assert:equals:"]=6;
  1599. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1600. return smalltalk.withContext(function($ctx2) {
  1601. return (42);
  1602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1603. return smalltalk.withContext(function($ctx2) {
  1604. return (999);
  1605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1606. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1607. self._assert_equals_($19,(999));
  1608. $ctx1.sendIdx["assert:equals:"]=7;
  1609. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return (42);
  1612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1613. return smalltalk.withContext(function($ctx2) {
  1614. return (999);
  1615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1616. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1617. args: [],
  1618. 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",
  1619. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1620. referencedClasses: []
  1621. }),
  1622. smalltalk.CollectionTest);
  1623. smalltalk.addMethod(
  1624. smalltalk.method({
  1625. selector: "testIsEmpty",
  1626. protocol: 'tests',
  1627. fn: function (){
  1628. var self=this;
  1629. return smalltalk.withContext(function($ctx1) {
  1630. var $1;
  1631. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1632. $ctx1.sendIdx["isEmpty"]=1;
  1633. self._assert_($1);
  1634. self._deny_(_st(self._collection())._isEmpty());
  1635. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1636. args: [],
  1637. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1638. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1639. referencedClasses: []
  1640. }),
  1641. smalltalk.CollectionTest);
  1642. smalltalk.addMethod(
  1643. smalltalk.method({
  1644. selector: "testNoneSatisfy",
  1645. protocol: 'tests',
  1646. fn: function (){
  1647. var self=this;
  1648. var anyOne;
  1649. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1650. return smalltalk.withContext(function($ctx1) {
  1651. var $1,$3,$2;
  1652. $1=self._collection();
  1653. $ctx1.sendIdx["collection"]=1;
  1654. anyOne=_st($1)._anyOne();
  1655. $3=self._collection();
  1656. $ctx1.sendIdx["collection"]=2;
  1657. $2=_st($3)._noneSatisfy_((function(each){
  1658. return smalltalk.withContext(function($ctx2) {
  1659. return _st(each).__eq(anyOne);
  1660. $ctx2.sendIdx["="]=1;
  1661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1662. $ctx1.sendIdx["noneSatisfy:"]=1;
  1663. self._deny_($2);
  1664. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1665. return smalltalk.withContext(function($ctx2) {
  1666. return _st(each).__eq(_st($Object())._new());
  1667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1668. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1669. args: [],
  1670. 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 ])",
  1671. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1672. referencedClasses: ["Object"]
  1673. }),
  1674. smalltalk.CollectionTest);
  1675. smalltalk.addMethod(
  1676. smalltalk.method({
  1677. selector: "testRemoveAll",
  1678. protocol: 'tests',
  1679. fn: function (){
  1680. var self=this;
  1681. return smalltalk.withContext(function($ctx1) {
  1682. var $1,$2;
  1683. $1=self._collection();
  1684. _st($1)._removeAll();
  1685. $2=_st($1)._yourself();
  1686. self._assert_equals_($2,_st(self._collectionClass())._new());
  1687. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1688. args: [],
  1689. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1690. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1691. referencedClasses: []
  1692. }),
  1693. smalltalk.CollectionTest);
  1694. smalltalk.addMethod(
  1695. smalltalk.method({
  1696. selector: "testSelect",
  1697. protocol: 'tests',
  1698. fn: function (){
  1699. var self=this;
  1700. var newCollection;
  1701. return smalltalk.withContext(function($ctx1) {
  1702. newCollection=[(2), (-4)];
  1703. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1704. return smalltalk.withContext(function($ctx2) {
  1705. return _st(each)._even();
  1706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
  1710. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testSize",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. return smalltalk.withContext(function($ctx1) {
  1721. var $1;
  1722. $1=_st(_st(self._collectionClass())._new())._size();
  1723. $ctx1.sendIdx["size"]=1;
  1724. self._assert_equals_($1,(0));
  1725. $ctx1.sendIdx["assert:equals:"]=1;
  1726. self._assert_equals_(_st(self._collection())._size(),(4));
  1727. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1728. args: [],
  1729. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1730. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1731. referencedClasses: []
  1732. }),
  1733. smalltalk.CollectionTest);
  1734. smalltalk.addMethod(
  1735. smalltalk.method({
  1736. selector: "collectionClass",
  1737. protocol: 'fixture',
  1738. fn: function (){
  1739. var self=this;
  1740. return smalltalk.withContext(function($ctx1) {
  1741. self._subclassResponsibility();
  1742. return self}, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1743. args: [],
  1744. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09self subclassResponsibility",
  1745. messageSends: ["subclassResponsibility"],
  1746. referencedClasses: []
  1747. }),
  1748. smalltalk.CollectionTest.klass);
  1749. smalltalk.addMethod(
  1750. smalltalk.method({
  1751. selector: "isAbstract",
  1752. protocol: 'testing',
  1753. fn: function (){
  1754. var self=this;
  1755. return smalltalk.withContext(function($ctx1) {
  1756. var $1;
  1757. $1=_st(self._collectionClass())._isNil();
  1758. return $1;
  1759. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1760. args: [],
  1761. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1762. messageSends: ["isNil", "collectionClass"],
  1763. referencedClasses: []
  1764. }),
  1765. smalltalk.CollectionTest.klass);
  1766. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "sampleNonIndexesDo:",
  1770. protocol: 'fixture',
  1771. fn: function (aBlock){
  1772. var self=this;
  1773. return smalltalk.withContext(function($ctx1) {
  1774. self._subclassResponsibility();
  1775. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  1776. args: ["aBlock"],
  1777. 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",
  1778. messageSends: ["subclassResponsibility"],
  1779. referencedClasses: []
  1780. }),
  1781. smalltalk.IndexableCollectionTest);
  1782. smalltalk.addMethod(
  1783. smalltalk.method({
  1784. selector: "samplesDo:",
  1785. protocol: 'fixture',
  1786. fn: function (aBlock){
  1787. var self=this;
  1788. return smalltalk.withContext(function($ctx1) {
  1789. self._subclassResponsibility();
  1790. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  1791. args: ["aBlock"],
  1792. 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",
  1793. messageSends: ["subclassResponsibility"],
  1794. referencedClasses: []
  1795. }),
  1796. smalltalk.IndexableCollectionTest);
  1797. smalltalk.addMethod(
  1798. smalltalk.method({
  1799. selector: "testAt",
  1800. protocol: 'tests',
  1801. fn: function (){
  1802. var self=this;
  1803. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1804. return smalltalk.withContext(function($ctx1) {
  1805. var $1;
  1806. self._nonIndexesDo_((function(each){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return self._should_raise_((function(){
  1809. return smalltalk.withContext(function($ctx3) {
  1810. $1=self._collection();
  1811. $ctx3.sendIdx["collection"]=1;
  1812. return _st($1)._at_(each);
  1813. $ctx3.sendIdx["at:"]=1;
  1814. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  1815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1816. self._samplesDo_((function(index,value){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return self._assert_equals_(_st(self._collection())._at_(index),value);
  1819. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  1820. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1821. args: [],
  1822. 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 ]",
  1823. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  1824. referencedClasses: ["Error"]
  1825. }),
  1826. smalltalk.IndexableCollectionTest);
  1827. smalltalk.addMethod(
  1828. smalltalk.method({
  1829. selector: "testAtIfAbsent",
  1830. protocol: 'tests',
  1831. fn: function (){
  1832. var self=this;
  1833. return smalltalk.withContext(function($ctx1) {
  1834. var $2,$1,$3;
  1835. self._nonIndexesDo_((function(each){
  1836. return smalltalk.withContext(function($ctx2) {
  1837. $2=self._collection();
  1838. $ctx2.sendIdx["collection"]=1;
  1839. $1=_st($2)._at_ifAbsent_(each,(function(){
  1840. return smalltalk.withContext(function($ctx3) {
  1841. return self._sampleNonValue();
  1842. $ctx3.sendIdx["sampleNonValue"]=1;
  1843. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1844. $ctx2.sendIdx["at:ifAbsent:"]=1;
  1845. $3=self._sampleNonValue();
  1846. $ctx2.sendIdx["sampleNonValue"]=2;
  1847. return self._assert_equals_($1,$3);
  1848. $ctx2.sendIdx["assert:equals:"]=1;
  1849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1850. self._samplesDo_((function(index,value){
  1851. return smalltalk.withContext(function($ctx2) {
  1852. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  1853. return smalltalk.withContext(function($ctx3) {
  1854. return self._sampleNonValue();
  1855. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  1856. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  1857. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1858. args: [],
  1859. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNonValue ]) equals: self sampleNonValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNonValue ]) equals: value ].",
  1860. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNonValue", "samplesDo:"],
  1861. referencedClasses: []
  1862. }),
  1863. smalltalk.IndexableCollectionTest);
  1864. smalltalk.addMethod(
  1865. smalltalk.method({
  1866. selector: "testIndexOf",
  1867. protocol: 'tests',
  1868. fn: function (){
  1869. var self=this;
  1870. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1871. return smalltalk.withContext(function($ctx1) {
  1872. var $1;
  1873. self._should_raise_((function(){
  1874. return smalltalk.withContext(function($ctx2) {
  1875. $1=self._collection();
  1876. $ctx2.sendIdx["collection"]=1;
  1877. return _st($1)._indexOf_(self._sampleNonValue());
  1878. $ctx2.sendIdx["indexOf:"]=1;
  1879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1880. self._samplesDo_((function(index,value){
  1881. return smalltalk.withContext(function($ctx2) {
  1882. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  1883. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1885. args: [],
  1886. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNonValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  1887. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNonValue", "samplesDo:", "assert:equals:"],
  1888. referencedClasses: ["Error"]
  1889. }),
  1890. smalltalk.IndexableCollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testWithIndexDo",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. var collection;
  1898. return smalltalk.withContext(function($ctx1) {
  1899. collection=self._collection();
  1900. $ctx1.sendIdx["collection"]=1;
  1901. _st(self._collection())._withIndexDo_((function(each,index){
  1902. return smalltalk.withContext(function($ctx2) {
  1903. return self._assert_equals_(_st(collection)._at_(index),each);
  1904. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1905. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1906. args: [],
  1907. 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 ]",
  1908. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1909. referencedClasses: []
  1910. }),
  1911. smalltalk.IndexableCollectionTest);
  1912. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1913. smalltalk.addMethod(
  1914. smalltalk.method({
  1915. selector: "collection",
  1916. protocol: 'fixture',
  1917. fn: function (){
  1918. var self=this;
  1919. return smalltalk.withContext(function($ctx1) {
  1920. var $2,$3,$4,$1;
  1921. $2="b".__minus_gt((1));
  1922. $ctx1.sendIdx["->"]=1;
  1923. $3="a".__minus_gt((2));
  1924. $ctx1.sendIdx["->"]=2;
  1925. $4="c".__minus_gt((3));
  1926. $ctx1.sendIdx["->"]=3;
  1927. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  1928. return $1;
  1929. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1930. args: [],
  1931. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1932. messageSends: ["->"],
  1933. referencedClasses: []
  1934. }),
  1935. smalltalk.HashedCollectionTest);
  1936. smalltalk.addMethod(
  1937. smalltalk.method({
  1938. selector: "collectionWithDuplicates",
  1939. protocol: 'fixture',
  1940. fn: function (){
  1941. var self=this;
  1942. return smalltalk.withContext(function($ctx1) {
  1943. var $2,$3,$4,$5,$6,$7,$1;
  1944. $2="b".__minus_gt((1));
  1945. $ctx1.sendIdx["->"]=1;
  1946. $3="a".__minus_gt((2));
  1947. $ctx1.sendIdx["->"]=2;
  1948. $4="c".__minus_gt((3));
  1949. $ctx1.sendIdx["->"]=3;
  1950. $5="d".__minus_gt((-4));
  1951. $ctx1.sendIdx["->"]=4;
  1952. $6="e".__minus_gt((1));
  1953. $ctx1.sendIdx["->"]=5;
  1954. $7="f".__minus_gt((2));
  1955. $ctx1.sendIdx["->"]=6;
  1956. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  1957. return $1;
  1958. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1959. args: [],
  1960. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1961. messageSends: ["->"],
  1962. referencedClasses: []
  1963. }),
  1964. smalltalk.HashedCollectionTest);
  1965. smalltalk.addMethod(
  1966. smalltalk.method({
  1967. selector: "nonIndexesDo:",
  1968. protocol: 'fixture',
  1969. fn: function (aBlock){
  1970. var self=this;
  1971. return smalltalk.withContext(function($ctx1) {
  1972. _st(aBlock)._value_((5));
  1973. $ctx1.sendIdx["value:"]=1;
  1974. _st(aBlock)._value_("z");
  1975. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  1976. args: ["aBlock"],
  1977. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  1978. messageSends: ["value:"],
  1979. referencedClasses: []
  1980. }),
  1981. smalltalk.HashedCollectionTest);
  1982. smalltalk.addMethod(
  1983. smalltalk.method({
  1984. selector: "samplesDo:",
  1985. protocol: 'fixture',
  1986. fn: function (aBlock){
  1987. var self=this;
  1988. return smalltalk.withContext(function($ctx1) {
  1989. _st(aBlock)._value_value_("a",(2));
  1990. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  1991. args: ["aBlock"],
  1992. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  1993. messageSends: ["value:value:"],
  1994. referencedClasses: []
  1995. }),
  1996. smalltalk.HashedCollectionTest);
  1997. smalltalk.addMethod(
  1998. smalltalk.method({
  1999. selector: "testAsDictionary",
  2000. protocol: 'tests',
  2001. fn: function (){
  2002. var self=this;
  2003. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2004. return smalltalk.withContext(function($ctx1) {
  2005. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2006. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2007. args: [],
  2008. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2009. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2010. referencedClasses: ["Dictionary"]
  2011. }),
  2012. smalltalk.HashedCollectionTest);
  2013. smalltalk.addMethod(
  2014. smalltalk.method({
  2015. selector: "testFrom",
  2016. protocol: 'tests',
  2017. fn: function (){
  2018. var self=this;
  2019. var associations;
  2020. return smalltalk.withContext(function($ctx1) {
  2021. var $1,$2,$3,$5,$4;
  2022. $1="a".__minus_gt((1));
  2023. $ctx1.sendIdx["->"]=1;
  2024. $2="b".__minus_gt((2));
  2025. $ctx1.sendIdx["->"]=2;
  2026. associations=[$1,$2];
  2027. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2028. $5="a".__minus_gt((1));
  2029. $ctx1.sendIdx["->"]=3;
  2030. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2031. self._assertSameContents_as_($3,$4);
  2032. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2033. args: [],
  2034. 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 }.",
  2035. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2036. referencedClasses: []
  2037. }),
  2038. smalltalk.HashedCollectionTest);
  2039. smalltalk.addMethod(
  2040. smalltalk.method({
  2041. selector: "testNewFromPairs",
  2042. protocol: 'tests',
  2043. fn: function (){
  2044. var self=this;
  2045. var flattenedAssociations;
  2046. return smalltalk.withContext(function($ctx1) {
  2047. var $1,$3,$2;
  2048. flattenedAssociations=["a",(1),"b",(2)];
  2049. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2050. $3="a".__minus_gt((1));
  2051. $ctx1.sendIdx["->"]=1;
  2052. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2053. self._assertSameContents_as_($1,$2);
  2054. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2055. args: [],
  2056. 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 }.",
  2057. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2058. referencedClasses: []
  2059. }),
  2060. smalltalk.HashedCollectionTest);
  2061. smalltalk.addMethod(
  2062. smalltalk.method({
  2063. selector: "collectionClass",
  2064. protocol: 'fixture',
  2065. fn: function (){
  2066. var self=this;
  2067. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2068. return smalltalk.withContext(function($ctx1) {
  2069. return $HashedCollection();
  2070. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2071. args: [],
  2072. source: "collectionClass\x0a\x09^ HashedCollection",
  2073. messageSends: [],
  2074. referencedClasses: ["HashedCollection"]
  2075. }),
  2076. smalltalk.HashedCollectionTest.klass);
  2077. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2078. smalltalk.addMethod(
  2079. smalltalk.method({
  2080. selector: "collection",
  2081. protocol: 'fixture',
  2082. fn: function (){
  2083. var self=this;
  2084. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2085. return smalltalk.withContext(function($ctx1) {
  2086. var $2,$3,$1;
  2087. $2=_st($Dictionary())._new();
  2088. _st($2)._at_put_((1),(1));
  2089. $ctx1.sendIdx["at:put:"]=1;
  2090. _st($2)._at_put_("a",(2));
  2091. $ctx1.sendIdx["at:put:"]=2;
  2092. _st($2)._at_put_(true,(3));
  2093. $ctx1.sendIdx["at:put:"]=3;
  2094. _st($2)._at_put_((4),(-4));
  2095. $3=_st($2)._yourself();
  2096. $1=$3;
  2097. return $1;
  2098. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2099. args: [],
  2100. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09yourself",
  2101. messageSends: ["at:put:", "new", "yourself"],
  2102. referencedClasses: ["Dictionary"]
  2103. }),
  2104. smalltalk.DictionaryTest);
  2105. smalltalk.addMethod(
  2106. smalltalk.method({
  2107. selector: "collectionWithDuplicates",
  2108. protocol: 'fixture',
  2109. fn: function (){
  2110. var self=this;
  2111. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2112. return smalltalk.withContext(function($ctx1) {
  2113. var $2,$3,$1;
  2114. $2=_st($Dictionary())._new();
  2115. _st($2)._at_put_((1),(1));
  2116. $ctx1.sendIdx["at:put:"]=1;
  2117. _st($2)._at_put_("a",(2));
  2118. $ctx1.sendIdx["at:put:"]=2;
  2119. _st($2)._at_put_(true,(3));
  2120. $ctx1.sendIdx["at:put:"]=3;
  2121. _st($2)._at_put_((4),(-4));
  2122. $ctx1.sendIdx["at:put:"]=4;
  2123. _st($2)._at_put_("b",(1));
  2124. $ctx1.sendIdx["at:put:"]=5;
  2125. _st($2)._at_put_((3),(3));
  2126. $ctx1.sendIdx["at:put:"]=6;
  2127. _st($2)._at_put_(false,(12));
  2128. $3=_st($2)._yourself();
  2129. $1=$3;
  2130. return $1;
  2131. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2132. args: [],
  2133. 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",
  2134. messageSends: ["at:put:", "new", "yourself"],
  2135. referencedClasses: ["Dictionary"]
  2136. }),
  2137. smalltalk.DictionaryTest);
  2138. smalltalk.addMethod(
  2139. smalltalk.method({
  2140. selector: "testAccessing",
  2141. protocol: 'tests',
  2142. fn: function (){
  2143. var self=this;
  2144. var d;
  2145. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2146. return smalltalk.withContext(function($ctx1) {
  2147. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2148. d=_st($Dictionary())._new();
  2149. _st(d)._at_put_("hello","world");
  2150. $ctx1.sendIdx["at:put:"]=1;
  2151. $1=_st(d)._at_("hello");
  2152. $ctx1.sendIdx["at:"]=1;
  2153. self._assert_equals_($1,"world");
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2156. return smalltalk.withContext(function($ctx2) {
  2157. return nil;
  2158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2159. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2160. self._assert_equals_($2,"world");
  2161. $ctx1.sendIdx["assert:equals:"]=2;
  2162. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2163. return smalltalk.withContext(function($ctx2) {
  2164. return nil;
  2165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2166. $ctx1.sendIdx["deny:"]=1;
  2167. $3=_st(d)._includesKey_("hello");
  2168. $ctx1.sendIdx["includesKey:"]=1;
  2169. self._assert_($3);
  2170. $ctx1.sendIdx["assert:"]=1;
  2171. $4=_st(d)._includesKey_("foo");
  2172. $ctx1.sendIdx["includesKey:"]=2;
  2173. self._deny_($4);
  2174. $ctx1.sendIdx["deny:"]=2;
  2175. _st(d)._at_put_((1),(2));
  2176. $ctx1.sendIdx["at:put:"]=2;
  2177. $5=_st(d)._at_((1));
  2178. $ctx1.sendIdx["at:"]=2;
  2179. self._assert_equals_($5,(2));
  2180. $ctx1.sendIdx["assert:equals:"]=3;
  2181. $6=d;
  2182. $7=(1).__at((3));
  2183. $ctx1.sendIdx["@"]=1;
  2184. _st($6)._at_put_($7,(3));
  2185. $9=d;
  2186. $10=(1).__at((3));
  2187. $ctx1.sendIdx["@"]=2;
  2188. $8=_st($9)._at_($10);
  2189. self._assert_equals_($8,(3));
  2190. $12=d;
  2191. $13=(1).__at((3));
  2192. $ctx1.sendIdx["@"]=3;
  2193. $11=_st($12)._includesKey_($13);
  2194. $ctx1.sendIdx["includesKey:"]=3;
  2195. self._assert_($11);
  2196. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2197. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2198. args: [],
  2199. 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)",
  2200. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2201. referencedClasses: ["Dictionary"]
  2202. }),
  2203. smalltalk.DictionaryTest);
  2204. smalltalk.addMethod(
  2205. smalltalk.method({
  2206. selector: "testAsHashedCollection",
  2207. protocol: 'tests',
  2208. fn: function (){
  2209. var self=this;
  2210. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2211. return smalltalk.withContext(function($ctx1) {
  2212. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2213. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2214. args: [],
  2215. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2216. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2217. referencedClasses: ["HashedCollection"]
  2218. }),
  2219. smalltalk.DictionaryTest);
  2220. smalltalk.addMethod(
  2221. smalltalk.method({
  2222. selector: "testDynamicDictionaries",
  2223. protocol: 'tests',
  2224. fn: function (){
  2225. var self=this;
  2226. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2227. return smalltalk.withContext(function($ctx1) {
  2228. var $3,$2,$1;
  2229. $3="hello".__minus_gt((1));
  2230. $ctx1.sendIdx["->"]=1;
  2231. $2=smalltalk.HashedCollection._from_([$3]);
  2232. $1=_st($2)._asDictionary();
  2233. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  2234. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2235. args: [],
  2236. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2237. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2238. referencedClasses: ["Dictionary"]
  2239. }),
  2240. smalltalk.DictionaryTest);
  2241. smalltalk.addMethod(
  2242. smalltalk.method({
  2243. selector: "testEquality",
  2244. protocol: 'tests',
  2245. fn: function (){
  2246. var self=this;
  2247. var d1,d2;
  2248. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2249. return smalltalk.withContext(function($ctx1) {
  2250. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  2251. $2=_st($Dictionary())._new();
  2252. $ctx1.sendIdx["new"]=1;
  2253. $3=_st($Dictionary())._new();
  2254. $ctx1.sendIdx["new"]=2;
  2255. $1=_st($2).__eq($3);
  2256. $ctx1.sendIdx["="]=1;
  2257. self._assert_($1);
  2258. $ctx1.sendIdx["assert:"]=1;
  2259. $4=_st($Dictionary())._new();
  2260. $ctx1.sendIdx["new"]=3;
  2261. _st($4)._at_put_((1),(2));
  2262. $ctx1.sendIdx["at:put:"]=1;
  2263. $5=_st($4)._yourself();
  2264. $ctx1.sendIdx["yourself"]=1;
  2265. d1=$5;
  2266. $6=_st($Dictionary())._new();
  2267. $ctx1.sendIdx["new"]=4;
  2268. _st($6)._at_put_((1),(2));
  2269. $ctx1.sendIdx["at:put:"]=2;
  2270. $7=_st($6)._yourself();
  2271. $ctx1.sendIdx["yourself"]=2;
  2272. d2=$7;
  2273. $8=_st(d1).__eq(d2);
  2274. $ctx1.sendIdx["="]=2;
  2275. self._assert_($8);
  2276. $9=_st($Dictionary())._new();
  2277. $ctx1.sendIdx["new"]=5;
  2278. _st($9)._at_put_((1),(3));
  2279. $ctx1.sendIdx["at:put:"]=3;
  2280. $10=_st($9)._yourself();
  2281. $ctx1.sendIdx["yourself"]=3;
  2282. d2=$10;
  2283. $11=_st(d1).__eq(d2);
  2284. $ctx1.sendIdx["="]=3;
  2285. self._deny_($11);
  2286. $ctx1.sendIdx["deny:"]=1;
  2287. $12=_st($Dictionary())._new();
  2288. $ctx1.sendIdx["new"]=6;
  2289. _st($12)._at_put_((2),(2));
  2290. $ctx1.sendIdx["at:put:"]=4;
  2291. $13=_st($12)._yourself();
  2292. $ctx1.sendIdx["yourself"]=4;
  2293. d2=$13;
  2294. $14=_st(d1).__eq(d2);
  2295. $ctx1.sendIdx["="]=4;
  2296. self._deny_($14);
  2297. $ctx1.sendIdx["deny:"]=2;
  2298. $15=_st($Dictionary())._new();
  2299. _st($15)._at_put_((1),(2));
  2300. $ctx1.sendIdx["at:put:"]=5;
  2301. _st($15)._at_put_((3),(4));
  2302. $16=_st($15)._yourself();
  2303. d2=$16;
  2304. self._deny_(_st(d1).__eq(d2));
  2305. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2306. args: [],
  2307. 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.",
  2308. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2309. referencedClasses: ["Dictionary"]
  2310. }),
  2311. smalltalk.DictionaryTest);
  2312. smalltalk.addMethod(
  2313. smalltalk.method({
  2314. selector: "testIfPresent",
  2315. protocol: 'tests',
  2316. fn: function (){
  2317. var self=this;
  2318. var d,visited,absent;
  2319. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2320. return smalltalk.withContext(function($ctx1) {
  2321. visited=false;
  2322. d=_st($Dictionary())._new();
  2323. _st(d)._at_put_("hello","world");
  2324. _st(d)._at_ifPresent_("hello",(function(value){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. visited=value;
  2327. return visited;
  2328. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2329. $ctx1.sendIdx["at:ifPresent:"]=1;
  2330. self._assert_equals_(visited,"world");
  2331. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2332. return smalltalk.withContext(function($ctx2) {
  2333. visited=value;
  2334. return visited;
  2335. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2336. self._assert_(_st(absent)._isNil());
  2337. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2338. args: [],
  2339. source: "testIfPresent\x0a\x0a\x09| d visited absent |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  2340. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2341. referencedClasses: ["Dictionary"]
  2342. }),
  2343. smalltalk.DictionaryTest);
  2344. smalltalk.addMethod(
  2345. smalltalk.method({
  2346. selector: "testIfPresentIfAbsent",
  2347. protocol: 'tests',
  2348. fn: function (){
  2349. var self=this;
  2350. var d,visited;
  2351. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2352. return smalltalk.withContext(function($ctx1) {
  2353. visited=false;
  2354. d=_st($Dictionary())._new();
  2355. _st(d)._at_put_("hello","world");
  2356. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2357. return smalltalk.withContext(function($ctx2) {
  2358. visited=value;
  2359. return visited;
  2360. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. visited=true;
  2363. return visited;
  2364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2365. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2366. self._assert_equals_(visited,"world");
  2367. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2368. return smalltalk.withContext(function($ctx2) {
  2369. visited=value;
  2370. return visited;
  2371. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2372. return smalltalk.withContext(function($ctx2) {
  2373. visited=true;
  2374. return visited;
  2375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2376. self._assert_(visited);
  2377. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2378. args: [],
  2379. source: "testIfPresentIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  2380. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2381. referencedClasses: ["Dictionary"]
  2382. }),
  2383. smalltalk.DictionaryTest);
  2384. smalltalk.addMethod(
  2385. smalltalk.method({
  2386. selector: "testKeys",
  2387. protocol: 'tests',
  2388. fn: function (){
  2389. var self=this;
  2390. var d;
  2391. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2392. return smalltalk.withContext(function($ctx1) {
  2393. d=_st($Dictionary())._new();
  2394. _st(d)._at_put_((1),(2));
  2395. $ctx1.sendIdx["at:put:"]=1;
  2396. _st(d)._at_put_((2),(3));
  2397. $ctx1.sendIdx["at:put:"]=2;
  2398. _st(d)._at_put_((3),(4));
  2399. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2400. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2401. args: [],
  2402. 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)",
  2403. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2404. referencedClasses: ["Dictionary"]
  2405. }),
  2406. smalltalk.DictionaryTest);
  2407. smalltalk.addMethod(
  2408. smalltalk.method({
  2409. selector: "testPointKey",
  2410. protocol: 'tests',
  2411. fn: function (){
  2412. var self=this;
  2413. var d;
  2414. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2415. return smalltalk.withContext(function($ctx1) {
  2416. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2417. d=_st($Dictionary())._new();
  2418. $1=d;
  2419. $2=(1).__at((1));
  2420. $ctx1.sendIdx["@"]=1;
  2421. _st($1)._at_put_($2,"foo");
  2422. $ctx1.sendIdx["at:put:"]=1;
  2423. $4=d;
  2424. $5=(1).__at((1));
  2425. $ctx1.sendIdx["@"]=2;
  2426. $3=_st($4)._at_($5);
  2427. $ctx1.sendIdx["at:"]=1;
  2428. self._assert_equals_($3,"foo");
  2429. $ctx1.sendIdx["assert:equals:"]=1;
  2430. $6=d;
  2431. $7=(1).__at((1));
  2432. $ctx1.sendIdx["@"]=3;
  2433. _st($6)._at_put_($7,"bar");
  2434. $9=d;
  2435. $10=(1).__at((1));
  2436. $ctx1.sendIdx["@"]=4;
  2437. $8=_st($9)._at_($10);
  2438. self._assert_equals_($8,"bar");
  2439. $ctx1.sendIdx["assert:equals:"]=2;
  2440. $11=d;
  2441. $12=(1).__at((1));
  2442. $ctx1.sendIdx["@"]=5;
  2443. _st($11)._removeKey_($12);
  2444. $14=d;
  2445. $15=(1).__at((1));
  2446. $ctx1.sendIdx["@"]=6;
  2447. $13=_st($14)._at_ifAbsent_($15,(function(){
  2448. return smalltalk.withContext(function($ctx2) {
  2449. return "baz";
  2450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2451. self._assert_equals_($13,"baz");
  2452. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2453. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2454. args: [],
  2455. 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)",
  2456. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2457. referencedClasses: ["Dictionary"]
  2458. }),
  2459. smalltalk.DictionaryTest);
  2460. smalltalk.addMethod(
  2461. smalltalk.method({
  2462. selector: "testPrintString",
  2463. protocol: 'tests',
  2464. fn: function (){
  2465. var self=this;
  2466. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2467. return smalltalk.withContext(function($ctx1) {
  2468. var $2,$3,$1;
  2469. $2=_st($Dictionary())._new();
  2470. _st($2)._at_put_("firstname","James");
  2471. $ctx1.sendIdx["at:put:"]=1;
  2472. _st($2)._at_put_("lastname","Bond");
  2473. $3=_st($2)._printString();
  2474. $1=$3;
  2475. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2476. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2477. args: [],
  2478. 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'')'",
  2479. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2480. referencedClasses: ["Dictionary"]
  2481. }),
  2482. smalltalk.DictionaryTest);
  2483. smalltalk.addMethod(
  2484. smalltalk.method({
  2485. selector: "testRemoveKey",
  2486. protocol: 'tests',
  2487. fn: function (){
  2488. var self=this;
  2489. var d,key;
  2490. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2491. return smalltalk.withContext(function($ctx1) {
  2492. var $1;
  2493. d=_st($Dictionary())._new();
  2494. _st(d)._at_put_((1),(2));
  2495. $ctx1.sendIdx["at:put:"]=1;
  2496. _st(d)._at_put_((2),(3));
  2497. $ctx1.sendIdx["at:put:"]=2;
  2498. _st(d)._at_put_((3),(4));
  2499. key=(2);
  2500. $1=_st(d)._keys();
  2501. $ctx1.sendIdx["keys"]=1;
  2502. self._assert_equals_($1,[(1), (2), (3)]);
  2503. $ctx1.sendIdx["assert:equals:"]=1;
  2504. _st(d)._removeKey_(key);
  2505. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  2506. $ctx1.sendIdx["assert:equals:"]=2;
  2507. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2508. self._deny_(_st(d)._includesKey_((2)));
  2509. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2510. args: [],
  2511. 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)",
  2512. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2513. referencedClasses: ["Dictionary"]
  2514. }),
  2515. smalltalk.DictionaryTest);
  2516. smalltalk.addMethod(
  2517. smalltalk.method({
  2518. selector: "testRemoveKeyIfAbsent",
  2519. protocol: 'tests',
  2520. fn: function (){
  2521. var self=this;
  2522. var d,key;
  2523. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2524. return smalltalk.withContext(function($ctx1) {
  2525. var $1;
  2526. d=_st($Dictionary())._new();
  2527. _st(d)._at_put_((1),(2));
  2528. $ctx1.sendIdx["at:put:"]=1;
  2529. _st(d)._at_put_((2),(3));
  2530. $ctx1.sendIdx["at:put:"]=2;
  2531. _st(d)._at_put_((3),(4));
  2532. key=(2);
  2533. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2534. $ctx1.sendIdx["assert:equals:"]=1;
  2535. key=(3);
  2536. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2537. return smalltalk.withContext(function($ctx2) {
  2538. return (42);
  2539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2540. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2541. self._assert_equals_($1,(4));
  2542. $ctx1.sendIdx["assert:equals:"]=2;
  2543. key="why";
  2544. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  2545. return smalltalk.withContext(function($ctx2) {
  2546. return (42);
  2547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  2548. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2549. args: [],
  2550. 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.",
  2551. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2552. referencedClasses: ["Dictionary"]
  2553. }),
  2554. smalltalk.DictionaryTest);
  2555. smalltalk.addMethod(
  2556. smalltalk.method({
  2557. selector: "testSize",
  2558. protocol: 'tests',
  2559. fn: function (){
  2560. var self=this;
  2561. var d;
  2562. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2563. return smalltalk.withContext(function($ctx1) {
  2564. var $1,$2;
  2565. d=_st($Dictionary())._new();
  2566. $1=_st(d)._size();
  2567. $ctx1.sendIdx["size"]=1;
  2568. self._assert_equals_($1,(0));
  2569. $ctx1.sendIdx["assert:equals:"]=1;
  2570. _st(d)._at_put_((1),(2));
  2571. $ctx1.sendIdx["at:put:"]=1;
  2572. $2=_st(d)._size();
  2573. $ctx1.sendIdx["size"]=2;
  2574. self._assert_equals_($2,(1));
  2575. $ctx1.sendIdx["assert:equals:"]=2;
  2576. _st(d)._at_put_((2),(3));
  2577. self._assert_equals_(_st(d)._size(),(2));
  2578. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2579. args: [],
  2580. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size equals: 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size equals: 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size equals: 2.",
  2581. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2582. referencedClasses: ["Dictionary"]
  2583. }),
  2584. smalltalk.DictionaryTest);
  2585. smalltalk.addMethod(
  2586. smalltalk.method({
  2587. selector: "testValues",
  2588. protocol: 'tests',
  2589. fn: function (){
  2590. var self=this;
  2591. var d;
  2592. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2593. return smalltalk.withContext(function($ctx1) {
  2594. d=_st($Dictionary())._new();
  2595. _st(d)._at_put_((1),(2));
  2596. $ctx1.sendIdx["at:put:"]=1;
  2597. _st(d)._at_put_((2),(3));
  2598. $ctx1.sendIdx["at:put:"]=2;
  2599. _st(d)._at_put_((3),(4));
  2600. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2601. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2602. args: [],
  2603. 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)",
  2604. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2605. referencedClasses: ["Dictionary"]
  2606. }),
  2607. smalltalk.DictionaryTest);
  2608. smalltalk.addMethod(
  2609. smalltalk.method({
  2610. selector: "collectionClass",
  2611. protocol: 'fixture',
  2612. fn: function (){
  2613. var self=this;
  2614. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2615. return smalltalk.withContext(function($ctx1) {
  2616. return $Dictionary();
  2617. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2618. args: [],
  2619. source: "collectionClass\x0a\x09^ Dictionary",
  2620. messageSends: [],
  2621. referencedClasses: ["Dictionary"]
  2622. }),
  2623. smalltalk.DictionaryTest.klass);
  2624. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2625. smalltalk.addMethod(
  2626. smalltalk.method({
  2627. selector: "collectionFirst",
  2628. protocol: 'fixture',
  2629. fn: function (){
  2630. var self=this;
  2631. return smalltalk.withContext(function($ctx1) {
  2632. self._subclassResponsibility();
  2633. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  2634. args: [],
  2635. source: "collectionFirst\x0a\x09self subclassResponsibility",
  2636. messageSends: ["subclassResponsibility"],
  2637. referencedClasses: []
  2638. }),
  2639. smalltalk.SequenceableCollectionTest);
  2640. smalltalk.addMethod(
  2641. smalltalk.method({
  2642. selector: "collectionFirstTwo",
  2643. protocol: 'fixture',
  2644. fn: function (){
  2645. var self=this;
  2646. return smalltalk.withContext(function($ctx1) {
  2647. self._subclassResponsibility();
  2648. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  2649. args: [],
  2650. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  2651. messageSends: ["subclassResponsibility"],
  2652. referencedClasses: []
  2653. }),
  2654. smalltalk.SequenceableCollectionTest);
  2655. smalltalk.addMethod(
  2656. smalltalk.method({
  2657. selector: "collectionLast",
  2658. protocol: 'fixture',
  2659. fn: function (){
  2660. var self=this;
  2661. return smalltalk.withContext(function($ctx1) {
  2662. self._subclassResponsibility();
  2663. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  2664. args: [],
  2665. source: "collectionLast\x0a\x09self subclassResponsibility",
  2666. messageSends: ["subclassResponsibility"],
  2667. referencedClasses: []
  2668. }),
  2669. smalltalk.SequenceableCollectionTest);
  2670. smalltalk.addMethod(
  2671. smalltalk.method({
  2672. selector: "collectionLastTwo",
  2673. protocol: 'fixture',
  2674. fn: function (){
  2675. var self=this;
  2676. return smalltalk.withContext(function($ctx1) {
  2677. self._subclassResponsibility();
  2678. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  2679. args: [],
  2680. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  2681. messageSends: ["subclassResponsibility"],
  2682. referencedClasses: []
  2683. }),
  2684. smalltalk.SequenceableCollectionTest);
  2685. smalltalk.addMethod(
  2686. smalltalk.method({
  2687. selector: "nonIndexesDo:",
  2688. protocol: 'fixture',
  2689. fn: function (aBlock){
  2690. var self=this;
  2691. return smalltalk.withContext(function($ctx1) {
  2692. _st(aBlock)._value_((0));
  2693. $ctx1.sendIdx["value:"]=1;
  2694. _st(aBlock)._value_(_st(_st(self._collection())._size()).__plus((1)));
  2695. $ctx1.sendIdx["value:"]=2;
  2696. _st(aBlock)._value_("z");
  2697. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  2698. args: ["aBlock"],
  2699. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collection size + 1.\x0a\x09aBlock value: 'z'",
  2700. messageSends: ["value:", "+", "size", "collection"],
  2701. referencedClasses: []
  2702. }),
  2703. smalltalk.SequenceableCollectionTest);
  2704. smalltalk.addMethod(
  2705. smalltalk.method({
  2706. selector: "samplesDo:",
  2707. protocol: 'fixture',
  2708. fn: function (aBlock){
  2709. var self=this;
  2710. return smalltalk.withContext(function($ctx1) {
  2711. _st(aBlock)._value_value_((1),self._collectionFirst());
  2712. $ctx1.sendIdx["value:value:"]=1;
  2713. _st(aBlock)._value_value_(_st(self._collection())._size(),self._collectionLast());
  2714. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  2715. args: ["aBlock"],
  2716. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collection size value: self collectionLast",
  2717. messageSends: ["value:value:", "collectionFirst", "size", "collection", "collectionLast"],
  2718. referencedClasses: []
  2719. }),
  2720. smalltalk.SequenceableCollectionTest);
  2721. smalltalk.addMethod(
  2722. smalltalk.method({
  2723. selector: "testBeginsWith",
  2724. protocol: 'tests',
  2725. fn: function (){
  2726. var self=this;
  2727. return smalltalk.withContext(function($ctx1) {
  2728. var $2,$1,$4,$5,$3,$7,$6;
  2729. $2=self._collection();
  2730. $ctx1.sendIdx["collection"]=1;
  2731. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  2732. $ctx1.sendIdx["beginsWith:"]=1;
  2733. self._assert_($1);
  2734. $ctx1.sendIdx["assert:"]=1;
  2735. $4=self._collection();
  2736. $ctx1.sendIdx["collection"]=2;
  2737. $5=self._collection();
  2738. $ctx1.sendIdx["collection"]=3;
  2739. $3=_st($4)._beginsWith_($5);
  2740. $ctx1.sendIdx["beginsWith:"]=2;
  2741. self._assert_($3);
  2742. $ctx1.sendIdx["assert:"]=2;
  2743. $7=self._collection();
  2744. $ctx1.sendIdx["collection"]=4;
  2745. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  2746. $ctx1.sendIdx["beginsWith:"]=3;
  2747. self._assert_($6);
  2748. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  2749. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  2750. args: [],
  2751. 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)",
  2752. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  2753. referencedClasses: []
  2754. }),
  2755. smalltalk.SequenceableCollectionTest);
  2756. smalltalk.addMethod(
  2757. smalltalk.method({
  2758. selector: "testEndsWith",
  2759. protocol: 'tests',
  2760. fn: function (){
  2761. var self=this;
  2762. return smalltalk.withContext(function($ctx1) {
  2763. var $2,$1,$4,$5,$3,$7,$6;
  2764. $2=self._collection();
  2765. $ctx1.sendIdx["collection"]=1;
  2766. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  2767. $ctx1.sendIdx["endsWith:"]=1;
  2768. self._assert_($1);
  2769. $ctx1.sendIdx["assert:"]=1;
  2770. $4=self._collection();
  2771. $ctx1.sendIdx["collection"]=2;
  2772. $5=self._collection();
  2773. $ctx1.sendIdx["collection"]=3;
  2774. $3=_st($4)._endsWith_($5);
  2775. $ctx1.sendIdx["endsWith:"]=2;
  2776. self._assert_($3);
  2777. $ctx1.sendIdx["assert:"]=2;
  2778. $7=self._collection();
  2779. $ctx1.sendIdx["collection"]=4;
  2780. $6=_st($7)._endsWith_(self._collectionLastTwo());
  2781. $ctx1.sendIdx["endsWith:"]=3;
  2782. self._assert_($6);
  2783. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  2784. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  2785. args: [],
  2786. 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)",
  2787. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  2788. referencedClasses: []
  2789. }),
  2790. smalltalk.SequenceableCollectionTest);
  2791. smalltalk.addMethod(
  2792. smalltalk.method({
  2793. selector: "testFirst",
  2794. protocol: 'tests',
  2795. fn: function (){
  2796. var self=this;
  2797. return smalltalk.withContext(function($ctx1) {
  2798. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2800. args: [],
  2801. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  2802. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  2803. referencedClasses: []
  2804. }),
  2805. smalltalk.SequenceableCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testFirstN",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2813. return smalltalk.withContext(function($ctx1) {
  2814. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  2815. $2=self._collection();
  2816. $ctx1.sendIdx["collection"]=1;
  2817. $1=_st($2)._first_((2));
  2818. $ctx1.sendIdx["first:"]=1;
  2819. self._assert_equals_($1,self._collectionFirstTwo());
  2820. $ctx1.sendIdx["assert:equals:"]=1;
  2821. $4=self._collection();
  2822. $ctx1.sendIdx["collection"]=2;
  2823. $3=_st($4)._first_((0));
  2824. $ctx1.sendIdx["first:"]=2;
  2825. self._assert_equals_($3,_st(self._collectionClass())._new());
  2826. $ctx1.sendIdx["assert:equals:"]=2;
  2827. $6=self._collection();
  2828. $ctx1.sendIdx["collection"]=3;
  2829. $8=self._collection();
  2830. $ctx1.sendIdx["collection"]=4;
  2831. $7=_st($8)._size();
  2832. $5=_st($6)._first_($7);
  2833. $ctx1.sendIdx["first:"]=3;
  2834. $9=self._collection();
  2835. $ctx1.sendIdx["collection"]=5;
  2836. self._assert_equals_($5,$9);
  2837. self._should_raise_((function(){
  2838. return smalltalk.withContext(function($ctx2) {
  2839. return _st(self._collection())._first_((33));
  2840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2841. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  2842. args: [],
  2843. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  2844. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "size", "should:raise:"],
  2845. referencedClasses: ["Error"]
  2846. }),
  2847. smalltalk.SequenceableCollectionTest);
  2848. smalltalk.addMethod(
  2849. smalltalk.method({
  2850. selector: "testFourth",
  2851. protocol: 'tests',
  2852. fn: function (){
  2853. var self=this;
  2854. return smalltalk.withContext(function($ctx1) {
  2855. var $2,$1;
  2856. $2=self._collection();
  2857. $ctx1.sendIdx["collection"]=1;
  2858. $1=_st($2)._fourth();
  2859. self._assert_equals_($1,_st(self._collection())._at_((4)));
  2860. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2861. args: [],
  2862. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2863. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2864. referencedClasses: []
  2865. }),
  2866. smalltalk.SequenceableCollectionTest);
  2867. smalltalk.addMethod(
  2868. smalltalk.method({
  2869. selector: "testLast",
  2870. protocol: 'tests',
  2871. fn: function (){
  2872. var self=this;
  2873. return smalltalk.withContext(function($ctx1) {
  2874. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  2875. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2876. args: [],
  2877. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  2878. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  2879. referencedClasses: []
  2880. }),
  2881. smalltalk.SequenceableCollectionTest);
  2882. smalltalk.addMethod(
  2883. smalltalk.method({
  2884. selector: "testLastN",
  2885. protocol: 'tests',
  2886. fn: function (){
  2887. var self=this;
  2888. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2889. return smalltalk.withContext(function($ctx1) {
  2890. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  2891. $2=self._collection();
  2892. $ctx1.sendIdx["collection"]=1;
  2893. $1=_st($2)._last_((2));
  2894. $ctx1.sendIdx["last:"]=1;
  2895. self._assert_equals_($1,self._collectionLastTwo());
  2896. $ctx1.sendIdx["assert:equals:"]=1;
  2897. $4=self._collection();
  2898. $ctx1.sendIdx["collection"]=2;
  2899. $3=_st($4)._last_((0));
  2900. $ctx1.sendIdx["last:"]=2;
  2901. self._assert_equals_($3,_st(self._collectionClass())._new());
  2902. $ctx1.sendIdx["assert:equals:"]=2;
  2903. $6=self._collection();
  2904. $ctx1.sendIdx["collection"]=3;
  2905. $8=self._collection();
  2906. $ctx1.sendIdx["collection"]=4;
  2907. $7=_st($8)._size();
  2908. $5=_st($6)._last_($7);
  2909. $ctx1.sendIdx["last:"]=3;
  2910. $9=self._collection();
  2911. $ctx1.sendIdx["collection"]=5;
  2912. self._assert_equals_($5,$9);
  2913. self._should_raise_((function(){
  2914. return smalltalk.withContext(function($ctx2) {
  2915. return _st(self._collection())._last_((33));
  2916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2917. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  2918. args: [],
  2919. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  2920. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "size", "should:raise:"],
  2921. referencedClasses: ["Error"]
  2922. }),
  2923. smalltalk.SequenceableCollectionTest);
  2924. smalltalk.addMethod(
  2925. smalltalk.method({
  2926. selector: "testSecond",
  2927. protocol: 'tests',
  2928. fn: function (){
  2929. var self=this;
  2930. return smalltalk.withContext(function($ctx1) {
  2931. var $2,$1;
  2932. $2=self._collection();
  2933. $ctx1.sendIdx["collection"]=1;
  2934. $1=_st($2)._second();
  2935. self._assert_equals_($1,_st(self._collection())._at_((2)));
  2936. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2937. args: [],
  2938. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2939. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2940. referencedClasses: []
  2941. }),
  2942. smalltalk.SequenceableCollectionTest);
  2943. smalltalk.addMethod(
  2944. smalltalk.method({
  2945. selector: "testThird",
  2946. protocol: 'tests',
  2947. fn: function (){
  2948. var self=this;
  2949. return smalltalk.withContext(function($ctx1) {
  2950. var $2,$1;
  2951. $2=self._collection();
  2952. $ctx1.sendIdx["collection"]=1;
  2953. $1=_st($2)._third();
  2954. self._assert_equals_($1,_st(self._collection())._at_((3)));
  2955. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2956. args: [],
  2957. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2958. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2959. referencedClasses: []
  2960. }),
  2961. smalltalk.SequenceableCollectionTest);
  2962. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2963. smalltalk.addMethod(
  2964. smalltalk.method({
  2965. selector: "collection",
  2966. protocol: 'fixture',
  2967. fn: function (){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) {
  2970. var $1;
  2971. $1=[(1), (2), (3), (-4)];
  2972. return $1;
  2973. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  2974. args: [],
  2975. source: "collection\x0a\x09^ #(1 2 3 -4)",
  2976. messageSends: [],
  2977. referencedClasses: []
  2978. }),
  2979. smalltalk.ArrayTest);
  2980. smalltalk.addMethod(
  2981. smalltalk.method({
  2982. selector: "collectionFirst",
  2983. protocol: 'fixture',
  2984. fn: function (){
  2985. var self=this;
  2986. return smalltalk.withContext(function($ctx1) {
  2987. return (1);
  2988. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  2989. args: [],
  2990. source: "collectionFirst\x0a\x09^ 1",
  2991. messageSends: [],
  2992. referencedClasses: []
  2993. }),
  2994. smalltalk.ArrayTest);
  2995. smalltalk.addMethod(
  2996. smalltalk.method({
  2997. selector: "collectionFirstTwo",
  2998. protocol: 'fixture',
  2999. fn: function (){
  3000. var self=this;
  3001. return smalltalk.withContext(function($ctx1) {
  3002. var $1;
  3003. $1=[(1), (2)];
  3004. return $1;
  3005. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3006. args: [],
  3007. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3008. messageSends: [],
  3009. referencedClasses: []
  3010. }),
  3011. smalltalk.ArrayTest);
  3012. smalltalk.addMethod(
  3013. smalltalk.method({
  3014. selector: "collectionLast",
  3015. protocol: 'fixture',
  3016. fn: function (){
  3017. var self=this;
  3018. return smalltalk.withContext(function($ctx1) {
  3019. return (-4);
  3020. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3021. args: [],
  3022. source: "collectionLast\x0a\x09^ -4",
  3023. messageSends: [],
  3024. referencedClasses: []
  3025. }),
  3026. smalltalk.ArrayTest);
  3027. smalltalk.addMethod(
  3028. smalltalk.method({
  3029. selector: "collectionLastTwo",
  3030. protocol: 'fixture',
  3031. fn: function (){
  3032. var self=this;
  3033. return smalltalk.withContext(function($ctx1) {
  3034. var $1;
  3035. $1=[(3), (-4)];
  3036. return $1;
  3037. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3038. args: [],
  3039. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3040. messageSends: [],
  3041. referencedClasses: []
  3042. }),
  3043. smalltalk.ArrayTest);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "collectionWithDuplicates",
  3047. protocol: 'fixture',
  3048. fn: function (){
  3049. var self=this;
  3050. return smalltalk.withContext(function($ctx1) {
  3051. var $1;
  3052. $1=["a", "b", "c", (1), (2), (1), "a"];
  3053. return $1;
  3054. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3055. args: [],
  3056. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3057. messageSends: [],
  3058. referencedClasses: []
  3059. }),
  3060. smalltalk.ArrayTest);
  3061. smalltalk.addMethod(
  3062. smalltalk.method({
  3063. selector: "samplesDo:",
  3064. protocol: 'fixture',
  3065. fn: function (aBlock){
  3066. var self=this;
  3067. return smalltalk.withContext(function($ctx1) {
  3068. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3069. _st(aBlock)._value_value_((3),(3));
  3070. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3071. args: ["aBlock"],
  3072. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3073. messageSends: ["samplesDo:", "value:value:"],
  3074. referencedClasses: []
  3075. }),
  3076. smalltalk.ArrayTest);
  3077. smalltalk.addMethod(
  3078. smalltalk.method({
  3079. selector: "testAdd",
  3080. protocol: 'tests',
  3081. fn: function (){
  3082. var self=this;
  3083. var array;
  3084. return smalltalk.withContext(function($ctx1) {
  3085. array=self._collection();
  3086. _st(array)._add_((6));
  3087. self._assert_equals_(_st(array)._last(),(6));
  3088. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3089. args: [],
  3090. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3091. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3092. referencedClasses: []
  3093. }),
  3094. smalltalk.ArrayTest);
  3095. smalltalk.addMethod(
  3096. smalltalk.method({
  3097. selector: "testAddFirst",
  3098. protocol: 'tests',
  3099. fn: function (){
  3100. var self=this;
  3101. return smalltalk.withContext(function($ctx1) {
  3102. var $1,$2;
  3103. $1=self._collection();
  3104. _st($1)._addFirst_((0));
  3105. $2=_st($1)._yourself();
  3106. self._assert_equals_(_st($2)._first(),(0));
  3107. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3108. args: [],
  3109. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3110. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3111. referencedClasses: []
  3112. }),
  3113. smalltalk.ArrayTest);
  3114. smalltalk.addMethod(
  3115. smalltalk.method({
  3116. selector: "testPrintString",
  3117. protocol: 'tests',
  3118. fn: function (){
  3119. var self=this;
  3120. var array;
  3121. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3122. return smalltalk.withContext(function($ctx1) {
  3123. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3124. array=_st($Array())._new();
  3125. $1=_st(array)._printString();
  3126. $ctx1.sendIdx["printString"]=1;
  3127. self._assert_equals_($1,"an Array ()");
  3128. $ctx1.sendIdx["assert:equals:"]=1;
  3129. $2=array;
  3130. _st($2)._add_((1));
  3131. $ctx1.sendIdx["add:"]=1;
  3132. $3=_st($2)._add_((3));
  3133. $ctx1.sendIdx["add:"]=2;
  3134. $4=_st(array)._printString();
  3135. $ctx1.sendIdx["printString"]=2;
  3136. self._assert_equals_($4,"an Array (1 3)");
  3137. $ctx1.sendIdx["assert:equals:"]=2;
  3138. _st(array)._add_("foo");
  3139. $5=_st(array)._printString();
  3140. $ctx1.sendIdx["printString"]=3;
  3141. self._assert_equals_($5,"an Array (1 3 'foo')");
  3142. $ctx1.sendIdx["assert:equals:"]=3;
  3143. $6=array;
  3144. _st($6)._remove_((1));
  3145. $ctx1.sendIdx["remove:"]=1;
  3146. $7=_st($6)._remove_((3));
  3147. $8=_st(array)._printString();
  3148. $ctx1.sendIdx["printString"]=4;
  3149. self._assert_equals_($8,"an Array ('foo')");
  3150. $ctx1.sendIdx["assert:equals:"]=4;
  3151. _st(array)._addLast_((3));
  3152. $ctx1.sendIdx["addLast:"]=1;
  3153. $9=_st(array)._printString();
  3154. $ctx1.sendIdx["printString"]=5;
  3155. self._assert_equals_($9,"an Array ('foo' 3)");
  3156. $ctx1.sendIdx["assert:equals:"]=5;
  3157. _st(array)._addLast_((3));
  3158. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3159. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3160. args: [],
  3161. 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)'.",
  3162. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3163. referencedClasses: ["Array"]
  3164. }),
  3165. smalltalk.ArrayTest);
  3166. smalltalk.addMethod(
  3167. smalltalk.method({
  3168. selector: "testRemove",
  3169. protocol: 'tests',
  3170. fn: function (){
  3171. var self=this;
  3172. var array;
  3173. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3174. return smalltalk.withContext(function($ctx1) {
  3175. array=[(1), (2), (3), (4), (5)];
  3176. _st(array)._remove_((3));
  3177. $ctx1.sendIdx["remove:"]=1;
  3178. self._assert_equals_(array,[(1), (2), (4), (5)]);
  3179. self._should_raise_((function(){
  3180. return smalltalk.withContext(function($ctx2) {
  3181. return _st(array)._remove_((3));
  3182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3183. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  3184. args: [],
  3185. 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",
  3186. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  3187. referencedClasses: ["Error"]
  3188. }),
  3189. smalltalk.ArrayTest);
  3190. smalltalk.addMethod(
  3191. smalltalk.method({
  3192. selector: "testRemoveFromTo",
  3193. protocol: 'tests',
  3194. fn: function (){
  3195. var self=this;
  3196. return smalltalk.withContext(function($ctx1) {
  3197. var $1,$2;
  3198. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  3199. $ctx1.sendIdx["removeFrom:to:"]=1;
  3200. self._assert_equals_($1,[(4)]);
  3201. $ctx1.sendIdx["assert:equals:"]=1;
  3202. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  3203. $ctx1.sendIdx["removeFrom:to:"]=2;
  3204. self._assert_equals_($2,[(1), (4)]);
  3205. $ctx1.sendIdx["assert:equals:"]=2;
  3206. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  3207. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  3208. args: [],
  3209. 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)",
  3210. messageSends: ["assert:equals:", "removeFrom:to:"],
  3211. referencedClasses: []
  3212. }),
  3213. smalltalk.ArrayTest);
  3214. smalltalk.addMethod(
  3215. smalltalk.method({
  3216. selector: "testRemoveIndex",
  3217. protocol: 'tests',
  3218. fn: function (){
  3219. var self=this;
  3220. return smalltalk.withContext(function($ctx1) {
  3221. var $1,$2;
  3222. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  3223. $ctx1.sendIdx["removeIndex:"]=1;
  3224. self._assert_equals_($1,[(1), (3), (4)]);
  3225. $ctx1.sendIdx["assert:equals:"]=1;
  3226. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  3227. $ctx1.sendIdx["removeIndex:"]=2;
  3228. self._assert_equals_($2,[(2), (3), (4)]);
  3229. $ctx1.sendIdx["assert:equals:"]=2;
  3230. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  3231. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  3232. args: [],
  3233. 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: #()",
  3234. messageSends: ["assert:equals:", "removeIndex:"],
  3235. referencedClasses: []
  3236. }),
  3237. smalltalk.ArrayTest);
  3238. smalltalk.addMethod(
  3239. smalltalk.method({
  3240. selector: "testRemoveLast",
  3241. protocol: 'tests',
  3242. fn: function (){
  3243. var self=this;
  3244. var array;
  3245. return smalltalk.withContext(function($ctx1) {
  3246. array=[(1), (2)];
  3247. _st(array)._removeLast();
  3248. self._assert_equals_(_st(array)._last(),(1));
  3249. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  3250. args: [],
  3251. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  3252. messageSends: ["removeLast", "assert:equals:", "last"],
  3253. referencedClasses: []
  3254. }),
  3255. smalltalk.ArrayTest);
  3256. smalltalk.addMethod(
  3257. smalltalk.method({
  3258. selector: "testReversed",
  3259. protocol: 'tests',
  3260. fn: function (){
  3261. var self=this;
  3262. var array;
  3263. return smalltalk.withContext(function($ctx1) {
  3264. array=[(5), (4), (3), (2), (1)];
  3265. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  3266. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  3267. args: [],
  3268. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  3269. messageSends: ["assert:equals:", "reversed"],
  3270. referencedClasses: []
  3271. }),
  3272. smalltalk.ArrayTest);
  3273. smalltalk.addMethod(
  3274. smalltalk.method({
  3275. selector: "testSort",
  3276. protocol: 'tests',
  3277. fn: function (){
  3278. var self=this;
  3279. var array;
  3280. return smalltalk.withContext(function($ctx1) {
  3281. array=[(3), (1), (4), (5), (2)];
  3282. _st(array)._sort();
  3283. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  3284. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  3285. args: [],
  3286. 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)",
  3287. messageSends: ["sort", "assert:equals:"],
  3288. referencedClasses: []
  3289. }),
  3290. smalltalk.ArrayTest);
  3291. smalltalk.addMethod(
  3292. smalltalk.method({
  3293. selector: "collectionClass",
  3294. protocol: 'fixture',
  3295. fn: function (){
  3296. var self=this;
  3297. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3298. return smalltalk.withContext(function($ctx1) {
  3299. return $Array();
  3300. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  3301. args: [],
  3302. source: "collectionClass\x0a\x09^ Array",
  3303. messageSends: [],
  3304. referencedClasses: ["Array"]
  3305. }),
  3306. smalltalk.ArrayTest.klass);
  3307. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3308. smalltalk.addMethod(
  3309. smalltalk.method({
  3310. selector: "collection",
  3311. protocol: 'fixture',
  3312. fn: function (){
  3313. var self=this;
  3314. return smalltalk.withContext(function($ctx1) {
  3315. return "hello";
  3316. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  3317. args: [],
  3318. source: "collection\x0a\x09^ 'hello'",
  3319. messageSends: [],
  3320. referencedClasses: []
  3321. }),
  3322. smalltalk.StringTest);
  3323. smalltalk.addMethod(
  3324. smalltalk.method({
  3325. selector: "collectionFirst",
  3326. protocol: 'fixture',
  3327. fn: function (){
  3328. var self=this;
  3329. return smalltalk.withContext(function($ctx1) {
  3330. return "h";
  3331. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  3332. args: [],
  3333. source: "collectionFirst\x0a\x09^ 'h'",
  3334. messageSends: [],
  3335. referencedClasses: []
  3336. }),
  3337. smalltalk.StringTest);
  3338. smalltalk.addMethod(
  3339. smalltalk.method({
  3340. selector: "collectionFirstTwo",
  3341. protocol: 'fixture',
  3342. fn: function (){
  3343. var self=this;
  3344. return smalltalk.withContext(function($ctx1) {
  3345. return "he";
  3346. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  3347. args: [],
  3348. source: "collectionFirstTwo\x0a\x09^ 'he'",
  3349. messageSends: [],
  3350. referencedClasses: []
  3351. }),
  3352. smalltalk.StringTest);
  3353. smalltalk.addMethod(
  3354. smalltalk.method({
  3355. selector: "collectionLast",
  3356. protocol: 'fixture',
  3357. fn: function (){
  3358. var self=this;
  3359. return smalltalk.withContext(function($ctx1) {
  3360. return "o";
  3361. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  3362. args: [],
  3363. source: "collectionLast\x0a\x09^ 'o'",
  3364. messageSends: [],
  3365. referencedClasses: []
  3366. }),
  3367. smalltalk.StringTest);
  3368. smalltalk.addMethod(
  3369. smalltalk.method({
  3370. selector: "collectionLastTwo",
  3371. protocol: 'fixture',
  3372. fn: function (){
  3373. var self=this;
  3374. return smalltalk.withContext(function($ctx1) {
  3375. return "lo";
  3376. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  3377. args: [],
  3378. source: "collectionLastTwo\x0a\x09^ 'lo'",
  3379. messageSends: [],
  3380. referencedClasses: []
  3381. }),
  3382. smalltalk.StringTest);
  3383. smalltalk.addMethod(
  3384. smalltalk.method({
  3385. selector: "collectionWithDuplicates",
  3386. protocol: 'fixture',
  3387. fn: function (){
  3388. var self=this;
  3389. return smalltalk.withContext(function($ctx1) {
  3390. return "abbaerte";
  3391. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  3392. args: [],
  3393. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  3394. messageSends: [],
  3395. referencedClasses: []
  3396. }),
  3397. smalltalk.StringTest);
  3398. smalltalk.addMethod(
  3399. smalltalk.method({
  3400. selector: "samplesDo:",
  3401. protocol: 'fixture',
  3402. fn: function (aBlock){
  3403. var self=this;
  3404. return smalltalk.withContext(function($ctx1) {
  3405. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3406. _st(aBlock)._value_value_((3),"l");
  3407. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  3408. args: ["aBlock"],
  3409. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  3410. messageSends: ["samplesDo:", "value:value:"],
  3411. referencedClasses: []
  3412. }),
  3413. smalltalk.StringTest);
  3414. smalltalk.addMethod(
  3415. smalltalk.method({
  3416. selector: "testAddRemove",
  3417. protocol: 'tests',
  3418. fn: function (){
  3419. var self=this;
  3420. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3421. return smalltalk.withContext(function($ctx1) {
  3422. self._should_raise_((function(){
  3423. return smalltalk.withContext(function($ctx2) {
  3424. return "hello"._add_("a");
  3425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3426. $ctx1.sendIdx["should:raise:"]=1;
  3427. self._should_raise_((function(){
  3428. return smalltalk.withContext(function($ctx2) {
  3429. return "hello"._remove_("h");
  3430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3431. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  3432. args: [],
  3433. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  3434. messageSends: ["should:raise:", "add:", "remove:"],
  3435. referencedClasses: ["Error"]
  3436. }),
  3437. smalltalk.StringTest);
  3438. smalltalk.addMethod(
  3439. smalltalk.method({
  3440. selector: "testAsArray",
  3441. protocol: 'tests',
  3442. fn: function (){
  3443. var self=this;
  3444. return smalltalk.withContext(function($ctx1) {
  3445. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  3446. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  3447. args: [],
  3448. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  3449. messageSends: ["assert:equals:", "asArray"],
  3450. referencedClasses: []
  3451. }),
  3452. smalltalk.StringTest);
  3453. smalltalk.addMethod(
  3454. smalltalk.method({
  3455. selector: "testAsLowerCase",
  3456. protocol: 'tests',
  3457. fn: function (){
  3458. var self=this;
  3459. return smalltalk.withContext(function($ctx1) {
  3460. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  3461. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  3462. args: [],
  3463. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  3464. messageSends: ["assert:equals:", "asLowercase"],
  3465. referencedClasses: []
  3466. }),
  3467. smalltalk.StringTest);
  3468. smalltalk.addMethod(
  3469. smalltalk.method({
  3470. selector: "testAsNumber",
  3471. protocol: 'tests',
  3472. fn: function (){
  3473. var self=this;
  3474. return smalltalk.withContext(function($ctx1) {
  3475. var $1,$2;
  3476. $1="3"._asNumber();
  3477. $ctx1.sendIdx["asNumber"]=1;
  3478. self._assert_equals_($1,(3));
  3479. $ctx1.sendIdx["assert:equals:"]=1;
  3480. $2="-3"._asNumber();
  3481. $ctx1.sendIdx["asNumber"]=2;
  3482. self._assert_equals_($2,(-3));
  3483. $ctx1.sendIdx["assert:equals:"]=2;
  3484. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  3485. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  3486. args: [],
  3487. 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.",
  3488. messageSends: ["assert:equals:", "asNumber"],
  3489. referencedClasses: []
  3490. }),
  3491. smalltalk.StringTest);
  3492. smalltalk.addMethod(
  3493. smalltalk.method({
  3494. selector: "testAsUpperCase",
  3495. protocol: 'tests',
  3496. fn: function (){
  3497. var self=this;
  3498. return smalltalk.withContext(function($ctx1) {
  3499. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3500. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3501. args: [],
  3502. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3503. messageSends: ["assert:equals:", "asUppercase"],
  3504. referencedClasses: []
  3505. }),
  3506. smalltalk.StringTest);
  3507. smalltalk.addMethod(
  3508. smalltalk.method({
  3509. selector: "testAsciiValue",
  3510. protocol: 'tests',
  3511. fn: function (){
  3512. var self=this;
  3513. var characterA,characterU;
  3514. return smalltalk.withContext(function($ctx1) {
  3515. var $1;
  3516. characterA="A";
  3517. characterU="U";
  3518. $1=_st(characterA)._asciiValue();
  3519. $ctx1.sendIdx["asciiValue"]=1;
  3520. self._assert_equals_($1,(65));
  3521. $ctx1.sendIdx["assert:equals:"]=1;
  3522. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  3523. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3524. args: [],
  3525. 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",
  3526. messageSends: ["assert:equals:", "asciiValue"],
  3527. referencedClasses: []
  3528. }),
  3529. smalltalk.StringTest);
  3530. smalltalk.addMethod(
  3531. smalltalk.method({
  3532. selector: "testAtPut",
  3533. protocol: 'tests',
  3534. fn: function (){
  3535. var self=this;
  3536. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3537. return smalltalk.withContext(function($ctx1) {
  3538. self._should_raise_((function(){
  3539. return smalltalk.withContext(function($ctx2) {
  3540. return "hello"._at_put_((1),"a");
  3541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3542. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3543. args: [],
  3544. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  3545. messageSends: ["should:raise:", "at:put:"],
  3546. referencedClasses: ["Error"]
  3547. }),
  3548. smalltalk.StringTest);
  3549. smalltalk.addMethod(
  3550. smalltalk.method({
  3551. selector: "testCapitalized",
  3552. protocol: 'tests',
  3553. fn: function (){
  3554. var self=this;
  3555. return smalltalk.withContext(function($ctx1) {
  3556. var $1,$2,$3;
  3557. $1="test"._capitalized();
  3558. $ctx1.sendIdx["capitalized"]=1;
  3559. self._assert_equals_($1,"Test");
  3560. $ctx1.sendIdx["assert:equals:"]=1;
  3561. $2="Test"._capitalized();
  3562. $ctx1.sendIdx["capitalized"]=2;
  3563. self._assert_equals_($2,"Test");
  3564. $ctx1.sendIdx["assert:equals:"]=2;
  3565. self._assert_equals_(""._capitalized(),"");
  3566. $ctx1.sendIdx["assert:equals:"]=3;
  3567. $3="Test"._isCapitalized();
  3568. $ctx1.sendIdx["isCapitalized"]=1;
  3569. self._assert_equals_($3,true);
  3570. $ctx1.sendIdx["assert:equals:"]=4;
  3571. self._assert_equals_("test"._isCapitalized(),false);
  3572. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3573. args: [],
  3574. 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.",
  3575. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3576. referencedClasses: []
  3577. }),
  3578. smalltalk.StringTest);
  3579. smalltalk.addMethod(
  3580. smalltalk.method({
  3581. selector: "testCharCodeAt",
  3582. protocol: 'tests',
  3583. fn: function (){
  3584. var self=this;
  3585. return smalltalk.withContext(function($ctx1) {
  3586. var $1,$2,$3,$4,$5;
  3587. $1="jackie"._charCodeAt_((1));
  3588. $ctx1.sendIdx["charCodeAt:"]=1;
  3589. self._assert_equals_($1,(106));
  3590. $ctx1.sendIdx["assert:equals:"]=1;
  3591. $2="jackie"._charCodeAt_((2));
  3592. $ctx1.sendIdx["charCodeAt:"]=2;
  3593. self._assert_equals_($2,(97));
  3594. $ctx1.sendIdx["assert:equals:"]=2;
  3595. $3="jackie"._charCodeAt_((3));
  3596. $ctx1.sendIdx["charCodeAt:"]=3;
  3597. self._assert_equals_($3,(99));
  3598. $ctx1.sendIdx["assert:equals:"]=3;
  3599. $4="jackie"._charCodeAt_((4));
  3600. $ctx1.sendIdx["charCodeAt:"]=4;
  3601. self._assert_equals_($4,(107));
  3602. $ctx1.sendIdx["assert:equals:"]=4;
  3603. $5="jackie"._charCodeAt_((5));
  3604. $ctx1.sendIdx["charCodeAt:"]=5;
  3605. self._assert_equals_($5,(105));
  3606. $ctx1.sendIdx["assert:equals:"]=5;
  3607. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3608. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3609. args: [],
  3610. 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",
  3611. messageSends: ["assert:equals:", "charCodeAt:"],
  3612. referencedClasses: []
  3613. }),
  3614. smalltalk.StringTest);
  3615. smalltalk.addMethod(
  3616. smalltalk.method({
  3617. selector: "testCollect",
  3618. protocol: 'tests',
  3619. fn: function (){
  3620. var self=this;
  3621. var newCollection;
  3622. return smalltalk.withContext(function($ctx1) {
  3623. newCollection="hheelllloo";
  3624. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3625. return smalltalk.withContext(function($ctx2) {
  3626. return _st(each).__comma(each);
  3627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3628. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3629. args: [],
  3630. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  3631. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3632. referencedClasses: []
  3633. }),
  3634. smalltalk.StringTest);
  3635. smalltalk.addMethod(
  3636. smalltalk.method({
  3637. selector: "testCopyFromTo",
  3638. protocol: 'tests',
  3639. fn: function (){
  3640. var self=this;
  3641. return smalltalk.withContext(function($ctx1) {
  3642. var $1;
  3643. $1="jackie"._copyFrom_to_((1),(3));
  3644. $ctx1.sendIdx["copyFrom:to:"]=1;
  3645. self._assert_equals_($1,"jac");
  3646. $ctx1.sendIdx["assert:equals:"]=1;
  3647. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3648. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3649. args: [],
  3650. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3651. messageSends: ["assert:equals:", "copyFrom:to:"],
  3652. referencedClasses: []
  3653. }),
  3654. smalltalk.StringTest);
  3655. smalltalk.addMethod(
  3656. smalltalk.method({
  3657. selector: "testCopyWithoutAll",
  3658. protocol: 'tests',
  3659. fn: function (){
  3660. var self=this;
  3661. return smalltalk.withContext(function($ctx1) {
  3662. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3663. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3664. args: [],
  3665. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3666. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3667. referencedClasses: []
  3668. }),
  3669. smalltalk.StringTest);
  3670. smalltalk.addMethod(
  3671. smalltalk.method({
  3672. selector: "testDetect",
  3673. protocol: 'tests',
  3674. fn: function (){
  3675. var self=this;
  3676. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3677. return smalltalk.withContext(function($ctx1) {
  3678. var $2,$1;
  3679. $2=self._collection();
  3680. $ctx1.sendIdx["collection"]=1;
  3681. $1=_st($2)._detect_((function(each){
  3682. return smalltalk.withContext(function($ctx2) {
  3683. return _st(each).__eq("h");
  3684. $ctx2.sendIdx["="]=1;
  3685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3686. $ctx1.sendIdx["detect:"]=1;
  3687. self._assert_equals_($1,"h");
  3688. self._should_raise_((function(){
  3689. return smalltalk.withContext(function($ctx2) {
  3690. return _st(self._collection())._detect_((function(each){
  3691. return smalltalk.withContext(function($ctx3) {
  3692. return _st(each).__eq((6));
  3693. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3695. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3696. args: [],
  3697. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  3698. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3699. referencedClasses: ["Error"]
  3700. }),
  3701. smalltalk.StringTest);
  3702. smalltalk.addMethod(
  3703. smalltalk.method({
  3704. selector: "testEquality",
  3705. protocol: 'tests',
  3706. fn: function (){
  3707. var self=this;
  3708. return smalltalk.withContext(function($ctx1) {
  3709. var $1,$2,$3;
  3710. self._assert_equals_("hello","hello");
  3711. $ctx1.sendIdx["assert:equals:"]=1;
  3712. $1="hello".__eq("world");
  3713. $ctx1.sendIdx["="]=1;
  3714. self._deny_($1);
  3715. $ctx1.sendIdx["deny:"]=1;
  3716. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3717. return smalltalk.withContext(function($ctx2) {
  3718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3719. $ctx1.sendIdx["="]=2;
  3720. self._deny_($2);
  3721. $ctx1.sendIdx["deny:"]=2;
  3722. $3="hello"._yourself();
  3723. $ctx1.sendIdx["yourself"]=1;
  3724. self._assert_equals_("hello",$3);
  3725. $ctx1.sendIdx["assert:equals:"]=2;
  3726. self._assert_equals_("hello"._yourself(),"hello");
  3727. self._deny_("".__eq((0)));
  3728. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3729. args: [],
  3730. 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",
  3731. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3732. referencedClasses: []
  3733. }),
  3734. smalltalk.StringTest);
  3735. smalltalk.addMethod(
  3736. smalltalk.method({
  3737. selector: "testIdentity",
  3738. protocol: 'tests',
  3739. fn: function (){
  3740. var self=this;
  3741. return smalltalk.withContext(function($ctx1) {
  3742. var $1,$2,$4,$3,$5;
  3743. $1="hello".__eq_eq("hello");
  3744. $ctx1.sendIdx["=="]=1;
  3745. self._assert_($1);
  3746. $ctx1.sendIdx["assert:"]=1;
  3747. $2="hello".__eq_eq("world");
  3748. $ctx1.sendIdx["=="]=2;
  3749. self._deny_($2);
  3750. $ctx1.sendIdx["deny:"]=1;
  3751. $4="hello"._yourself();
  3752. $ctx1.sendIdx["yourself"]=1;
  3753. $3="hello".__eq_eq($4);
  3754. $ctx1.sendIdx["=="]=3;
  3755. self._assert_($3);
  3756. $ctx1.sendIdx["assert:"]=2;
  3757. $5=_st("hello"._yourself()).__eq_eq("hello");
  3758. $ctx1.sendIdx["=="]=4;
  3759. self._assert_($5);
  3760. self._deny_("".__eq_eq((0)));
  3761. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3762. args: [],
  3763. 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",
  3764. messageSends: ["assert:", "==", "deny:", "yourself"],
  3765. referencedClasses: []
  3766. }),
  3767. smalltalk.StringTest);
  3768. smalltalk.addMethod(
  3769. smalltalk.method({
  3770. selector: "testIdentityHash",
  3771. protocol: 'tests',
  3772. fn: function (){
  3773. var self=this;
  3774. return smalltalk.withContext(function($ctx1) {
  3775. var $1,$2,$4,$3;
  3776. $1="foo"._identityHash();
  3777. $ctx1.sendIdx["identityHash"]=1;
  3778. $2="foo"._identityHash();
  3779. $ctx1.sendIdx["identityHash"]=2;
  3780. self._assert_equals_($1,$2);
  3781. $4="foo"._identityHash();
  3782. $ctx1.sendIdx["identityHash"]=3;
  3783. $3=_st($4).__eq("bar"._identityHash());
  3784. self._deny_($3);
  3785. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3786. args: [],
  3787. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3788. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3789. referencedClasses: []
  3790. }),
  3791. smalltalk.StringTest);
  3792. smalltalk.addMethod(
  3793. smalltalk.method({
  3794. selector: "testIncludesSubString",
  3795. protocol: 'tests',
  3796. fn: function (){
  3797. var self=this;
  3798. return smalltalk.withContext(function($ctx1) {
  3799. var $1;
  3800. $1="amber"._includesSubString_("ber");
  3801. $ctx1.sendIdx["includesSubString:"]=1;
  3802. self._assert_($1);
  3803. self._deny_("amber"._includesSubString_("zork"));
  3804. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3805. args: [],
  3806. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3807. messageSends: ["assert:", "includesSubString:", "deny:"],
  3808. referencedClasses: []
  3809. }),
  3810. smalltalk.StringTest);
  3811. smalltalk.addMethod(
  3812. smalltalk.method({
  3813. selector: "testIsVowel",
  3814. protocol: 'tests',
  3815. fn: function (){
  3816. var self=this;
  3817. var vowel,consonant;
  3818. return smalltalk.withContext(function($ctx1) {
  3819. var $1;
  3820. vowel="u";
  3821. consonant="z";
  3822. $1=_st(vowel)._isVowel();
  3823. $ctx1.sendIdx["isVowel"]=1;
  3824. self._assert_equals_($1,true);
  3825. $ctx1.sendIdx["assert:equals:"]=1;
  3826. self._assert_equals_(_st(consonant)._isVowel(),false);
  3827. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3828. args: [],
  3829. 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",
  3830. messageSends: ["assert:equals:", "isVowel"],
  3831. referencedClasses: []
  3832. }),
  3833. smalltalk.StringTest);
  3834. smalltalk.addMethod(
  3835. smalltalk.method({
  3836. selector: "testJoin",
  3837. protocol: 'tests',
  3838. fn: function (){
  3839. var self=this;
  3840. return smalltalk.withContext(function($ctx1) {
  3841. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3842. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3843. args: [],
  3844. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3845. messageSends: ["assert:equals:", "join:"],
  3846. referencedClasses: []
  3847. }),
  3848. smalltalk.StringTest);
  3849. smalltalk.addMethod(
  3850. smalltalk.method({
  3851. selector: "testRemoveAll",
  3852. protocol: 'tests',
  3853. fn: function (){
  3854. var self=this;
  3855. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3856. return smalltalk.withContext(function($ctx1) {
  3857. self._should_raise_((function(){
  3858. return smalltalk.withContext(function($ctx2) {
  3859. return _st(self._collection())._removeAll();
  3860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3861. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  3862. args: [],
  3863. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  3864. messageSends: ["should:raise:", "removeAll", "collection"],
  3865. referencedClasses: ["Error"]
  3866. }),
  3867. smalltalk.StringTest);
  3868. smalltalk.addMethod(
  3869. smalltalk.method({
  3870. selector: "testReversed",
  3871. protocol: 'tests',
  3872. fn: function (){
  3873. var self=this;
  3874. return smalltalk.withContext(function($ctx1) {
  3875. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3876. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3877. args: [],
  3878. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3879. messageSends: ["assert:equals:", "reversed"],
  3880. referencedClasses: []
  3881. }),
  3882. smalltalk.StringTest);
  3883. smalltalk.addMethod(
  3884. smalltalk.method({
  3885. selector: "testSelect",
  3886. protocol: 'tests',
  3887. fn: function (){
  3888. var self=this;
  3889. var newCollection;
  3890. return smalltalk.withContext(function($ctx1) {
  3891. newCollection="o";
  3892. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3893. return smalltalk.withContext(function($ctx2) {
  3894. return _st(each).__eq("o");
  3895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3896. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3897. args: [],
  3898. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  3899. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3900. referencedClasses: []
  3901. }),
  3902. smalltalk.StringTest);
  3903. smalltalk.addMethod(
  3904. smalltalk.method({
  3905. selector: "testSize",
  3906. protocol: 'tests',
  3907. fn: function (){
  3908. var self=this;
  3909. return smalltalk.withContext(function($ctx1) {
  3910. var $1;
  3911. $1="smalltalk"._size();
  3912. $ctx1.sendIdx["size"]=1;
  3913. self._assert_equals_($1,(9));
  3914. $ctx1.sendIdx["assert:equals:"]=1;
  3915. self._assert_equals_(""._size(),(0));
  3916. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3917. args: [],
  3918. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3919. messageSends: ["assert:equals:", "size"],
  3920. referencedClasses: []
  3921. }),
  3922. smalltalk.StringTest);
  3923. smalltalk.addMethod(
  3924. smalltalk.method({
  3925. selector: "testStreamContents",
  3926. protocol: 'tests',
  3927. fn: function (){
  3928. var self=this;
  3929. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3930. return smalltalk.withContext(function($ctx1) {
  3931. var $1;
  3932. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3933. return smalltalk.withContext(function($ctx2) {
  3934. _st(aStream)._nextPutAll_("hello");
  3935. $ctx2.sendIdx["nextPutAll:"]=1;
  3936. _st(aStream)._space();
  3937. $1=_st(aStream)._nextPutAll_("world");
  3938. return $1;
  3939. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3940. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3941. args: [],
  3942. 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'",
  3943. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3944. referencedClasses: ["String"]
  3945. }),
  3946. smalltalk.StringTest);
  3947. smalltalk.addMethod(
  3948. smalltalk.method({
  3949. selector: "testSubStrings",
  3950. protocol: 'tests',
  3951. fn: function (){
  3952. var self=this;
  3953. return smalltalk.withContext(function($ctx1) {
  3954. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3955. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3956. args: [],
  3957. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3958. messageSends: ["assert:equals:", "subStrings:"],
  3959. referencedClasses: []
  3960. }),
  3961. smalltalk.StringTest);
  3962. smalltalk.addMethod(
  3963. smalltalk.method({
  3964. selector: "testTrim",
  3965. protocol: 'tests',
  3966. fn: function (){
  3967. var self=this;
  3968. return smalltalk.withContext(function($ctx1) {
  3969. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3970. $ctx1.sendIdx["assert:equals:"]=1;
  3971. self._assert_equals_("jackie "._trimRight(),"jackie");
  3972. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3973. args: [],
  3974. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3975. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3976. referencedClasses: []
  3977. }),
  3978. smalltalk.StringTest);
  3979. smalltalk.addMethod(
  3980. smalltalk.method({
  3981. selector: "collectionClass",
  3982. protocol: 'fixture',
  3983. fn: function (){
  3984. var self=this;
  3985. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3986. return smalltalk.withContext(function($ctx1) {
  3987. return $String();
  3988. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3989. args: [],
  3990. source: "collectionClass\x0a\x09^ String",
  3991. messageSends: [],
  3992. referencedClasses: ["String"]
  3993. }),
  3994. smalltalk.StringTest.klass);
  3995. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3996. smalltalk.addMethod(
  3997. smalltalk.method({
  3998. selector: "testShow",
  3999. protocol: 'tests',
  4000. fn: function (){
  4001. var self=this;
  4002. var originalTranscript;
  4003. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  4004. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  4005. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4006. return smalltalk.withContext(function($ctx1) {
  4007. originalTranscript=_st($Transcript())._current();
  4008. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  4009. $ctx1.sendIdx["register:"]=1;
  4010. self._shouldnt_raise_((function(){
  4011. return smalltalk.withContext(function($ctx2) {
  4012. return _st($Transcript())._show_("Hello console!");
  4013. $ctx2.sendIdx["show:"]=1;
  4014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4015. $ctx1.sendIdx["shouldnt:raise:"]=1;
  4016. self._shouldnt_raise_((function(){
  4017. return smalltalk.withContext(function($ctx2) {
  4018. return _st($Transcript())._show_(console);
  4019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4020. _st($Transcript())._register_(originalTranscript);
  4021. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  4022. args: [],
  4023. 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.",
  4024. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  4025. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  4026. }),
  4027. smalltalk.ConsoleTranscriptTest);
  4028. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "jsObject",
  4032. protocol: 'accessing',
  4033. fn: function (){
  4034. var self=this;
  4035. return smalltalk.withContext(function($ctx1) {
  4036. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  4037. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  4038. args: [],
  4039. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. smalltalk.JSObjectProxyTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "testAtIfAbsent",
  4047. protocol: 'tests',
  4048. fn: function (){
  4049. var self=this;
  4050. var testObject;
  4051. return smalltalk.withContext(function($ctx1) {
  4052. var $1,$2,$3;
  4053. testObject=self._jsObject();
  4054. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  4055. return smalltalk.withContext(function($ctx2) {
  4056. return "Property does not exist";
  4057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4058. $ctx1.sendIdx["at:ifAbsent:"]=1;
  4059. self._assert_equals_($1,"Property does not exist");
  4060. $ctx1.sendIdx["assert:equals:"]=1;
  4061. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  4062. return smalltalk.withContext(function($ctx2) {
  4063. return "Property does not exist";
  4064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4065. $ctx1.sendIdx["at:ifAbsent:"]=2;
  4066. self._assert_equals_($2,nil);
  4067. $ctx1.sendIdx["assert:equals:"]=2;
  4068. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  4069. return smalltalk.withContext(function($ctx2) {
  4070. return "Property does not exist";
  4071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  4072. $ctx1.sendIdx["at:ifAbsent:"]=3;
  4073. self._assert_equals_($3,(1));
  4074. $ctx1.sendIdx["assert:equals:"]=3;
  4075. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  4076. return smalltalk.withContext(function($ctx2) {
  4077. return "Property does not exist";
  4078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  4079. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4080. args: [],
  4081. 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.",
  4082. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  4083. referencedClasses: []
  4084. }),
  4085. smalltalk.JSObjectProxyTest);
  4086. smalltalk.addMethod(
  4087. smalltalk.method({
  4088. selector: "testAtIfPresent",
  4089. protocol: 'tests',
  4090. fn: function (){
  4091. var self=this;
  4092. var testObject;
  4093. return smalltalk.withContext(function($ctx1) {
  4094. var $2,$1,$4,$3,$6,$5;
  4095. testObject=self._jsObject();
  4096. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  4097. return smalltalk.withContext(function($ctx2) {
  4098. $2=_st(x)._asString();
  4099. $ctx2.sendIdx["asString"]=1;
  4100. return "hello ".__comma($2);
  4101. $ctx2.sendIdx[","]=1;
  4102. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  4103. $ctx1.sendIdx["at:ifPresent:"]=1;
  4104. self._assert_equals_($1,nil);
  4105. $ctx1.sendIdx["assert:equals:"]=1;
  4106. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  4107. return smalltalk.withContext(function($ctx2) {
  4108. $4=_st(x)._asString();
  4109. $ctx2.sendIdx["asString"]=2;
  4110. return "hello ".__comma($4);
  4111. $ctx2.sendIdx[","]=2;
  4112. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  4113. $ctx1.sendIdx["at:ifPresent:"]=2;
  4114. self._assert_equals_($3,"hello nil");
  4115. $ctx1.sendIdx["assert:equals:"]=2;
  4116. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  4117. return smalltalk.withContext(function($ctx2) {
  4118. $6=_st(x)._asString();
  4119. $ctx2.sendIdx["asString"]=3;
  4120. return "hello ".__comma($6);
  4121. $ctx2.sendIdx[","]=3;
  4122. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  4123. $ctx1.sendIdx["at:ifPresent:"]=3;
  4124. self._assert_equals_($5,"hello 1");
  4125. $ctx1.sendIdx["assert:equals:"]=3;
  4126. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  4127. return smalltalk.withContext(function($ctx2) {
  4128. return "hello ".__comma(_st(x)._asString());
  4129. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  4130. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4131. args: [],
  4132. 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'.",
  4133. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  4134. referencedClasses: []
  4135. }),
  4136. smalltalk.JSObjectProxyTest);
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "testAtIfPresentIfAbsent",
  4140. protocol: 'tests',
  4141. fn: function (){
  4142. var self=this;
  4143. var testObject;
  4144. return smalltalk.withContext(function($ctx1) {
  4145. var $2,$1,$4,$3,$6,$5;
  4146. testObject=self._jsObject();
  4147. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  4148. return smalltalk.withContext(function($ctx2) {
  4149. $2=_st(x)._asString();
  4150. $ctx2.sendIdx["asString"]=1;
  4151. return "hello ".__comma($2);
  4152. $ctx2.sendIdx[","]=1;
  4153. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  4154. return smalltalk.withContext(function($ctx2) {
  4155. return "not present";
  4156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4157. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  4158. self._assert_equals_($1,"not present");
  4159. $ctx1.sendIdx["assert:equals:"]=1;
  4160. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  4161. return smalltalk.withContext(function($ctx2) {
  4162. $4=_st(x)._asString();
  4163. $ctx2.sendIdx["asString"]=2;
  4164. return "hello ".__comma($4);
  4165. $ctx2.sendIdx[","]=2;
  4166. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  4167. return smalltalk.withContext(function($ctx2) {
  4168. return "not present";
  4169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4170. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  4171. self._assert_equals_($3,"hello nil");
  4172. $ctx1.sendIdx["assert:equals:"]=2;
  4173. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  4174. return smalltalk.withContext(function($ctx2) {
  4175. $6=_st(x)._asString();
  4176. $ctx2.sendIdx["asString"]=3;
  4177. return "hello ".__comma($6);
  4178. $ctx2.sendIdx[","]=3;
  4179. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  4180. return smalltalk.withContext(function($ctx2) {
  4181. return "not present";
  4182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4183. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  4184. self._assert_equals_($5,"hello 1");
  4185. $ctx1.sendIdx["assert:equals:"]=3;
  4186. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  4187. return smalltalk.withContext(function($ctx2) {
  4188. return "hello ".__comma(_st(x)._asString());
  4189. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  4190. return smalltalk.withContext(function($ctx2) {
  4191. return "not present";
  4192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  4193. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4194. args: [],
  4195. 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'.",
  4196. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  4197. referencedClasses: []
  4198. }),
  4199. smalltalk.JSObjectProxyTest);
  4200. smalltalk.addMethod(
  4201. smalltalk.method({
  4202. selector: "testAtPut",
  4203. protocol: 'tests',
  4204. fn: function (){
  4205. var self=this;
  4206. var testObject;
  4207. return smalltalk.withContext(function($ctx1) {
  4208. var $2,$1;
  4209. testObject=self._jsObject();
  4210. $2=_st(testObject)._at_("abc");
  4211. $ctx1.sendIdx["at:"]=1;
  4212. $1=_st($2).__tild_eq("xyz");
  4213. self._assert_($1);
  4214. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  4215. $ctx1.sendIdx["assert:equals:"]=1;
  4216. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  4217. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4218. args: [],
  4219. 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'",
  4220. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  4221. referencedClasses: []
  4222. }),
  4223. smalltalk.JSObjectProxyTest);
  4224. smalltalk.addMethod(
  4225. smalltalk.method({
  4226. selector: "testDNU",
  4227. protocol: 'tests',
  4228. fn: function (){
  4229. var self=this;
  4230. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4231. return smalltalk.withContext(function($ctx1) {
  4232. self._should_raise_((function(){
  4233. return smalltalk.withContext(function($ctx2) {
  4234. return _st(self._jsObject())._foo();
  4235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4236. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  4237. args: [],
  4238. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  4239. messageSends: ["should:raise:", "foo", "jsObject"],
  4240. referencedClasses: ["MessageNotUnderstood"]
  4241. }),
  4242. smalltalk.JSObjectProxyTest);
  4243. smalltalk.addMethod(
  4244. smalltalk.method({
  4245. selector: "testMessageSend",
  4246. protocol: 'tests',
  4247. fn: function (){
  4248. var self=this;
  4249. return smalltalk.withContext(function($ctx1) {
  4250. var $2,$1,$4,$3;
  4251. $2=self._jsObject();
  4252. $ctx1.sendIdx["jsObject"]=1;
  4253. $1=_st($2)._a();
  4254. self._assert_equals_($1,(1));
  4255. $ctx1.sendIdx["assert:equals:"]=1;
  4256. $4=self._jsObject();
  4257. $ctx1.sendIdx["jsObject"]=2;
  4258. $3=_st($4)._b();
  4259. self._assert_equals_($3,(2));
  4260. $ctx1.sendIdx["assert:equals:"]=2;
  4261. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  4262. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  4263. args: [],
  4264. 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",
  4265. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  4266. referencedClasses: []
  4267. }),
  4268. smalltalk.JSObjectProxyTest);
  4269. smalltalk.addMethod(
  4270. smalltalk.method({
  4271. selector: "testMethodWithArguments",
  4272. protocol: 'tests',
  4273. fn: function (){
  4274. var self=this;
  4275. return smalltalk.withContext(function($ctx1) {
  4276. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  4277. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  4278. args: [],
  4279. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  4280. messageSends: ["assert:equals:", "c:", "jsObject"],
  4281. referencedClasses: []
  4282. }),
  4283. smalltalk.JSObjectProxyTest);
  4284. smalltalk.addMethod(
  4285. smalltalk.method({
  4286. selector: "testPrinting",
  4287. protocol: 'tests',
  4288. fn: function (){
  4289. var self=this;
  4290. return smalltalk.withContext(function($ctx1) {
  4291. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  4292. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  4293. args: [],
  4294. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  4295. messageSends: ["assert:equals:", "printString", "jsObject"],
  4296. referencedClasses: []
  4297. }),
  4298. smalltalk.JSObjectProxyTest);
  4299. smalltalk.addMethod(
  4300. smalltalk.method({
  4301. selector: "testPropertyThatReturnsEmptyString",
  4302. protocol: 'tests',
  4303. fn: function (){
  4304. var self=this;
  4305. var object;
  4306. return smalltalk.withContext(function($ctx1) {
  4307. var $1;
  4308. object=self._jsObject();
  4309. $1=_st(object)._d();
  4310. $ctx1.sendIdx["d"]=1;
  4311. self._assert_equals_($1,"");
  4312. $ctx1.sendIdx["assert:equals:"]=1;
  4313. _st(object)._d_("hello");
  4314. self._assert_equals_(_st(object)._d(),"hello");
  4315. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  4316. args: [],
  4317. 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'",
  4318. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  4319. referencedClasses: []
  4320. }),
  4321. smalltalk.JSObjectProxyTest);
  4322. smalltalk.addMethod(
  4323. smalltalk.method({
  4324. selector: "testPropertyThatReturnsUndefined",
  4325. protocol: 'tests',
  4326. fn: function (){
  4327. var self=this;
  4328. var object;
  4329. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4330. return smalltalk.withContext(function($ctx1) {
  4331. object=self._jsObject();
  4332. self._shouldnt_raise_((function(){
  4333. return smalltalk.withContext(function($ctx2) {
  4334. return _st(object)._e();
  4335. $ctx2.sendIdx["e"]=1;
  4336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4337. self._assert_(_st(_st(object)._e())._isNil());
  4338. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  4339. args: [],
  4340. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  4341. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  4342. referencedClasses: ["MessageNotUnderstood"]
  4343. }),
  4344. smalltalk.JSObjectProxyTest);
  4345. smalltalk.addMethod(
  4346. smalltalk.method({
  4347. selector: "testValue",
  4348. protocol: 'tests',
  4349. fn: function (){
  4350. var self=this;
  4351. var testObject;
  4352. return smalltalk.withContext(function($ctx1) {
  4353. testObject=self._jsObject();
  4354. _st(testObject)._at_put_("value","aValue");
  4355. self._assert_equals_(_st(testObject)._value(),"aValue");
  4356. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4357. args: [],
  4358. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  4359. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  4360. referencedClasses: []
  4361. }),
  4362. smalltalk.JSObjectProxyTest);
  4363. smalltalk.addMethod(
  4364. smalltalk.method({
  4365. selector: "testYourself",
  4366. protocol: 'tests',
  4367. fn: function (){
  4368. var self=this;
  4369. var object;
  4370. return smalltalk.withContext(function($ctx1) {
  4371. var $1,$2;
  4372. $1=self._jsObject();
  4373. _st($1)._d_("test");
  4374. $2=_st($1)._yourself();
  4375. object=$2;
  4376. self._assert_equals_(_st(object)._d(),"test");
  4377. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4378. args: [],
  4379. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4380. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4381. referencedClasses: []
  4382. }),
  4383. smalltalk.JSObjectProxyTest);
  4384. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4385. smalltalk.addMethod(
  4386. smalltalk.method({
  4387. selector: "testCatchingException",
  4388. protocol: 'tests',
  4389. fn: function (){
  4390. var self=this;
  4391. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4392. return smalltalk.withContext(function($ctx1) {
  4393. _st((function(){
  4394. return smalltalk.withContext(function($ctx2) {
  4395. return self._throwException();
  4396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4397. return smalltalk.withContext(function($ctx2) {
  4398. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4399. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4400. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4401. args: [],
  4402. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4403. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4404. referencedClasses: ["Error"]
  4405. }),
  4406. smalltalk.JavaScriptExceptionTest);
  4407. smalltalk.addMethod(
  4408. smalltalk.method({
  4409. selector: "testRaisingException",
  4410. protocol: 'tests',
  4411. fn: function (){
  4412. var self=this;
  4413. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4414. return smalltalk.withContext(function($ctx1) {
  4415. self._should_raise_((function(){
  4416. return smalltalk.withContext(function($ctx2) {
  4417. return self._throwException();
  4418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  4419. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  4420. args: [],
  4421. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  4422. messageSends: ["should:raise:", "throwException"],
  4423. referencedClasses: ["JavaScriptException"]
  4424. }),
  4425. smalltalk.JavaScriptExceptionTest);
  4426. smalltalk.addMethod(
  4427. smalltalk.method({
  4428. selector: "throwException",
  4429. protocol: 'helpers',
  4430. fn: function (){
  4431. var self=this;
  4432. return smalltalk.withContext(function($ctx1) {
  4433. throw 'test';
  4434. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4435. args: [],
  4436. source: "throwException\x0a\x09<throw 'test'>",
  4437. messageSends: [],
  4438. referencedClasses: []
  4439. }),
  4440. smalltalk.JavaScriptExceptionTest);
  4441. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4442. smalltalk.addMethod(
  4443. smalltalk.method({
  4444. selector: "testValue",
  4445. protocol: 'tests',
  4446. fn: function (){
  4447. var self=this;
  4448. var messageSend;
  4449. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4450. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4451. return smalltalk.withContext(function($ctx1) {
  4452. var $1,$2;
  4453. $1=_st($MessageSend())._new();
  4454. $ctx1.sendIdx["new"]=1;
  4455. _st($1)._receiver_(_st($Object())._new());
  4456. _st($1)._selector_("asString");
  4457. $2=_st($1)._yourself();
  4458. messageSend=$2;
  4459. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4460. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4461. args: [],
  4462. 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'",
  4463. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4464. referencedClasses: ["MessageSend", "Object"]
  4465. }),
  4466. smalltalk.MessageSendTest);
  4467. smalltalk.addMethod(
  4468. smalltalk.method({
  4469. selector: "testValueWithArguments",
  4470. protocol: 'tests',
  4471. fn: function (){
  4472. var self=this;
  4473. var messageSend;
  4474. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4475. return smalltalk.withContext(function($ctx1) {
  4476. var $1,$2;
  4477. $1=_st($MessageSend())._new();
  4478. _st($1)._receiver_((2));
  4479. _st($1)._selector_("+");
  4480. $2=_st($1)._yourself();
  4481. messageSend=$2;
  4482. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4483. $ctx1.sendIdx["assert:equals:"]=1;
  4484. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4485. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4486. args: [],
  4487. 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",
  4488. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4489. referencedClasses: ["MessageSend"]
  4490. }),
  4491. smalltalk.MessageSendTest);
  4492. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "codeGeneratorClass",
  4496. protocol: 'accessing',
  4497. fn: function (){
  4498. var self=this;
  4499. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4500. return smalltalk.withContext(function($ctx1) {
  4501. return $CodeGenerator();
  4502. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4503. args: [],
  4504. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4505. messageSends: [],
  4506. referencedClasses: ["CodeGenerator"]
  4507. }),
  4508. smalltalk.MethodInheritanceTest);
  4509. smalltalk.addMethod(
  4510. smalltalk.method({
  4511. selector: "compiler",
  4512. protocol: 'factory',
  4513. fn: function (){
  4514. var self=this;
  4515. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4516. return smalltalk.withContext(function($ctx1) {
  4517. var $2,$3,$1;
  4518. $2=_st($Compiler())._new();
  4519. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4520. $3=_st($2)._yourself();
  4521. $1=$3;
  4522. return $1;
  4523. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4524. args: [],
  4525. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4526. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4527. referencedClasses: ["Compiler"]
  4528. }),
  4529. smalltalk.MethodInheritanceTest);
  4530. smalltalk.addMethod(
  4531. smalltalk.method({
  4532. selector: "deinstallBottom",
  4533. protocol: 'testing',
  4534. fn: function (){
  4535. var self=this;
  4536. return smalltalk.withContext(function($ctx1) {
  4537. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4538. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4539. args: [],
  4540. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4541. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4542. referencedClasses: []
  4543. }),
  4544. smalltalk.MethodInheritanceTest);
  4545. smalltalk.addMethod(
  4546. smalltalk.method({
  4547. selector: "deinstallMiddle",
  4548. protocol: 'testing',
  4549. fn: function (){
  4550. var self=this;
  4551. return smalltalk.withContext(function($ctx1) {
  4552. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4553. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4554. args: [],
  4555. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4556. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4557. referencedClasses: []
  4558. }),
  4559. smalltalk.MethodInheritanceTest);
  4560. smalltalk.addMethod(
  4561. smalltalk.method({
  4562. selector: "deinstallTop",
  4563. protocol: 'testing',
  4564. fn: function (){
  4565. var self=this;
  4566. return smalltalk.withContext(function($ctx1) {
  4567. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4568. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4569. args: [],
  4570. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4571. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4572. referencedClasses: []
  4573. }),
  4574. smalltalk.MethodInheritanceTest);
  4575. smalltalk.addMethod(
  4576. smalltalk.method({
  4577. selector: "installBottom:",
  4578. protocol: 'testing',
  4579. fn: function (aString){
  4580. var self=this;
  4581. return smalltalk.withContext(function($ctx1) {
  4582. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  4583. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4584. args: ["aString"],
  4585. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  4586. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  4587. referencedClasses: []
  4588. }),
  4589. smalltalk.MethodInheritanceTest);
  4590. smalltalk.addMethod(
  4591. smalltalk.method({
  4592. selector: "installMiddle:",
  4593. protocol: 'testing',
  4594. fn: function (aString){
  4595. var self=this;
  4596. return smalltalk.withContext(function($ctx1) {
  4597. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  4598. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4599. args: ["aString"],
  4600. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  4601. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  4602. referencedClasses: []
  4603. }),
  4604. smalltalk.MethodInheritanceTest);
  4605. smalltalk.addMethod(
  4606. smalltalk.method({
  4607. selector: "installTop:",
  4608. protocol: 'testing',
  4609. fn: function (aString){
  4610. var self=this;
  4611. return smalltalk.withContext(function($ctx1) {
  4612. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  4613. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4614. args: ["aString"],
  4615. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  4616. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  4617. referencedClasses: []
  4618. }),
  4619. smalltalk.MethodInheritanceTest);
  4620. smalltalk.addMethod(
  4621. smalltalk.method({
  4622. selector: "setUp",
  4623. protocol: 'initialization',
  4624. fn: function (){
  4625. var self=this;
  4626. return smalltalk.withContext(function($ctx1) {
  4627. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4628. $ctx1.sendIdx["new"]=1;
  4629. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4630. $ctx1.sendIdx["new"]=2;
  4631. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4632. self["@method"]=nil;
  4633. self["@performBlock"]=(function(){
  4634. return smalltalk.withContext(function($ctx2) {
  4635. return self._error_("performBlock not initialized");
  4636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4637. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4638. args: [],
  4639. 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' ]",
  4640. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4641. referencedClasses: []
  4642. }),
  4643. smalltalk.MethodInheritanceTest);
  4644. smalltalk.addMethod(
  4645. smalltalk.method({
  4646. selector: "shouldMNU",
  4647. protocol: 'testing',
  4648. fn: function (){
  4649. var self=this;
  4650. return smalltalk.withContext(function($ctx1) {
  4651. self._shouldMNUTop();
  4652. self._shouldMNUMiddle();
  4653. self._shouldMNUBottom();
  4654. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4655. args: [],
  4656. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4657. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4658. referencedClasses: []
  4659. }),
  4660. smalltalk.MethodInheritanceTest);
  4661. smalltalk.addMethod(
  4662. smalltalk.method({
  4663. selector: "shouldMNUBottom",
  4664. protocol: 'testing',
  4665. fn: function (){
  4666. var self=this;
  4667. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4668. return smalltalk.withContext(function($ctx1) {
  4669. self._should_raise_((function(){
  4670. return smalltalk.withContext(function($ctx2) {
  4671. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4673. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4674. args: [],
  4675. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4676. messageSends: ["should:raise:", "value:"],
  4677. referencedClasses: ["MessageNotUnderstood"]
  4678. }),
  4679. smalltalk.MethodInheritanceTest);
  4680. smalltalk.addMethod(
  4681. smalltalk.method({
  4682. selector: "shouldMNUMiddle",
  4683. protocol: 'testing',
  4684. fn: function (){
  4685. var self=this;
  4686. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4687. return smalltalk.withContext(function($ctx1) {
  4688. self._should_raise_((function(){
  4689. return smalltalk.withContext(function($ctx2) {
  4690. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4692. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4693. args: [],
  4694. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4695. messageSends: ["should:raise:", "value:"],
  4696. referencedClasses: ["MessageNotUnderstood"]
  4697. }),
  4698. smalltalk.MethodInheritanceTest);
  4699. smalltalk.addMethod(
  4700. smalltalk.method({
  4701. selector: "shouldMNUTop",
  4702. protocol: 'testing',
  4703. fn: function (){
  4704. var self=this;
  4705. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4706. return smalltalk.withContext(function($ctx1) {
  4707. self._should_raise_((function(){
  4708. return smalltalk.withContext(function($ctx2) {
  4709. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4711. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4712. args: [],
  4713. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4714. messageSends: ["should:raise:", "value:"],
  4715. referencedClasses: ["MessageNotUnderstood"]
  4716. }),
  4717. smalltalk.MethodInheritanceTest);
  4718. smalltalk.addMethod(
  4719. smalltalk.method({
  4720. selector: "shouldReturn:",
  4721. protocol: 'testing',
  4722. fn: function (anObject){
  4723. var self=this;
  4724. var result;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4727. $ctx1.sendIdx["value:"]=1;
  4728. self._assert_equals_(["top",anObject],["top",result]);
  4729. $ctx1.sendIdx["assert:equals:"]=1;
  4730. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4731. $ctx1.sendIdx["value:"]=2;
  4732. self._assert_equals_(["middle",anObject],["middle",result]);
  4733. $ctx1.sendIdx["assert:equals:"]=2;
  4734. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4735. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4736. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4737. args: ["anObject"],
  4738. 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 }",
  4739. messageSends: ["value:", "assert:equals:"],
  4740. referencedClasses: []
  4741. }),
  4742. smalltalk.MethodInheritanceTest);
  4743. smalltalk.addMethod(
  4744. smalltalk.method({
  4745. selector: "shouldReturn:and:and:",
  4746. protocol: 'testing',
  4747. fn: function (anObject,anObject2,anObject3){
  4748. var self=this;
  4749. var result;
  4750. return smalltalk.withContext(function($ctx1) {
  4751. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4752. $ctx1.sendIdx["value:"]=1;
  4753. self._assert_equals_(["top",anObject],["top",result]);
  4754. $ctx1.sendIdx["assert:equals:"]=1;
  4755. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4756. $ctx1.sendIdx["value:"]=2;
  4757. self._assert_equals_(["middle",anObject2],["middle",result]);
  4758. $ctx1.sendIdx["assert:equals:"]=2;
  4759. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4760. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4761. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4762. args: ["anObject", "anObject2", "anObject3"],
  4763. 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 }",
  4764. messageSends: ["value:", "assert:equals:"],
  4765. referencedClasses: []
  4766. }),
  4767. smalltalk.MethodInheritanceTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "targetClassBottom",
  4771. protocol: 'accessing',
  4772. fn: function (){
  4773. var self=this;
  4774. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4775. return smalltalk.withContext(function($ctx1) {
  4776. return $JavaScriptException();
  4777. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4778. args: [],
  4779. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4780. messageSends: [],
  4781. referencedClasses: ["JavaScriptException"]
  4782. }),
  4783. smalltalk.MethodInheritanceTest);
  4784. smalltalk.addMethod(
  4785. smalltalk.method({
  4786. selector: "targetClassMiddle",
  4787. protocol: 'accessing',
  4788. fn: function (){
  4789. var self=this;
  4790. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4791. return smalltalk.withContext(function($ctx1) {
  4792. return $Error();
  4793. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4794. args: [],
  4795. source: "targetClassMiddle\x0a\x09^ Error",
  4796. messageSends: [],
  4797. referencedClasses: ["Error"]
  4798. }),
  4799. smalltalk.MethodInheritanceTest);
  4800. smalltalk.addMethod(
  4801. smalltalk.method({
  4802. selector: "targetClassTop",
  4803. protocol: 'accessing',
  4804. fn: function (){
  4805. var self=this;
  4806. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4807. return smalltalk.withContext(function($ctx1) {
  4808. return $Object();
  4809. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4810. args: [],
  4811. source: "targetClassTop\x0a\x09^ Object",
  4812. messageSends: [],
  4813. referencedClasses: ["Object"]
  4814. }),
  4815. smalltalk.MethodInheritanceTest);
  4816. smalltalk.addMethod(
  4817. smalltalk.method({
  4818. selector: "tearDown",
  4819. protocol: 'initialization',
  4820. fn: function (){
  4821. var self=this;
  4822. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4823. return smalltalk.withContext(function($ctx1) {
  4824. _st((function(){
  4825. return smalltalk.withContext(function($ctx2) {
  4826. return self._deinstallTop();
  4827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4828. return smalltalk.withContext(function($ctx2) {
  4829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4830. $ctx1.sendIdx["on:do:"]=1;
  4831. _st((function(){
  4832. return smalltalk.withContext(function($ctx2) {
  4833. return self._deinstallMiddle();
  4834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4837. $ctx1.sendIdx["on:do:"]=2;
  4838. _st((function(){
  4839. return smalltalk.withContext(function($ctx2) {
  4840. return self._deinstallBottom();
  4841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4842. return smalltalk.withContext(function($ctx2) {
  4843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4844. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4845. args: [],
  4846. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  4847. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4848. referencedClasses: ["Error"]
  4849. }),
  4850. smalltalk.MethodInheritanceTest);
  4851. smalltalk.addMethod(
  4852. smalltalk.method({
  4853. selector: "testMNU11",
  4854. protocol: 'tests',
  4855. fn: function (){
  4856. var self=this;
  4857. return smalltalk.withContext(function($ctx1) {
  4858. self["@performBlock"]=(function(x){
  4859. return smalltalk.withContext(function($ctx2) {
  4860. return _st(x)._foo();
  4861. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4862. self._shouldMNU();
  4863. $ctx1.sendIdx["shouldMNU"]=1;
  4864. self._installTop_("foo ^ false");
  4865. $ctx1.sendIdx["installTop:"]=1;
  4866. self._installTop_("foo ^ true");
  4867. self._deinstallTop();
  4868. self._shouldMNU();
  4869. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4870. args: [],
  4871. 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",
  4872. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4873. referencedClasses: []
  4874. }),
  4875. smalltalk.MethodInheritanceTest);
  4876. smalltalk.addMethod(
  4877. smalltalk.method({
  4878. selector: "testMNU22",
  4879. protocol: 'tests',
  4880. fn: function (){
  4881. var self=this;
  4882. return smalltalk.withContext(function($ctx1) {
  4883. self["@performBlock"]=(function(x){
  4884. return smalltalk.withContext(function($ctx2) {
  4885. return _st(x)._foo();
  4886. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4887. self._shouldMNU();
  4888. $ctx1.sendIdx["shouldMNU"]=1;
  4889. self._installMiddle_("foo ^ false");
  4890. $ctx1.sendIdx["installMiddle:"]=1;
  4891. self._installMiddle_("foo ^ true");
  4892. self._deinstallMiddle();
  4893. self._shouldMNU();
  4894. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4895. args: [],
  4896. 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",
  4897. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4898. referencedClasses: []
  4899. }),
  4900. smalltalk.MethodInheritanceTest);
  4901. smalltalk.addMethod(
  4902. smalltalk.method({
  4903. selector: "testReturns1",
  4904. protocol: 'tests',
  4905. fn: function (){
  4906. var self=this;
  4907. return smalltalk.withContext(function($ctx1) {
  4908. self["@performBlock"]=(function(x){
  4909. return smalltalk.withContext(function($ctx2) {
  4910. return _st(x)._foo();
  4911. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4912. self._installTop_("foo ^ false");
  4913. $ctx1.sendIdx["installTop:"]=1;
  4914. self._shouldReturn_(false);
  4915. $ctx1.sendIdx["shouldReturn:"]=1;
  4916. self._installTop_("foo ^ true");
  4917. self._shouldReturn_(true);
  4918. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4919. args: [],
  4920. 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",
  4921. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4922. referencedClasses: []
  4923. }),
  4924. smalltalk.MethodInheritanceTest);
  4925. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4926. smalltalk.addMethod(
  4927. smalltalk.method({
  4928. selector: "testAbs",
  4929. protocol: 'tests',
  4930. fn: function (){
  4931. var self=this;
  4932. return smalltalk.withContext(function($ctx1) {
  4933. var $1;
  4934. $1=(4)._abs();
  4935. $ctx1.sendIdx["abs"]=1;
  4936. self._assert_equals_($1,(4));
  4937. $ctx1.sendIdx["assert:equals:"]=1;
  4938. self._assert_equals_((-4)._abs(),(4));
  4939. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4940. args: [],
  4941. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4942. messageSends: ["assert:equals:", "abs"],
  4943. referencedClasses: []
  4944. }),
  4945. smalltalk.NumberTest);
  4946. smalltalk.addMethod(
  4947. smalltalk.method({
  4948. selector: "testArithmetic",
  4949. protocol: 'tests',
  4950. fn: function (){
  4951. var self=this;
  4952. return smalltalk.withContext(function($ctx1) {
  4953. var $1,$2,$3,$5,$4;
  4954. $1=(1.5).__plus((1));
  4955. $ctx1.sendIdx["+"]=1;
  4956. self._assert_equals_($1,(2.5));
  4957. $ctx1.sendIdx["assert:equals:"]=1;
  4958. $2=(2).__minus((1));
  4959. $ctx1.sendIdx["-"]=1;
  4960. self._assert_equals_($2,(1));
  4961. $ctx1.sendIdx["assert:equals:"]=2;
  4962. self._assert_equals_((-2).__minus((1)),(-3));
  4963. $ctx1.sendIdx["assert:equals:"]=3;
  4964. self._assert_equals_((12).__slash((2)),(6));
  4965. $ctx1.sendIdx["assert:equals:"]=4;
  4966. $3=(3).__star((4));
  4967. $ctx1.sendIdx["*"]=1;
  4968. self._assert_equals_($3,(12));
  4969. $ctx1.sendIdx["assert:equals:"]=5;
  4970. self._assert_equals_((7).__slash_slash((2)),(3));
  4971. $ctx1.sendIdx["assert:equals:"]=6;
  4972. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4973. $ctx1.sendIdx["assert:equals:"]=7;
  4974. $5=(1).__plus((2));
  4975. $ctx1.sendIdx["+"]=2;
  4976. $4=_st($5).__star((3));
  4977. $ctx1.sendIdx["*"]=2;
  4978. self._assert_equals_($4,(9));
  4979. $ctx1.sendIdx["assert:equals:"]=8;
  4980. self._assert_equals_((1).__plus((2).__star((3))),(7));
  4981. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4982. args: [],
  4983. 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",
  4984. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4985. referencedClasses: []
  4986. }),
  4987. smalltalk.NumberTest);
  4988. smalltalk.addMethod(
  4989. smalltalk.method({
  4990. selector: "testAsNumber",
  4991. protocol: 'tests',
  4992. fn: function (){
  4993. var self=this;
  4994. return smalltalk.withContext(function($ctx1) {
  4995. self._assert_equals_((3)._asNumber(),(3));
  4996. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4997. args: [],
  4998. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4999. messageSends: ["assert:equals:", "asNumber"],
  5000. referencedClasses: []
  5001. }),
  5002. smalltalk.NumberTest);
  5003. smalltalk.addMethod(
  5004. smalltalk.method({
  5005. selector: "testCeiling",
  5006. protocol: 'tests',
  5007. fn: function (){
  5008. var self=this;
  5009. return smalltalk.withContext(function($ctx1) {
  5010. var $1,$2;
  5011. $1=(1.2)._ceiling();
  5012. $ctx1.sendIdx["ceiling"]=1;
  5013. self._assert_equals_($1,(2));
  5014. $ctx1.sendIdx["assert:equals:"]=1;
  5015. $2=(-1.2)._ceiling();
  5016. $ctx1.sendIdx["ceiling"]=2;
  5017. self._assert_equals_($2,(-1));
  5018. $ctx1.sendIdx["assert:equals:"]=2;
  5019. self._assert_equals_((1)._ceiling(),(1));
  5020. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  5021. args: [],
  5022. 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.",
  5023. messageSends: ["assert:equals:", "ceiling"],
  5024. referencedClasses: []
  5025. }),
  5026. smalltalk.NumberTest);
  5027. smalltalk.addMethod(
  5028. smalltalk.method({
  5029. selector: "testComparison",
  5030. protocol: 'tests',
  5031. fn: function (){
  5032. var self=this;
  5033. return smalltalk.withContext(function($ctx1) {
  5034. var $1,$2,$3,$4;
  5035. $1=(3).__gt((2));
  5036. $ctx1.sendIdx[">"]=1;
  5037. self._assert_($1);
  5038. $ctx1.sendIdx["assert:"]=1;
  5039. $2=(2).__lt((3));
  5040. $ctx1.sendIdx["<"]=1;
  5041. self._assert_($2);
  5042. $ctx1.sendIdx["assert:"]=2;
  5043. self._deny_((3).__lt((2)));
  5044. $ctx1.sendIdx["deny:"]=1;
  5045. self._deny_((2).__gt((3)));
  5046. $3=(3).__gt_eq((3));
  5047. $ctx1.sendIdx[">="]=1;
  5048. self._assert_($3);
  5049. $ctx1.sendIdx["assert:"]=3;
  5050. self._assert_((3.1).__gt_eq((3)));
  5051. $ctx1.sendIdx["assert:"]=4;
  5052. $4=(3).__lt_eq((3));
  5053. $ctx1.sendIdx["<="]=1;
  5054. self._assert_($4);
  5055. $ctx1.sendIdx["assert:"]=5;
  5056. self._assert_((3).__lt_eq((3.1)));
  5057. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  5058. args: [],
  5059. 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",
  5060. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  5061. referencedClasses: []
  5062. }),
  5063. smalltalk.NumberTest);
  5064. smalltalk.addMethod(
  5065. smalltalk.method({
  5066. selector: "testCopying",
  5067. protocol: 'tests',
  5068. fn: function (){
  5069. var self=this;
  5070. return smalltalk.withContext(function($ctx1) {
  5071. var $1;
  5072. $1=_st((1)._copy()).__eq_eq((1));
  5073. $ctx1.sendIdx["=="]=1;
  5074. self._assert_($1);
  5075. $ctx1.sendIdx["assert:"]=1;
  5076. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  5077. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  5078. args: [],
  5079. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  5080. messageSends: ["assert:", "==", "copy", "deepCopy"],
  5081. referencedClasses: []
  5082. }),
  5083. smalltalk.NumberTest);
  5084. smalltalk.addMethod(
  5085. smalltalk.method({
  5086. selector: "testEquality",
  5087. protocol: 'tests',
  5088. fn: function (){
  5089. var self=this;
  5090. return smalltalk.withContext(function($ctx1) {
  5091. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  5092. $1=(1).__eq((1));
  5093. $ctx1.sendIdx["="]=1;
  5094. self._assert_($1);
  5095. $ctx1.sendIdx["assert:"]=1;
  5096. $2=(0).__eq((0));
  5097. $ctx1.sendIdx["="]=2;
  5098. self._assert_($2);
  5099. $ctx1.sendIdx["assert:"]=2;
  5100. $3=(1).__eq((0));
  5101. $ctx1.sendIdx["="]=3;
  5102. self._deny_($3);
  5103. $ctx1.sendIdx["deny:"]=1;
  5104. $5=(1)._yourself();
  5105. $ctx1.sendIdx["yourself"]=1;
  5106. $4=_st($5).__eq((1));
  5107. $ctx1.sendIdx["="]=4;
  5108. self._assert_($4);
  5109. $ctx1.sendIdx["assert:"]=3;
  5110. $7=(1)._yourself();
  5111. $ctx1.sendIdx["yourself"]=2;
  5112. $6=(1).__eq($7);
  5113. $ctx1.sendIdx["="]=5;
  5114. self._assert_($6);
  5115. $ctx1.sendIdx["assert:"]=4;
  5116. $9=(1)._yourself();
  5117. $ctx1.sendIdx["yourself"]=3;
  5118. $8=_st($9).__eq((1)._yourself());
  5119. $ctx1.sendIdx["="]=6;
  5120. self._assert_($8);
  5121. $10=(0).__eq(false);
  5122. $ctx1.sendIdx["="]=7;
  5123. self._deny_($10);
  5124. $ctx1.sendIdx["deny:"]=2;
  5125. $11=false.__eq((0));
  5126. $ctx1.sendIdx["="]=8;
  5127. self._deny_($11);
  5128. $ctx1.sendIdx["deny:"]=3;
  5129. $12="".__eq((0));
  5130. $ctx1.sendIdx["="]=9;
  5131. self._deny_($12);
  5132. $ctx1.sendIdx["deny:"]=4;
  5133. self._deny_((0).__eq(""));
  5134. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  5135. args: [],
  5136. 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 = ''",
  5137. messageSends: ["assert:", "=", "deny:", "yourself"],
  5138. referencedClasses: []
  5139. }),
  5140. smalltalk.NumberTest);
  5141. smalltalk.addMethod(
  5142. smalltalk.method({
  5143. selector: "testFloor",
  5144. protocol: 'tests',
  5145. fn: function (){
  5146. var self=this;
  5147. return smalltalk.withContext(function($ctx1) {
  5148. var $1,$2;
  5149. $1=(1.2)._floor();
  5150. $ctx1.sendIdx["floor"]=1;
  5151. self._assert_equals_($1,(1));
  5152. $ctx1.sendIdx["assert:equals:"]=1;
  5153. $2=(-1.2)._floor();
  5154. $ctx1.sendIdx["floor"]=2;
  5155. self._assert_equals_($2,(-2));
  5156. $ctx1.sendIdx["assert:equals:"]=2;
  5157. self._assert_equals_((1)._floor(),(1));
  5158. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  5159. args: [],
  5160. 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.",
  5161. messageSends: ["assert:equals:", "floor"],
  5162. referencedClasses: []
  5163. }),
  5164. smalltalk.NumberTest);
  5165. smalltalk.addMethod(
  5166. smalltalk.method({
  5167. selector: "testHexNumbers",
  5168. protocol: 'tests',
  5169. fn: function (){
  5170. var self=this;
  5171. return smalltalk.withContext(function($ctx1) {
  5172. var $1,$2,$3,$4,$5;
  5173. self._assert_equals_((9),(9));
  5174. $ctx1.sendIdx["assert:equals:"]=1;
  5175. $1=(10)._truncated();
  5176. $ctx1.sendIdx["truncated"]=1;
  5177. self._assert_equals_($1,(10));
  5178. $ctx1.sendIdx["assert:equals:"]=2;
  5179. $2=(11)._truncated();
  5180. $ctx1.sendIdx["truncated"]=2;
  5181. self._assert_equals_($2,(11));
  5182. $ctx1.sendIdx["assert:equals:"]=3;
  5183. $3=(12)._truncated();
  5184. $ctx1.sendIdx["truncated"]=3;
  5185. self._assert_equals_($3,(12));
  5186. $ctx1.sendIdx["assert:equals:"]=4;
  5187. $4=(13)._truncated();
  5188. $ctx1.sendIdx["truncated"]=4;
  5189. self._assert_equals_($4,(13));
  5190. $ctx1.sendIdx["assert:equals:"]=5;
  5191. $5=(14)._truncated();
  5192. $ctx1.sendIdx["truncated"]=5;
  5193. self._assert_equals_($5,(14));
  5194. $ctx1.sendIdx["assert:equals:"]=6;
  5195. self._assert_equals_((15)._truncated(),(15));
  5196. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  5197. args: [],
  5198. 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",
  5199. messageSends: ["assert:equals:", "truncated"],
  5200. referencedClasses: []
  5201. }),
  5202. smalltalk.NumberTest);
  5203. smalltalk.addMethod(
  5204. smalltalk.method({
  5205. selector: "testIdentity",
  5206. protocol: 'tests',
  5207. fn: function (){
  5208. var self=this;
  5209. return smalltalk.withContext(function($ctx1) {
  5210. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  5211. $1=(1).__eq_eq((1));
  5212. $ctx1.sendIdx["=="]=1;
  5213. self._assert_($1);
  5214. $ctx1.sendIdx["assert:"]=1;
  5215. $2=(0).__eq_eq((0));
  5216. $ctx1.sendIdx["=="]=2;
  5217. self._assert_($2);
  5218. $ctx1.sendIdx["assert:"]=2;
  5219. $3=(1).__eq_eq((0));
  5220. $ctx1.sendIdx["=="]=3;
  5221. self._deny_($3);
  5222. $ctx1.sendIdx["deny:"]=1;
  5223. $5=(1)._yourself();
  5224. $ctx1.sendIdx["yourself"]=1;
  5225. $4=_st($5).__eq_eq((1));
  5226. $ctx1.sendIdx["=="]=4;
  5227. self._assert_($4);
  5228. $ctx1.sendIdx["assert:"]=3;
  5229. $7=(1)._yourself();
  5230. $ctx1.sendIdx["yourself"]=2;
  5231. $6=(1).__eq_eq($7);
  5232. $ctx1.sendIdx["=="]=5;
  5233. self._assert_($6);
  5234. $ctx1.sendIdx["assert:"]=4;
  5235. $9=(1)._yourself();
  5236. $ctx1.sendIdx["yourself"]=3;
  5237. $8=_st($9).__eq_eq((1)._yourself());
  5238. $ctx1.sendIdx["=="]=6;
  5239. self._assert_($8);
  5240. self._deny_((1).__eq_eq((2)));
  5241. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  5242. args: [],
  5243. 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",
  5244. messageSends: ["assert:", "==", "deny:", "yourself"],
  5245. referencedClasses: []
  5246. }),
  5247. smalltalk.NumberTest);
  5248. smalltalk.addMethod(
  5249. smalltalk.method({
  5250. selector: "testInvalidHexNumbers",
  5251. protocol: 'tests',
  5252. fn: function (){
  5253. var self=this;
  5254. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5255. return smalltalk.withContext(function($ctx1) {
  5256. self._should_raise_((function(){
  5257. return smalltalk.withContext(function($ctx2) {
  5258. return (16)._rG();
  5259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5260. $ctx1.sendIdx["should:raise:"]=1;
  5261. self._should_raise_((function(){
  5262. return smalltalk.withContext(function($ctx2) {
  5263. return (16)._rg();
  5264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  5265. $ctx1.sendIdx["should:raise:"]=2;
  5266. self._should_raise_((function(){
  5267. return smalltalk.withContext(function($ctx2) {
  5268. return (16)._rH();
  5269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  5270. $ctx1.sendIdx["should:raise:"]=3;
  5271. self._should_raise_((function(){
  5272. return smalltalk.withContext(function($ctx2) {
  5273. return (16)._rh();
  5274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  5275. $ctx1.sendIdx["should:raise:"]=4;
  5276. self._should_raise_((function(){
  5277. return smalltalk.withContext(function($ctx2) {
  5278. return (16)._rI();
  5279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  5280. $ctx1.sendIdx["should:raise:"]=5;
  5281. self._should_raise_((function(){
  5282. return smalltalk.withContext(function($ctx2) {
  5283. return (16)._ri();
  5284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  5285. $ctx1.sendIdx["should:raise:"]=6;
  5286. self._should_raise_((function(){
  5287. return smalltalk.withContext(function($ctx2) {
  5288. return (16)._rJ();
  5289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  5290. $ctx1.sendIdx["should:raise:"]=7;
  5291. self._should_raise_((function(){
  5292. return smalltalk.withContext(function($ctx2) {
  5293. return (16)._rj();
  5294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  5295. $ctx1.sendIdx["should:raise:"]=8;
  5296. self._should_raise_((function(){
  5297. return smalltalk.withContext(function($ctx2) {
  5298. return (16)._rK();
  5299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  5300. $ctx1.sendIdx["should:raise:"]=9;
  5301. self._should_raise_((function(){
  5302. return smalltalk.withContext(function($ctx2) {
  5303. return (16)._rk();
  5304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  5305. $ctx1.sendIdx["should:raise:"]=10;
  5306. self._should_raise_((function(){
  5307. return smalltalk.withContext(function($ctx2) {
  5308. return (16)._rL();
  5309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  5310. $ctx1.sendIdx["should:raise:"]=11;
  5311. self._should_raise_((function(){
  5312. return smalltalk.withContext(function($ctx2) {
  5313. return (16)._rl();
  5314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  5315. $ctx1.sendIdx["should:raise:"]=12;
  5316. self._should_raise_((function(){
  5317. return smalltalk.withContext(function($ctx2) {
  5318. return (16)._rM();
  5319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  5320. $ctx1.sendIdx["should:raise:"]=13;
  5321. self._should_raise_((function(){
  5322. return smalltalk.withContext(function($ctx2) {
  5323. return (16)._rm();
  5324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  5325. $ctx1.sendIdx["should:raise:"]=14;
  5326. self._should_raise_((function(){
  5327. return smalltalk.withContext(function($ctx2) {
  5328. return (16)._rN();
  5329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  5330. $ctx1.sendIdx["should:raise:"]=15;
  5331. self._should_raise_((function(){
  5332. return smalltalk.withContext(function($ctx2) {
  5333. return (16)._rn();
  5334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  5335. $ctx1.sendIdx["should:raise:"]=16;
  5336. self._should_raise_((function(){
  5337. return smalltalk.withContext(function($ctx2) {
  5338. return (16)._rO();
  5339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  5340. $ctx1.sendIdx["should:raise:"]=17;
  5341. self._should_raise_((function(){
  5342. return smalltalk.withContext(function($ctx2) {
  5343. return (16)._ro();
  5344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  5345. $ctx1.sendIdx["should:raise:"]=18;
  5346. self._should_raise_((function(){
  5347. return smalltalk.withContext(function($ctx2) {
  5348. return (16)._rP();
  5349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5350. $ctx1.sendIdx["should:raise:"]=19;
  5351. self._should_raise_((function(){
  5352. return smalltalk.withContext(function($ctx2) {
  5353. return (16)._rp();
  5354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5355. $ctx1.sendIdx["should:raise:"]=20;
  5356. self._should_raise_((function(){
  5357. return smalltalk.withContext(function($ctx2) {
  5358. return (16)._rQ();
  5359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5360. $ctx1.sendIdx["should:raise:"]=21;
  5361. self._should_raise_((function(){
  5362. return smalltalk.withContext(function($ctx2) {
  5363. return (16)._rq();
  5364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5365. $ctx1.sendIdx["should:raise:"]=22;
  5366. self._should_raise_((function(){
  5367. return smalltalk.withContext(function($ctx2) {
  5368. return (16)._rR();
  5369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5370. $ctx1.sendIdx["should:raise:"]=23;
  5371. self._should_raise_((function(){
  5372. return smalltalk.withContext(function($ctx2) {
  5373. return (16)._rr();
  5374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5375. $ctx1.sendIdx["should:raise:"]=24;
  5376. self._should_raise_((function(){
  5377. return smalltalk.withContext(function($ctx2) {
  5378. return (16)._rS();
  5379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5380. $ctx1.sendIdx["should:raise:"]=25;
  5381. self._should_raise_((function(){
  5382. return smalltalk.withContext(function($ctx2) {
  5383. return (16)._rs();
  5384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5385. $ctx1.sendIdx["should:raise:"]=26;
  5386. self._should_raise_((function(){
  5387. return smalltalk.withContext(function($ctx2) {
  5388. return (16)._rT();
  5389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5390. $ctx1.sendIdx["should:raise:"]=27;
  5391. self._should_raise_((function(){
  5392. return smalltalk.withContext(function($ctx2) {
  5393. return (16)._rt();
  5394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5395. $ctx1.sendIdx["should:raise:"]=28;
  5396. self._should_raise_((function(){
  5397. return smalltalk.withContext(function($ctx2) {
  5398. return (16)._rU();
  5399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5400. $ctx1.sendIdx["should:raise:"]=29;
  5401. self._should_raise_((function(){
  5402. return smalltalk.withContext(function($ctx2) {
  5403. return (16)._ru();
  5404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5405. $ctx1.sendIdx["should:raise:"]=30;
  5406. self._should_raise_((function(){
  5407. return smalltalk.withContext(function($ctx2) {
  5408. return (16)._rV();
  5409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5410. $ctx1.sendIdx["should:raise:"]=31;
  5411. self._should_raise_((function(){
  5412. return smalltalk.withContext(function($ctx2) {
  5413. return (16)._rv();
  5414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5415. $ctx1.sendIdx["should:raise:"]=32;
  5416. self._should_raise_((function(){
  5417. return smalltalk.withContext(function($ctx2) {
  5418. return (16)._rW();
  5419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5420. $ctx1.sendIdx["should:raise:"]=33;
  5421. self._should_raise_((function(){
  5422. return smalltalk.withContext(function($ctx2) {
  5423. return (16)._rw();
  5424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5425. $ctx1.sendIdx["should:raise:"]=34;
  5426. self._should_raise_((function(){
  5427. return smalltalk.withContext(function($ctx2) {
  5428. return (16)._rX();
  5429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5430. $ctx1.sendIdx["should:raise:"]=35;
  5431. self._should_raise_((function(){
  5432. return smalltalk.withContext(function($ctx2) {
  5433. return (16)._rx();
  5434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5435. $ctx1.sendIdx["should:raise:"]=36;
  5436. self._should_raise_((function(){
  5437. return smalltalk.withContext(function($ctx2) {
  5438. return (16)._rY();
  5439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5440. $ctx1.sendIdx["should:raise:"]=37;
  5441. self._should_raise_((function(){
  5442. return smalltalk.withContext(function($ctx2) {
  5443. return (16)._ry();
  5444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5445. $ctx1.sendIdx["should:raise:"]=38;
  5446. self._should_raise_((function(){
  5447. return smalltalk.withContext(function($ctx2) {
  5448. return (16)._rZ();
  5449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5450. $ctx1.sendIdx["should:raise:"]=39;
  5451. self._should_raise_((function(){
  5452. return smalltalk.withContext(function($ctx2) {
  5453. return (16)._rz();
  5454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5455. $ctx1.sendIdx["should:raise:"]=40;
  5456. self._should_raise_((function(){
  5457. return smalltalk.withContext(function($ctx2) {
  5458. return (11259375)._Z();
  5459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5460. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5461. args: [],
  5462. 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.",
  5463. 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"],
  5464. referencedClasses: ["MessageNotUnderstood"]
  5465. }),
  5466. smalltalk.NumberTest);
  5467. smalltalk.addMethod(
  5468. smalltalk.method({
  5469. selector: "testLog",
  5470. protocol: 'tests',
  5471. fn: function (){
  5472. var self=this;
  5473. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5474. return smalltalk.withContext(function($ctx1) {
  5475. self._assert_equals_((10000)._log(),(4));
  5476. $ctx1.sendIdx["assert:equals:"]=1;
  5477. self._assert_equals_((512)._log_((2)),(9));
  5478. $ctx1.sendIdx["assert:equals:"]=2;
  5479. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5480. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5481. args: [],
  5482. 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.",
  5483. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5484. referencedClasses: ["Number"]
  5485. }),
  5486. smalltalk.NumberTest);
  5487. smalltalk.addMethod(
  5488. smalltalk.method({
  5489. selector: "testMinMax",
  5490. protocol: 'tests',
  5491. fn: function (){
  5492. var self=this;
  5493. return smalltalk.withContext(function($ctx1) {
  5494. self._assert_equals_((2)._max_((5)),(5));
  5495. $ctx1.sendIdx["assert:equals:"]=1;
  5496. self._assert_equals_((2)._min_((5)),(2));
  5497. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5498. args: [],
  5499. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5500. messageSends: ["assert:equals:", "max:", "min:"],
  5501. referencedClasses: []
  5502. }),
  5503. smalltalk.NumberTest);
  5504. smalltalk.addMethod(
  5505. smalltalk.method({
  5506. selector: "testNegated",
  5507. protocol: 'tests',
  5508. fn: function (){
  5509. var self=this;
  5510. return smalltalk.withContext(function($ctx1) {
  5511. var $1;
  5512. $1=(3)._negated();
  5513. $ctx1.sendIdx["negated"]=1;
  5514. self._assert_equals_($1,(-3));
  5515. $ctx1.sendIdx["assert:equals:"]=1;
  5516. self._assert_equals_((-3)._negated(),(3));
  5517. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5518. args: [],
  5519. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5520. messageSends: ["assert:equals:", "negated"],
  5521. referencedClasses: []
  5522. }),
  5523. smalltalk.NumberTest);
  5524. smalltalk.addMethod(
  5525. smalltalk.method({
  5526. selector: "testPrintShowingDecimalPlaces",
  5527. protocol: 'tests',
  5528. fn: function (){
  5529. var self=this;
  5530. return smalltalk.withContext(function($ctx1) {
  5531. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  5532. $1=(23)._printShowingDecimalPlaces_((2));
  5533. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5534. self._assert_equals_($1,"23.00");
  5535. $ctx1.sendIdx["assert:equals:"]=1;
  5536. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5537. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5538. self._assert_equals_($2,"23.57");
  5539. $ctx1.sendIdx["assert:equals:"]=2;
  5540. $4=(234.567)._negated();
  5541. $ctx1.sendIdx["negated"]=1;
  5542. $3=_st($4)._printShowingDecimalPlaces_((5));
  5543. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5544. self._assert_equals_($3,"-234.56700");
  5545. $ctx1.sendIdx["assert:equals:"]=3;
  5546. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5547. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5548. self._assert_equals_($5,"23");
  5549. $ctx1.sendIdx["assert:equals:"]=4;
  5550. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5551. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5552. self._assert_equals_($6,"24");
  5553. $ctx1.sendIdx["assert:equals:"]=5;
  5554. $8=(23.4567)._negated();
  5555. $ctx1.sendIdx["negated"]=2;
  5556. $7=_st($8)._printShowingDecimalPlaces_((0));
  5557. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5558. self._assert_equals_($7,"-23");
  5559. $ctx1.sendIdx["assert:equals:"]=6;
  5560. $10=(23.5567)._negated();
  5561. $ctx1.sendIdx["negated"]=3;
  5562. $9=_st($10)._printShowingDecimalPlaces_((0));
  5563. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5564. self._assert_equals_($9,"-24");
  5565. $ctx1.sendIdx["assert:equals:"]=7;
  5566. $11=(100000000)._printShowingDecimalPlaces_((1));
  5567. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5568. self._assert_equals_($11,"100000000.0");
  5569. $ctx1.sendIdx["assert:equals:"]=8;
  5570. $12=(0.98)._printShowingDecimalPlaces_((5));
  5571. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5572. self._assert_equals_($12,"0.98000");
  5573. $ctx1.sendIdx["assert:equals:"]=9;
  5574. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5575. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5576. self._assert_equals_($13,"-0.98");
  5577. $ctx1.sendIdx["assert:equals:"]=10;
  5578. $14=(2.567)._printShowingDecimalPlaces_((2));
  5579. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5580. self._assert_equals_($14,"2.57");
  5581. $ctx1.sendIdx["assert:equals:"]=11;
  5582. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5583. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5584. self._assert_equals_($15,"-2.57");
  5585. $ctx1.sendIdx["assert:equals:"]=12;
  5586. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5587. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5588. args: [],
  5589. 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'.",
  5590. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5591. referencedClasses: []
  5592. }),
  5593. smalltalk.NumberTest);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "testRaisedTo",
  5597. protocol: 'tests',
  5598. fn: function (){
  5599. var self=this;
  5600. return smalltalk.withContext(function($ctx1) {
  5601. var $1,$2,$3;
  5602. $1=(2)._raisedTo_((4));
  5603. $ctx1.sendIdx["raisedTo:"]=1;
  5604. self._assert_equals_($1,(16));
  5605. $ctx1.sendIdx["assert:equals:"]=1;
  5606. $2=(2)._raisedTo_((0));
  5607. $ctx1.sendIdx["raisedTo:"]=2;
  5608. self._assert_equals_($2,(1));
  5609. $ctx1.sendIdx["assert:equals:"]=2;
  5610. $3=(2)._raisedTo_((-3));
  5611. $ctx1.sendIdx["raisedTo:"]=3;
  5612. self._assert_equals_($3,(0.125));
  5613. $ctx1.sendIdx["assert:equals:"]=3;
  5614. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5615. $ctx1.sendIdx["assert:equals:"]=4;
  5616. self._assert_equals_((2).__star_star((4)),(16));
  5617. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5618. args: [],
  5619. 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.",
  5620. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5621. referencedClasses: []
  5622. }),
  5623. smalltalk.NumberTest);
  5624. smalltalk.addMethod(
  5625. smalltalk.method({
  5626. selector: "testRounded",
  5627. protocol: 'tests',
  5628. fn: function (){
  5629. var self=this;
  5630. return smalltalk.withContext(function($ctx1) {
  5631. var $1,$2;
  5632. $1=(3)._rounded();
  5633. $ctx1.sendIdx["rounded"]=1;
  5634. self._assert_equals_($1,(3));
  5635. $ctx1.sendIdx["assert:equals:"]=1;
  5636. $2=(3.212)._rounded();
  5637. $ctx1.sendIdx["rounded"]=2;
  5638. self._assert_equals_($2,(3));
  5639. $ctx1.sendIdx["assert:equals:"]=2;
  5640. self._assert_equals_((3.51)._rounded(),(4));
  5641. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5642. args: [],
  5643. 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",
  5644. messageSends: ["assert:equals:", "rounded"],
  5645. referencedClasses: []
  5646. }),
  5647. smalltalk.NumberTest);
  5648. smalltalk.addMethod(
  5649. smalltalk.method({
  5650. selector: "testSign",
  5651. protocol: 'tests',
  5652. fn: function (){
  5653. var self=this;
  5654. return smalltalk.withContext(function($ctx1) {
  5655. var $1,$2;
  5656. $1=(5)._sign();
  5657. $ctx1.sendIdx["sign"]=1;
  5658. self._assert_equals_($1,(1));
  5659. $ctx1.sendIdx["assert:equals:"]=1;
  5660. $2=(0)._sign();
  5661. $ctx1.sendIdx["sign"]=2;
  5662. self._assert_equals_($2,(0));
  5663. $ctx1.sendIdx["assert:equals:"]=2;
  5664. self._assert_equals_((-1.4)._sign(),(-1));
  5665. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5666. args: [],
  5667. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5668. messageSends: ["assert:equals:", "sign"],
  5669. referencedClasses: []
  5670. }),
  5671. smalltalk.NumberTest);
  5672. smalltalk.addMethod(
  5673. smalltalk.method({
  5674. selector: "testSqrt",
  5675. protocol: 'tests',
  5676. fn: function (){
  5677. var self=this;
  5678. return smalltalk.withContext(function($ctx1) {
  5679. var $1;
  5680. $1=(4)._sqrt();
  5681. $ctx1.sendIdx["sqrt"]=1;
  5682. self._assert_equals_($1,(2));
  5683. $ctx1.sendIdx["assert:equals:"]=1;
  5684. self._assert_equals_((16)._sqrt(),(4));
  5685. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5686. args: [],
  5687. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5688. messageSends: ["assert:equals:", "sqrt"],
  5689. referencedClasses: []
  5690. }),
  5691. smalltalk.NumberTest);
  5692. smalltalk.addMethod(
  5693. smalltalk.method({
  5694. selector: "testSquared",
  5695. protocol: 'tests',
  5696. fn: function (){
  5697. var self=this;
  5698. return smalltalk.withContext(function($ctx1) {
  5699. self._assert_equals_((4)._squared(),(16));
  5700. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5701. args: [],
  5702. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5703. messageSends: ["assert:equals:", "squared"],
  5704. referencedClasses: []
  5705. }),
  5706. smalltalk.NumberTest);
  5707. smalltalk.addMethod(
  5708. smalltalk.method({
  5709. selector: "testTimesRepeat",
  5710. protocol: 'tests',
  5711. fn: function (){
  5712. var self=this;
  5713. var i;
  5714. return smalltalk.withContext(function($ctx1) {
  5715. i=(0);
  5716. (0)._timesRepeat_((function(){
  5717. return smalltalk.withContext(function($ctx2) {
  5718. i=_st(i).__plus((1));
  5719. $ctx2.sendIdx["+"]=1;
  5720. return i;
  5721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5722. $ctx1.sendIdx["timesRepeat:"]=1;
  5723. self._assert_equals_(i,(0));
  5724. $ctx1.sendIdx["assert:equals:"]=1;
  5725. (5)._timesRepeat_((function(){
  5726. return smalltalk.withContext(function($ctx2) {
  5727. i=_st(i).__plus((1));
  5728. return i;
  5729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5730. self._assert_equals_(i,(5));
  5731. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5732. args: [],
  5733. 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",
  5734. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5735. referencedClasses: []
  5736. }),
  5737. smalltalk.NumberTest);
  5738. smalltalk.addMethod(
  5739. smalltalk.method({
  5740. selector: "testTo",
  5741. protocol: 'tests',
  5742. fn: function (){
  5743. var self=this;
  5744. return smalltalk.withContext(function($ctx1) {
  5745. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5746. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5747. args: [],
  5748. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5749. messageSends: ["assert:equals:", "to:"],
  5750. referencedClasses: []
  5751. }),
  5752. smalltalk.NumberTest);
  5753. smalltalk.addMethod(
  5754. smalltalk.method({
  5755. selector: "testToBy",
  5756. protocol: 'tests',
  5757. fn: function (){
  5758. var self=this;
  5759. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5760. return smalltalk.withContext(function($ctx1) {
  5761. var $1;
  5762. $1=(0)._to_by_((6),(2));
  5763. $ctx1.sendIdx["to:by:"]=1;
  5764. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5765. self._should_raise_((function(){
  5766. return smalltalk.withContext(function($ctx2) {
  5767. return (1)._to_by_((4),(0));
  5768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5769. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5770. args: [],
  5771. 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",
  5772. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5773. referencedClasses: ["Error"]
  5774. }),
  5775. smalltalk.NumberTest);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "testTrigonometry",
  5779. protocol: 'tests',
  5780. fn: function (){
  5781. var self=this;
  5782. return smalltalk.withContext(function($ctx1) {
  5783. self._assert_equals_((0)._cos(),(1));
  5784. $ctx1.sendIdx["assert:equals:"]=1;
  5785. self._assert_equals_((0)._sin(),(0));
  5786. $ctx1.sendIdx["assert:equals:"]=2;
  5787. self._assert_equals_((0)._tan(),(0));
  5788. $ctx1.sendIdx["assert:equals:"]=3;
  5789. self._assert_equals_((1)._arcCos(),(0));
  5790. $ctx1.sendIdx["assert:equals:"]=4;
  5791. self._assert_equals_((0)._arcSin(),(0));
  5792. $ctx1.sendIdx["assert:equals:"]=5;
  5793. self._assert_equals_((0)._arcTan(),(0));
  5794. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5795. args: [],
  5796. 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.",
  5797. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5798. referencedClasses: []
  5799. }),
  5800. smalltalk.NumberTest);
  5801. smalltalk.addMethod(
  5802. smalltalk.method({
  5803. selector: "testTruncated",
  5804. protocol: 'tests',
  5805. fn: function (){
  5806. var self=this;
  5807. return smalltalk.withContext(function($ctx1) {
  5808. var $1,$2;
  5809. $1=(3)._truncated();
  5810. $ctx1.sendIdx["truncated"]=1;
  5811. self._assert_equals_($1,(3));
  5812. $ctx1.sendIdx["assert:equals:"]=1;
  5813. $2=(3.212)._truncated();
  5814. $ctx1.sendIdx["truncated"]=2;
  5815. self._assert_equals_($2,(3));
  5816. $ctx1.sendIdx["assert:equals:"]=2;
  5817. self._assert_equals_((3.51)._truncated(),(3));
  5818. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5819. args: [],
  5820. 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",
  5821. messageSends: ["assert:equals:", "truncated"],
  5822. referencedClasses: []
  5823. }),
  5824. smalltalk.NumberTest);
  5825. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5826. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5827. smalltalk.addMethod(
  5828. smalltalk.method({
  5829. selector: "foo",
  5830. protocol: 'not yet classified',
  5831. fn: function (){
  5832. var self=this;
  5833. return smalltalk.withContext(function($ctx1) {
  5834. var $1;
  5835. $1=self["@foo"];
  5836. return $1;
  5837. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5838. args: [],
  5839. source: "foo\x0a\x09^ foo",
  5840. messageSends: [],
  5841. referencedClasses: []
  5842. }),
  5843. smalltalk.ObjectMock);
  5844. smalltalk.addMethod(
  5845. smalltalk.method({
  5846. selector: "foo:",
  5847. protocol: 'not yet classified',
  5848. fn: function (anObject){
  5849. var self=this;
  5850. return smalltalk.withContext(function($ctx1) {
  5851. self["@foo"]=anObject;
  5852. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5853. args: ["anObject"],
  5854. source: "foo: anObject\x0a\x09foo := anObject",
  5855. messageSends: [],
  5856. referencedClasses: []
  5857. }),
  5858. smalltalk.ObjectMock);
  5859. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5860. smalltalk.addMethod(
  5861. smalltalk.method({
  5862. selector: "notDefined",
  5863. protocol: 'tests',
  5864. fn: function (){
  5865. var self=this;
  5866. return smalltalk.withContext(function($ctx1) {
  5867. return void 0;;
  5868. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5869. args: [],
  5870. source: "notDefined\x0a\x09<return void 0;>",
  5871. messageSends: [],
  5872. referencedClasses: []
  5873. }),
  5874. smalltalk.ObjectTest);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "testBasicAccess",
  5878. protocol: 'tests',
  5879. fn: function (){
  5880. var self=this;
  5881. var o;
  5882. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5883. return smalltalk.withContext(function($ctx1) {
  5884. var $1;
  5885. o=_st($Object())._new();
  5886. _st(o)._basicAt_put_("a",(1));
  5887. $1=_st(o)._basicAt_("a");
  5888. $ctx1.sendIdx["basicAt:"]=1;
  5889. self._assert_equals_($1,(1));
  5890. $ctx1.sendIdx["assert:equals:"]=1;
  5891. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  5892. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5893. args: [],
  5894. 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",
  5895. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5896. referencedClasses: ["Object"]
  5897. }),
  5898. smalltalk.ObjectTest);
  5899. smalltalk.addMethod(
  5900. smalltalk.method({
  5901. selector: "testBasicPerform",
  5902. protocol: 'tests',
  5903. fn: function (){
  5904. var self=this;
  5905. var o;
  5906. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5907. return smalltalk.withContext(function($ctx1) {
  5908. o=_st($Object())._new();
  5909. _st(o)._basicAt_put_("func",(function(){
  5910. return smalltalk.withContext(function($ctx2) {
  5911. return "hello";
  5912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5913. $ctx1.sendIdx["basicAt:put:"]=1;
  5914. _st(o)._basicAt_put_("func2",(function(a){
  5915. return smalltalk.withContext(function($ctx2) {
  5916. return _st(a).__plus((1));
  5917. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5918. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5919. $ctx1.sendIdx["assert:equals:"]=1;
  5920. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5921. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5922. args: [],
  5923. 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",
  5924. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5925. referencedClasses: ["Object"]
  5926. }),
  5927. smalltalk.ObjectTest);
  5928. smalltalk.addMethod(
  5929. smalltalk.method({
  5930. selector: "testDNU",
  5931. protocol: 'tests',
  5932. fn: function (){
  5933. var self=this;
  5934. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5935. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5936. return smalltalk.withContext(function($ctx1) {
  5937. self._should_raise_((function(){
  5938. return smalltalk.withContext(function($ctx2) {
  5939. return _st(_st($Object())._new())._foo();
  5940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5941. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5942. args: [],
  5943. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  5944. messageSends: ["should:raise:", "foo", "new"],
  5945. referencedClasses: ["Object", "MessageNotUnderstood"]
  5946. }),
  5947. smalltalk.ObjectTest);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "testEquality",
  5951. protocol: 'tests',
  5952. fn: function (){
  5953. var self=this;
  5954. var o;
  5955. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5956. return smalltalk.withContext(function($ctx1) {
  5957. var $1,$2,$4,$3;
  5958. o=_st($Object())._new();
  5959. $ctx1.sendIdx["new"]=1;
  5960. $1=_st(o).__eq(_st($Object())._new());
  5961. $ctx1.sendIdx["="]=1;
  5962. self._deny_($1);
  5963. $2=_st(o).__eq(o);
  5964. $ctx1.sendIdx["="]=2;
  5965. self._assert_($2);
  5966. $ctx1.sendIdx["assert:"]=1;
  5967. $4=_st(o)._yourself();
  5968. $ctx1.sendIdx["yourself"]=1;
  5969. $3=_st($4).__eq(o);
  5970. $ctx1.sendIdx["="]=3;
  5971. self._assert_($3);
  5972. $ctx1.sendIdx["assert:"]=2;
  5973. self._assert_(_st(o).__eq(_st(o)._yourself()));
  5974. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5975. args: [],
  5976. 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)",
  5977. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5978. referencedClasses: ["Object"]
  5979. }),
  5980. smalltalk.ObjectTest);
  5981. smalltalk.addMethod(
  5982. smalltalk.method({
  5983. selector: "testHalt",
  5984. protocol: 'tests',
  5985. fn: function (){
  5986. var self=this;
  5987. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5988. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5989. return smalltalk.withContext(function($ctx1) {
  5990. self._should_raise_((function(){
  5991. return smalltalk.withContext(function($ctx2) {
  5992. return _st(_st($Object())._new())._halt();
  5993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5994. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5995. args: [],
  5996. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  5997. messageSends: ["should:raise:", "halt", "new"],
  5998. referencedClasses: ["Object", "Error"]
  5999. }),
  6000. smalltalk.ObjectTest);
  6001. smalltalk.addMethod(
  6002. smalltalk.method({
  6003. selector: "testIdentity",
  6004. protocol: 'tests',
  6005. fn: function (){
  6006. var self=this;
  6007. var o;
  6008. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6009. return smalltalk.withContext(function($ctx1) {
  6010. var $1,$2,$4,$3;
  6011. o=_st($Object())._new();
  6012. $ctx1.sendIdx["new"]=1;
  6013. $1=_st(o).__eq_eq(_st($Object())._new());
  6014. $ctx1.sendIdx["=="]=1;
  6015. self._deny_($1);
  6016. $2=_st(o).__eq_eq(o);
  6017. $ctx1.sendIdx["=="]=2;
  6018. self._assert_($2);
  6019. $ctx1.sendIdx["assert:"]=1;
  6020. $4=_st(o)._yourself();
  6021. $ctx1.sendIdx["yourself"]=1;
  6022. $3=_st($4).__eq_eq(o);
  6023. $ctx1.sendIdx["=="]=3;
  6024. self._assert_($3);
  6025. $ctx1.sendIdx["assert:"]=2;
  6026. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  6027. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  6028. args: [],
  6029. 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",
  6030. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  6031. referencedClasses: ["Object"]
  6032. }),
  6033. smalltalk.ObjectTest);
  6034. smalltalk.addMethod(
  6035. smalltalk.method({
  6036. selector: "testIfNil",
  6037. protocol: 'tests',
  6038. fn: function (){
  6039. var self=this;
  6040. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6041. return smalltalk.withContext(function($ctx1) {
  6042. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  6043. $2=_st($Object())._new();
  6044. $ctx1.sendIdx["new"]=1;
  6045. $1=_st($2)._isNil();
  6046. self._deny_($1);
  6047. $ctx1.sendIdx["deny:"]=1;
  6048. $5=_st($Object())._new();
  6049. $ctx1.sendIdx["new"]=2;
  6050. if(($receiver = $5) == nil || $receiver == null){
  6051. $4=true;
  6052. } else {
  6053. $4=$5;
  6054. };
  6055. $3=_st($4).__eq(true);
  6056. self._deny_($3);
  6057. $7=_st($Object())._new();
  6058. $ctx1.sendIdx["new"]=3;
  6059. if(($receiver = $7) == nil || $receiver == null){
  6060. $6=$7;
  6061. } else {
  6062. $6=true;
  6063. };
  6064. self._assert_equals_($6,true);
  6065. $ctx1.sendIdx["assert:equals:"]=1;
  6066. $9=_st($Object())._new();
  6067. $ctx1.sendIdx["new"]=4;
  6068. if(($receiver = $9) == nil || $receiver == null){
  6069. $8=false;
  6070. } else {
  6071. $8=true;
  6072. };
  6073. self._assert_equals_($8,true);
  6074. $ctx1.sendIdx["assert:equals:"]=2;
  6075. $11=_st($Object())._new();
  6076. if(($receiver = $11) == nil || $receiver == null){
  6077. $10=false;
  6078. } else {
  6079. $10=true;
  6080. };
  6081. self._assert_equals_($10,true);
  6082. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  6083. args: [],
  6084. 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",
  6085. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6086. referencedClasses: ["Object"]
  6087. }),
  6088. smalltalk.ObjectTest);
  6089. smalltalk.addMethod(
  6090. smalltalk.method({
  6091. selector: "testInstVars",
  6092. protocol: 'tests',
  6093. fn: function (){
  6094. var self=this;
  6095. var o;
  6096. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6097. return smalltalk.withContext(function($ctx1) {
  6098. var $1,$2;
  6099. o=_st($ObjectMock())._new();
  6100. $1=_st(o)._instVarAt_("foo");
  6101. $ctx1.sendIdx["instVarAt:"]=1;
  6102. self._assert_equals_($1,nil);
  6103. $ctx1.sendIdx["assert:equals:"]=1;
  6104. _st(o)._instVarAt_put_("foo",(1));
  6105. $2=_st(o)._instVarAt_("foo");
  6106. $ctx1.sendIdx["instVarAt:"]=2;
  6107. self._assert_equals_($2,(1));
  6108. $ctx1.sendIdx["assert:equals:"]=2;
  6109. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  6110. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  6111. args: [],
  6112. 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",
  6113. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  6114. referencedClasses: ["ObjectMock"]
  6115. }),
  6116. smalltalk.ObjectTest);
  6117. smalltalk.addMethod(
  6118. smalltalk.method({
  6119. selector: "testNilUndefined",
  6120. protocol: 'tests',
  6121. fn: function (){
  6122. var self=this;
  6123. return smalltalk.withContext(function($ctx1) {
  6124. self._assert_equals_(self._notDefined(),nil);
  6125. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  6126. args: [],
  6127. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  6128. messageSends: ["assert:equals:", "notDefined"],
  6129. referencedClasses: []
  6130. }),
  6131. smalltalk.ObjectTest);
  6132. smalltalk.addMethod(
  6133. smalltalk.method({
  6134. selector: "testYourself",
  6135. protocol: 'tests',
  6136. fn: function (){
  6137. var self=this;
  6138. var o;
  6139. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6140. return smalltalk.withContext(function($ctx1) {
  6141. o=_st($ObjectMock())._new();
  6142. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  6143. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  6144. args: [],
  6145. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  6146. messageSends: ["new", "assert:", "==", "yourself"],
  6147. referencedClasses: ["ObjectMock"]
  6148. }),
  6149. smalltalk.ObjectTest);
  6150. smalltalk.addMethod(
  6151. smalltalk.method({
  6152. selector: "testidentityHash",
  6153. protocol: 'tests',
  6154. fn: function (){
  6155. var self=this;
  6156. var o1,o2;
  6157. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6158. return smalltalk.withContext(function($ctx1) {
  6159. var $2,$3,$1,$5,$4;
  6160. o1=_st($Object())._new();
  6161. $ctx1.sendIdx["new"]=1;
  6162. o2=_st($Object())._new();
  6163. $2=_st(o1)._identityHash();
  6164. $ctx1.sendIdx["identityHash"]=1;
  6165. $3=_st(o1)._identityHash();
  6166. $ctx1.sendIdx["identityHash"]=2;
  6167. $1=_st($2).__eq_eq($3);
  6168. $ctx1.sendIdx["=="]=1;
  6169. self._assert_($1);
  6170. $5=_st(o1)._identityHash();
  6171. $ctx1.sendIdx["identityHash"]=3;
  6172. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  6173. self._deny_($4);
  6174. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  6175. args: [],
  6176. 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",
  6177. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  6178. referencedClasses: ["Object"]
  6179. }),
  6180. smalltalk.ObjectTest);
  6181. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6182. smalltalk.addMethod(
  6183. smalltalk.method({
  6184. selector: "testAccessing",
  6185. protocol: 'tests',
  6186. fn: function (){
  6187. var self=this;
  6188. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6189. return smalltalk.withContext(function($ctx1) {
  6190. var $2,$1,$3,$6,$5,$4;
  6191. $2=_st($Point())._x_y_((3),(4));
  6192. $ctx1.sendIdx["x:y:"]=1;
  6193. $1=_st($2)._x();
  6194. $ctx1.sendIdx["x"]=1;
  6195. self._assert_equals_($1,(3));
  6196. $ctx1.sendIdx["assert:equals:"]=1;
  6197. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  6198. $ctx1.sendIdx["y"]=1;
  6199. self._assert_equals_($3,(4));
  6200. $ctx1.sendIdx["assert:equals:"]=2;
  6201. $6=_st($Point())._new();
  6202. $ctx1.sendIdx["new"]=1;
  6203. $5=_st($6)._x_((3));
  6204. $4=_st($5)._x();
  6205. self._assert_equals_($4,(3));
  6206. $ctx1.sendIdx["assert:equals:"]=3;
  6207. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  6208. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  6209. args: [],
  6210. 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",
  6211. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  6212. referencedClasses: ["Point"]
  6213. }),
  6214. smalltalk.PointTest);
  6215. smalltalk.addMethod(
  6216. smalltalk.method({
  6217. selector: "testArithmetic",
  6218. protocol: 'tests',
  6219. fn: function (){
  6220. var self=this;
  6221. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6222. return smalltalk.withContext(function($ctx1) {
  6223. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  6224. $2=(3).__at((4));
  6225. $ctx1.sendIdx["@"]=1;
  6226. $3=(3).__at((4));
  6227. $ctx1.sendIdx["@"]=2;
  6228. $1=_st($2).__star($3);
  6229. $4=_st($Point())._x_y_((9),(16));
  6230. $ctx1.sendIdx["x:y:"]=1;
  6231. self._assert_equals_($1,$4);
  6232. $ctx1.sendIdx["assert:equals:"]=1;
  6233. $6=(3).__at((4));
  6234. $ctx1.sendIdx["@"]=3;
  6235. $7=(3).__at((4));
  6236. $ctx1.sendIdx["@"]=4;
  6237. $5=_st($6).__plus($7);
  6238. $8=_st($Point())._x_y_((6),(8));
  6239. $ctx1.sendIdx["x:y:"]=2;
  6240. self._assert_equals_($5,$8);
  6241. $ctx1.sendIdx["assert:equals:"]=2;
  6242. $10=(3).__at((4));
  6243. $ctx1.sendIdx["@"]=5;
  6244. $11=(3).__at((4));
  6245. $ctx1.sendIdx["@"]=6;
  6246. $9=_st($10).__minus($11);
  6247. $12=_st($Point())._x_y_((0),(0));
  6248. $ctx1.sendIdx["x:y:"]=3;
  6249. self._assert_equals_($9,$12);
  6250. $ctx1.sendIdx["assert:equals:"]=3;
  6251. $14=(6).__at((8));
  6252. $ctx1.sendIdx["@"]=7;
  6253. $13=_st($14).__slash((3).__at((4)));
  6254. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  6255. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  6256. args: [],
  6257. 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)",
  6258. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  6259. referencedClasses: ["Point"]
  6260. }),
  6261. smalltalk.PointTest);
  6262. smalltalk.addMethod(
  6263. smalltalk.method({
  6264. selector: "testAt",
  6265. protocol: 'tests',
  6266. fn: function (){
  6267. var self=this;
  6268. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6269. return smalltalk.withContext(function($ctx1) {
  6270. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  6271. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  6272. args: [],
  6273. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  6274. messageSends: ["assert:equals:", "@", "x:y:"],
  6275. referencedClasses: ["Point"]
  6276. }),
  6277. smalltalk.PointTest);
  6278. smalltalk.addMethod(
  6279. smalltalk.method({
  6280. selector: "testEgality",
  6281. protocol: 'tests',
  6282. fn: function (){
  6283. var self=this;
  6284. return smalltalk.withContext(function($ctx1) {
  6285. var $2,$3,$1,$5,$4;
  6286. $2=(3).__at((4));
  6287. $ctx1.sendIdx["@"]=1;
  6288. $3=(3).__at((4));
  6289. $ctx1.sendIdx["@"]=2;
  6290. $1=_st($2).__eq($3);
  6291. $ctx1.sendIdx["="]=1;
  6292. self._assert_($1);
  6293. $5=(3).__at((5));
  6294. $ctx1.sendIdx["@"]=3;
  6295. $4=_st($5).__eq((3).__at((6)));
  6296. self._deny_($4);
  6297. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  6298. args: [],
  6299. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  6300. messageSends: ["assert:", "=", "@", "deny:"],
  6301. referencedClasses: []
  6302. }),
  6303. smalltalk.PointTest);
  6304. smalltalk.addMethod(
  6305. smalltalk.method({
  6306. selector: "testNew",
  6307. protocol: 'tests',
  6308. fn: function (){
  6309. var self=this;
  6310. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6311. return smalltalk.withContext(function($ctx1) {
  6312. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  6313. $3=_st($Point())._new();
  6314. $ctx1.sendIdx["new"]=1;
  6315. $2=_st($3)._x_((3));
  6316. $ctx1.sendIdx["x:"]=1;
  6317. $1=_st($2)._y();
  6318. $ctx1.sendIdx["y"]=1;
  6319. self._assert_equals_($1,nil);
  6320. $ctx1.sendIdx["assert:equals:"]=1;
  6321. $7=_st($Point())._new();
  6322. $ctx1.sendIdx["new"]=2;
  6323. $6=_st($7)._x_((3));
  6324. $5=_st($6)._x();
  6325. $ctx1.sendIdx["x"]=1;
  6326. $4=_st($5).__eq((0));
  6327. $ctx1.sendIdx["="]=1;
  6328. self._deny_($4);
  6329. $ctx1.sendIdx["deny:"]=1;
  6330. $10=_st($Point())._new();
  6331. $ctx1.sendIdx["new"]=3;
  6332. $9=_st($10)._y_((4));
  6333. $ctx1.sendIdx["y:"]=1;
  6334. $8=_st($9)._x();
  6335. self._assert_equals_($8,nil);
  6336. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  6337. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  6338. args: [],
  6339. 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",
  6340. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  6341. referencedClasses: ["Point"]
  6342. }),
  6343. smalltalk.PointTest);
  6344. smalltalk.addMethod(
  6345. smalltalk.method({
  6346. selector: "testTranslateBy",
  6347. protocol: 'tests',
  6348. fn: function (){
  6349. var self=this;
  6350. return smalltalk.withContext(function($ctx1) {
  6351. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6352. $2=(3).__at((3));
  6353. $ctx1.sendIdx["@"]=1;
  6354. $3=(0).__at((1));
  6355. $ctx1.sendIdx["@"]=2;
  6356. $1=_st($2)._translateBy_($3);
  6357. $ctx1.sendIdx["translateBy:"]=1;
  6358. $4=(3).__at((4));
  6359. $ctx1.sendIdx["@"]=3;
  6360. self._assert_equals_($1,$4);
  6361. $ctx1.sendIdx["assert:equals:"]=1;
  6362. $6=(3).__at((3));
  6363. $ctx1.sendIdx["@"]=4;
  6364. $8=(1)._negated();
  6365. $ctx1.sendIdx["negated"]=1;
  6366. $7=(0).__at($8);
  6367. $ctx1.sendIdx["@"]=5;
  6368. $5=_st($6)._translateBy_($7);
  6369. $ctx1.sendIdx["translateBy:"]=2;
  6370. $9=(3).__at((2));
  6371. $ctx1.sendIdx["@"]=6;
  6372. self._assert_equals_($5,$9);
  6373. $ctx1.sendIdx["assert:equals:"]=2;
  6374. $11=(3).__at((3));
  6375. $ctx1.sendIdx["@"]=7;
  6376. $12=(2).__at((3));
  6377. $ctx1.sendIdx["@"]=8;
  6378. $10=_st($11)._translateBy_($12);
  6379. $ctx1.sendIdx["translateBy:"]=3;
  6380. $13=(5).__at((6));
  6381. $ctx1.sendIdx["@"]=9;
  6382. self._assert_equals_($10,$13);
  6383. $ctx1.sendIdx["assert:equals:"]=3;
  6384. $15=(3).__at((3));
  6385. $ctx1.sendIdx["@"]=10;
  6386. $16=_st((3)._negated()).__at((0));
  6387. $ctx1.sendIdx["@"]=11;
  6388. $14=_st($15)._translateBy_($16);
  6389. self._assert_equals_($14,(0).__at((3)));
  6390. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6391. args: [],
  6392. 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.",
  6393. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6394. referencedClasses: []
  6395. }),
  6396. smalltalk.PointTest);
  6397. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6398. smalltalk.addMethod(
  6399. smalltalk.method({
  6400. selector: "testNextIfAbsent",
  6401. protocol: 'tests',
  6402. fn: function (){
  6403. var self=this;
  6404. var queue;
  6405. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6406. return smalltalk.withContext(function($ctx1) {
  6407. var $2,$1;
  6408. queue=_st($Queue())._new();
  6409. _st(queue)._nextPut_("index1");
  6410. $2=_st(queue)._nextIfAbsent_("empty");
  6411. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6412. $1=_st($2).__eq("index1");
  6413. $ctx1.sendIdx["="]=1;
  6414. self._assert_($1);
  6415. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  6416. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6417. args: [],
  6418. 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'",
  6419. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6420. referencedClasses: ["Queue"]
  6421. }),
  6422. smalltalk.QueueTest);
  6423. smalltalk.addMethod(
  6424. smalltalk.method({
  6425. selector: "testQueueNext",
  6426. protocol: 'tests',
  6427. fn: function (){
  6428. var self=this;
  6429. var queue;
  6430. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6431. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6432. return smalltalk.withContext(function($ctx1) {
  6433. var $1,$2,$4,$3,$6,$5;
  6434. queue=_st($Queue())._new();
  6435. $1=queue;
  6436. _st($1)._nextPut_("index1");
  6437. $ctx1.sendIdx["nextPut:"]=1;
  6438. $2=_st($1)._nextPut_("index2");
  6439. $4=_st(queue)._next();
  6440. $ctx1.sendIdx["next"]=1;
  6441. $3=_st($4).__eq("index1");
  6442. $ctx1.sendIdx["="]=1;
  6443. self._assert_($3);
  6444. $6=_st(queue)._next();
  6445. $ctx1.sendIdx["next"]=2;
  6446. $5=_st($6).__eq("index");
  6447. self._deny_($5);
  6448. self._should_raise_((function(){
  6449. return smalltalk.withContext(function($ctx2) {
  6450. return _st(queue)._next();
  6451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6452. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6453. args: [],
  6454. 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",
  6455. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6456. referencedClasses: ["Queue", "Error"]
  6457. }),
  6458. smalltalk.QueueTest);
  6459. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6460. smalltalk.addMethod(
  6461. smalltalk.method({
  6462. selector: "testAtRandomNumber",
  6463. protocol: 'tests',
  6464. fn: function (){
  6465. var self=this;
  6466. var val;
  6467. return smalltalk.withContext(function($ctx1) {
  6468. (100)._timesRepeat_((function(){
  6469. return smalltalk.withContext(function($ctx2) {
  6470. val=(10)._atRandom();
  6471. val;
  6472. self._assert_(_st(val).__gt((0)));
  6473. $ctx2.sendIdx["assert:"]=1;
  6474. return self._assert_(_st(val).__lt((11)));
  6475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6476. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6477. args: [],
  6478. 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]",
  6479. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6480. referencedClasses: []
  6481. }),
  6482. smalltalk.RandomTest);
  6483. smalltalk.addMethod(
  6484. smalltalk.method({
  6485. selector: "testAtRandomSequenceableCollection",
  6486. protocol: 'tests',
  6487. fn: function (){
  6488. var self=this;
  6489. var val;
  6490. return smalltalk.withContext(function($ctx1) {
  6491. var $3,$4,$2,$1;
  6492. (100)._timesRepeat_((function(){
  6493. return smalltalk.withContext(function($ctx2) {
  6494. val="abc"._atRandom();
  6495. val;
  6496. $3=_st(val).__eq("a");
  6497. $ctx2.sendIdx["="]=1;
  6498. $4=_st(val).__eq("b");
  6499. $ctx2.sendIdx["="]=2;
  6500. $2=_st($3).__or($4);
  6501. $1=_st($2).__or(_st(val).__eq("c"));
  6502. $ctx2.sendIdx["|"]=1;
  6503. return self._assert_($1);
  6504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6505. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6506. args: [],
  6507. 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].",
  6508. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6509. referencedClasses: []
  6510. }),
  6511. smalltalk.RandomTest);
  6512. smalltalk.addMethod(
  6513. smalltalk.method({
  6514. selector: "textNext",
  6515. protocol: 'tests',
  6516. fn: function (){
  6517. var self=this;
  6518. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6519. return smalltalk.withContext(function($ctx1) {
  6520. var $1;
  6521. (10000)._timesRepeat_((function(){
  6522. var current,next;
  6523. return smalltalk.withContext(function($ctx2) {
  6524. next=_st(_st($Random())._new())._next();
  6525. next;
  6526. self._assert_(_st(next).__gt_eq((0)));
  6527. $ctx2.sendIdx["assert:"]=1;
  6528. self._assert_(_st(next).__lt((1)));
  6529. $1=_st(current).__eq(next);
  6530. $ctx2.sendIdx["="]=1;
  6531. self._deny_($1);
  6532. return _st(next).__eq(current);
  6533. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6534. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6535. args: [],
  6536. 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 ]",
  6537. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6538. referencedClasses: ["Random"]
  6539. }),
  6540. smalltalk.RandomTest);
  6541. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6542. smalltalk.addMethod(
  6543. smalltalk.method({
  6544. selector: "testAddRemove",
  6545. protocol: 'tests',
  6546. fn: function (){
  6547. var self=this;
  6548. var set;
  6549. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6550. return smalltalk.withContext(function($ctx1) {
  6551. var $1,$2;
  6552. set=_st($Set())._new();
  6553. self._assert_(_st(set)._isEmpty());
  6554. $ctx1.sendIdx["assert:"]=1;
  6555. _st(set)._add_((3));
  6556. $ctx1.sendIdx["add:"]=1;
  6557. $1=_st(set)._includes_((3));
  6558. $ctx1.sendIdx["includes:"]=1;
  6559. self._assert_($1);
  6560. $ctx1.sendIdx["assert:"]=2;
  6561. _st(set)._add_((5));
  6562. $2=_st(set)._includes_((5));
  6563. $ctx1.sendIdx["includes:"]=2;
  6564. self._assert_($2);
  6565. _st(set)._remove_((3));
  6566. self._deny_(_st(set)._includes_((3)));
  6567. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6568. args: [],
  6569. 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)",
  6570. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6571. referencedClasses: ["Set"]
  6572. }),
  6573. smalltalk.SetTest);
  6574. smalltalk.addMethod(
  6575. smalltalk.method({
  6576. selector: "testAt",
  6577. protocol: 'tests',
  6578. fn: function (){
  6579. var self=this;
  6580. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6581. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6582. return smalltalk.withContext(function($ctx1) {
  6583. self._should_raise_((function(){
  6584. return smalltalk.withContext(function($ctx2) {
  6585. return _st(_st($Set())._new())._at_put_((1),(2));
  6586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6587. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6588. args: [],
  6589. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6590. messageSends: ["should:raise:", "at:put:", "new"],
  6591. referencedClasses: ["Set", "Error"]
  6592. }),
  6593. smalltalk.SetTest);
  6594. smalltalk.addMethod(
  6595. smalltalk.method({
  6596. selector: "testCollect",
  6597. protocol: 'tests',
  6598. fn: function (){
  6599. var self=this;
  6600. return smalltalk.withContext(function($ctx1) {
  6601. var $2,$1;
  6602. $2=[(5), (6), (8)]._asSet();
  6603. $ctx1.sendIdx["asSet"]=1;
  6604. $1=_st($2)._collect_((function(x){
  6605. return smalltalk.withContext(function($ctx2) {
  6606. return _st(x).__backslash_backslash((3));
  6607. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6608. self._assert_equals_($1,[(0), (2)]._asSet());
  6609. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6610. args: [],
  6611. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6612. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6613. referencedClasses: []
  6614. }),
  6615. smalltalk.SetTest);
  6616. smalltalk.addMethod(
  6617. smalltalk.method({
  6618. selector: "testComparing",
  6619. protocol: 'tests',
  6620. fn: function (){
  6621. var self=this;
  6622. return smalltalk.withContext(function($ctx1) {
  6623. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6624. $1=[(0), (2)]._asSet();
  6625. $ctx1.sendIdx["asSet"]=1;
  6626. $2=[(0), (2)]._asSet();
  6627. $ctx1.sendIdx["asSet"]=2;
  6628. self._assert_equals_($1,$2);
  6629. $ctx1.sendIdx["assert:equals:"]=1;
  6630. $3=[(2), (0)]._asSet();
  6631. $ctx1.sendIdx["asSet"]=3;
  6632. $4=[(0), (2)]._asSet();
  6633. $ctx1.sendIdx["asSet"]=4;
  6634. self._assert_equals_($3,$4);
  6635. $6=[(0), (2), (3)]._asSet();
  6636. $ctx1.sendIdx["asSet"]=5;
  6637. $7=[(0), (2)]._asSet();
  6638. $ctx1.sendIdx["asSet"]=6;
  6639. $5=_st($6).__eq($7);
  6640. $ctx1.sendIdx["="]=1;
  6641. self._deny_($5);
  6642. $ctx1.sendIdx["deny:"]=1;
  6643. $9=[(1), (2)]._asSet();
  6644. $ctx1.sendIdx["asSet"]=7;
  6645. $8=_st($9).__eq([(0), (2)]._asSet());
  6646. self._deny_($8);
  6647. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6648. args: [],
  6649. 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",
  6650. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6651. referencedClasses: []
  6652. }),
  6653. smalltalk.SetTest);
  6654. smalltalk.addMethod(
  6655. smalltalk.method({
  6656. selector: "testPrintString",
  6657. protocol: 'tests',
  6658. fn: function (){
  6659. var self=this;
  6660. var set;
  6661. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6662. return smalltalk.withContext(function($ctx1) {
  6663. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  6664. set=_st($Set())._new();
  6665. $1=_st(set)._printString();
  6666. $ctx1.sendIdx["printString"]=1;
  6667. self._assert_equals_($1,"a Set ()");
  6668. $ctx1.sendIdx["assert:equals:"]=1;
  6669. $2=set;
  6670. _st($2)._add_((1));
  6671. $ctx1.sendIdx["add:"]=1;
  6672. $3=_st($2)._add_((3));
  6673. $ctx1.sendIdx["add:"]=2;
  6674. $4=_st(set)._printString();
  6675. $ctx1.sendIdx["printString"]=2;
  6676. self._assert_equals_($4,"a Set (1 3)");
  6677. $ctx1.sendIdx["assert:equals:"]=2;
  6678. _st(set)._add_("foo");
  6679. $ctx1.sendIdx["add:"]=3;
  6680. $5=_st(set)._printString();
  6681. $ctx1.sendIdx["printString"]=3;
  6682. self._assert_equals_($5,"a Set (1 3 'foo')");
  6683. $ctx1.sendIdx["assert:equals:"]=3;
  6684. $6=set;
  6685. _st($6)._remove_((1));
  6686. $ctx1.sendIdx["remove:"]=1;
  6687. $7=_st($6)._remove_((3));
  6688. $8=_st(set)._printString();
  6689. $ctx1.sendIdx["printString"]=4;
  6690. self._assert_equals_($8,"a Set ('foo')");
  6691. $ctx1.sendIdx["assert:equals:"]=4;
  6692. _st(set)._add_((3));
  6693. $ctx1.sendIdx["add:"]=4;
  6694. $9=_st(set)._printString();
  6695. $ctx1.sendIdx["printString"]=5;
  6696. self._assert_equals_($9,"a Set ('foo' 3)");
  6697. $ctx1.sendIdx["assert:equals:"]=5;
  6698. _st(set)._add_((3));
  6699. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6700. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6701. args: [],
  6702. 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)'",
  6703. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6704. referencedClasses: ["Set"]
  6705. }),
  6706. smalltalk.SetTest);
  6707. smalltalk.addMethod(
  6708. smalltalk.method({
  6709. selector: "testSize",
  6710. protocol: 'tests',
  6711. fn: function (){
  6712. var self=this;
  6713. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6714. return smalltalk.withContext(function($ctx1) {
  6715. var $1,$3,$2;
  6716. $1=_st(_st($Set())._new())._size();
  6717. $ctx1.sendIdx["size"]=1;
  6718. self._assert_equals_($1,(0));
  6719. $ctx1.sendIdx["assert:equals:"]=1;
  6720. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6721. $ctx1.sendIdx["withAll:"]=1;
  6722. $2=_st($3)._size();
  6723. $ctx1.sendIdx["size"]=2;
  6724. self._assert_equals_($2,(4));
  6725. $ctx1.sendIdx["assert:equals:"]=2;
  6726. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6727. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6728. args: [],
  6729. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  6730. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6731. referencedClasses: ["Set"]
  6732. }),
  6733. smalltalk.SetTest);
  6734. smalltalk.addMethod(
  6735. smalltalk.method({
  6736. selector: "testUnboxedObjects",
  6737. protocol: 'tests',
  6738. fn: function (){
  6739. var self=this;
  6740. return smalltalk.withContext(function($ctx1) {
  6741. var $4,$3,$2,$1;
  6742. $4="foo"._yourself();
  6743. $ctx1.sendIdx["yourself"]=1;
  6744. $3=[$4,"foo"._yourself()];
  6745. $2=_st($3)._asSet();
  6746. $1=_st($2)._asArray();
  6747. self._assert_equals_($1,["foo"]);
  6748. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6749. args: [],
  6750. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6751. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6752. referencedClasses: []
  6753. }),
  6754. smalltalk.SetTest);
  6755. smalltalk.addMethod(
  6756. smalltalk.method({
  6757. selector: "testUnicity",
  6758. protocol: 'tests',
  6759. fn: function (){
  6760. var self=this;
  6761. var set;
  6762. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6763. return smalltalk.withContext(function($ctx1) {
  6764. var $1;
  6765. set=_st($Set())._new();
  6766. _st(set)._add_((21));
  6767. $ctx1.sendIdx["add:"]=1;
  6768. _st(set)._add_("hello");
  6769. $ctx1.sendIdx["add:"]=2;
  6770. _st(set)._add_((21));
  6771. $ctx1.sendIdx["add:"]=3;
  6772. $1=_st(set)._size();
  6773. $ctx1.sendIdx["size"]=1;
  6774. self._assert_equals_($1,(2));
  6775. $ctx1.sendIdx["assert:equals:"]=1;
  6776. _st(set)._add_("hello");
  6777. self._assert_equals_(_st(set)._size(),(2));
  6778. $ctx1.sendIdx["assert:equals:"]=2;
  6779. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6780. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6781. args: [],
  6782. 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')",
  6783. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6784. referencedClasses: ["Set"]
  6785. }),
  6786. smalltalk.SetTest);
  6787. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6788. smalltalk.addMethod(
  6789. smalltalk.method({
  6790. selector: "collectionClass",
  6791. protocol: 'accessing',
  6792. fn: function (){
  6793. var self=this;
  6794. return smalltalk.withContext(function($ctx1) {
  6795. var $1;
  6796. $1=_st(self._class())._collectionClass();
  6797. return $1;
  6798. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6799. args: [],
  6800. source: "collectionClass\x0a\x09^ self class collectionClass",
  6801. messageSends: ["collectionClass", "class"],
  6802. referencedClasses: []
  6803. }),
  6804. smalltalk.StreamTest);
  6805. smalltalk.addMethod(
  6806. smalltalk.method({
  6807. selector: "newCollection",
  6808. protocol: 'accessing',
  6809. fn: function (){
  6810. var self=this;
  6811. return smalltalk.withContext(function($ctx1) {
  6812. var $1;
  6813. $1=_st(self._collectionClass())._new();
  6814. return $1;
  6815. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6816. args: [],
  6817. source: "newCollection\x0a\x09^ self collectionClass new",
  6818. messageSends: ["new", "collectionClass"],
  6819. referencedClasses: []
  6820. }),
  6821. smalltalk.StreamTest);
  6822. smalltalk.addMethod(
  6823. smalltalk.method({
  6824. selector: "newStream",
  6825. protocol: 'accessing',
  6826. fn: function (){
  6827. var self=this;
  6828. return smalltalk.withContext(function($ctx1) {
  6829. var $1;
  6830. $1=_st(_st(self._collectionClass())._new())._stream();
  6831. return $1;
  6832. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6833. args: [],
  6834. source: "newStream\x0a\x09^ self collectionClass new stream",
  6835. messageSends: ["stream", "new", "collectionClass"],
  6836. referencedClasses: []
  6837. }),
  6838. smalltalk.StreamTest);
  6839. smalltalk.addMethod(
  6840. smalltalk.method({
  6841. selector: "testAtStartAtEnd",
  6842. protocol: 'tests',
  6843. fn: function (){
  6844. var self=this;
  6845. var stream;
  6846. return smalltalk.withContext(function($ctx1) {
  6847. var $1,$2,$3,$4;
  6848. stream=self._newStream();
  6849. $1=_st(stream)._atStart();
  6850. $ctx1.sendIdx["atStart"]=1;
  6851. self._assert_($1);
  6852. $ctx1.sendIdx["assert:"]=1;
  6853. $2=_st(stream)._atEnd();
  6854. $ctx1.sendIdx["atEnd"]=1;
  6855. self._assert_($2);
  6856. $ctx1.sendIdx["assert:"]=2;
  6857. _st(stream)._nextPutAll_(self._newCollection());
  6858. $3=_st(stream)._atEnd();
  6859. $ctx1.sendIdx["atEnd"]=2;
  6860. self._assert_($3);
  6861. $4=_st(stream)._atStart();
  6862. $ctx1.sendIdx["atStart"]=2;
  6863. self._deny_($4);
  6864. $ctx1.sendIdx["deny:"]=1;
  6865. _st(stream)._position_((1));
  6866. self._deny_(_st(stream)._atEnd());
  6867. $ctx1.sendIdx["deny:"]=2;
  6868. self._deny_(_st(stream)._atStart());
  6869. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6870. args: [],
  6871. 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",
  6872. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6873. referencedClasses: []
  6874. }),
  6875. smalltalk.StreamTest);
  6876. smalltalk.addMethod(
  6877. smalltalk.method({
  6878. selector: "testContents",
  6879. protocol: 'tests',
  6880. fn: function (){
  6881. var self=this;
  6882. var stream;
  6883. return smalltalk.withContext(function($ctx1) {
  6884. var $1,$2;
  6885. stream=self._newStream();
  6886. $1=stream;
  6887. $2=self._newCollection();
  6888. $ctx1.sendIdx["newCollection"]=1;
  6889. _st($1)._nextPutAll_($2);
  6890. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  6891. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6892. args: [],
  6893. 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",
  6894. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6895. referencedClasses: []
  6896. }),
  6897. smalltalk.StreamTest);
  6898. smalltalk.addMethod(
  6899. smalltalk.method({
  6900. selector: "testIsEmpty",
  6901. protocol: 'tests',
  6902. fn: function (){
  6903. var self=this;
  6904. var stream;
  6905. return smalltalk.withContext(function($ctx1) {
  6906. var $1;
  6907. stream=self._newStream();
  6908. $1=_st(stream)._isEmpty();
  6909. $ctx1.sendIdx["isEmpty"]=1;
  6910. self._assert_($1);
  6911. _st(stream)._nextPutAll_(self._newCollection());
  6912. self._deny_(_st(stream)._isEmpty());
  6913. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6914. args: [],
  6915. 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",
  6916. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6917. referencedClasses: []
  6918. }),
  6919. smalltalk.StreamTest);
  6920. smalltalk.addMethod(
  6921. smalltalk.method({
  6922. selector: "testPosition",
  6923. protocol: 'tests',
  6924. fn: function (){
  6925. var self=this;
  6926. var collection,stream;
  6927. return smalltalk.withContext(function($ctx1) {
  6928. var $1,$2,$3;
  6929. collection=self._newCollection();
  6930. stream=self._newStream();
  6931. _st(stream)._nextPutAll_(collection);
  6932. $1=_st(stream)._position();
  6933. $ctx1.sendIdx["position"]=1;
  6934. self._assert_equals_($1,_st(collection)._size());
  6935. $ctx1.sendIdx["assert:equals:"]=1;
  6936. _st(stream)._position_((0));
  6937. $2=_st(stream)._position();
  6938. $ctx1.sendIdx["position"]=2;
  6939. self._assert_equals_($2,(0));
  6940. $ctx1.sendIdx["assert:equals:"]=2;
  6941. _st(stream)._next();
  6942. $ctx1.sendIdx["next"]=1;
  6943. $3=_st(stream)._position();
  6944. $ctx1.sendIdx["position"]=3;
  6945. self._assert_equals_($3,(1));
  6946. $ctx1.sendIdx["assert:equals:"]=3;
  6947. _st(stream)._next();
  6948. self._assert_equals_(_st(stream)._position(),(2));
  6949. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6950. args: [],
  6951. 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",
  6952. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6953. referencedClasses: []
  6954. }),
  6955. smalltalk.StreamTest);
  6956. smalltalk.addMethod(
  6957. smalltalk.method({
  6958. selector: "testReading",
  6959. protocol: 'tests',
  6960. fn: function (){
  6961. var self=this;
  6962. var stream,collection;
  6963. return smalltalk.withContext(function($ctx1) {
  6964. var $1,$2,$3;
  6965. collection=self._newCollection();
  6966. stream=self._newStream();
  6967. $1=stream;
  6968. _st($1)._nextPutAll_(collection);
  6969. $2=_st($1)._position_((0));
  6970. _st(collection)._do_((function(each){
  6971. return smalltalk.withContext(function($ctx2) {
  6972. $3=_st(stream)._next();
  6973. $ctx2.sendIdx["next"]=1;
  6974. return self._assert_equals_($3,each);
  6975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6976. self._assert_(_st(_st(stream)._next())._isNil());
  6977. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6978. args: [],
  6979. 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",
  6980. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6981. referencedClasses: []
  6982. }),
  6983. smalltalk.StreamTest);
  6984. smalltalk.addMethod(
  6985. smalltalk.method({
  6986. selector: "testStreamContents",
  6987. protocol: 'tests',
  6988. fn: function (){
  6989. var self=this;
  6990. return smalltalk.withContext(function($ctx1) {
  6991. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6992. args: [],
  6993. source: "testStreamContents",
  6994. messageSends: [],
  6995. referencedClasses: []
  6996. }),
  6997. smalltalk.StreamTest);
  6998. smalltalk.addMethod(
  6999. smalltalk.method({
  7000. selector: "testWrite",
  7001. protocol: 'tests',
  7002. fn: function (){
  7003. var self=this;
  7004. var stream,collection;
  7005. return smalltalk.withContext(function($ctx1) {
  7006. collection=self._newCollection();
  7007. stream=self._newStream();
  7008. _st(collection)._do_((function(each){
  7009. return smalltalk.withContext(function($ctx2) {
  7010. return _st(stream).__lt_lt(each);
  7011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7012. self._assert_equals_(_st(stream)._contents(),collection);
  7013. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7014. args: [],
  7015. 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",
  7016. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7017. referencedClasses: []
  7018. }),
  7019. smalltalk.StreamTest);
  7020. smalltalk.addMethod(
  7021. smalltalk.method({
  7022. selector: "testWriting",
  7023. protocol: 'tests',
  7024. fn: function (){
  7025. var self=this;
  7026. var stream,collection;
  7027. return smalltalk.withContext(function($ctx1) {
  7028. var $1;
  7029. collection=self._newCollection();
  7030. stream=self._newStream();
  7031. $ctx1.sendIdx["newStream"]=1;
  7032. _st(collection)._do_((function(each){
  7033. return smalltalk.withContext(function($ctx2) {
  7034. return _st(stream)._nextPut_(each);
  7035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7036. $1=_st(stream)._contents();
  7037. $ctx1.sendIdx["contents"]=1;
  7038. self._assert_equals_($1,collection);
  7039. $ctx1.sendIdx["assert:equals:"]=1;
  7040. stream=self._newStream();
  7041. _st(stream)._nextPutAll_(collection);
  7042. self._assert_equals_(_st(stream)._contents(),collection);
  7043. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7044. args: [],
  7045. 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",
  7046. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7047. referencedClasses: []
  7048. }),
  7049. smalltalk.StreamTest);
  7050. smalltalk.addMethod(
  7051. smalltalk.method({
  7052. selector: "collectionClass",
  7053. protocol: 'accessing',
  7054. fn: function (){
  7055. var self=this;
  7056. return smalltalk.withContext(function($ctx1) {
  7057. return nil;
  7058. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7059. args: [],
  7060. source: "collectionClass\x0a\x09^ nil",
  7061. messageSends: [],
  7062. referencedClasses: []
  7063. }),
  7064. smalltalk.StreamTest.klass);
  7065. smalltalk.addMethod(
  7066. smalltalk.method({
  7067. selector: "isAbstract",
  7068. protocol: 'testing',
  7069. fn: function (){
  7070. var self=this;
  7071. return smalltalk.withContext(function($ctx1) {
  7072. var $1;
  7073. $1=_st(self._collectionClass())._isNil();
  7074. return $1;
  7075. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  7076. args: [],
  7077. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  7078. messageSends: ["isNil", "collectionClass"],
  7079. referencedClasses: []
  7080. }),
  7081. smalltalk.StreamTest.klass);
  7082. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7083. smalltalk.addMethod(
  7084. smalltalk.method({
  7085. selector: "newCollection",
  7086. protocol: 'accessing',
  7087. fn: function (){
  7088. var self=this;
  7089. return smalltalk.withContext(function($ctx1) {
  7090. var $1;
  7091. $1=[true,(1),(3).__at((4)),"foo"];
  7092. return $1;
  7093. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  7094. args: [],
  7095. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  7096. messageSends: ["@"],
  7097. referencedClasses: []
  7098. }),
  7099. smalltalk.ArrayStreamTest);
  7100. smalltalk.addMethod(
  7101. smalltalk.method({
  7102. selector: "collectionClass",
  7103. protocol: 'accessing',
  7104. fn: function (){
  7105. var self=this;
  7106. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7107. return smalltalk.withContext(function($ctx1) {
  7108. return $Array();
  7109. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  7110. args: [],
  7111. source: "collectionClass\x0a\x09^ Array",
  7112. messageSends: [],
  7113. referencedClasses: ["Array"]
  7114. }),
  7115. smalltalk.ArrayStreamTest.klass);
  7116. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7117. smalltalk.addMethod(
  7118. smalltalk.method({
  7119. selector: "newCollection",
  7120. protocol: 'accessing',
  7121. fn: function (){
  7122. var self=this;
  7123. return smalltalk.withContext(function($ctx1) {
  7124. return "hello world";
  7125. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  7126. args: [],
  7127. source: "newCollection\x0a\x09^ 'hello world'",
  7128. messageSends: [],
  7129. referencedClasses: []
  7130. }),
  7131. smalltalk.StringStreamTest);
  7132. smalltalk.addMethod(
  7133. smalltalk.method({
  7134. selector: "collectionClass",
  7135. protocol: 'accessing',
  7136. fn: function (){
  7137. var self=this;
  7138. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7139. return smalltalk.withContext(function($ctx1) {
  7140. return $String();
  7141. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  7142. args: [],
  7143. source: "collectionClass\x0a\x09^ String",
  7144. messageSends: [],
  7145. referencedClasses: ["String"]
  7146. }),
  7147. smalltalk.StringStreamTest.klass);
  7148. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7149. smalltalk.addMethod(
  7150. smalltalk.method({
  7151. selector: "testCopying",
  7152. protocol: 'tests',
  7153. fn: function (){
  7154. var self=this;
  7155. return smalltalk.withContext(function($ctx1) {
  7156. self._assert_equals_(nil._copy(),nil);
  7157. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  7158. args: [],
  7159. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  7160. messageSends: ["assert:equals:", "copy"],
  7161. referencedClasses: []
  7162. }),
  7163. smalltalk.UndefinedTest);
  7164. smalltalk.addMethod(
  7165. smalltalk.method({
  7166. selector: "testDeepCopy",
  7167. protocol: 'tests',
  7168. fn: function (){
  7169. var self=this;
  7170. return smalltalk.withContext(function($ctx1) {
  7171. self._assert_(_st(nil._deepCopy()).__eq(nil));
  7172. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  7173. args: [],
  7174. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  7175. messageSends: ["assert:", "=", "deepCopy"],
  7176. referencedClasses: []
  7177. }),
  7178. smalltalk.UndefinedTest);
  7179. smalltalk.addMethod(
  7180. smalltalk.method({
  7181. selector: "testIfNil",
  7182. protocol: 'tests',
  7183. fn: function (){
  7184. var self=this;
  7185. return smalltalk.withContext(function($ctx1) {
  7186. var $1,$3,$2,$4,$6,$5;
  7187. if(($receiver = nil) == nil || $receiver == null){
  7188. $1=true;
  7189. } else {
  7190. $1=nil;
  7191. };
  7192. self._assert_equals_($1,true);
  7193. $ctx1.sendIdx["assert:equals:"]=1;
  7194. if(($receiver = nil) == nil || $receiver == null){
  7195. $3=nil;
  7196. } else {
  7197. $3=true;
  7198. };
  7199. $2=_st($3).__eq(true);
  7200. $ctx1.sendIdx["="]=1;
  7201. self._deny_($2);
  7202. $ctx1.sendIdx["deny:"]=1;
  7203. if(($receiver = nil) == nil || $receiver == null){
  7204. $4=true;
  7205. } else {
  7206. $4=false;
  7207. };
  7208. self._assert_equals_($4,true);
  7209. if(($receiver = nil) == nil || $receiver == null){
  7210. $6=false;
  7211. } else {
  7212. $6=true;
  7213. };
  7214. $5=_st($6).__eq(true);
  7215. self._deny_($5);
  7216. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  7217. args: [],
  7218. 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",
  7219. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7220. referencedClasses: []
  7221. }),
  7222. smalltalk.UndefinedTest);
  7223. smalltalk.addMethod(
  7224. smalltalk.method({
  7225. selector: "testIsNil",
  7226. protocol: 'tests',
  7227. fn: function (){
  7228. var self=this;
  7229. return smalltalk.withContext(function($ctx1) {
  7230. self._assert_(nil._isNil());
  7231. self._deny_(nil._notNil());
  7232. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  7233. args: [],
  7234. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  7235. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  7236. referencedClasses: []
  7237. }),
  7238. smalltalk.UndefinedTest);
  7239. });