MCPcopy Create free account
hub / github.com/OpenPrinting/goipp / TestOpString

Function TestOpString

op_test.go:14–42  ·  view source on GitHub ↗

TestOpString tests Op.String method

(t *testing.T)

Source from the content-addressed store, hash-verified

12
13// TestOpString tests Op.String method
14func TestOpString(t *testing.T) {
15 type testData struct {
16 op Op // Input Op code
17 s string // Expected output string
18 }
19
20 tests := []testData{
21 {OpPrintJob, "Print-Job"},
22 {OpPrintURI, "Print-URI"},
23 {OpPausePrinter, "Pause-Printer"},
24 {OpRestartSystem, "Restart-System"},
25 {OpCupsGetDefault, "CUPS-Get-Default"},
26 {OpCupsGetPpd, "CUPS-Get-PPD"},
27 {OpCupsCreateLocalPrinter, "CUPS-Create-Local-Printer"},
28 {0xabcd, "0xabcd"},
29 }
30
31 for _, test := range tests {
32 s := test.op.String()
33 if s != test.s {
34 t.Errorf("testing Op.String:\n"+
35 "input: 0x%4.4x\n"+
36 "expected: %s\n"+
37 "present: %s\n",
38 int(test.op), test.s, s,
39 )
40 }
41 }
42}

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected