@@ -27,7 +27,7 @@ import escritoire.*, tableStyles.default, columnAttenuation.ignore
2727import fulminate .*
2828import gossamer .*
2929import hieroglyph .*
30- import iridescence .*
30+ import iridescence .* , webColors . *
3131import rudiments .*
3232import spectacular .*
3333import turbulence .*
@@ -132,21 +132,21 @@ class Report(using Environment):
132132
133133 def color : Rgb24 = this match
134134 case Pass => rgb " #8abd00 "
135- case Fail => webColors. Tomato
136- case Throws => webColors. DarkOrange
135+ case Fail => Tomato
136+ case Throws => DarkOrange
137137 case CheckThrows => rgb " #dd40a0 "
138138 case Mixed => rgb " #ddd700 "
139- case Suite => webColors. SlateBlue
140- case Bench => webColors. CadetBlue
139+ case Suite => SlateBlue
140+ case Bench => CadetBlue
141141
142142 def symbol : Teletype = this match
143- case Pass => e " ${Bg (rgb " #8abd00 " )}( $Bold( ${webColors. Black } (✓)) ) "
144- case Fail => e " ${Bg (webColors. Tomato )}( $Bold( ${webColors. Black } (✗)) ) "
145- case Throws => e " ${Bg (webColors. DarkOrange )}( $Bold( ${webColors. Black } (!)) ) "
146- case CheckThrows => e " ${Bg (rgb " #dd40a0 " )}( $Bold( ${webColors. Black } (‼)) ) "
147- case Mixed => e " ${Bg (rgb " #ddd700 " )}( $Bold( ${webColors. Black } (?)) ) "
143+ case Pass => e " ${Bg (rgb " #8abd00 " )}( $Bold( $Black(✓)) ) "
144+ case Fail => e " ${Bg (Tomato )}( $Bold( $Black(✗)) ) "
145+ case Throws => e " ${Bg (DarkOrange )}( $Bold( $Black(!)) ) "
146+ case CheckThrows => e " ${Bg (rgb " #dd40a0 " )}( $Bold( $Black(‼)) ) "
147+ case Mixed => e " ${Bg (rgb " #ddd700 " )}( $Bold( $Black(?)) ) "
148148 case Suite => e " "
149- case Bench => e " ${Bg (webColors. CadetBlue )}( $Bold( ${webColors. Black } (*)) ) "
149+ case Bench => e " ${Bg (CadetBlue )}( $Bold( $Black(*)) ) "
150150
151151 def describe : Teletype = this match
152152 case Pass => e " Pass "
@@ -158,9 +158,9 @@ class Report(using Environment):
158158 case Bench => e " Benchmark "
159159
160160 val unitsSeq : List [Teletype ] = List (
161- e " ${webColors. BurlyWood } (µs) " ,
162- e " ${webColors. Goldenrod } (ms) " ,
163- e " ${webColors. Sienna } (s) "
161+ e " $BurlyWood(µs) " ,
162+ e " $Goldenrod(ms) " ,
163+ e " $Sienna(s) "
164164 )
165165
166166 def showTime (n : Long , units : List [Teletype ] = unitsSeq): Teletype = units match
@@ -172,14 +172,14 @@ class Report(using Environment):
172172 val sig = (n/ 1000L ).show
173173 import textMetrics .uniform
174174 val frac = (n% 1000 ).show.pad(3 , Rtl , '0' )
175- e " ${webColors. Silver } ( ${sig}. $frac) ${unit}"
175+ e " $Silver( ${sig}. $frac) ${unit}"
176176
177177 case class Summary (status : Status , id : TestId , count : Int , min : Long , max : Long , avg : Long ):
178178 def indentedName : Teletype =
179179 val depth = id.suite.let(_.id.depth).or(0 ) + 1
180180
181181 val title =
182- if status == Status .Suite then e " ${webColors. Silver } ( $Bold( ${id.name})) "
182+ if status == Status .Suite then e " $Silver( $Bold( ${id.name})) "
183183 else e " ${id.name}"
184184
185185 e " ${t " " * (depth - 1 )}$title"
@@ -205,12 +205,12 @@ class Report(using Environment):
205205 Column (e " " )(_.status.symbol),
206206
207207 Column (e " $Bold(Hash) " ): s =>
208- e " ${webColors. CadetBlue } ( ${s.id.id}) " ,
208+ e " $CadetBlue( ${s.id.id}) " ,
209209
210210 Column (e " $Bold(Test) " )(_.indentedName),
211211
212212 Column (e " $Bold(Count) " , textAlign = TextAlignment .Right ): s =>
213- e " ${webColors. SteelBlue } ( ${s.iterations}) " ,
213+ e " $SteelBlue( ${s.iterations}) " ,
214214
215215 Column (e " $Bold(Min) " , textAlign = TextAlignment .Right ): s =>
216216 if s.count < 2 then e " " else s.minTime,
@@ -229,10 +229,10 @@ class Report(using Environment):
229229 Out .println(e " $Bold( $Underline(Test coverage)) " )
230230 case class CoverageData (path : Text , branches : Int , hits : Int , oldHits : Int ):
231231 def hitsText : Teletype =
232- val main = e " ${if hits == 0 then webColors. Gray else webColors. ForestGreen }( $hits) "
232+ val main = e " ${if hits == 0 then Gray else ForestGreen }( $hits) "
233233
234234 if oldHits == 0 then main
235- else e " ${webColors. Goldenrod } ( ${oldHits.show.subscript}) $main"
235+ else e " $Goldenrod( ${oldHits.show.subscript}) $main"
236236
237237 val data = coverage.spec.groupBy(_.path).to(List ).map: (path, branches) =>
238238 val hitCount : Int =
@@ -255,8 +255,6 @@ class Report(using Environment):
255255 val diagram = TreeDiagram .by[Surface ](_.children)(junctures* )
256256 diagram.nodes.zip(diagram.render(describe))
257257
258- import webColors .*
259-
260258 val allHits = coverage.hits ++ coverage.oldHits
261259
262260 val junctures2 =
@@ -299,8 +297,7 @@ class Report(using Environment):
299297 val notCovered : Text = width(maxHits.map((data.branches.toDouble - data.hits -
300298 data.oldHits)/ _).getOrElse(0 ))
301299
302- val bars = List (webColors.ForestGreen -> covered, webColors.Goldenrod -> oldCovered,
303- webColors.Brown -> notCovered)
300+ val bars = List (ForestGreen -> covered, Goldenrod -> oldCovered, Brown -> notCovered)
304301
305302 bars.filter(_(1 ).length > 0 ).map { (color, bar) => e " $color( $bar) " }.join)
306303 . tabulate(data).grid(columns).render.each(Out .println(_))
@@ -317,7 +314,7 @@ class Report(using Environment):
317314
318315 table.tabulate(summaryLines).grid(columns).render.each(Out .println(_))
319316 given Decimalizer = Decimalizer (decimalPlaces = 1 )
320- Out .println(e " $Bold( ${webColors. White } ( $passed)) passed ( ${100.0 * passed/ total}%), $Bold( ${webColors. White } ( $failed)) failed ( ${100.0 * failed/ total}%), $Bold( ${webColors. White } ( ${passed + failed})) total " )
317+ Out .println(e " $Bold( $White( $passed)) passed ( ${100.0 * passed/ total}%), $Bold( $White( $failed)) failed ( ${100.0 * failed/ total}%), $Bold( $White( ${passed + failed})) total " )
321318 Out .println(t " ─ " * 72 )
322319 List (Status .Pass , Status .Bench , Status .Throws , Status .Fail , Status .Mixed , Status .CheckThrows ).grouped(3 ).each: statuses =>
323320 Out .println:
@@ -336,7 +333,7 @@ class Report(using Environment):
336333
337334 benches(lines).groupBy(_.test.suite).each: (suite, benchmarks) =>
338335 val ribbon =
339- Ribbon (webColors. DarkGreen .srgb, webColors. MediumSeaGreen .srgb, webColors. PaleGreen .srgb)
336+ Ribbon (DarkGreen .srgb, MediumSeaGreen .srgb, PaleGreen .srgb)
340337
341338 Out .println(ribbon.fill(e " ${suite.let(_.id.id).or(t " " )}" , e " Benchmarks " , e " ${suite.let(_.name).or(t " " )}" ))
342339
@@ -345,16 +342,16 @@ class Report(using Environment):
345342
346343 def confInt (b : Benchmark ): Teletype =
347344 if b.confidenceInterval == 0 then e " "
348- else e " ${webColors. Thistle } (±) ${showTime(b.confidenceInterval)}"
345+ else e " $Thistle(±) ${showTime(b.confidenceInterval)}"
349346
350347 def opsPerS (b : Benchmark ): Teletype =
351348 if b.throughput == 0 then e " "
352- else e " ${webColors. Silver } ( ${b.throughput}) ${webColors. Turquoise } (op ${webColors. Gray } (·)s¯¹) "
349+ else e " $Silver( ${b.throughput}) $Turquoise(op $Gray(·)s¯¹) "
353350
354351 val bench : Table [ReportLine .Bench , Teletype ] = Table [ReportLine .Bench ](
355352 (List (
356353 Column (e " $Bold(Hash) " ): s =>
357- e " ${webColors. CadetBlue } ( ${s.test.id}) " ,
354+ e " $CadetBlue( ${s.test.id}) " ,
358355 Column (e " $Bold(Test) " ): s =>
359356 e " ${s.test.name}" ,
360357
@@ -373,7 +370,7 @@ class Report(using Environment):
373370 comparisons.map: c =>
374371 import Baseline .*
375372 val baseline = c.benchmark.baseline.vouch(using Unsafe )
376- Column (e " $Bold( ${webColors. CadetBlue } ( ${c.test.id})) " , textAlign = TextAlignment .Right ): (bench : ReportLine .Bench ) =>
373+ Column (e " $Bold( $CadetBlue( ${c.test.id})) " , textAlign = TextAlignment .Right ): (bench : ReportLine .Bench ) =>
377374 def op (left : Double , right : Double ): Double = baseline.mode match
378375 case Arithmetic => left - right
379376 case Geometric => left/ right
@@ -390,15 +387,15 @@ class Report(using Environment):
390387 showTime(value.toLong)
391388
392389 case BySpeed =>
393- e " ${webColors. Silver } ( ${value}) ${webColors. Turquoise } (op ${webColors. Gray } (·)s¯¹) "
390+ e " $Silver( ${value}) $Turquoise(op $Gray(·)s¯¹) "
394391
395392 baseline.mode match
396393 case Arithmetic => if value == 0 then e " ★ "
397394 else if value < 0
398- then e " ${webColors. Thistle } (-) ${valueWithUnits.dropChars(1 )}"
399- else e " ${webColors. Thistle } (+) $valueWithUnits"
395+ then e " $Thistle(-) ${valueWithUnits.dropChars(1 )}"
396+ else e " $Thistle(+) $valueWithUnits"
400397
401- case Geometric => if value == 1 then e " ★ " else e " ${webColors. Silver } ( $value) "
398+ case Geometric => if value == 1 then e " ★ " else e " $Silver( $value) "
402399 ))*
403400 )
404401
@@ -408,37 +405,37 @@ class Report(using Environment):
408405 Out .println(t " ─ " * 74 )
409406 Out .println:
410407 StackTrace .legend.to(List ).map: (symbol, description) =>
411- e " $Bold( ${webColors. White } ( ${symbol.pad(3 , Rtl )})) ${description.pad(20 )}"
408+ e " $Bold( $White( ${symbol.pad(3 , Rtl )})) ${description.pad(20 )}"
412409
413410 . grouped(3 ).to(List ).map(_.to(List ).join).join(e " ${t " \n " }" )
414411
415412 Out .println(t " ─ " * 74 )
416413
417414 details.to(List ).sortBy(_(0 ).timestamp).each: (id, info) =>
418- val ribbon = Ribbon (webColors. DarkRed .srgb, webColors. FireBrick .srgb, webColors. Tomato .srgb)
415+ val ribbon = Ribbon (DarkRed .srgb, FireBrick .srgb, Tomato .srgb)
419416 Out .println(ribbon.fill(e " $Bold( ${id.id}) " , id.codepoint.text.teletype, id.name.teletype))
420417
421418 info.each: details =>
422419 Out .println(t " " )
423420 details match
424421 case Details .Throws (err) =>
425- val name = e " $Italic( ${webColors. White } ( ${err.component}. ${err.className})) "
426- Out .println(e " ${webColors. Silver } (An exception was thrown while running test:) " )
422+ val name = e " $Italic( $White( ${err.component}. ${err.className})) "
423+ Out .println(e " $Silver(An exception was thrown while running test:) " )
427424 Out .println(err.crop(t " probably.Runner " , t " run() " ).teletype)
428425 showLegend()
429426
430427 case Details .CheckThrows (err) =>
431- val name = e " $Italic( ${webColors. White } ( ${err.component}. ${err.className})) "
432- Out .println(e " ${webColors. Silver } (An exception was thrown while checking the test predicate:) " )
428+ val name = e " $Italic( $White( ${err.component}. ${err.className})) "
429+ Out .println(e " $Silver(An exception was thrown while checking the test predicate:) " )
433430 Out .println(err.crop(t " probably.Outcome# " , t " apply() " ).dropRight(1 ).teletype)
434431 showLegend()
435432
436433 case Details .Compare (expected, found, cmp) =>
437- val expected2 : Teletype = e " $Italic( ${webColors. White } ( $expected)) "
438- val found2 : Teletype = e " $Italic( ${webColors. White } ( $found)) "
434+ val expected2 : Teletype = e " $Italic( $White( $expected)) "
435+ val found2 : Teletype = e " $Italic( $White( $found)) "
439436 val nl = if expected.contains(t " \n " ) || found.contains(t " \n " ) then '\n ' else ' '
440437 val instead = e " but instead it returned $nl$found2$nl"
441- Out .println(e " ${webColors. Silver } (The test was expected to return $nl$expected2$nl$instead) " )
438+ Out .println(e " $Silver(The test was expected to return $nl$expected2$nl$instead) " )
442439 Out .println(cmp.teletype)
443440
444441 case Details .Captures (map) =>
@@ -465,5 +462,5 @@ class Report(using Environment):
465462
466463 Out .println()
467464
468- Out .println(Ribbon (webColors. Crimson .srgb, webColors. LightSalmon .srgb).fill(e " $Bold(FATAL) " , explanation))
465+ Out .println(Ribbon (Crimson .srgb, LightSalmon .srgb).fill(e " $Bold(FATAL) " , explanation))
469466 Out .println(StackTrace (error).teletype)
0 commit comments