diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-02-03 23:53:04 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-02-04 01:03:15 -0700 |
| commit | b58b6bcfc599712472dd3ce74c6128da9d3bdb11 (patch) | |
| tree | 95ade4f0917aca7dc20bd06259f5af61cd0df5f5 /test/reader_test.rb | |
| parent | b84c85d8060b88afdab65ffc9aa06bba9730a1ec (diff) | |
add additional tests for include tags
Diffstat (limited to 'test/reader_test.rb')
| -rw-r--r-- | test/reader_test.rb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/test/reader_test.rb b/test/reader_test.rb index 667fcd8e..f6ba8cfe 100644 --- a/test/reader_test.rb +++ b/test/reader_test.rb @@ -1289,7 +1289,7 @@ class ReaderTest < Minitest::Test assert_includes output, expected end - test 'include directive skips lines all tagged lines when value of tags attribute is negated wildcard' do + test 'include directive skips lines all tagged regions when value of tags attribute is negated wildcard' do input = <<~'EOS' ---- include::fixtures/tagged-class.rb[tags=!*] @@ -1301,6 +1301,39 @@ class ReaderTest < Minitest::Test assert_includes output, expected end + test 'include directive skips lines all tagged regions except ones enabled when value of tags attribute is negated wildcard' do + input = <<~'EOS' + ---- + include::fixtures/tagged-class.rb[tags=!*;init] + ---- + EOS + + output = convert_string_to_embedded input, safe: :safe, base_dir: DIRNAME + expected = <<~'EOS'.chomp + class Dog + def initialize breed + @breed = breed + end + end + EOS + assert_includes output, expected + end + + test 'include directive does not include tag that has been included then excluded' do + input = <<~'EOS' + ---- + include::fixtures/tagged-class.rb[tags=!*;init;!init] + ---- + EOS + + output = convert_string_to_embedded input, safe: :safe, base_dir: DIRNAME + expected = <<~'EOS'.chomp + class Dog + end + EOS + assert_includes output, expected + end + test 'include directive selects specified tagged lines and ignores the other tag directives' do input = <<~'EOS' [indent=0] |
