File: matchers.rb

package info (click to toggle)
ruby-byebug 11.1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,252 kB
  • sloc: ruby: 8,835; ansic: 1,662; sh: 6; makefile: 4
file content (32 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require "support/assertions"

module Byebug
  #
  # Some custom matches for byebug's output
  #
  module TestMatchers
    def check_output_includes(*args)
      check_stream(:assert_includes_in_order, interface.output, *args)
    end

    def check_error_includes(*args)
      check_stream(:assert_includes_in_order, interface.error, *args)
    end

    def check_output_doesnt_include(*args)
      check_stream(:refute_includes_in_order, interface.output, *args)
    end

    def check_error_doesnt_include(*args)
      check_stream(:refute_includes_in_order, interface.error, *args)
    end

    private

    def check_stream(check_method, stream, *args)
      send(check_method, Array(args), stream.map(&:strip))
    end
  end
end