Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added some testcases

  • Loading branch information...
commit 4aa90a1e4f85e80db5a85f1bcc1ff7c2bec13d2d 1 parent df81b01
Shuhei Tanuma authored January 09, 2012
2  .travis.yml
@@ -3,4 +3,4 @@ php:
3 3
   - 5.3
4 4
   - 5.4
5 5
 
6  
-script: rake submodule compile test:conformance 
  6
+script: rake submodule compile test
8  Rakefile
@@ -21,6 +21,14 @@ task :clean do
21 21
 	end
22 22
 end
23 23
 
  24
+desc "run php test cases"
  25
+task :test do
  26
+	Dir.chdir("src") do
  27
+		ENV["TESTS"] = "-q"
  28
+		sh "make test"
  29
+	end
  30
+end
  31
+
24 32
 desc "Run conformance tests"
25 33
 task "test:conformance" do
26 34
 	Dir.chdir("test") do
17  src/tests/002-basic-constructor-arguments.phpt
... ...
@@ -0,0 +1,17 @@
  1
+--TEST--
  2
+Check for Sundown::__construct arguments
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$a = new Sundown('a');
  8
+if (is_array($a->extensions) && is_null($a->enable_pants) && $a->data == 'a') {
  9
+  echo "OK" .PHP_EOL;
  10
+}
  11
+$a = new Sundown('a',array('autolink'=>true));
  12
+if (isset($a->extensions['autolink']) && is_null($a->enable_pants) && $a->data == 'a') {
  13
+  echo "OK" .PHP_EOL;
  14
+}
  15
+--EXPECT--
  16
+OK
  17
+OK
17  src/tests/002-basic-to_html.phpt
... ...
@@ -0,0 +1,17 @@
  1
+--TEST--
  2
+Check for Sundown::to_html() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$data = <<<EOF
  8
+* Hello World
  9
+EOF;
  10
+
  11
+$a = new Sundown($data);
  12
+// list
  13
+echo $a->to_html();
  14
+--EXPECT--
  15
+<ul>
  16
+<li>Hello World</li>
  17
+</ul>
14  src/tests/003-advanced-constructor.phpt
... ...
@@ -0,0 +1,14 @@
  1
+--TEST--
  2
+Check for Sundown\Markdown::__construct() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$a = new Sundown\Markdown(Sundown\Render\HTML);
  8
+$a = new Sundown\Markdown(new Sundown\Render\HTML());
  9
+$r = new Sundown\Render\HTML();
  10
+$a = new Sundown\Markdown($r);
  11
+$a = new Sundown\Markdown($r,array());
  12
+echo "OK";
  13
+--EXPECT--
  14
+OK
13  src/tests/003-advanced-render-html-block_code.phpt
... ...
@@ -0,0 +1,13 @@
  1
+--TEST--
  2
+Check for Sundown\Render\HTML::block_code() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$render = new Sundown\Render\HTML();
  8
+echo $render->block_code("echo 'abc'","php") . PHP_EOL;
  9
+echo $render->block_code("echo 'abc'", null) . PHP_EOL;
  10
+--EXPECT--
  11
+<pre><code class="php">echo &#39;abc&#39;</code></pre>
  12
+
  13
+<pre><code>echo &#39;abc&#39;</code></pre>
10  src/tests/003-advanced-render-html-block_html.phpt
... ...
@@ -0,0 +1,10 @@
  1
+--TEST--
  2
+Check for Sundown\Render\HTML::block_html() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$render = new Sundown\Render\HTML();
  8
+echo $render->block_html("block html") . PHP_EOL;
  9
+--EXPECT--
  10
+block html
11  src/tests/003-advanced-render-html-block_quote.phpt
... ...
@@ -0,0 +1,11 @@
  1
+--TEST--
  2
+Check for Sundown\Render\HTML::block_quote() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$render = new Sundown\Render\HTML();
  8
+echo $render->block_quote("quoted paragraph") . PHP_EOL;
  9
+--EXPECT--
  10
+<blockquote>
  11
+quoted paragraph</blockquote>
14  src/tests/003-advanced-render-html-header.phpt
... ...
@@ -0,0 +1,14 @@
  1
+--TEST--
  2
+Check for Sundown\Render\HTML::header() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$render = new Sundown\Render\HTML();
  8
+echo $render->header("Hello World",1);
  9
+echo $render->header("Hello World",2);
  10
+echo $render->header("Hello World",3);
  11
+--EXPECT--
  12
+<h1>Hello World</h1>
  13
+<h2>Hello World</h2>
  14
+<h3>Hello World</h3>
18  src/tests/003-advanced-render-html-list.phpt
... ...
@@ -0,0 +1,18 @@
  1
+--TEST--
  2
+Check for Sundown\Render\HTML::list_box() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$render = new Sundown\Render\HTML();
  8
+echo $render->list_box("",1);
  9
+echo $render->list_box("",0);
  10
+echo $render->list_item("hello",1);
  11
+echo $render->list_item("hello",0);
  12
+--EXPECT--
  13
+<ol>
  14
+</ol>
  15
+<ul>
  16
+</ul>
  17
+<li>hello</li>
  18
+<li>hello</li>
10  src/tests/003-advanced-render-html-paragraph.phpt
... ...
@@ -0,0 +1,10 @@
  1
+--TEST--
  2
+Check for Sundown\Render\HTML::paragraph() feature
  3
+--SKIPIF--
  4
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5
+--FILE--
  6
+<?php
  7
+$render = new Sundown\Render\HTML();
  8
+echo $render->paragraph("Hello World");
  9
+--EXPECT--
  10
+<p>Hello World</p>

0 notes on commit 4aa90a1

Please sign in to comment.
Something went wrong with that request. Please try again.