@@ -20,9 +20,9 @@ subroutine test_24(error_cnt)
20
20
integer ,intent (out ) :: error_cnt
21
21
22
22
type (json_value),pointer :: p
23
- type (json_value),pointer :: tmp
24
23
type (json_core) :: json
25
24
logical (lk) :: found
25
+ logical (lk) :: was_created
26
26
logical (lk) :: is_valid
27
27
character (kind= CK,len= :),allocatable :: error_msg
28
28
@@ -55,7 +55,23 @@ subroutine test_24(error_cnt)
55
55
call json% add_by_path(p,' a.aa.aaaa(3)' , 4.0_rk , found)
56
56
call json% add_by_path(p,' a.array(1)' , 5 , found)
57
57
call json% add_by_path(p,' a.array(2).scalar' , ' 6' , found)
58
- call json% add_by_path(p,' a.array(2).logical' , .true. , found)
58
+ call json% add_by_path(p,' a.array(2).logical' , .true. , found, was_created)
59
+
60
+ if (.not. was_created) then
61
+ write (error_unit,' (A)' ) ' Error: variable should have been created.'
62
+ error_cnt = error_cnt + 1
63
+ end if
64
+
65
+ ! now for variables that are already present:
66
+ call json% add_by_path(p,' a.aa.aaaa(3)' , 40.0_rk , found)
67
+ call json% add_by_path(p,' a.array(1)' , 50 , found)
68
+ call json% add_by_path(p,' a.array(2).scalar' , ' 60' , found)
69
+ call json% add_by_path(p,' a.array(2).logical' , .false. , found, was_created)
70
+
71
+ if (was_created) then
72
+ write (error_unit,' (A)' ) ' Error: variable should already have been present.'
73
+ error_cnt = error_cnt + 1
74
+ end if
59
75
60
76
write (error_unit,' (A)' ) ' validating...'
61
77
call json% validate(p,is_valid,error_msg)
0 commit comments