Skip to content

Commit

Permalink
catch case with only linenumbernode (#53)
Browse files Browse the repository at this point in the history
* catch case with only linenumbernode

* don't use only

* don't run that test on 1.0

* rewrite because of patch versions
  • Loading branch information
jkrumbiegel authored Feb 21, 2024
1 parent 72a1993 commit f9fae78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Chain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ end

function rewrite_chain_block(block)
block_expressions = block.args
isempty(block_expressions) && error("No expressions found in chain block.")
isempty(block_expressions) ||
(length(block_expressions) == 1 && block_expressions[] isa LineNumberNode) &&
error("No expressions found in chain block.")

reconvert_docstrings!(block_expressions)

Expand Down
10 changes: 6 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,12 @@ end

@testset "invalid single arg versions" begin
# empty
@test_throws LoadError eval(quote
@chain begin
end
end)
if !(VERSION < v"1.1") # weird interaction with test macros in 1.0
@test_throws LoadError eval(quote
@chain begin
end
end)
end

# rvalue _ errors
@test_throws ErrorException eval(quote
Expand Down

0 comments on commit f9fae78

Please sign in to comment.