A string drawn from a pool of round-trip hazards: empty, unicode, embedded quotes/newlines, and JSON-looking text (the last is the trap for the untagged `ToolResultContentField` — a string that looks* like an array must still come back as `Text`, not `Blocks`).
(&mut self)
| 100 | /// trap for the untagged `ToolResultContentField` — a string that |
| 101 | /// *looks* like an array must still come back as `Text`, not `Blocks`). |
| 102 | fn string(&mut self) -> String { |
| 103 | const POOL: &[&str] = &[ |
| 104 | "", |
| 105 | "ok", |
| 106 | "hello world", |
| 107 | "with \"double\" quotes", |
| 108 | "line\nbreak\tand tab", |
| 109 | "unicode ü ñ 日本語 🚀", |
| 110 | "{\"looks\":\"like json\"}", |
| 111 | "[1, 2, 3]", |
| 112 | "null", |
| 113 | "12345", |
| 114 | "trailing space ", |
| 115 | "ümlaut-prefixed", |
| 116 | ]; |
| 117 | let base = POOL[self.usize_below(POOL.len() as u64)].to_string(); |
| 118 | // Occasionally suffix with the seed so distinct generations differ. |
| 119 | if self.boolean() { |
| 120 | format!("{base}#{}", self.below(1000)) |
| 121 | } else { |
| 122 | base |
| 123 | } |
| 124 | } |
| 125 | fn opt_string(&mut self) -> Option<String> { |
| 126 | if self.boolean() { |
| 127 | Some(self.string()) |
no test coverage detected