mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Catch duplicate given blocks with same variable name
This commit is contained in:
parent
5646a6ebd9
commit
cb0ae516ae
1 changed files with 3 additions and 0 deletions
|
@ -110,6 +110,9 @@ module Spectator
|
||||||
macro given(collection, source_file = __FILE__, source_line = __LINE__, &block)
|
macro given(collection, source_file = __FILE__, source_line = __LINE__, &block)
|
||||||
context({{collection}}, {{source_file}}, {{source_line}}, "Given") do
|
context({{collection}}, {{source_file}}, {{source_line}}, "Given") do
|
||||||
{% var_name = block.args.empty? ? "value" : block.args.first %}
|
{% var_name = block.args.empty? ? "value" : block.args.first %}
|
||||||
|
{% if GIVEN_VARIABLES.find { |v| v[0].id == var_name.id } %}
|
||||||
|
{% raise "Duplicate given variable name \"#{var_name.id}\"" %}
|
||||||
|
{% end %}
|
||||||
|
|
||||||
module Locals
|
module Locals
|
||||||
@%wrapper : ValueWrapper?
|
@%wrapper : ValueWrapper?
|
||||||
|
|
Loading…
Reference in a new issue