forked from OpenPrinting/ipp-usb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addpdl_test.go
73 lines (63 loc) · 2 KB
/
addpdl_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* ipp-usb - HTTP reverse proxy, backed by IPP-over-USB connection to device
*
* Copyright (C) 2020 and up by Alexander Pevzner ([email protected])
* See LICENSE for license terms and conditions
*
* (*DNSSdTxtRecord) AddPDL() test
*/
package main
import (
"testing"
)
var testDataAddPDL = []struct{ in, out string }{
{
"application/pdf",
"application/pdf",
},
{
"application/octet-stream," +
"application/pdf,image/tiff,image/jpeg,image/urf," +
"application/postscript,application/vnd.hp-PCL," +
"application/vnd.hp-PCLXL,application/vnd.xpsdocument," +
"image/pwg-raster",
"application/octet-stream," +
"application/pdf,image/tiff,image/jpeg,image/urf," +
"application/postscript,application/vnd.hp-PCL," +
"application/vnd.hp-PCLXL,application/vnd.xpsdocument," +
"image/pwg-raster",
},
{
"application/vnd.hp-PCL,application/vnd.hp-PCLXL," +
"application/postscript,application/msword," +
"application/pdf,image/jpeg,image/urf," +
"image/pwg-raster," +
"application/PCLm," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document," +
"application/vnd.ms-excel," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet," +
"application/vnd.ms-powerpoint," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation," +
"application/octet-stream",
"application/vnd.hp-PCL,application/vnd.hp-PCLXL," +
"application/postscript,application/msword," +
"application/pdf,image/jpeg,image/urf," +
"image/pwg-raster,application/PCLm," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
},
}
// Test .INI reader
func TestAddPDL(t *testing.T) {
for i, data := range testDataAddPDL {
var txt DNSSdTxtRecord
txt.AddPDL("pdl", data.in)
if len(txt) != 1 {
t.Errorf("test %d: unexpected (%d) number of TXT elements added",
i+1, len(txt))
return
}
if txt[0].Value != data.out {
t.Errorf("test %d: extected %q, got %q",
i+1, data.out, txt[0].Value)
}
}
}