Verifies error conditions for a command named `name` that takes three X/Y pairs.
(name: &'static str)
| 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) { |
| 1203 | for args in &["1, 2, 3, 4, 5", "1, 2, 3, 4, 5, 6, 7", "1, 2, 3, 4, , 6"] { |
| 1204 | check_stmt_compilation_err( |
| 1205 | format!("1:1: {} expected x1%, y1%, x2%, y2%, x3%, y3%", name), |
| 1206 | &format!("{} {}", name, args), |
| 1207 | ); |
| 1208 | } |
| 1209 | |
| 1210 | check_stmt_compilation_err( |
| 1211 | format!("1:{}: {} expected x1%, y1%, x2%, y2%, x3%, y3%", name.len() + 3, name), |
| 1212 | &format!("{} 2; 3, 4, 5, 6, 7", name), |
| 1213 | ); |
| 1214 | |
| 1215 | for args in &[ |
| 1216 | "-40000, 1, 1, 1, 1, 1", |
| 1217 | "1, -40000, 1, 1, 1, 1", |
| 1218 | "1, 1, -40000, 1, 1, 1", |
| 1219 | "1, 1, 1, -40000, 1, 1", |
| 1220 | "1, 1, 1, 1, -40000, 1", |
| 1221 | "1, 1, 1, 1, 1, -40000", |
| 1222 | ] { |
| 1223 | let pos = name.len() + 1 + args.find('-').unwrap() + 1; |
| 1224 | check_stmt_err( |
| 1225 | format!("1:{}: Coordinate -40000 out of range", pos), |
| 1226 | &format!("{} {}", name, args), |
| 1227 | ); |
| 1228 | } |
| 1229 | |
| 1230 | for args in &[ |
| 1231 | "40000, 1, 1, 1, 1, 1", |
| 1232 | "1, 40000, 1, 1, 1, 1", |
| 1233 | "1, 1, 40000, 1, 1, 1", |
| 1234 | "1, 1, 1, 40000, 1, 1", |
| 1235 | "1, 1, 1, 1, 40000, 1", |
| 1236 | "1, 1, 1, 1, 1, 40000", |
| 1237 | ] { |
| 1238 | let pos = name.len() + 1 + args.find('4').unwrap() + 1; |
| 1239 | check_stmt_err( |
| 1240 | format!("1:{}: Coordinate 40000 out of range", pos), |
| 1241 | &format!("{} {}", name, args), |
| 1242 | ); |
| 1243 | } |
| 1244 | |
| 1245 | for args in &[ |
| 1246 | "\"a\", 1, 1, 1, 1, 1", |
| 1247 | "1, \"a\", 1, 1, 1, 1", |
| 1248 | "1, 1, \"a\", 1, 1, 1", |
| 1249 | "1, 1, 1, \"a\", 1, 1", |
| 1250 | "1, 1, 1, 1, \"a\", 1", |
| 1251 | "1, 1, 1, 1, 1, \"a\"", |
| 1252 | ] { |
| 1253 | let stmt = &format!("{} {}", name, args); |
| 1254 | let pos = stmt.find('"').unwrap() + 1; |
| 1255 | check_stmt_compilation_err(format!("1:{}: STRING is not a number", pos), stmt); |
| 1256 | } |
| 1257 | } |
| 1258 | |
| 1259 | /// Verifies error conditions for a command named `name` that takes zero or more X/Y pairs. |