File: expression.at

package info (click to toggle)
open-cobol 1.1-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 6,256 kB
  • ctags: 7,627
  • sloc: ansic: 36,307; sh: 34,639; yacc: 5,763; lex: 1,712; cobol: 480; perl: 215; makefile: 200
file content (71 lines) | stat: -rw-r--r-- 2,169 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
### OpenCOBOL Test Suite				-*- m4 -*-

## Copyright (C) 2004-2009 Keisuke Nishida
## Copyright (C) 2007-2009 Roger While
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this software; see the file COPYING.  If not, write to
## the Free Software Foundation, 51 Franklin Street, Fifth Floor
## Boston, MA 02110-1301 USA

AT_SETUP([Ambiguous AND/OR])

AT_DATA([prog.cob], [
       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      prog.
       PROCEDURE        DIVISION.
           IF 3 = 1 AND 2 OR 3
               DISPLAY "OK"
               END-DISPLAY
           END-IF.
           IF 3 = 1 OR 2 AND 3
               DISPLAY "NO"
               END-DISPLAY
           END-IF.
           STOP RUN.
])

AT_CHECK([${COMPILE_ONLY} prog.cob], [0], ,
[prog.cob:6: Warning: Suggest parentheses around AND within OR
prog.cob:10: Warning: Suggest parentheses around AND within OR
])

AT_CLEANUP

AT_SETUP([START on SEQUENTIAL file])

AT_DATA([prog.cob], [
       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      prog.
       ENVIRONMENT      DIVISION.
       INPUT-OUTPUT     SECTION.
       FILE-CONTROL.
       SELECT TEST-FILE ASSIGN       "./TEST-FILE"
                        ORGANIZATION IS LINE SEQUENTIAL.
       DATA             DIVISION.
       FILE             SECTION.
       FD TEST-FILE.
       01 TEST-REC      PIC X(4).
       PROCEDURE        DIVISION.
           OPEN  INPUT TEST-FILE.
           START TEST-FILE KEY EQUAL TEST-REC
           END-START.
           CLOSE TEST-FILE.
           STOP RUN.
])

AT_CHECK([${COMPILE_ONLY} prog.cob], [1], ,
[prog.cob:16: Error: START not allowed on SEQUENTIAL files
])

AT_CLEANUP