Skip to content

Commit b6d8251

Browse files
authored
Fix produce_and_load bug (#310)
* Fix produce_and_load bug * Bump patch
1 parent 669be88 commit b6d8251

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DrWatson"
22
uuid = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1"
33
repo = "https://github.com/JuliaDynamics/DrWatson.jl.git"
4-
version = "2.7.5"
4+
version = "2.7.6"
55

66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

src/saving_files.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ macro produce_or_load(f, path, config, args...)
113113
kws = ((;kwargs...)->Dict(kwargs...))($(esc.(convert_to_kw.(args))...))
114114
gitpath = get(kws, :gitpath, projectdir())
115115
# Include the script tag with checking for the type of dict keys, etc.
116-
scripttag!(data, $s; gitpath = gitpath)
116+
data = scripttag!(data, $s; gitpath = gitpath)
117117
data
118118
end
119119
end

test/savefiles_tests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ using DataFrames
234234
@test !isfile(spath)
235235
end
236236

237+
# Regression test for https://github.com/JuliaDynamics/DrWatson.jl/issues/309
238+
@testset "@produce_or_load with value-type widening" begin
239+
d, spath = @produce_or_load("", Dict("a" => 5.0)) do config
240+
return Dict("field" => config)
241+
end
242+
@test haskey(d, "script")
243+
rm(spath)
244+
end
245+
237246
################################################################################
238247
# Backup files before saving #
239248
################################################################################

0 commit comments

Comments
 (0)