From cafffc2774e0093f6b70a89c15359384952f0261 Mon Sep 17 00:00:00 2001 From: Nick Wogan Date: Mon, 8 Aug 2022 23:26:11 -0700 Subject: [PATCH] added more tests --- tests/test3.yaml | 1 + tests/test_roundtrip.py | 1 + tests/test_yaml.f90 | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/test3.yaml diff --git a/tests/test3.yaml b/tests/test3.yaml new file mode 100644 index 0000000..c2261aa --- /dev/null +++ b/tests/test3.yaml @@ -0,0 +1 @@ +pi: asdf d: \ No newline at end of file diff --git a/tests/test_roundtrip.py b/tests/test_roundtrip.py index 1ecb507..568ccfc 100644 --- a/tests/test_roundtrip.py +++ b/tests/test_roundtrip.py @@ -16,6 +16,7 @@ def test_roundtrip(): fil.close() assert test2 == test2_copy + print("test_roundtrip passed!") if __name__ == "__main__": test_roundtrip() \ No newline at end of file diff --git a/tests/test_yaml.f90 b/tests/test_yaml.f90 index ada2f62..6e700eb 100644 --- a/tests/test_yaml.f90 +++ b/tests/test_yaml.f90 @@ -5,6 +5,8 @@ program test_yaml implicit none call test1() call test2() + call test3() + call test4() contains subroutine test1() type(YamlFile) :: file @@ -33,6 +35,30 @@ subroutine test2() call file%dump(unit=2, indent=0) close(2) end subroutine + + subroutine test3() + type(YamlFile) :: file + character(:), allocatable :: err + + call file%parse("../tests/test3.yaml", err) + if (.not.allocated(err)) then + stop 1 + endif + print*,err + + end subroutine + + subroutine test4() + type(YamlFile) :: file + character(:), allocatable :: err + + call file%parse("../tests/not_a_file.yaml", err) + if (.not.allocated(err)) then + stop 1 + endif + print*,err + + end subroutine end program