Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test

  • Loading branch information...
commit 4d0a15380b35abf1a775522d811105e0870b91a2 1 parent b3754dd
Igor authored
4 Makefile
View
@@ -0,0 +1,4 @@
+test:
+ bash tests/yml-to-json-test.sh
+
+.PHONY: test
7 tests/composer-expected.json
View
@@ -0,0 +1,7 @@
+{
+ "name": "foo/bar",
+ "description": "The foobar.",
+ "require": {
+ "baz/qux": "1.0.*@dev"
+ }
+}
4 tests/composer.yml
View
@@ -0,0 +1,4 @@
+name: foo/bar
+description: The foobar.
+require:
+ baz/qux: 1.0.*@dev
49 tests/yml-to-json-test.sh
View
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+function startTests {
+ echo "PlaygroundUnit 0.0.1 by Igor Wiedler."
+ echo
+}
+
+function endTests {
+ echo
+ echo
+}
+
+function assertEquals {
+ if [ "$1" = "$2" ]; then
+ echo -n .
+ else
+ echo "Assertion failed:"
+ echo "--- Expected"
+ echo "+++ Actual"
+ echo "- $1"
+ echo "+ $2"
+
+ endTests
+ exit 1
+ fi
+}
+
+function assertContentsEquals {
+ diff="$(diff -u $1 $2)"
+
+ if [ "$diff" = "" ]; then
+ echo -n .
+ else
+ echo "Assertion failed:"
+ echo "$diff"
+
+ endTests
+ exit 1
+ fi
+}
+
+startTests
+
+touch tests/composer-actual.json
+bin/composer-yaml convert tests/composer.yml tests/composer-actual.json
+assertContentsEquals tests/composer-expected.json tests/composer-actual.json
+rm tests/composer-actual.json
+
+endTests
Please sign in to comment.
Something went wrong with that request. Please try again.