Kernel-Tests.js 266 KB

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