Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
258a6198
Commit
258a6198
authored
Apr 13, 2021
by
Jacob Bogdanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix backwards assertions
parent
3b02ff3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
tests/headers_test.cc
tests/headers_test.cc
+4
-4
tests/mime_test.cc
tests/mime_test.cc
+6
-6
No files found.
tests/headers_test.cc
View file @
258a6198
...
@@ -821,10 +821,10 @@ TEST(headers_test, raw_headers_are_case_insensitive)
...
@@ -821,10 +821,10 @@ TEST(headers_test, raw_headers_are_case_insensitive)
step
.
apply
(
cursor
);
step
.
apply
(
cursor
);
// or the header you try and get, it should work:
// or the header you try and get, it should work:
ASSERT_
FALS
E
(
request
.
headers
().
tryGetRaw
(
"Custom-Header"
).
has_value
());
ASSERT_
TRU
E
(
request
.
headers
().
tryGetRaw
(
"Custom-Header"
).
has_value
());
ASSERT_
FALS
E
(
request
.
headers
().
tryGetRaw
(
"CUSTOM-HEADER"
).
has_value
());
ASSERT_
TRU
E
(
request
.
headers
().
tryGetRaw
(
"CUSTOM-HEADER"
).
has_value
());
ASSERT_
FALS
E
(
request
.
headers
().
tryGetRaw
(
"custom-header"
).
has_value
());
ASSERT_
TRU
E
(
request
.
headers
().
tryGetRaw
(
"custom-header"
).
has_value
());
ASSERT_
FALS
E
(
request
.
headers
().
tryGetRaw
(
"CuStOm-HeAdEr"
).
has_value
());
ASSERT_
TRU
E
(
request
.
headers
().
tryGetRaw
(
"CuStOm-HeAdEr"
).
has_value
());
}
}
}
}
...
...
tests/mime_test.cc
View file @
258a6198
...
@@ -21,7 +21,7 @@ TEST(mime_test, basic_test)
...
@@ -21,7 +21,7 @@ TEST(mime_test, basic_test)
ASSERT_TRUE
(
m2
.
toString
()
==
"application/xhtml+xml"
);
ASSERT_TRUE
(
m2
.
toString
()
==
"application/xhtml+xml"
);
auto
m3
=
MIME
(
Text
,
Plain
);
auto
m3
=
MIME
(
Text
,
Plain
);
ASSERT_
TRU
E
(
m3
.
q
().
has_value
());
ASSERT_
FALS
E
(
m3
.
q
().
has_value
());
m3
.
setQuality
(
Q
::
fromFloat
(
0.7
));
m3
.
setQuality
(
Q
::
fromFloat
(
0.7
));
ASSERT_TRUE
(
m3
.
q
().
value_or
(
Q
(
0
))
==
Q
(
70
));
ASSERT_TRUE
(
m3
.
q
().
value_or
(
Q
(
0
))
==
Q
(
70
));
...
@@ -54,12 +54,12 @@ TEST(mime_test, valid_parsing_test)
...
@@ -54,12 +54,12 @@ TEST(mime_test, valid_parsing_test)
{
{
parse
(
"application/json"
,
[](
const
MediaType
&
m1
)
{
parse
(
"application/json"
,
[](
const
MediaType
&
m1
)
{
ASSERT_TRUE
(
m1
==
MIME
(
Application
,
Json
));
ASSERT_TRUE
(
m1
==
MIME
(
Application
,
Json
));
ASSERT_
TRU
E
(
m1
.
q
().
has_value
());
ASSERT_
FALS
E
(
m1
.
q
().
has_value
());
});
});
parse
(
"application/xhtml+xml"
,
[](
const
MediaType
&
m2
)
{
parse
(
"application/xhtml+xml"
,
[](
const
MediaType
&
m2
)
{
ASSERT_TRUE
(
m2
==
MediaType
(
Type
::
Application
,
Subtype
::
Xhtml
,
Suffix
::
Xml
));
ASSERT_TRUE
(
m2
==
MediaType
(
Type
::
Application
,
Subtype
::
Xhtml
,
Suffix
::
Xml
));
ASSERT_
TRU
E
(
m2
.
q
().
has_value
());
ASSERT_
FALS
E
(
m2
.
q
().
has_value
());
});
});
parse
(
"application/json; q=0.3"
,
[](
const
MediaType
&
m3
)
{
parse
(
"application/json; q=0.3"
,
[](
const
MediaType
&
m3
)
{
...
@@ -108,7 +108,7 @@ TEST(mime_test, valid_parsing_test)
...
@@ -108,7 +108,7 @@ TEST(mime_test, valid_parsing_test)
parse
(
"text/html; charset=ISO-8859-4"
,
[](
const
MediaType
&
m10
)
{
parse
(
"text/html; charset=ISO-8859-4"
,
[](
const
MediaType
&
m10
)
{
ASSERT_TRUE
(
m10
==
MIME
(
Text
,
Html
));
ASSERT_TRUE
(
m10
==
MIME
(
Text
,
Html
));
ASSERT_
TRU
E
(
m10
.
q
().
has_value
());
ASSERT_
FALS
E
(
m10
.
q
().
has_value
());
auto
charset
=
m10
.
getParam
(
"charset"
);
auto
charset
=
m10
.
getParam
(
"charset"
);
ASSERT_TRUE
(
charset
.
value_or
(
""
)
==
"ISO-8859-4"
);
ASSERT_TRUE
(
charset
.
value_or
(
""
)
==
"ISO-8859-4"
);
});
});
...
@@ -150,12 +150,12 @@ TEST(mime_test, should_parse_case_insensitive_issue_179)
...
@@ -150,12 +150,12 @@ TEST(mime_test, should_parse_case_insensitive_issue_179)
{
{
parse
(
"Application/Json"
,
[](
const
Mime
::
MediaType
&
mime
)
{
parse
(
"Application/Json"
,
[](
const
Mime
::
MediaType
&
mime
)
{
ASSERT_TRUE
(
mime
==
MIME
(
Application
,
Json
));
ASSERT_TRUE
(
mime
==
MIME
(
Application
,
Json
));
ASSERT_
TRU
E
(
mime
.
q
().
has_value
());
ASSERT_
FALS
E
(
mime
.
q
().
has_value
());
});
});
parse
(
"aPpliCAtion/Xhtml+XML"
,
[](
const
MediaType
&
mime
)
{
parse
(
"aPpliCAtion/Xhtml+XML"
,
[](
const
MediaType
&
mime
)
{
ASSERT_TRUE
(
mime
==
MediaType
(
Type
::
Application
,
Subtype
::
Xhtml
,
Suffix
::
Xml
));
ASSERT_TRUE
(
mime
==
MediaType
(
Type
::
Application
,
Subtype
::
Xhtml
,
Suffix
::
Xml
));
ASSERT_
TRU
E
(
mime
.
q
().
has_value
());
ASSERT_
FALS
E
(
mime
.
q
().
has_value
());
});
});
parse
(
"Application/Xhtml+XML; q=0.78"
,
[](
const
MediaType
&
mime
)
{
parse
(
"Application/Xhtml+XML; q=0.78"
,
[](
const
MediaType
&
mime
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment