diff options
Diffstat (limited to 'test/indent')
| -rw-r--r-- | test/indent/modula2.mod | 53 | ||||
| -rw-r--r-- | test/indent/octave.m | 24 |
2 files changed, 68 insertions, 9 deletions
diff --git a/test/indent/modula2.mod b/test/indent/modula2.mod new file mode 100644 index 00000000000..f8fbcb7f4e5 --- /dev/null +++ b/test/indent/modula2.mod | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | (* -*- mode: modula-2; m2-indent:3 -*- *) | ||
| 2 | |||
| 3 | IMPLEMENTATION MODULE Indent ; | ||
| 4 | |||
| 5 | (* This is (* a nested comment *) *) | ||
| 6 | // This is a single-line comment. | ||
| 7 | |||
| 8 | FROM SYSTEM IMPORT ADR, TSIZE, SIZE, WORD ; | ||
| 9 | |||
| 10 | CONST | ||
| 11 | c1 = 2; | ||
| 12 | |||
| 13 | TYPE | ||
| 14 | t = POINTER TO ARRAY [0..10] OF LONGINT; | ||
| 15 | |||
| 16 | VAR x: t; | ||
| 17 | y:LONGINT; | ||
| 18 | |||
| 19 | |||
| 20 | PROCEDURE f1 (f: File) : INTEGER ; | ||
| 21 | VAR | ||
| 22 | fd: FileDescriptor ; | ||
| 23 | PROCEDURE foo (a:CARDINAL) : INTEGER; | ||
| 24 | BEGIN | ||
| 25 | END foo; | ||
| 26 | BEGIN | ||
| 27 | IF f#Error | ||
| 28 | THEN | ||
| 29 | fd := GetIndice(FileInfo, f) ; | ||
| 30 | IF fd#NIL THEN | ||
| 31 | RETURN( fd^.unixfd ) | ||
| 32 | ELSE | ||
| 33 | CASE z OF | ||
| 34 | 1: do1(); | ||
| 35 | | 2: do2(); | ||
| 36 | toto(x); | ||
| 37 | | 3: ; | ||
| 38 | | 4: do4(); | ||
| 39 | ELSE do5(); | ||
| 40 | END ; (* CASE selection *) | ||
| 41 | |||
| 42 | END | ||
| 43 | END ; | ||
| 44 | FormatError1('file %d has not been opened or is out of range\n', f) ; | ||
| 45 | RETURN( -1 ) | ||
| 46 | END f1 ; | ||
| 47 | |||
| 48 | |||
| 49 | BEGIN | ||
| 50 | init | ||
| 51 | FINALLY | ||
| 52 | done | ||
| 53 | END Indent. | ||
diff --git a/test/indent/octave.m b/test/indent/octave.m index dc6f8448152..768f3d85e01 100644 --- a/test/indent/octave.m +++ b/test/indent/octave.m | |||
| @@ -17,15 +17,21 @@ function res = tcomp (fn) | |||
| 17 | cnty = repmat(x(:,1)(:), 10, 1); | 17 | cnty = repmat(x(:,1)(:), 10, 1); |
| 18 | 18 | ||
| 19 | pop = x(:,1:10)(:); | 19 | pop = x(:,1:10)(:); |
| 20 | bir = x(:,11:20)(:); | 20 | ## Here and below, we test if the indentation aligns with a previous |
| 21 | dth = x(:,21:30)(:); | 21 | ## fixindented line. This is important so as to make it easier for the |
| 22 | imig = x(:,31:40)(:); | 22 | ## user to verride some indentation somewhere, and also because it |
| 23 | dmig = x(:,41:50)(:); | 23 | ## reflects the fact that the indentation decision is taken with a minimum |
| 24 | gq = x(:,51:60)(:); | 24 | ## amount of work (i.e. in the present case, without having to walk back |
| 25 | 25 | ## until the `function' line). | |
| 26 | yrs = repmat(2000:2009, 39, 1)(:); | 26 | bir = x(:,11:20)(:); # fixindent |
| 27 | 27 | dth = x(:,21:30)(:); | |
| 28 | res = [yrs, cnty, pop, bir, dth, imig, dmig, gq]; | 28 | imig = x(:,31:40)(:); |
| 29 | dmig = x(:,41:50)(:); | ||
| 30 | gq = x(:,51:60)(:); | ||
| 31 | |||
| 32 | yrs = repmat(2000:2009, 39, 1)(:); | ||
| 33 | |||
| 34 | res = [yrs, cnty, pop, bir, dth, imig, dmig, gq]; | ||
| 29 | 35 | ||
| 30 | endfunction | 36 | endfunction |
| 31 | 37 | ||