Skip to content

Restructured test Fortran code #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/test/resources",
"${workspaceFolder}/test/fortran",
"--disable-extension=fortran-lang.linter-gfortran",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Changed tests Fortran source code directory structures
([#563](https://github.com/fortran-lang/vscode-fortran-support/pull/563))
- Changed Free and Fixed Form language aliases. `Fortran` is now associated with `FortranFreeForm`
([#536](https://github.com/fortran-lang/vscode-fortran-support/issues/536))

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@
"webpack": "webpack --mode production",
"pretest": "npm run compile-dev && tsc -p tsconfig.test.json",
"test": "node ./out/test/runTest.js",
"test:grammar-free": "vscode-tmgrammar-snap -s source.fortran.free -g ./syntaxes/fortran_free-form.tmLanguage.json \"./test/**/*{.f90,F90}\"",
"test:grammar-fixed": "vscode-tmgrammar-snap -s source.fortran.fixed -g ./syntaxes/fortran_fixed-form.tmLanguage.json \"./test/**/*{.f,F}\"",
"test:grammar-free": "vscode-tmgrammar-snap -s source.fortran.free -g ./syntaxes/fortran_free-form.tmLanguage.json \"./test/fortran/syntax/**/*{.f90,F90}\"",
"test:grammar-fixed": "vscode-tmgrammar-snap -s source.fortran.fixed -g ./syntaxes/fortran_fixed-form.tmLanguage.json \"./test/fortran/syntax/**/*{.f,F}\"",
"test:grammar": "npm run test:grammar-free && npm run test:grammar-fixed",
"test:grammar-update": "npm run test:grammar-free -- -u && npm run test:grammar-fixed -- -u",
"lint": "eslint . --ext .ts,.tsx",
Expand Down
2 changes: 1 addition & 1 deletion test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { FortranDocumentSymbolProvider } from '../src/features/document-symbol-p
// Defines a Mocha test suite to group tests of similar kind together
suite('Extension Tests', () => {
test('symbol provider works as expected', async () => {
const filePath = path.resolve(__dirname, '../../test/resources/sample.f90');
const filePath = path.resolve(__dirname, '../../test/fortran/sample.f90');
const openPath = vscode.Uri.file(filePath);
const doc = await vscode.workspace.openTextDocument(openPath);
vscode.window.showTextDocument(doc);
Expand Down
7 changes: 5 additions & 2 deletions test/formatting-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ suite('Formatting tests', () => {
let doc: vscode.TextDocument;
const fmt = new FortranFormattingProvider(new LoggingService());
const fileUri = vscode.Uri.file(
path.resolve(__dirname, '../../test/resources/formatting_test.f90')
path.resolve(__dirname, '../../test/fortran/format/formatting_test.f90')
);

suiteSetup(async function (): Promise<void> {
Expand Down Expand Up @@ -62,7 +62,10 @@ end program main
test(`Using fprettify with stderr`, async () => {
doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(
path.resolve(__dirname, '../../test/resources/formatting_test_fprettify_long_lines.f90')
path.resolve(
__dirname,
'../../test/fortran/format/formatting_test_fprettify_long_lines.f90'
)
)
);
const edits = await fmt['doFormatFprettify'](doc);
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions test/fortran/lint/err-mod.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module err_mod
private
implicit none
contains
subroutine foo(arg1, arg2)
integer, intent(in) :: arg1, arg2
print*, 'arg1:', arg1, 'arg2:', arg2
end subroutine foo
subroutine proc_with_err()
call foo()
end subroutine proc_with_err
end module err_mod
8 changes: 8 additions & 0 deletions test/fortran/lint/err-warns.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
program main
call say_hello(1,2)
contains
subroutine say_hello(a,b)
integer :: a,b
print *, "Hello, World!"
end subroutine say_hello
end program main
27 changes: 27 additions & 0 deletions test/fortran/lint/test1.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module test
intrinsic :: size
end module test

program test_literals
use iso_c_binding
use test, only: fsize => size

implicit none
integer(c_int) :: ierr
integer :: i, j
integer, allocatable :: a(:,:)
a = reshape([1, 2, 3, 4, 5, 6], [2, 3])
print*, size(a), size(a, 1), size(a, 2)
print*, "loop over array ranks"
do i = 1, size(a, 2)
print*, a(:, i)
end do
print*, "end looping over array ranks"

call foo(a, )
contains
subroutine foo(pair)
integer, dimension(*), intent(in) :: pair
print*, pair(1:6)
end subroutine foo
end program test_literals
File renamed without changes.
4 changes: 4 additions & 0 deletions test/fortran/syntax/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


clean:
rm -f *.o *.out *.mod *.smod
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions test/linter-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ suite('GNU (gfortran) lint preprocessor multiple', () => {
const linter = new FortranLintingProvider();
linter['compiler'] = 'gfortran';
const msg = `
f951: Warning: Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/resources/include' [-Wmissing-include-dirs]
/Code/TypeScript/vscode-fortran-support/test/resources/sample.f90:4:18:
f951: Warning: Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/fortran/include' [-Wmissing-include-dirs]
/Code/TypeScript/vscode-fortran-support/test/fortran/sample.f90:4:18:

4 | call say_hello()
| 1
Expand All @@ -187,12 +187,12 @@ Error: Missing actual argument for argument 'a' at (1)
test('REGEX: match 1 - message <msg2>', () => {
strictEqual(
g1['msg2'],
"Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/resources/include' [-Wmissing-include-dirs]"
"Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/fortran/include' [-Wmissing-include-dirs]"
);
});
const g2 = matches[1].groups;
test('REGEX: match 2 - filename', () => {
strictEqual(g2['fname'], '/Code/TypeScript/vscode-fortran-support/test/resources/sample.f90');
strictEqual(g2['fname'], '/Code/TypeScript/vscode-fortran-support/test/fortran/sample.f90');
});
test('REGEX: match 2 - line number', () => {
strictEqual(g2['ln'], '4');
Expand All @@ -212,7 +212,7 @@ Error: Missing actual argument for argument 'a' at (1)
const ref = [
new Diagnostic(
new Range(new Position(0, 1), new Position(0, 1)),
"Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/resources/include' [-Wmissing-include-dirs]",
"Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/fortran/include' [-Wmissing-include-dirs]",
DiagnosticSeverity.Warning
),
new Diagnostic(
Expand Down
2 changes: 1 addition & 1 deletion test/lsp-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ suite('Language Server integration tests', () => {
let doc: vscode.TextDocument;
const server = new FortlsClient(new LoggingService());
const fileUri = vscode.Uri.file(
path.resolve(__dirname, '../../test/resources/function_subroutine_definitions.f90')
path.resolve(__dirname, '../../test/fortran/function_subroutine_definitions.f90')
);

suiteSetup(async function (): Promise<void> {
Expand Down
64 changes: 0 additions & 64 deletions test/resources/formatting_test.f90.snap

This file was deleted.

21 changes: 0 additions & 21 deletions test/resources/formatting_test_fprettify_long_lines.f90.snap

This file was deleted.

Loading