Debian Codegraph @

debian/patches/0001-skip-removed-testdata-gracefully.patch

raw symbols SCIP
1 From: Anthony Fok <[email protected]>
2 Date: Thu, 6 Nov 2025 18:50:39 +0100
3 Subject: Skip removed testdata files gracefully
4
5 Origin: vendor
6 Forwarded: not-needed
7 Last-Update: 2025-08-26
8
9 Last-Update: 2025-08-26
10 ---
11 mimetype_test.go | 12 ++++++++++++
12 1 file changed, 12 insertions(+)
13
14 diff --git a/mimetype_test.go b/mimetype_test.go
15 index 484a129..948bd58 100644
16 --- a/mimetype_test.go
17 +++ b/mimetype_test.go
18 @@ -407,6 +407,9 @@ ENDHDR`,
19
20 func TestDetect(t *testing.T) {
21 for _, tc := range testcases {
22 + if tc.data == "debian-packaging-removed" {
23 + continue
24 + }
25 t.Run(tc.name, func(t *testing.T) {
26 if mtype := Detect([]byte(tc.data)); mtype.String() != tc.expectedMIME {
27 t.Errorf("Detect: Expected: %s != Detected: %s", tc.expectedMIME, mtype.String())
28 @@ -709,6 +712,9 @@ func TestIndexOutOfRangePanic(t *testing.T) {
29 }
30
31 for _, tc := range testcases {
32 + if tc.data == "debian-packaging-removed" {
33 + continue
34 + }
35 t.Run(tc.name, func(t *testing.T) {
36 testAtEachIndex(t, []byte(tc.data))
37 })
38 @@ -951,9 +957,15 @@ func offset(n int, s string) string {
39 prepend := make([]byte, n)
40 return string(prepend) + s
41 }
42 +
43 func fromDisk(path string) string {
44 data, err := os.ReadFile("testdata/" + path)
45 if err != nil {
46 + if strings.HasSuffix(err.Error(), "open testdata/"+path+": no such file or directory") {
47 + fmt.Println(err.Error())
48 + fmt.Println("(removed from Debian packaging)")
49 + return "debian-packaging-removed"
50 + }
51 panic(err)
52 }
53 return string(data)