Kernel-Tests.js 286 KB

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