Skip to content

Commit 920ff59

Browse files
authored
Add missing VRL tests for parse_etld (#684)
Missed in #669 This also adds `known_suffix` to type definition of `parse_etld` result, that was missed in original PR.
1 parent 3c32569 commit 920ff59

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# object: { "url": "https://vector.dev" }
2+
# result: { "etld": "dev", "etld_plus": "vector.dev", "known_suffix": true }
3+
4+
parsed_url = parse_url!(.url)
5+
etld_result = parse_etld!(parsed_url.host, plus_parts: 1)
6+
etld_result
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# object: { "host": "vector.dev" }
2+
# result: { "etld": "dev", "etld_plus": "vector.dev", "known_suffix": true }
3+
4+
etld_result = parse_etld!(.host, plus_parts: 1)
5+
etld_result
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# object: { "host": "vector.dev" }
2+
# result: { "etld": "dev", "etld_plus": "vector.dev", "known_suffix": true }
3+
4+
etld_result = parse_etld!(.host, plus_parts: 10)
5+
etld_result
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# object: { "host": "vector.dev" }
2+
# result: { "etld": "dev", "known_suffix": true }
3+
4+
etld_result = parse_etld!(.host)
5+
del(etld_result.etld_plus)
6+
etld_result

src/stdlib/parse_etld.rs

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ fn inner_kind() -> BTreeMap<Field, Kind> {
129129
BTreeMap::from([
130130
("etld".into(), Kind::bytes()),
131131
("etld_plus".into(), Kind::bytes()),
132+
("known_suffix".into(), Kind::boolean()),
132133
])
133134
}
134135

0 commit comments

Comments
 (0)