Skip to content

Commit d217b3b

Browse files
committed
dns: Fix clang-format violations and Copilot comment in hostname_test.cc
- Apply clang-format (LLVM style) to four code blocks that violated line-length / alignment rules under --dry-run -Werror: valid_label_exactly_63: collapse two-line EXPECT_TRUE to one line invalid_label_64: collapse two-line EXPECT_FALSE to one line invalid_fullwidth_dot: split adjacent string literal across two lines invalid_high_bit_byte / invalid_nul_byte: align string_view initialiser list per LLVM column rules - Update comment on invalid_empty: replace "<name> requires at least one <let>" with "<hname> requires at least one <name> / label" (Copilot review: original phrasing was inaccurate given the RFC 1123 §2.1 relaxation that allows digit-first labels) All 44 tests still pass. Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
1 parent 7478815 commit d217b3b

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

test/dns/hostname_test.cc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ TEST(DNS_hostname, valid_mixed_case) {
6363

6464
// RFC 1123 §2.1 MUST: label of exactly 63 chars (TS d4 #17, TS d7+ #23)
6565
TEST(DNS_hostname, valid_label_exactly_63) {
66-
EXPECT_TRUE(sourcemeta::core::is_hostname(
67-
std::string(63, 'a') + ".com"));
66+
EXPECT_TRUE(sourcemeta::core::is_hostname(std::string(63, 'a') + ".com"));
6867
}
6968

7069
// RFC 1123 §2.1 MUST: single label of exactly 63 chars
@@ -124,7 +123,7 @@ TEST(DNS_hostname, valid_many_labels) {
124123

125124
// INVALID - non-compliant inputs
126125

127-
// RFC 952 §B: <name> requires at least one <let> (TS d7+ #12)
126+
// RFC 952 §B: <hname> requires at least one <name> / label (TS d7+ #12)
128127
TEST(DNS_hostname, invalid_empty) {
129128
EXPECT_FALSE(sourcemeta::core::is_hostname(""));
130129
}
@@ -202,8 +201,7 @@ TEST(DNS_hostname, invalid_space) {
202201

203202
// RFC 1123 §2.1 MUST: label exceeds 63-character limit (TS d4 #18, d7+ #24)
204203
TEST(DNS_hostname, invalid_label_64) {
205-
EXPECT_FALSE(sourcemeta::core::is_hostname(
206-
std::string(64, 'a') + ".com"));
204+
EXPECT_FALSE(sourcemeta::core::is_hostname(std::string(64, 'a') + ".com"));
207205
}
208206

209207
// RFC 1123 §2.1 MUST: single label of 64 chars exceeds per-label limit
@@ -234,19 +232,22 @@ TEST(DNS_hostname, invalid_ts_256_string) {
234232
// RFC 952 ASSUMPTIONS: U+FF0E (fullwidth full stop) is not in the ASCII
235233
// alphabet; UTF-8 bytes 0xEF 0xBC 0x8E (TS d4 #27, d7+ #16)
236234
TEST(DNS_hostname, invalid_fullwidth_dot) {
237-
EXPECT_FALSE(sourcemeta::core::is_hostname("example\xef\xbc\x8e" "com"));
235+
EXPECT_FALSE(sourcemeta::core::is_hostname("example\xef\xbc\x8e"
236+
"com"));
238237
}
239238

240239
// RFC 952 ASSUMPTIONS: any byte >= 0x80 is outside the ASCII alphabet
241240
TEST(DNS_hostname, invalid_high_bit_byte) {
242-
EXPECT_FALSE(
243-
sourcemeta::core::is_hostname(std::string_view{"a\x80" "b", 3}));
241+
EXPECT_FALSE(sourcemeta::core::is_hostname(std::string_view{"a\x80"
242+
"b",
243+
3}));
244244
}
245245

246246
// RFC 952 ASSUMPTIONS: NUL byte (0x00) is not in the ASCII alphabet
247247
TEST(DNS_hostname, invalid_nul_byte) {
248-
EXPECT_FALSE(
249-
sourcemeta::core::is_hostname(std::string_view{"a\x00" "b", 3}));
248+
EXPECT_FALSE(sourcemeta::core::is_hostname(std::string_view{"a\x00"
249+
"b",
250+
3}));
250251
}
251252

252253
// RFC 952 ASSUMPTIONS: '@' is not in the alphabet (A-Z 0-9 '-' '.')

0 commit comments

Comments
 (0)