Class: Ast::Merge::Git::CorpusRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/ast/merge/git/corpus.rb,
sig/ast/merge/git.rbs

Overview

Executes validated corpus cases without changing the source checkout.

Constant Summary collapse

DEFAULT_TIMEOUT =

Returns:

  • (Integer)
30
OUTCOMES =

Returns:

  • (Array[String])
%w[
  correct_clean false_conflict true_conflict false_auto_merge error unsupported excluded_ambiguous
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(corpus:, repository:, driver_path:, tmp_root:, timeout: DEFAULT_TIMEOUT) ⇒ CorpusRunner

Returns a new instance of CorpusRunner.



204
205
206
207
208
209
210
# File 'lib/ast/merge/git/corpus.rb', line 204

def initialize(corpus:, repository:, driver_path:, tmp_root:, timeout: DEFAULT_TIMEOUT)
  @corpus = corpus
  @repository = Pathname(repository).expand_path
  @driver_path = Pathname(driver_path).expand_path
  @tmp_root = Pathname(tmp_root).expand_path
  @timeout = Integer(timeout)
end

Instance Method Details

#run(case_id: nil) ⇒ Array[Hash[Symbol, untyped]]

Parameters:

  • case_id: (String, nil) (defaults to: nil)

Returns:

  • (Array[Hash[Symbol, untyped]])


212
213
214
215
# File 'lib/ast/merge/git/corpus.rb', line 212

def run(case_id: nil)
  verify_environment!
  @corpus.cases(case_id).map { |item| run_case(item) }
end