Class: Sqlite::DatasetTestParser

Inherits:
Object
  • Object
show all
Includes:
CommonTestParser
Defined in:
lib/parsers/dataset_test_parser.rb

Direct Known Subclasses

FinalDatasetTestParser

Constant Summary

Constants included from CommonTestParser

CommonTestParser::COMMENT

Instance Attribute Summary

Attributes included from CommonTestParser

#final, #result

Instance Method Summary collapse

Constructor Details

#initialize(test) ⇒ DatasetTestParser

Returns a new instance of DatasetTestParser.



6
7
8
9
# File 'lib/parsers/dataset_test_parser.rb', line 6

def initialize(test)
  @test = test
  @result = parse test
end

Instance Method Details

#choose(_solution) ⇒ Object



29
30
31
# File 'lib/parsers/dataset_test_parser.rb', line 29

def choose(_solution)
  @solutions
end

#parse(test) ⇒ Object

test =

type: dataset,
seed: INSERT INTO ...,
expected: |
  id|field
  1|row 1
  ...

return

seed: INSERT INTO ...,
expected: -- NONE



24
25
26
27
# File 'lib/parsers/dataset_test_parser.rb', line 24

def parse(test)
  @solutions = test[:expected].to_s.split("\n").map(&:strip).join("\n")
  final_parse test, {expected: '-- NONE'}
end