Kernel-Tests.js 273 KB

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