Skip to content

Commit ba3a7e6

Browse files
authored
Fix and test split_kwargs. (#290)
1 parent bf93f58 commit ba3a7e6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/execution.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function split_kwargs(kwargs, kw_groups...)
1717
isa(key, Symbol) || throw(ArgumentError("non-symbolic keyword '$key'"))
1818

1919
# find a matching group
20-
group = length(kw_groups)
20+
group = length(kwarg_groups)
2121
for (i, kws) in enumerate(kw_groups)
2222
if key in kws
2323
group = i

test/util.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## test helpers
2+
13
# @test_throw, with additional testing for the exception message
24
macro test_throws_message(f, typ, ex...)
35
quote
@@ -46,3 +48,15 @@ end
4648

4749
struct TestCompilerParams <: AbstractCompilerParams end
4850
GPUCompiler.runtime_module(::CompilerJob{<:Any,TestCompilerParams}) = TestRuntime
51+
52+
53+
## tests of auxiliary functionality
54+
55+
@testset "split_kwargs" begin
56+
kwargs = [:(a=1), :(b=2), :(c=3), :(d=4)]
57+
groups = GPUCompiler.split_kwargs(kwargs, [:a], [:b, :c])
58+
@test length(groups) == 3
59+
@test groups[1] == [:(a=1)]
60+
@test groups[2] == [:(b=2), :(c=3)]
61+
@test groups[3] == [:(d=4)]
62+
end

0 commit comments

Comments
 (0)