OSDN Git Service

creating.
authoriga <tosiki.iga@nifty.ne.jp>
Thu, 30 Jan 2014 12:59:19 +0000 (21:59 +0900)
committeriga <tosiki.iga@nifty.ne.jp>
Thu, 30 Jan 2014 12:59:19 +0000 (21:59 +0900)
main/buassert.fnc [new file with mode: 0644]
test/.gitignore [new file with mode: 0644]
test/test001.sh

diff --git a/main/buassert.fnc b/main/buassert.fnc
new file mode 100644 (file)
index 0000000..3c0e223
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+assertEquals() {
+  local message=$1
+  local expectValue=$2
+  local actualValue=$3
+
+  if [ ! "${expectValue}" = "${actualValue}" ]; then
+    echo 'Assertion failure: '"${message}"' Both value should be equal. expect:['"${expectValue}"'] actual:['"${actualValue}"']' 1>&2
+  fi
+}
\ No newline at end of file
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644 (file)
index 0000000..10521eb
--- /dev/null
@@ -0,0 +1 @@
+/test001.sh~
index 99108d7..b09a9e2 100644 (file)
@@ -1,7 +1,11 @@
 #!/bin/sh
 . ../main/bumsg.fnc
+. ../main/buassert.fnc
 . ./test001.msg
 
 logmsg 'M001' 'Bash'
+value1=`getmsg 'M001' 'Bash'`
+assertEquals 'Value should be equal.' 'Hello [Bash] world!' "${value1}"
 
 logmsg 'M002' 'pen'
+