assertEqual('http://images.google.com/images?num=30&q=larry+bird', BSMarkdown::Parse('http://images.google.com/images?num=30&q=larry+bird')); } public function testSingleEntityEscape() { $this->assertEqual('©', BSMarkdown::Parse('©')); $this->assertEqual('AT&T', BSMarkdown::Parse('AT&T')); $this->assertEqual('

Test

', BSMarkdown::Parse('

Test

')); $this->assertEqual('4 < 5', BSMarkdown::Parse('4 < 5')); } public function testParagraphs() { $this->assertEqual("

Example

\n\n

Of

\n\n

Parsing

", BSMarkdown::Parse("Example\n\nOf\n\nParsing")); $this->assertEqual("

Example

\n\n

Two

", BSMarkdown::Parse("Example\n \nTwo")); $this->assertEqual("

One\nTwo\nThree

\n\n

Four

", BSMarkdown::Parse("One\nTwo\nThree\n\nFour")); } public function testLineBreak() { $this->assertEqual("

This is line break
\nhere

", BSMarkdown::Parse("This is a line break \n")); $this->assertEqual("

Paragraph one
\nline two.

\n\n

Paragraph two.

", BSMarkdown::Parse("Paragraph one \nline two.\n\nParagraph two.")); } public function testSetextHeaders() { $this->assertEqual('

Heading

', BSMarkdown::Parse("Heading\n=")); $this->assertEqual('

Heading

', BSMarkdown::Parse("Heading\n=====")); $this->assertEqual('

Heading

', BSMarkdown::Parse("Heading\n-")); $this->assertEqual('

Heading

', BSMarkdown::Parse("Heading\n----- ")); $this->assertEqual("

Heading\n=3

", BSMarkdown::Parse("Heading\n=3")); } public function testAtxHeaders() { $this->assertEqual('

Heading 1

', BSMarkdown::Parse('# Heading 1')); $this->assertEqual('

Heading 2

', BSMarkdown::Parse('## Heading 2')); $this->assertEqual('

Heading 3

', BSMarkdown::Parse('### Heading 3')); $this->assertEqual('

Heading 4

', BSMarkdown::Parse('#### Heading 4')); $this->assertEqual('

Heading 5
', BSMarkdown::Parse('##### Heading 5')); $this->assertEqual('
Heading 6
', BSMarkdown::Parse('###### Heading 6')); $this->assertEqual('
A simple heading
', BSMarkdown::Parse('#####A simple heading')); $this->assertEqual('

Another heading

', BSMarkdown::Parse('## \tAnother heading')); $this->assertEqual('

The # of headings', BSMarkdown::Parse('### The # of headings')); $this->assertEqual('

End test

', BSMarkdown::Parse('#### End test ##')); $this->assertEqual('

End test 2

', BSMarkdown::Parse('#### End test 2####')); $this->assertEqual('

# of #s in #

', BSMarkdown::Parse('# # of #s in # ###')); } public function testBlockquote() { $this->assertEqual("
\n\t

Example of blockquoted text

\n
", BSMarkdown::Parse('> Example of blockquoted text')); $this->assertEqual("
\n\t

Another\n\texample\n\tof

\n\n

blockquoted text \
\there.

\n
", BSMarkdown::Parse("> Another\nexample\nof\n\n>blockquoted text \nhere.")); $this->assertEqual("
\n\t

This is a header.

\n\n\t

Welcome to AT&T.

\n
", BSMarkdown::Parse("> ## This is a header.\n>\n>\nWelcome to AT&T.")); } public function testUnorderedLists() { $this->assertEqual("", BSMarkdown::Parse("* Red\n* Green\n*\tBlue")); $this->assertEqual("", BSMarkdown::Parse("+ Red\n+ Green\n+ Blue")); $this->assertEqual("", BSMarkdown::Parse("- Red\n- Green\n- Blue")); $this->assertEqual("

Test

\n", BSMarkdown::Parse("Test\n\n- Example")); $this->assertEqual("", BSMarkdown::Parse("* Lorem\n ipsum\n dolor\n sit\n amet.\n* Another\nexample.")); } public function testOrderedList() { $this->assertEqual("
    \n
  1. Bird
  2. \n
  3. McHale
  4. \n
  5. Parish
  6. \n
", BSMarkdown::Parse("3. Bird\n1. McHale\n8. Parish")); $this->assertEqual("
    \n
  1. Bird
  2. \n
  3. McHale
  4. \n
  5. Parish
  6. \n
", BSMarkdown::Parse("1. Bird\n2. McHale\n2. Parish")); } public function testParagraphedLists() { $this->assertEqual("
    \n
  1. Item 1

  2. \n
  3. Item 2

  4. \n
", BSMarkdown::Parse("1. Item 1\n\n2. Item 2")); $this->assertEqual("", BSMarkdown::Parse("+ Part one.\n\n\tPart two.\n+Part three.")); $this->assertEqual("", BSMarkdown::Parse("+ Part one.\n\n Part two.\n+Part three.")); $this->assertEqual("", BSMarkdown::Parse("+ Example \nline break.")); $this->assertEqual("
    \n
  1. A list with blockquote:\n\n
    \n\t

    This blockquote\n\tis inside a list.

    \n
  2. \n
", BSMarkdown::Parse("1. A list with blockquote:\n\n > This blockquote\nis inside a list.")); $this->assertEqual("
    \n
  1. A list with blockquote:\n\n
    \n\t

    This blockquote\n\tis inside a list.

    \n
  2. \n
", BSMarkdown::Parse("1. A list with blockquote:\n\n\t> This blockquote\n> is inside a list.")); $this->assertEqual("", BSMarkdown::Parse("+ A list item without a code block: code goes here")); $this->assertEqual("", BSMarkdown::Parse("* A list item without a code block:\t\tcode goes here")); } public function testCodeBlocks() { $this->assertEqual("

This is a normal paragraph:

\n\n
This is a code block.\n
", BSMarkdown::Parse("This is a normal paragraph:\n\n This is a code block.")); $this->assertEqual("

This is a normal paragraph:

\n\n
This is a code block.\n
", BSMarkdown::Parse("This is a normal paragraph:\n\n\tThis is a code block.")); $this->assertEqual("

AppleScript:

\n\n
tell application \"Foo\"\n\tbeep\nend tell\n
", BSMarkdown::Parse("AppleScript:\n\n\ttell application \"Foo\"\n\t\tbeep\n\tend tell")); $this->assertEqual("
<div class="footer">&© 2004 Foo Corporation</div>\n
", BSMarkdown::Parse("
© 2004 Foo Corporation
")); } public function testHorizontalRules() { $this->assertEqual('
', BSMarkdown::Parse('* * *')); $this->assertEqual('
', BSMarkdown::Parse('***')); $this->assertEqual('
', BSMarkdown::Parse('*****')); $this->assertEqual('
', BSMarkdown::Parse('- - -')); $this->assertEqual('
', BSMarkdown::Parse('--------------------')); } public function testSimpleLinks() { $this->assertEqual('

This is an example inline link.

', BSMarkdown::Parse('This is [an example](http://example.com/ "Title") inline link.')); $this->assertEqual('

This link has no title attribute.

', BSMarkdown::Parse('[This link](http://example.net/) has no title attribute.')); $this->assertEqual('

See my About page for details.

', BSMarkdown::Parse('See my [About](/about/) page for details.')); $this->assertEqual('

http://example.com/

', BSMarkdown::Parse('')); $this->assertEqual('

address@example.com

', BSMarkdown::Parse('')); } public function testReferenceLinks() { $this->assertEqual('

This is an example reference-style link.

', BSMarkdown::Parse("This is [an example][id] reference-style link.\n\n[id]: http://example.com/ \"Optional Title Here\"")); $this->assertEqual('

This is an example reference-style link.

', BSMarkdown::Parse("This is [an example] [id] reference-style link.\n[id]: http://example.com/ 'Optional Title Here'")); $this->assertEqual('

This is an example reference-style link.

', BSMarkdown::Parse("This is [an example]\t[id] reference-style link.\n\n\n[id]: http://example.com/ (Optional Title Here)")); $this->assertEqual('

Example link here there.

', BSMarkdown::Parse("Example link [here][id] there.\n[id]: (title)")); $this->assertEqual('

Example link here there.

', BSMarkdown::Parse("Example link [here][id] there.\n[id]: ")); $this->assertEqual('

Welcome to Google.

', BSMarkdown::Parse("Welcome to [Google][].\n[Google]: http://www.google.com")); $this->assertEqual('

Visit Daring Fireball!', BSMarkdown::Parse("Visit [Daring Fireball][]!\n[Daring Fireball]: http://daringfireball.net")); } public function testEmphasis() { $this->assertEqual('

single asterisks

', BSMarkdown::Parse('*single asterisks*')); $this->assertEqual('

single underscores

', BSMarkdown::Parse('_single underscores_')); $this->assertEqual('

double asterisks

', BSMarkdown::Parse('**double asterisks**')); $this->assertEqual('

double underscores

', BSMarkdown::Parse('__double underscores__')); $this->assertEqual('

unfuckingbelievable

', BSMarkdown::Parse('un*fucking*believable')); $this->assertEqual('

un * fucking * believable

', BSMarkdown::Parse('un * fucking * believable')); } public function testCodeSpan() { $this->assertEqual('

Use the printf() function.

', BSMarkdown::Parse('Use the `printf()` function.')); $this->assertEqual('

There is a literal backtick (`) here.

', BSMarkdown::Parse('``There is a literal backtick (`) here.``')); $this->assertEqual('

A single backtick in a code span: `

', BSMarkdown::Parse('A single backtick in a code span: `` ` ``')); $this->assertEqual('

A backtick-delimited string in a code span: `foo`

', BSMarkdown::Parse('A backtick-delimited string in a code span: `` `foo` ``')); $this->assertEqual('

Please do not use any <blink> tags.

', BSMarkdown::Parse('Please do not use any `` tags.')); $this->assertEqual('

&#8212; is the decimal-encoded equivalent of &mdash;.

', BSMarkdown::Parse('`—` is the decimal-encoded equivalent of `—`.')); } public function testImages() { $this->assertEqual('

Alt text

', BSMarkdown::Parse('![Alt text](/path/to/img.jpg)')); $this->assertEqual('

Alt text

', BSMarkdown::Parse('![Alt text](/path/to/img.jpg "Optional title")')); $this->assertEqual('

Alt text

', BSMarkdown::Parse('![Alt text](/path/to/img.jpg \'Optional title\')')); $this->assertEqual('

Alt text

', BSMarkdown::Parse("![Alt text][id]\n[id]: url/to/image \"Optional title attribute\"")); $this->assertEqual('

Alt text

', BSMarkdown::Parse("![Alt text][id]\n[id]: url/to/image\t 'Optional title attribute'")); } public function testEscapeSequences() { $this->assertEqual('

Escaped \ Backslash

', BSMarkdown::Parse('Escaped \\ Backslash')); $this->assertEqual('

`This is not code`

', BSMarkdown::Parse('\`This is not code\`')); $this->assertEqual('

*This is not italics*

', BSMarkdown::Parse('\*This is not italics\*')); $this->assertEqual('

* This is not a list

', BSMarkdown::Parse('\* This is not a list')); $this->assertEqual('

__This is not bold__

', BSMarkdown::Parse('\_\_This is not bold__')); $this->assertEqual('

This [is not](http://www.example.com "Moo") a URL.

', BSMarkdown::Parse('This \[is not](http://www.example.com "Moo") a URL.')); $this->assertEqual('

This [is not](http://www.example.com "Moo") a URL.

', BSMarkdown::Parse('This [is not]\(http://www.example.com "Moo") a URL.')); $this->assertEqual("

This is not a heading\n-

", BSMarkdown::Parse("This is not a heading\n\-")); $this->assertEqual("

1986. What a great season.

", BSMarkdown::Parse('1986\. What a great season.')); $this->assertEqual('

This is not an iamge: !Alt text!

', BSMarkdown::Parse('This is not an iamge: \![Alt text](url/to/image "Optional title attribute")!')); $this->assertEqual('

This is not an iamge: ![Alt text](url/to/image "Optional title attribute")!

', BSMarkdown::Parse('This is not an iamge: \!\[Alt text](url/to/image "Optional title attribute")!')); } } ?>