Skip to content

Commit c0238d1

Browse files
committed
add sema test of getcwd
1 parent c51519b commit c0238d1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

flang/test/Semantics/getcwd.f90

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2+
! Tests for the GETCWD intrinsics
3+
4+
subroutine bad_kind_error(cwd, status)
5+
CHARACTER(len=255) :: cwd
6+
INTEGER(2) :: status
7+
!ERROR: Actual argument for 'status=' has bad type or kind 'INTEGER(2)'
8+
call getcwd(cwd, status)
9+
end subroutine bad_kind_error
10+
11+
subroutine bad_args_error()
12+
!ERROR: missing mandatory 'c=' argument
13+
call getcwd()
14+
end subroutine bad_args_error
15+
16+
subroutine bad_apply_form(cwd)
17+
CHARACTER(len=255) :: cwd
18+
INTEGER :: status
19+
!Declaration of 'getcwd'
20+
call getcwd(cwd, status)
21+
!ERROR: Cannot call subroutine 'getcwd' like a function
22+
status = getcwd(cwd)
23+
end subroutine bad_apply_form
24+
25+
subroutine good_subroutine(cwd, status)
26+
CHARACTER(len=255) :: cwd
27+
INTEGER :: status
28+
call getcwd(cwd, status)
29+
end subroutine good_subroutine
30+
31+
subroutine good_function(cwd, status)
32+
CHARACTER(len=255) :: cwd
33+
INTEGER :: status
34+
status = getcwd(cwd)
35+
end subroutine good_function

0 commit comments

Comments
 (0)