Commits

Luke Plant  committed a0d7aa0

Moved contents of 'tests' up a directory

  • Participants
  • Parent commits e5dde07

Comments (0)

Files changed (7)

File testsuite/Main.hs

+import qualified Tests.Blog.DBUtils as DBUtils
+import Test.HUnit
+
+main = runTestTT (test [
+                    DBUtils.tests
+                  ])

File testsuite/Tests/Blog/DBUtils.hs

+module Tests.Blog.DBUtils
+
+where
+
+import Blog.DBUtils
+import Database.HDBC
+import Test.HUnit
+import qualified Tests.Blog.TestDB as TestDB
+
+makeTestSlugTable cn = do
+  quickQuery cn "CREATE TABLE slugs (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, slug TEXT);" []
+
+insertSlug cn title slug = do
+  quickQuery cn "INSERT INTO slugs (title, slug) VALUES (?, ?);" [toSql title, toSql slug]
+
+slugFromTitle1 =  "this-is-a-title" ~=? (slugFromTitle "This is a % $ /title ^£$")
+makeSlugGeneric1 = do
+  cn <- TestDB.connect;
+  makeTestSlugTable cn
+  slug1 <- makeSlugGeneric cn "This is a title" "slugs"
+  assertEqual "" "this-is-a-title" slug1
+  insertSlug cn "This is a title" slug1
+  slug2 <- makeSlugGeneric cn "This is a title" "slugs"
+  insertSlug cn "This is a title" slug2
+  assertEqual "" "this-is-a-title2" slug2
+
+tests = test [
+         slugFromTitle1,
+         TestCase makeSlugGeneric1
+        ]

File testsuite/Tests/Blog/TestDB.hs

+module Tests.Blog.TestDB where
+
+import Database.HDBC.Sqlite3 (connectSqlite3)
+import qualified Blog.Settings as Settings
+
+-- TODO - make testdb_sqlite_path into a command-line argument so that
+-- the tests can be run without having to change the settings
+connect = connectSqlite3 Settings.testdb_sqlite_path

File testsuite/runtests.sh

 #!/bin/sh
 DIR=`dirname $0`
 rm $DIR/test.db 2> /dev/null
-runhaskell -i$DIR/tests:$DIR/../src $DIR/tests/Main.hs
+runhaskell -i$DIR:$DIR/../src $DIR/Main.hs

File testsuite/tests/Main.hs

-import qualified Tests.Blog.DBUtils as DBUtils
-import Test.HUnit
-
-main = runTestTT (test [
-                    DBUtils.tests
-                  ])

File testsuite/tests/Tests/Blog/DBUtils.hs

-module Tests.Blog.DBUtils
-
-where
-
-import Blog.DBUtils
-import Database.HDBC
-import Test.HUnit
-import qualified Tests.Blog.TestDB as TestDB
-
-makeTestSlugTable cn = do
-  quickQuery cn "CREATE TABLE slugs (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, slug TEXT);" []
-
-insertSlug cn title slug = do
-  quickQuery cn "INSERT INTO slugs (title, slug) VALUES (?, ?);" [toSql title, toSql slug]
-
-slugFromTitle1 =  "this-is-a-title" ~=? (slugFromTitle "This is a % $ /title ^£$")
-makeSlugGeneric1 = do
-  cn <- TestDB.connect;
-  makeTestSlugTable cn
-  slug1 <- makeSlugGeneric cn "This is a title" "slugs"
-  assertEqual "" "this-is-a-title" slug1
-  insertSlug cn "This is a title" slug1
-  slug2 <- makeSlugGeneric cn "This is a title" "slugs"
-  insertSlug cn "This is a title" slug2
-  assertEqual "" "this-is-a-title2" slug2
-
-tests = test [
-         slugFromTitle1,
-         TestCase makeSlugGeneric1
-        ]

File testsuite/tests/Tests/Blog/TestDB.hs

-module Tests.Blog.TestDB where
-
-import Database.HDBC.Sqlite3 (connectSqlite3)
-import qualified Blog.Settings as Settings
-
--- TODO - make testdb_sqlite_path into a command-line argument so that
--- the tests can be run without having to change the settings
-connect = connectSqlite3 Settings.testdb_sqlite_path