diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-05-05 23:58:09 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-05 23:58:09 -0600 |
| commit | 3872c5aa3453b899d8439e6bcbaebf6fc867b4a1 (patch) | |
| tree | 1c7cb5823f6e5b58e1d3e96dc8c55212246e0aa2 /test/reader_test.rb | |
| parent | 78f8e4378cba62357962bc28daed3be2c5f2e611 (diff) | |
resolves #4048 include all lines outside specified tagged region when tag filter is a single negated tag (PR #4049)
Diffstat (limited to 'test/reader_test.rb')
| -rw-r--r-- | test/reader_test.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/reader_test.rb b/test/reader_test.rb index b1ac2033..985a3361 100644 --- a/test/reader_test.rb +++ b/test/reader_test.rb @@ -1246,6 +1246,41 @@ class ReaderTest < Minitest::Test assert_includes output, expected end + test 'include directive takes all lines except negated tags when value only contains negated tag' do + input = <<~'EOS' + ---- + include::fixtures/tagged-class.rb[tags=!bark] + ---- + EOS + + output = convert_string_to_embedded input, safe: :safe, base_dir: DIRNAME + # NOTE cannot use single-quoted heredoc because of https://github.com/jruby/jruby/issues/4260 + expected = <<~EOS.chop + class Dog + def initialize breed + @breed = breed + end + end + EOS + assert_includes output, expected + end + + test 'include directive takes all lines except negated tags when value only contains negated tags' do + input = <<~'EOS' + ---- + include::fixtures/tagged-class.rb[tags=!bark;!init] + ---- + EOS + + output = convert_string_to_embedded input, safe: :safe, base_dir: DIRNAME + # NOTE cannot use single-quoted heredoc because of https://github.com/jruby/jruby/issues/4260 + expected = <<~EOS.chop + class Dog + end + EOS + assert_includes output, expected + end + test 'should recognize tag wildcard if not at head of list' do input = <<~'EOS' ---- |
