Commit 3669034d75d5c90740e149c6915c511bf949ff75

Golmote 2015-09-15T08:25:00

Add tests for diff

diff --git a/components/prism-diff.js b/components/prism-diff.js
index f01858d..3c5351c 100644
--- a/components/prism-diff.js
+++ b/components/prism-diff.js
@@ -1,11 +1,11 @@
 Prism.languages.diff = {
 	'coord': [
 		// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
-		/^(\*{3}|-{3}|\+{3}).*$/m,
+		/^(?:\*{3}|-{3}|\+{3}).*$/m,
 		// Match "@@ ... @@" coord lines in unified diff.
 		/^@@.*@@$/m,
 		// Match coord lines in normal diff (starts with a number).
-		/^\d+.*$/m,
+		/^\d+.*$/m
 	],
 
 	// Match inserted and deleted lines. Support both +/- and >/< styles.
@@ -14,7 +14,7 @@ Prism.languages.diff = {
 
 	// Match "different" lines (prefixed with "!") in context diff.
 	'diff': {
-		'pattern': /^\!(?!\!).+$/m,
+		'pattern': /^!(?!!).+$/m,
 		'alias': 'important'
 	}
-}
+};
\ No newline at end of file
diff --git a/components/prism-diff.min.js b/components/prism-diff.min.js
index 57cc657..091562e 100644
--- a/components/prism-diff.min.js
+++ b/components/prism-diff.min.js
@@ -1 +1 @@
-Prism.languages.diff={coord:[/^(\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d+.*$/m],deleted:/^[-<].+$/m,inserted:/^[+>].+$/m,diff:{pattern:/^\!(?!\!).+$/m,alias:"important"}};
\ No newline at end of file
+Prism.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d+.*$/m],deleted:/^[-<].+$/m,inserted:/^[+>].+$/m,diff:{pattern:/^!(?!!).+$/m,alias:"important"}};
\ No newline at end of file
diff --git a/tests/languages/diff/coord_feature.test b/tests/languages/diff/coord_feature.test
new file mode 100644
index 0000000..c082693
--- /dev/null
+++ b/tests/languages/diff/coord_feature.test
@@ -0,0 +1,21 @@
+7c7
+
+*** 4,8 ****
+--- 4,8 ----
+
+@@ -4,5 +4,5 @@
+
+----------------------------------------------------
+
+[
+	["coord", "7c7"],
+
+	["coord", "*** 4,8 ****"],
+	["coord", "--- 4,8 ----"],
+
+	["coord", "@@ -4,5 +4,5 @@"]
+]
+
+----------------------------------------------------
+
+Checks for coords.
\ No newline at end of file
diff --git a/tests/languages/diff/diff_feature.test b/tests/languages/diff/diff_feature.test
new file mode 100644
index 0000000..0e53490
--- /dev/null
+++ b/tests/languages/diff/diff_feature.test
@@ -0,0 +1,21 @@
+!     qt: core
+
+-    qt: core
++    qt: core gui
+
+< qt: core
+> qt: core quick
+
+----------------------------------------------------
+
+[
+	["diff", "!     qt: core"],
+	["deleted", "-    qt: core"],
+	["inserted", "+    qt: core gui"],
+	["deleted", "< qt: core"],
+	["inserted", "> qt: core quick"]
+]
+
+----------------------------------------------------
+
+Checks for deleted, inserted and different lines.
\ No newline at end of file