Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkgs/id/src/commands/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,11 @@ mod tests {

#[test]
fn test_every_named_format_char_is_escaped_alone_and_with_a_space() {
// The full Cf set named in #3111's acceptance: U+202A-202E, U+2066-2069,
// U+200E/U+200F, U+200B, U+FEFF, U+00AD.
// The named Cf cases in #3111's acceptance: U+202A-202E, U+2066-2069,
// U+200B-U+200F, U+FEFF, U+00AD.
let named: Vec<char> = (0x202a..=0x202e)
.chain(0x2066..=0x2069)
.chain([0x200e, 0x200f, 0x200b, 0xfeff, 0x00ad])
.chain([0x200b, 0x200c, 0x200d, 0x200e, 0x200f, 0xfeff, 0x00ad])
.map(|cp| char::from_u32(cp).expect("named Cf code point"))
.collect();
for c in named {
Expand Down
18 changes: 18 additions & 0 deletions pkgs/id/src/commands/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,24 @@ mod tests {
serde_json::from_str::<String>(&with_tab).unwrap(),
"a\u{202e}\tb"
);

// Join controls are part of the same Cf set: escape them in both the
// Cf-only and already-quoted paths without losing the stored value.
let joiner_alone = plain_field("\u{200d}");
assert_eq!(joiner_alone, r#""\u200d""#);
assert!(!joiner_alone.contains('\u{200d}'));
assert_eq!(
serde_json::from_str::<String>(&joiner_alone).unwrap(),
"\u{200d}"
);

let joiner_with_tab = plain_field("a\u{200d}\tb");
assert_eq!(joiner_with_tab, r#""a\u200d\tb""#);
assert!(!joiner_with_tab.contains('\u{200d}'));
assert_eq!(
serde_json::from_str::<String>(&joiner_with_tab).unwrap(),
"a\u{200d}\tb"
);
}

#[test]
Expand Down
5 changes: 3 additions & 2 deletions pkgs/id/src/invite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,12 @@ mod tests {

#[test]
fn format_characters_are_refused() {
// Representative Cf: soft hyphen, zero-width space, a bidi
// override, the BOM/zero-width no-break space, a tag char.
// Representative Cf: soft hyphen, zero-width space and joiner, a
// bidi override, the BOM/zero-width no-break space, a tag char.
for name in [
"Ann\u{ad}Lee",
"Ann\u{200b}Lee",
"Ann\u{200d}Lee",
"Ann\u{202e}Lee",
"\u{feff}Ann",
"Ann\u{e0041}",
Expand Down
Loading