Permalink
Browse files

test quoting with blockquotes

  • Loading branch information...
1 parent 8c42d02 commit 7a93c55d124d66eed3645601f93571af9175d0ba @ruz ruz committed Jan 9, 2011
Showing with 69 additions and 0 deletions.
  1. +1 −0 MANIFEST
  2. +68 −0 t/blockquote.t
View
1 MANIFEST
@@ -13,5 +13,6 @@ Makefile.PL
MANIFEST This list of files
META.yml
README
+t/blockquote.t
t/blocks.t
t/lines.t
View
68 t/blockquote.t
@@ -0,0 +1,68 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+use HTML::Quoted;
+use Data::Dumper;
+
+sub check {
+ my ($html, $expected) = @_;
+ my $res = HTML::Quoted->extract($html);
+ is_deeply( $res, $expected, 'correct parsing')
+ or diag Dumper($res);
+}
+
+{
+ my $text = q{Hi,<div><br><div>On date X wrote:<br><blockquote>Hello,<div>How are you?</div></blockquote><div>I&#39;m fine.</div><blockquote><div>Where have you been?</div></blockquote><div>Around.</div></div></div>};
+
+ my $res = [
+ {
+ 'raw' => 'Hi,'
+ },
+ {
+ 'block' => 1,
+ 'raw' => '<div><br><div>On date X wrote:<br>'
+ },
+ [
+ {
+ 'quote' => 1,
+ 'block' => 1,
+ 'raw' => '<blockquote>'
+ },
+ {
+ 'raw' => 'Hello,'
+ },
+ {
+ 'block' => 1,
+ 'raw' => '<div>How are you?</div>'
+ },
+ {
+ 'raw' => '</blockquote>'
+ }
+ ],
+ {
+ 'block' => 1,
+ 'raw' => '<div>I&#39;m fine.</div>'
+ },
+ [
+ {
+ 'quote' => 1,
+ 'block' => 1,
+ 'raw' => '<blockquote>'
+ },
+ {
+ 'block' => 1,
+ 'raw' => '<div>Where have you been?</div>'
+ },
+ {
+ 'raw' => '</blockquote>'
+ }
+ ],
+ {
+ 'block' => 1,
+ 'raw' => '<div>Around.</div></div></div>'
+ }
+ ];
+
+ check( $text, $res );
+}

0 comments on commit 7a93c55

Please sign in to comment.