@@ -150,6 +150,8 @@ subroutine memory_leak_test()
150
150
write (* ,* ) ' MEMORY LEAK TEST'
151
151
write (* ,* ) ' ================================='
152
152
write (* ,* ) ' '
153
+
154
+ i = 0
153
155
154
156
do
155
157
@@ -169,7 +171,10 @@ subroutine test_4()
169
171
! **************************************************************
170
172
!
171
173
! Populate a JSON structure, write it to a file,
172
- ! then read it.
174
+ ! then read it.
175
+ !
176
+ ! Also tests the json_value_to_string routine to write
177
+ ! the file to a character string.
173
178
!
174
179
! **************************************************************
175
180
implicit none
@@ -180,6 +185,7 @@ subroutine test_4()
180
185
integer :: i
181
186
character (len= 10 ) :: istr
182
187
integer :: iunit
188
+ character (len= :),allocatable :: string
183
189
184
190
write (* ,* ) ' '
185
191
write (* ,* ) ' ================================='
@@ -205,13 +211,21 @@ subroutine test_4()
205
211
nullify(inp)
206
212
207
213
write (* ,* ) ' '
208
- write (* ,* ) ' write file'
214
+ write (* ,* ) ' write to file'
209
215
210
216
! write the file:
211
217
open (newunit= iunit, file= dir// filename4, status= ' REPLACE' )
212
218
call json_print(p,iunit)
213
219
close (iunit)
214
220
221
+ write (* ,* ) ' '
222
+ write (* ,* ) ' write to string'
223
+ write (* ,* ) ' '
224
+ ! write it to a string, and print to console:
225
+ call json_print_to_string(p, string)
226
+ write (* ,* ) string
227
+ deallocate (string) ! cleanup
228
+
215
229
! cleanup:
216
230
call json_destroy(p)
217
231
0 commit comments