Skip to content

Commit b6571d8

Browse files
committed
attempting to fix platform new line differences causing a unit test to fail.
1 parent 8b74ef2 commit b6571d8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/json_value_module.F90

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8926,6 +8926,15 @@ subroutine annotate_invalid_json(json,iunit,str)
89268926
line = CK_''
89278927
end if
89288928

8929+
! add a newline for the error display if necessary:
8930+
line = trim(line)
8931+
if (len(line)>0) then
8932+
i = len(line)
8933+
if (line(i:i)/=newline) line = line//newline
8934+
else
8935+
line = line//newline
8936+
end if
8937+
89298938
!create the error message:
89308939
if (allocated(json%err_message)) then
89318940
json%err_message = json%err_message//newline
@@ -8935,7 +8944,7 @@ subroutine annotate_invalid_json(json,iunit,str)
89358944
json%err_message = json%err_message//&
89368945
'line: '//trim(adjustl(line_str))//', '//&
89378946
'character: '//trim(adjustl(char_str))//newline//&
8938-
trim(line)//newline//arrow_str
8947+
line//arrow_str
89398948

89408949
if (allocated(line)) deallocate(line)
89418950

src/tests/jf_test_06.F90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,10 @@ subroutine test_6(error_cnt)
6161

6262
if (i==1) then
6363
call json%check_for_errors(status_ok, error_msg=error_msg)
64-
6564
if (error_msg /= &
6665
CK_'Error in parse_array: Unexpected character encountered when parsing array.'//newline//&
6766
CK_'line: 13, character: 1'//newline//&
6867
CK_'}'//newline//&
69-
''//newline//&
7068
'^') then
7169
! verify that the expected error string is present
7270
write(error_unit,'(A)') 'Error: unexpected error message string: "'//error_msg//'"'

0 commit comments

Comments
 (0)