Rollup merge of #146731 - Muscraft:svg-test-terminal-url, r=jdonszelmann

test: Use SVG for terminal url test

I came across the test for `-Zterminal-urls` and found its output a bit hard to read. So, I decided to switch it to an SVG test, as I found it easier to differentiate the link and link text.

Note: `anstyle-svg` needed to be upgraded to at least `0.1.8` to support links in SVGs, so I went ahead and upgraded it to the latest version (`0.1.11`).
This commit is contained in:
Matthias Krüger 2025-09-23 18:13:52 +02:00 committed by GitHub
commit ba9d057804
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 119 additions and 33 deletions

View file

@ -128,9 +128,9 @@ dependencies = [
[[package]]
name = "anstyle-svg"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc03a770ef506fe1396c0e476120ac0e6523cf14b74218dd5f18cd6833326fa9"
checksum = "26b9ec8c976eada1b0f9747a3d7cc4eae3bef10613e443746e7487f26c872fde"
dependencies = [
"anstyle",
"anstyle-lossy",

View file

@ -12,7 +12,7 @@ path = "src/bin/main.rs"
[dependencies]
# tidy-alphabetical-start
anstyle-svg = "0.1.3"
anstyle-svg = "0.1.11"
build_helper = { path = "../../build_helper" }
camino = "1"
colored = "2"

View file

@ -1,7 +1,7 @@
<svg width="743px" height="758px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="758px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-012 { fill: #5555FF }
.container {

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="743px" height="758px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="758px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-012 { fill: #5555FF }
.container {

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="750px" height="74px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="74px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-yellow { fill: #AA5500 }
.container {
padding: 0 10px;

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 811 B

Before After
Before After

View file

@ -1,4 +1,4 @@
//@ compile-flags: -Zterminal-urls=yes
//@ compile-flags: -Zterminal-urls=yes --error-format=human --color=always
fn main() {
let () = 4; //~ ERROR
let () = 4;
}

View file

@ -1,11 +0,0 @@
error[]8;;https://doc.rust-lang.org/error_codes/E0308.htmlE0308]8;;]: mismatched types
--> $DIR/terminal_urls.rs:3:9
|
LL | let () = 4;
| ^^ - this expression has type `{integer}`
| |
| expected integer, found `()`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -0,0 +1,48 @@
<svg width="740px" height="236px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-012 { fill: #5555FF }
.container {
padding: 0 10px;
line-height: 18px;
}
.bold { font-weight: bold; }
tspan {
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
white-space: pre;
line-height: 18px;
}
</style>
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[</tspan><tspan class="fg-ansi256-009 bold"><a href="https://doc.rust-lang.org/error_codes/E0308.html">E0308</a></tspan><tspan class="fg-ansi256-009 bold">]</tspan><tspan class="bold">: mismatched types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/terminal_urls.rs:3:9</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
<tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> let () = 4;</tspan>
</tspan>
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">this expression has type `{integer}`</tspan>
</tspan>
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">|</tspan>
</tspan>
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">expected integer, found `()`</tspan>
</tspan>
<tspan x="10px" y="154px">
</tspan>
<tspan x="10px" y="172px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
</tspan>
<tspan x="10px" y="190px">
</tspan>
<tspan x="10px" y="208px"><tspan class="bold">For more information about this error, try `rustc --explain E0308`.</tspan>
</tspan>
<tspan x="10px" y="226px">
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,49 @@
<svg width="740px" height="236px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-014 { fill: #55FFFF }
.fg-ansi256-015 { fill: #FFFFFF }
.container {
padding: 0 10px;
line-height: 18px;
}
.bold { font-weight: bold; }
tspan {
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
white-space: pre;
line-height: 18px;
}
</style>
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[</tspan><tspan class="fg-ansi256-009 bold"><a href="https://doc.rust-lang.org/error_codes/E0308.html">E0308</a></tspan><tspan class="fg-ansi256-009 bold">]</tspan><tspan class="fg-ansi256-015 bold">: mismatched types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/terminal_urls.rs:3:9</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
<tspan x="10px" y="82px"><tspan class="fg-ansi256-014 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan><tspan> let () = 4;</tspan>
</tspan>
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">-</tspan><tspan> </tspan><tspan class="fg-ansi256-014 bold">this expression has type `{integer}`</tspan>
</tspan>
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">|</tspan>
</tspan>
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">expected integer, found `()`</tspan>
</tspan>
<tspan x="10px" y="154px">
</tspan>
<tspan x="10px" y="172px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="fg-ansi256-015 bold">: aborting due to 1 previous error</tspan>
</tspan>
<tspan x="10px" y="190px">
</tspan>
<tspan x="10px" y="208px"><tspan class="fg-ansi256-015 bold">For more information about this error, try `rustc --explain E0308`.</tspan>
</tspan>
<tspan x="10px" y="226px">
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,7 +1,7 @@
<svg width="740px" height="668px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-012 { fill: #5555FF }
.fg-magenta { fill: #AA00AA }

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="785px" height="434px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="785px" height="434px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-014 { fill: #55FFFF }

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="1306px" height="866px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="1306px" height="866px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-014 { fill: #55FFFF }

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="2238px" height="3890px" xmlns="http://www.w3.org/2000/svg">
<svg width="2288px" height="3890px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="785px" height="434px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="1188px" height="398px" xmlns="http://www.w3.org/2000/svg">
<svg width="1096px" height="398px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
<svg width="886px" height="9524px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.bg { fill: #000000 }
.fg-ansi256-009 { fill: #FF5555 }
.fg-ansi256-010 { fill: #55FF55 }
.fg-ansi256-012 { fill: #5555FF }

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Before After
Before After