1! Checks that the module file:
2!   * is _saved_
3!   * is saved in the _directory specified by the user_
4! We use `-fsyntax-only` as it stops after the semantic checks (the module file is generated when sema checks are run)
5
6!--------------------------
7! -module-dir
8!--------------------------
9! RUN: rm -rf %t && mkdir -p %t/dir-flang
10! RUN: cd %t && %flang -fsyntax-only -module-dir %t/dir-flang %s
11! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
12
13!---------------------------
14! -J <dir> (i.e. with space)
15!---------------------------
16! RUN: rm -rf %t && mkdir -p %t/dir-flang
17! RUN: cd %t && %flang -fsyntax-only -J %t/dir-flang %s
18! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
19
20!------------------------------
21! -J<dir> (i.e. without space)
22!------------------------------
23! RUN: rm -rf %t && mkdir -p %t/dir-flang
24! RUN: cd %t && %flang -fsyntax-only -J%t/dir-flang %s
25! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
26
27module testmodule
28  type::t2
29  end type
30end
31