Verifies error conditions for a command named `name` that takes two X/Y pairs.
(name: &'static str)
| 1168 | |
| 1169 | /// Verifies error conditions for a command named `name` that takes two X/Y pairs. |
| 1170 | fn check_errors_two_xy(name: &'static str) { |
| 1171 | for args in &["1, 2, , 4", "1, 2, 3", "1, 2, 3, 4, 5", "2; 3, 4"] { |
| 1172 | check_stmt_compilation_err( |
| 1173 | format!("1:1: {} expected x1%, y1%, x2%, y2%", name), |
| 1174 | &format!("{} {}", name, args), |
| 1175 | ); |
| 1176 | } |
| 1177 | |
| 1178 | for args in &["-40000, 1, 1, 1", "1, -40000, 1, 1", "1, 1, -40000, 1", "1, 1, 1, -40000"] { |
| 1179 | let pos = name.len() + 1 + args.find('-').unwrap() + 1; |
| 1180 | check_stmt_err( |
| 1181 | format!("1:{}: Coordinate -40000 out of range", pos), |
| 1182 | &format!("{} {}", name, args), |
| 1183 | ); |
| 1184 | } |
| 1185 | |
| 1186 | for args in &["40000, 1, 1, 1", "1, 40000, 1, 1", "1, 1, 40000, 1", "1, 1, 1, 40000"] { |
| 1187 | let pos = name.len() + 1 + args.find('4').unwrap() + 1; |
| 1188 | check_stmt_err( |
| 1189 | format!("1:{}: Coordinate 40000 out of range", pos), |
| 1190 | &format!("{} {}", name, args), |
| 1191 | ); |
| 1192 | } |
| 1193 | |
| 1194 | for args in &["\"a\", 1, 1, 1", "1, \"a\", 1, 1", "1, 1, \"a\", 1", "1, 1, 1, \"a\""] { |
| 1195 | let stmt = &format!("{} {}", name, args); |
| 1196 | let pos = stmt.find('"').unwrap() + 1; |
| 1197 | check_stmt_compilation_err(format!("1:{}: STRING is not a number", pos), stmt); |
| 1198 | } |
| 1199 | } |
| 1200 | |
| 1201 | /// Verifies error conditions for a command named `name` that takes three X/Y pairs. |
| 1202 | fn check_errors_three_xy(name: &'static str) { |