### ----------------------------------------------------
### -- Perl6::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Jeffrey Goff <drforr@pobox.com>
### -- File: t/16-quote.t
### ----------------------------------------------------
### -- Chunk 4 of 4
imiter-end, Q{>}, Q{end delimiter};

      done-testing;
    }, Q{no intervening ws};

    done-testing;
  }, Q{adverb :w};

  subtest {
    subtest {
      my $source = Q{q :x <pi>};
      my $tree = $pp.to-tree( $source );
      my $node = $tree.child.[0].child.[0];

      is $pp.to-string( $tree ), $source, Q{formatted};
      isa-ok $node, Perl6::String::Escaping,
             Q{correct type};
      is $node.quote, Q{q}, Q{quote name};
      is $node.delimiter-start, Q{<}, Q{start delimiter};
      is $node.delimiter-end, Q{>}, Q{end delimiter};

      done-testing;
    }, Q{all intervening ws};

    subtest {
      my $source = Q{q :x<pi>};
      my $tree = $pp.to-tree( $source );
      my $node = $tree.child.[0].child.[0];

      is $pp.to-string( $tree ), $source, Q{formatted};
      isa-ok $node, Perl6::String::Escaping,
             Q{correct type};
      is $node.quote, Q{q}, Q{quote name};
      is $node.delimiter-start, Q{<}, Q{start delimiter};
      is $node.delimiter-end, Q{>}, Q{end delimiter};

      done-testing;
    }, Q{leading intervening ws};

    subtest {
      my $source = Q{q:x <pi>};
      my $tree = $pp.to-tree( $source );
      my $node = $tree.child.[0].child.[0];

      is $pp.to-string( $tree ), $source, Q{formatted};
      isa-ok $node, Perl6::String::Escaping,
             Q{correct type};
      is $node.quote, Q{q}, Q{quote name};
      is $node.delimiter-start, Q{<}, Q{start delimiter};
      is $node.delimiter-end, Q{>}, Q{end delimiter};

      done-testing;
    }, Q{trailing intervening ws};

    subtest {
      my $source = Q{q:x<pi>};
      my $tree = $pp.to-tree( $source );
      my $node = $tree.child.[0].child.[0];

      is $pp.to-string( $tree ), $source, Q{formatted};
      isa-ok $node, Perl6::String::Escaping,
             Q{correct type};
      is $node.quote, Q{q}, Q{quote name};
      is $node.delimiter-start, Q{<}, Q{start delimiter};
      is $node.delimiter-end, Q{>}, Q{end delimiter};

      done-testing;
    }, Q{no intervening ws};

    done-testing;
  }, Q{adverb :x};

  subtest {
    my $source = Q{q <pi>};
    my $tree = $pp.to-tree( $source );
    my $node = $tree.child.[0].child.[0];

    is $pp.to-string( $tree ), $source, Q{formatted};
    isa-ok $node, Perl6::String::Escaping,
             Q{correct type};
    is $node.quote, Q{q}, Q{quote name};
    is $node.delimiter-start, Q{<}, Q{start delimiter};
    is $node.delimiter-end, Q{>}, Q{end delimiter};

    done-testing;
  }, Q{intervening ws, no adverbs};

  subtest {
    my $source = Q{q<pi>};
    my $tree = $pp.to-tree( $source );
    my $node = $tree.child.[0].child.[0];

    is $pp.to-string( $tree ), $source, Q{formatted};
    isa-ok $node, Perl6::String::Escaping,
             Q{correct type};
    is $node.quote, Q{q}, Q{quote name};
    is $node.delimiter-start, Q{<}, Q{start delimiter};
    is $node.delimiter-end, Q{>}, Q{end delimiter};

    done-testing;
  }, Q{no ws, no adverbs};

  done-testing;
}, Q{q<>};

subtest {
  my $source = Q{<pi>};
  my $tree = $pp.to-tree( $source );
  my $node = $tree.child.[0].child.[0];

  is $pp.to-string( $tree ), $source, Q{formatted};
  isa-ok $node, Perl6::String::WordQuoting, Q{correct type};
#  is $node.quote, Q{<>}, Q{quote name};
#  is $node.delimiter-start, Q{<}, Q{start delimiter};
#  is $node.delimiter-end, Q{>}, Q{end delimiter};

  done-testing;
}, Q{<>};

subtest {
  my $source = Q{｢pi｣};
  my $tree = $pp.to-tree( $source );
  my $node = $tree.child.[0].child.[0];

  is $pp.to-string( $tree ), $source, Q{formatted};
  isa-ok $node, Perl6::String::Literal, Q{correct type};
#  is $node.quote, Q{｢｣}, Q{quote name};
  is $node.delimiter-start, Q{｢}, Q{start delimiter};
  is $node.delimiter-end, Q{｣}, Q{end delimiter};

  done-testing;
}, Q{｢｣};

subtest {
  my $source = Q{"pi"};
  my $tree = $pp.to-tree( $source );
  my $node = $tree.child.[0].child.[0];

  is $pp.to-string( $tree ), $source, Q{formatted};
  isa-ok $node, Perl6::String::Interpolation, Q{correct type};
#  is $node.quote, Q{""}, Q{quote name};
  is $node.delimiter-start, Q{"}, Q{start delimiter};
  is $node.delimiter-end, Q{"}, Q{end delimiter};

  done-testing;
}, Q{"" (double-quote)};

subtest {
  my $source = Q{'pi'};
  my $tree = $pp.to-tree( $source );
  my $node = $tree.child.[0].child.[0];

  is $pp.to-string( $tree ), $source, Q{formatted};
  isa-ok $node, Perl6::String::Escaping, Q{correct type};
#  is $node.quote, Q{''}, Q{quote name};
  is $node.delimiter-start, Q{'}, Q{start delimiter};
  is $node.delimiter-end, Q{'}, Q{end delimiter};

  done-testing;
}, Q{'' (single-quote)};

subtest {
#`[
  my $source = Q:to[END];
say join " ", .lines given q:to/📝/, qq:to/📝/
Hey,
📝
    dawg {
  [~] q:to/📝/, qq:to/📝/
  I heard you
  📝
      liked heredocs {
    [~] q:to/📝/, qq:to/📝/
    so here's
    📝
        a heredoc {
      [~] q:to/📝/, q:to/📝/
      in a
      📝
          heredoc
          📝
        }
        📝
      }
      📝
    }
    📝
END
  my $tree = $pp.to-tree( $source );
  my $node = $tree.child.[0].child.[0];

  is $pp.to-string( $tree ), $source, Q{formatted};
  isa-ok $node, Perl6::String::Escaping,
         Q{correct type};
#  is $node.quote, Q{qqww}, Q{quote name};
  is $node.delimiter-start, Q{<}, Q{start delimiter};
  is $node.delimiter-end, Q{>}, Q{end delimiter};
]

  done-testing;
}, Q{here-doc torture test};

# vim: ft=perl6


