Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/liquid/spec/adapter_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def run_single(spec)
compile_options = { line_numbers: true }
compile_options[:error_mode] = spec.error_mode if spec.error_mode
compile_options[:file_system] = filesystem if filesystem
compile_options[:template_name] = spec.template_name if spec.template_name

@compile_block.call(@ctx, spec.template, compile_options)

Expand Down
4 changes: 4 additions & 0 deletions lib/liquid/spec/cli/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ def prepare_benchmark_spec(spec, _config)
line_numbers: true,
error_mode: :strict,
file_system: filesystem,
template_name: spec.template_name,
}.compact

# Pre-compile to set up ctx[:template]
Expand Down Expand Up @@ -675,6 +676,7 @@ def run_benchmark_spec(spec, _config, duration_seconds)
line_numbers: true,
error_mode: :strict,
file_system: filesystem,
template_name: spec.template_name,
}.compact

LiquidSpec.do_compile(spec.template, compile_options)
Expand Down Expand Up @@ -1061,6 +1063,7 @@ def compare_single_spec(spec, _config)
compile_options = {
line_numbers: true,
error_mode: spec.error_mode&.to_sym || required_opts[:error_mode],
template_name: spec.template_name,
}.compact

assigns = deep_copy(spec.instantiate_environment)
Expand Down Expand Up @@ -1130,6 +1133,7 @@ def run_single_spec(spec, _config)
line_numbers: true,
error_mode: spec.error_mode&.to_sym || required_opts[:error_mode],
file_system: filesystem,
template_name: spec.template_name,
}.compact

begin
Expand Down
4 changes: 3 additions & 1 deletion lib/liquid/spec/lazy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ def initialize(spec_name:, source_file:, line_number:, errors:)
class LazySpec
VALID_ERROR_KEYS = ["parse_error", "render_error", "output"].freeze

attr_reader :name, :template, :expected, :errors, :hint, :doc, :complexity
attr_reader :name, :template, :template_name, :expected, :errors, :hint, :doc, :complexity
attr_reader :error_mode, :render_errors, :required_features
attr_reader :source_file, :line_number
attr_reader :raw_environment, :raw_filesystem, :raw_template_factory

def initialize(
name:,
template:,
template_name: nil,
expected: nil,
errors: {},
hint: nil,
Expand All @@ -53,6 +54,7 @@ def initialize(
)
@name = name
@template = template
@template_name = template_name
@expected = expected
@errors = errors || {}
@hint = hint
Expand Down
3 changes: 2 additions & 1 deletion lib/liquid/spec/spec_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module SpecLoader
VALID_METADATA_KEYS = %w[hint doc required_options render_errors minimum_complexity complexity].freeze
VALID_SPEC_KEYS = %w[
name template expected environment filesystem complexity hint doc
error_mode render_errors required_features errors
error_mode render_errors required_features errors template_name
].freeze

class << self
Expand Down Expand Up @@ -237,6 +237,7 @@ def load_yaml_file(path, suite: nil)
spec = LazySpec.new(
name: spec_data["name"],
template: spec_data["template"],
template_name: spec_data["template_name"],
expected: spec_expected,
errors: spec_data["errors"] || {},
hint: spec_data["hint"],
Expand Down
Loading