loki.tests.test_source_identity

Test identity of source-to-source translation.

The tests in here do rarely verify correct representation internally, they mostly check whether at the end comes out what went in at the beginning.

Functions

test_multiline_pragma(frontend)

Test that multi-line pragmas are combined correctly.

test_raw_source_conditional(tmp_path, frontend)

Verify that the raw_source property is correctly used to annotate AST nodes with source strings for conditionals.

test_raw_source_loop(tmp_path, frontend)

Verify that the raw_source property is correctly used to annotate AST nodes with source strings for loops.

test_raw_source_multicond(tmp_path, frontend)

Verify that the raw_source property is correctly used to annotate AST nodes with source strings for multi conditionals.

test_subroutine_conservative(frontend)

Test that conservative output of fgen reproduces the original source string for a simple subroutine.

test_subroutine_simple_fgen(frontend)

Test that non-conservative output produces the original source string for a simple subroutine.

test_raw_source_loop(tmp_path, frontend)

Verify that the raw_source property is correctly used to annotate AST nodes with source strings for loops.

test_raw_source_conditional(tmp_path, frontend)

Verify that the raw_source property is correctly used to annotate AST nodes with source strings for conditionals.

test_raw_source_multicond(tmp_path, frontend)

Verify that the raw_source property is correctly used to annotate AST nodes with source strings for multi conditionals.

test_subroutine_conservative(frontend)

Test that conservative output of fgen reproduces the original source string for a simple subroutine. This has a few limitations, in particular with respect to the signature of the subroutine.

test_subroutine_simple_fgen(frontend)

Test that non-conservative output produces the original source string for a simple subroutine. This has a few limitations, in particular for formatting of expressions.

test_multiline_pragma(frontend)

Test that multi-line pragmas are combined correctly.