Skip to content

Commit 7b54176

Browse files
committed
improve coverage
1 parent 2ddd1cc commit 7b54176

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/structbond/macro.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function replace_single_underscore(ex::Expr, newval::Symbol)
2020
end
2121

2222
# This will take an expression and check if it contains single underscores identifiers. If it does, it assumes it has to translate this into an anonymous function with a single argument that will go in place of the underscore
23-
make_function(x) = x
23+
make_function(x) = return x
2424
function make_function(ex::Expr)
2525
Meta.isexpr(ex, :(->)) && return ex
2626
newsym = gensym()
@@ -33,7 +33,7 @@ function make_function(ex::Expr)
3333
end
3434

3535
# This function will try parsing the fieldbond expression to eventually deal with `@tv`
36-
process_fieldbond_expression(x) = x
36+
process_fieldbond_expression(x) = return x
3737
function process_fieldbond_expression(ex::Expr)
3838
Meta.isexpr(ex, :macrocall) || return ex
3939
args = filter(x -> !(x isa LineNumberNode), ex.args)

test/structbond.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using PlutoExtras
33
using Markdown
44
using PlutoExtras.StructBondModule
5-
using PlutoExtras.StructBondModule: structbondtype, popoutwrap, fieldbond, NotDefined, typeasfield, collect_reinterpret!
5+
using PlutoExtras.StructBondModule: structbondtype, popoutwrap, fieldbond,NotDefined, typeasfield, collect_reinterpret!
66
import PlutoExtras.AbstractPlutoDingetjes.Bonds
77
using Test
88

@@ -128,4 +128,11 @@ end
128128
@test eval_in_nb(sn, :alt) == 150
129129
@test eval_in_nb(sn, :freq) == 2e10
130130
SessionActions.shutdown(ss, nb)
131+
end
132+
133+
@testitem "StructBondModule misc coverage" begin
134+
ex = :(f(x))
135+
@test StructBondModule.make_function(ex) == ex
136+
137+
@test StructBondModule.process_fieldbond_expression(:a) == :a
131138
end

0 commit comments

Comments
 (0)