Skip to content

Commit ac02a7c

Browse files
committed
useragent(test): additional malformed comment cases
1 parent 234c90f commit ac02a7c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

useragent/from_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@ func Test_fromString(t *testing.T) {
9898
Comment: "a comment",
9999
},
100100
},
101+
{
102+
"comment malformed closing",
103+
"my-product/v1.2.3 (a comment",
104+
config.UserAgentProduct{
105+
Name: "my-product",
106+
Version: "v1.2.3",
107+
Comment: "a comment",
108+
},
109+
},
110+
{
111+
"comment missing parenthesis",
112+
"my-product/v1.2.3 a comment",
113+
// This is a known edge case, but the processed output will render identical
114+
// to the original input despite the version and comment merging.
115+
config.UserAgentProduct{
116+
Name: "my-product",
117+
Version: "v1.2.3 a comment",
118+
},
119+
},
101120
{
102121
"all the slash",
103122
"foo/bar/baz/qux",

0 commit comments

Comments
 (0)