| ... | ... | @@ -1308,108 +1308,108 @@ test "zig fmt: 2nd arg multiline string" { |
| 1308 | 1308 | ); |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | | //test "zig fmt: 2nd arg multiline string many args" { |
| 1312 | | // try testCanonical( |
| 1313 | | // \\comptime { |
| 1314 | | // \\ cases.addAsm("hello world linux x86_64", |
| 1315 | | // \\ \\.text |
| 1316 | | // \\ , "Hello, world!\n", "Hello, world!\n"); |
| 1317 | | // \\} |
| 1318 | | // \\ |
| 1319 | | // ); |
| 1320 | | //} |
| 1321 | | // |
| 1322 | | //test "zig fmt: final arg multiline string" { |
| 1323 | | // try testCanonical( |
| 1324 | | // \\comptime { |
| 1325 | | // \\ cases.addAsm("hello world linux x86_64", "Hello, world!\n", |
| 1326 | | // \\ \\.text |
| 1327 | | // \\ ); |
| 1328 | | // \\} |
| 1329 | | // \\ |
| 1330 | | // ); |
| 1331 | | //} |
| 1332 | | // |
| 1333 | | //test "zig fmt: if condition wraps" { |
| 1334 | | // try testTransform( |
| 1335 | | // \\comptime { |
| 1336 | | // \\ if (cond and |
| 1337 | | // \\ cond) { |
| 1338 | | // \\ return x; |
| 1339 | | // \\ } |
| 1340 | | // \\ while (cond and |
| 1341 | | // \\ cond) { |
| 1342 | | // \\ return x; |
| 1343 | | // \\ } |
| 1344 | | // \\ if (a == b and |
| 1345 | | // \\ c) { |
| 1346 | | // \\ a = b; |
| 1347 | | // \\ } |
| 1348 | | // \\ while (a == b and |
| 1349 | | // \\ c) { |
| 1350 | | // \\ a = b; |
| 1351 | | // \\ } |
| 1352 | | // \\ if ((cond and |
| 1353 | | // \\ cond)) { |
| 1354 | | // \\ return x; |
| 1355 | | // \\ } |
| 1356 | | // \\ while ((cond and |
| 1357 | | // \\ cond)) { |
| 1358 | | // \\ return x; |
| 1359 | | // \\ } |
| 1360 | | // \\ var a = if (a) |*f| x: { |
| 1361 | | // \\ break :x &a.b; |
| 1362 | | // \\ } else |err| err; |
| 1363 | | // \\ var a = if (cond and |
| 1364 | | // \\ cond) |*f| |
| 1365 | | // \\ x: { |
| 1366 | | // \\ break :x &a.b; |
| 1367 | | // \\ } else |err| err; |
| 1368 | | // \\} |
| 1369 | | // , |
| 1370 | | // \\comptime { |
| 1371 | | // \\ if (cond and |
| 1372 | | // \\ cond) |
| 1373 | | // \\ { |
| 1374 | | // \\ return x; |
| 1375 | | // \\ } |
| 1376 | | // \\ while (cond and |
| 1377 | | // \\ cond) |
| 1378 | | // \\ { |
| 1379 | | // \\ return x; |
| 1380 | | // \\ } |
| 1381 | | // \\ if (a == b and |
| 1382 | | // \\ c) |
| 1383 | | // \\ { |
| 1384 | | // \\ a = b; |
| 1385 | | // \\ } |
| 1386 | | // \\ while (a == b and |
| 1387 | | // \\ c) |
| 1388 | | // \\ { |
| 1389 | | // \\ a = b; |
| 1390 | | // \\ } |
| 1391 | | // \\ if ((cond and |
| 1392 | | // \\ cond)) |
| 1393 | | // \\ { |
| 1394 | | // \\ return x; |
| 1395 | | // \\ } |
| 1396 | | // \\ while ((cond and |
| 1397 | | // \\ cond)) |
| 1398 | | // \\ { |
| 1399 | | // \\ return x; |
| 1400 | | // \\ } |
| 1401 | | // \\ var a = if (a) |*f| x: { |
| 1402 | | // \\ break :x &a.b; |
| 1403 | | // \\ } else |err| err; |
| 1404 | | // \\ var a = if (cond and |
| 1405 | | // \\ cond) |*f| |
| 1406 | | // \\ x: { |
| 1407 | | // \\ break :x &a.b; |
| 1408 | | // \\ } else |err| err; |
| 1409 | | // \\} |
| 1410 | | // \\ |
| 1411 | | // ); |
| 1412 | | //} |
| 1311 | test "zig fmt: 2nd arg multiline string many args" { |
| 1312 | try testCanonical( |
| 1313 | \\comptime { |
| 1314 | \\ cases.addAsm("hello world linux x86_64", |
| 1315 | \\ \\.text |
| 1316 | \\ , "Hello, world!\n", "Hello, world!\n"); |
| 1317 | \\} |
| 1318 | \\ |
| 1319 | ); |
| 1320 | } |
| 1321 | |
| 1322 | test "zig fmt: final arg multiline string" { |
| 1323 | try testCanonical( |
| 1324 | \\comptime { |
| 1325 | \\ cases.addAsm("hello world linux x86_64", "Hello, world!\n", |
| 1326 | \\ \\.text |
| 1327 | \\ ); |
| 1328 | \\} |
| 1329 | \\ |
| 1330 | ); |
| 1331 | } |
| 1332 | |
| 1333 | test "zig fmt: if condition wraps" { |
| 1334 | try testTransform( |
| 1335 | \\comptime { |
| 1336 | \\ if (cond and |
| 1337 | \\ cond) { |
| 1338 | \\ return x; |
| 1339 | \\ } |
| 1340 | \\ while (cond and |
| 1341 | \\ cond) { |
| 1342 | \\ return x; |
| 1343 | \\ } |
| 1344 | \\ if (a == b and |
| 1345 | \\ c) { |
| 1346 | \\ a = b; |
| 1347 | \\ } |
| 1348 | \\ while (a == b and |
| 1349 | \\ c) { |
| 1350 | \\ a = b; |
| 1351 | \\ } |
| 1352 | \\ if ((cond and |
| 1353 | \\ cond)) { |
| 1354 | \\ return x; |
| 1355 | \\ } |
| 1356 | \\ while ((cond and |
| 1357 | \\ cond)) { |
| 1358 | \\ return x; |
| 1359 | \\ } |
| 1360 | \\ var a = if (a) |*f| x: { |
| 1361 | \\ break :x &a.b; |
| 1362 | \\ } else |err| err; |
| 1363 | \\ var a = if (cond and |
| 1364 | \\ cond) |*f| |
| 1365 | \\ x: { |
| 1366 | \\ break :x &a.b; |
| 1367 | \\ } else |err| err; |
| 1368 | \\} |
| 1369 | , |
| 1370 | \\comptime { |
| 1371 | \\ if (cond and |
| 1372 | \\ cond) |
| 1373 | \\ { |
| 1374 | \\ return x; |
| 1375 | \\ } |
| 1376 | \\ while (cond and |
| 1377 | \\ cond) |
| 1378 | \\ { |
| 1379 | \\ return x; |
| 1380 | \\ } |
| 1381 | \\ if (a == b and |
| 1382 | \\ c) |
| 1383 | \\ { |
| 1384 | \\ a = b; |
| 1385 | \\ } |
| 1386 | \\ while (a == b and |
| 1387 | \\ c) |
| 1388 | \\ { |
| 1389 | \\ a = b; |
| 1390 | \\ } |
| 1391 | \\ if ((cond and |
| 1392 | \\ cond)) |
| 1393 | \\ { |
| 1394 | \\ return x; |
| 1395 | \\ } |
| 1396 | \\ while ((cond and |
| 1397 | \\ cond)) |
| 1398 | \\ { |
| 1399 | \\ return x; |
| 1400 | \\ } |
| 1401 | \\ var a = if (a) |*f| x: { |
| 1402 | \\ break :x &a.b; |
| 1403 | \\ } else |err| err; |
| 1404 | \\ var a = if (cond and |
| 1405 | \\ cond) |*f| |
| 1406 | \\ x: { |
| 1407 | \\ break :x &a.b; |
| 1408 | \\ } else |err| err; |
| 1409 | \\} |
| 1410 | \\ |
| 1411 | ); |
| 1412 | } |
| 1413 | 1413 | // |
| 1414 | 1414 | //test "zig fmt: if condition has line break but must not wrap" { |
| 1415 | 1415 | // try testCanonical( |