Sha256: 876e4f38baa5f82a8eae97373830fb0dad73484c9989a671d6a5ec0b31dba2fe

Contents?: true

Size: 669 Bytes

Versions: 8

Compression:

Stored size: 669 Bytes

Contents

# -*- coding: utf-8 -*-

require 'minitest/autorun'
require 'kramdown/utils/string_scanner'

describe Kramdown::Utils::StringScanner do

  [
    ["...........X............", [/X/], 1],
    ["1\n2\n3\n4\n5\n6X", [/X/], 6],
    ["1\n2\n3\n4\n5\n6X\n7\n8X", [/X/,/X/], 8],
    [(".\n" * 1000) + 'X', [/X/], 1001]
  ].each_with_index do |test_data, i|
    test_string, scan_regexes, expect = test_data
    it "computes the correct current_line_number for example ##{i+1}" do
      str_sc = Kramdown::Utils::StringScanner.new(test_string)
      scan_regexes.each { |scan_re| str_sc.scan_until(scan_re) }
      str_sc.current_line_number.must_equal expect
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kramdown-1.5.0 test/test_string_scanner_kramdown.rb
kramdown-1.4.2 test/test_string_scanner_kramdown.rb
kramdown-1.4.1 test/test_string_scanner_kramdown.rb
kramdown-1.4.0 test/test_string_scanner_kramdown.rb
kramdown-1.3.3 test/test_string_scanner_kramdown.rb
kramdown-1.3.2 test/test_string_scanner_kramdown.rb
kramdown-1.3.1 test/test_string_scanner_kramdown.rb
kramdown-1.3.0 test/test_string_scanner_kramdown.rb