#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 4;
use MarkdownParser;
my $parser = MarkdownParser->new();
my $input = <<'EOF';
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
EOF
my $expected = <<'EOF';
| Header 1 |
Header 2 |
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
EOF
is( $parser->parse($input), $expected, "Basic table" );
$input = <<'EOF';
| Name | Age |
|------|-----|
| John | 25 |
| Jane | 30 |
EOF
$expected = <<'EOF';
EOF
is( $parser->parse($input), $expected, "Table with different content" );
$input = <<'EOF';
# Title
| Col1 | Col2 |
|------|------|
| Data | Info |
More text.
EOF
$expected = <<'EOF';
Title
More text.
EOF
is( $parser->parse($input), $expected, "Table with surrounding content" );
$input = <<'EOF';
| **Bold** | *Italic* | [Link](url) |
|----------|----------|-------------|
| Text | More | Info |
EOF
$expected = <<'EOF';
| Bold |
Italic |
Link |
| Text |
More |
Info |
EOF
is( $parser->parse($input), $expected, "Table with inline formatting" );