diff --git a/samples/sample_copy_path_flat.jl b/samples/sample_copy_path_flat.jl index f053cf8..a95769b 100644 --- a/samples/sample_copy_path_flat.jl +++ b/samples/sample_copy_path_flat.jl @@ -40,7 +40,7 @@ for x in opath end s1 = repr(x.points) move_to(cr,10.0,16.0+(14.0*l)) - l += 1 + global l += 1 show_text(cr,s0*s1) end @@ -59,7 +59,7 @@ for x in fpath end s1 = repr(x.points) move_to(cr,10.0,50.0+(14.0*l)) - l += 1 + global l += 1 show_text(cr,s0*s1) end diff --git a/samples/sample_script0.jl b/samples/sample_script0.jl index 079c663..4993be1 100644 --- a/samples/sample_script0.jl +++ b/samples/sample_script0.jl @@ -48,7 +48,7 @@ t1 = 24.0 for x in r1 move_to(cr,0.0,t1) show_text(cr,x) - t1 += 12.0 + global t1 += 12.0 end diff --git a/test/runtests.jl b/test/runtests.jl index 6fa4cc0..51f6039 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -78,8 +78,11 @@ end end @testset "sample: $test_file_name" for test_file_name in samples_files - mod = Module(Symbol(test_file_name)) + # Run each sample script in a separate module to avoid pollution + s = Symbol(test_file_name) + mod = @eval(Main, module $s end) @eval mod include($(joinpath(samples_dir_path, test_file_name))) + output_png_name = replace(test_file_name,".jl",".png") @test isfile(output_png_name) rm(output_png_name)