1/* $NetBSD: opt_l.c,v 1.5 2022/04/24 09:04:12 rillig Exp $ */ 2 3/* 4 * Tests for the option '-l', which specifies the maximum length of a line. 5 * 6 * As of 2021-11-20, indent assumes that each byte occupies a single column, 7 * it does not properly handle Unicode. 8 */ 9 10//indent input 11/* 12 * With a line length of 38, this comment and the next one are broken. 13 */ 14 15/* The options -l and -lc produce the same output. */ 16//indent end 17 18//indent run -l38 19/* 20 * With a line length of 38, this 21 * comment and the next one are 22 * broken. 23 */ 24 25/* 26 * The options -l and -lc produce the 27 * same output. 28 */ 29//indent end 30 31//indent run-equals-prev-output -lc38 32 33//indent run-equals-input -l78 34 35//indent run-equals-input -lc78 36 37 38//indent input 39int decl; /* comment comment comment comment */ 40//indent end 41 42/* 43 * The option '-lc' only applies to block comments, not to comments to the 44 * right of code or declarations. 45 */ 46//indent run -di8 -c17 -lc32 47int decl; /* comment comment comment comment */ 48//indent end 49 50//indent run -di8 -c17 -l32 51int decl; /* comment comment 52 * comment comment */ 53//indent end 54 55 56/* 57 * FIXME: Even though the line length is limited with -l38, 58 * the overly long lines in the code are not broken. 59 */ 60//indent input 61void 62example(int a, int b, int c, const char *cp) 63{ 64 for (const char *p = cp; *p != '\0'; p++) 65 if (*p > a) 66 if (*p > b) 67 if (*p > c) 68 return; 69 70 function(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 71} 72//indent end 73 74//indent run-equals-input -l38 75