-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathos_utils_test.go
More file actions
61 lines (56 loc) · 1.34 KB
/
os_utils_test.go
File metadata and controls
61 lines (56 loc) · 1.34 KB
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
// Copyright (c) F5, Inc.
//
// This source code is licensed under the Apache License, Version 2.0 license found in the
// LICENSE file in the root directory of this source tree.
package helpers
import (
"testing"
"github.com/stretchr/testify/assert"
)
// nolint: staticcheck
func TestRemoveASCIIControlSignals(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "No control characters",
input: "Hello, World!",
expected: "Hello, World!",
},
{
name: "With control characters",
input: "Hello, World!", expected: "Hello, World!",
},
{
name: "Only control characters",
input: "", expected: "",
},
{
name: "Mixed printable and control characters",
input: "Hello\nWorld\t!",
expected: "HelloWorld!",
},
{
name: "Empty string",
input: "",
expected: "",
},
{
name: "Agent version example",
input: "nginx-agent version v3.0.0-4a64a94", expected: "nginx-agent version v3.0.0-4a64a94",
},
{
name: "Agent version example alpine",
input: "#nginx-agent version v3.0.0-f94d93a",
expected: "nginx-agent version v3.0.0-f94d93a",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
result := RemoveASCIIControlSignals(t, test.input)
assert.Equal(t, test.expected, result)
})
}
}