class Steep::Expectations::TestResult
def each_diagnostics
def each_diagnostics if block_given? expected_set = Set.new(expectation) #: Set[Diagnostic] actual_set = Set.new(actual) #: Set[Diagnostic] (expected_set + actual_set).sort_by(&:sort_key).each do |diagnostic| case when expected_set.include?(diagnostic) && actual_set.include?(diagnostic) yield [:expected, diagnostic] when expected_set.include?(diagnostic) yield [:missing, diagnostic] when actual_set.include?(diagnostic) yield [:unexpected, diagnostic] end end else enum_for :each_diagnostics end end
def empty?
def empty? actual.empty? end
def expected_diagnostics
def expected_diagnostics each_diagnostics.select {|type, _| type == :expected }.map {|_, diag| diag } end
def initialize(path:, expectation:, actual:)
def initialize(path:, expectation:, actual:) @path = path @expectation = expectation @actual = actual end
def missing_diagnostics
def missing_diagnostics each_diagnostics.select {|type, _| type == :missing }.map {|_, diag| diag } end
def satisfied?
def satisfied? unexpected_diagnostics.empty? && missing_diagnostics.empty? end
def unexpected_diagnostics
def unexpected_diagnostics each_diagnostics.select {|type, _| type == :unexpected }.map {|_, diag| diag } end