File: fixtures_test.rb

package info (click to toggle)
ruby3.4 3.4.9-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 152,040 kB
  • sloc: ruby: 1,262,509; ansic: 831,188; yacc: 28,233; pascal: 7,359; sh: 3,910; python: 1,799; cpp: 1,158; makefile: 827; asm: 808; javascript: 414; lisp: 109; perl: 62; awk: 36; xml: 4; sed: 4
file content (37 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download
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
33
34
35
36
37
# frozen_string_literal: true

return if RUBY_VERSION < "3.2.0"

require_relative "test_helper"

module Prism
  class FixturesTest < TestCase
    except = []

    if RUBY_VERSION < "3.3.0"
      # Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace
      # characters in the heredoc start.
      # Example: <<~'   EOF' or <<-'  EOF'
      # https://bugs.ruby-lang.org/issues/19539
      except << "heredocs_leading_whitespace.txt"
      except << "whitequark/ruby_bug_19539.txt"

      # https://bugs.ruby-lang.org/issues/19025
      except << "whitequark/numparam_ruby_bug_19025.txt"
      # https://bugs.ruby-lang.org/issues/18878
      except << "whitequark/ruby_bug_18878.txt"
      # https://bugs.ruby-lang.org/issues/19281
      except << "whitequark/ruby_bug_19281.txt"
    end

    # Leaving these out until they are supported by parse.y.
    except << "leading_logical.txt"
    except << "endless_methods_command_call.txt"
    # https://bugs.ruby-lang.org/issues/21168#note-5
    except << "command_method_call_2.txt"

    Fixture.each(except: except) do |fixture|
      define_method(fixture.test_name) { assert_valid_syntax(fixture.read) }
    end
  end
end