From 3fb2aa6a2daff76ad3926d6fd38b401443df80c1 Mon Sep 17 00:00:00 2001
From: Michael Ochmann
Date: Thu, 18 Aug 2022 14:55:32 +0200
Subject: [PATCH] added full test suite for:
* code blocks
* paragraphs
* horizontal rules
* references
* tables
---
tests/CodeBlocksTest.php | 46 ++++++++++++++++++++++++++++++++++++
tests/GenericBlocksTest.php | 47 +++++++++++++++++++++++++++++++++++++
tests/ReferencesTest.php | 38 ++++++++++++++++++++++++++++++
tests/TablesTest.php | 37 +++++++++++++++++++++++++++++
4 files changed, 168 insertions(+)
create mode 100644 tests/CodeBlocksTest.php
create mode 100644 tests/GenericBlocksTest.php
create mode 100644 tests/ReferencesTest.php
create mode 100644 tests/TablesTest.php
diff --git a/tests/CodeBlocksTest.php b/tests/CodeBlocksTest.php
new file mode 100644
index 0000000..a2aaad5
--- /dev/null
+++ b/tests/CodeBlocksTest.php
@@ -0,0 +1,46 @@
+
+
+ this is a code block
+
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+
+ public function testLanguageAnnotationParsesCorrectly() : void {
+ $source = "
+```php
+ public function testLanguageAnnotationParsesCorrectly() : bool {
+ return true;
+ }
+
+```
+ ";
+ $target = "
+
+
+ public function testLanguageAnnotationParsesCorrectly() : bool {
+ return true;
+ }
+
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+}
\ No newline at end of file
diff --git a/tests/GenericBlocksTest.php b/tests/GenericBlocksTest.php
new file mode 100644
index 0000000..43cd151
--- /dev/null
+++ b/tests/GenericBlocksTest.php
@@ -0,0 +1,47 @@
+
+ this is a paragraph
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+
+ public function testBlockquotesParseCorrectly() : void {
+ $source = "
+> this is
+>
+> a blockquote
+
+";
+ $target = "
+
+ this is
+ a blockquote
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+
+ public function testHorizontalRuleParsesCorrectly() : void {
+ $source = "
+---
+ ";
+ $target = "
";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+}
\ No newline at end of file
diff --git a/tests/ReferencesTest.php b/tests/ReferencesTest.php
new file mode 100644
index 0000000..2b2fc91
--- /dev/null
+++ b/tests/ReferencesTest.php
@@ -0,0 +1,38 @@
+
+ this text uses a simple reference
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+
+ public function testNamedReferencesAreResolvedCorrectly() : void {
+ $source = "
+this text uses [a simple reference][REF] and does it [twice][REF]
+
+[REF]: https://massivedynamic.eu
+ ";
+ $target = "
+
+ this text uses a simple reference
+ and does it twice
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+}
\ No newline at end of file
diff --git a/tests/TablesTest.php b/tests/TablesTest.php
new file mode 100644
index 0000000..ec42784
--- /dev/null
+++ b/tests/TablesTest.php
@@ -0,0 +1,37 @@
+
+
+ Product |
+ Amount |
+ Price |
+
+
+ Part A |
+ 5 |
+ 20,00€ |
+
+
+ Editor |
+ 100 |
+ 39,99€ |
+
+
+ ";
+
+ [$source, $result] = createTest($source, $target);
+ $this->assertEquals($source, $result);
+ }
+}
\ No newline at end of file