Skip to content

Commit 7eedc16

Browse files
committed
rename
1 parent 2c50ee0 commit 7eedc16

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/StructHelpers.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ function hash_eq_as(obj)
3030
end
3131

3232
"""
33-
hasbatteries(T::Type)::Bool
33+
has_batteries(T::Type)::Bool
3434
3535
Check if `@batteries` or `@enumbatteries` was applied to `T`.
3636
"""
37-
function hasbatteries(::Type)::Bool
37+
function has_batteries(::Type)::Bool
3838
false
3939
end
4040

@@ -242,13 +242,13 @@ macro batteries(T, kw...)
242242
def = :($ST.StructType(::Type{<:$T}) = $ST.Struct())
243243
push!(ret.args, def)
244244
end
245-
push!(ret.args, def_hasbatteries(T))
245+
push!(ret.args, def_has_batteries(T))
246246
return esc(ret)
247247
end
248248

249-
function def_hasbatteries(T)
249+
function def_has_batteries(T)
250250
:(
251-
function ($hasbatteries)(::Type{<:$T})
251+
function ($has_batteries)(::Type{<:$T})
252252
true
253253
end
254254
)
@@ -445,7 +445,7 @@ macro enumbatteries(T, kw...)
445445
def = def_selfconstructor(T)
446446
push!(ret.args, def)
447447
end
448-
push!(ret.args, def_hasbatteries(T))
448+
push!(ret.args, def_has_batteries(T))
449449
return esc(ret)
450450
end
451451

test/runtests.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ struct SNoIsEqual; a; end
5555
@test Skw(1,[]) == Skw(1,[])
5656
@test SNoHash(1,[]) == SNoHash(1,[])
5757
@test SVanilla(1,[]) != SVanilla(1,[])
58-
@test SH.hasbatteries(SBatteries)
59-
@test !SH.hasbatteries(SVanilla)
60-
@test !SH.hasbatteries(Tuple)
58+
@test SH.has_batteries(SBatteries)
59+
@test !SH.has_batteries(SVanilla)
60+
@test !SH.has_batteries(Tuple)
6161

6262
@test isequal(SBatteries(NaN, 1), SBatteries(NaN, 1))
6363
@test !isequal(SBatteries(1, 1), SBatteries(NaN, 1))
@@ -129,8 +129,8 @@ end
129129
@enumbatteries Shape symbol_conversion =true
130130

131131
@testset "@enumbatteries" begin
132-
@test SH.hasbatteries(Color)
133-
@test !SH.hasbatteries(EnumNoBatteries)
132+
@test SH.has_batteries(Color)
133+
@test !SH.has_batteries(EnumNoBatteries)
134134
@test Red === @inferred Color("Red")
135135
@test Red === @inferred convert(Color, "Red")
136136
@test "Red" === @inferred String(Red)

0 commit comments

Comments
 (0)