diff --git a/.travis.yml b/.travis.yml index b392e33..93d23ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,6 +66,7 @@ script: - cabal test - cabal check - cabal sdist # tests that a source-distribution can be generated + - ./scripts/test-official.sh # Check that the resulting source distribution can be built & installed. # If there are no other `.tar.gz` files in `dist`, this can be even simpler: diff --git a/scripts/test-official.sh b/scripts/test-official.sh new file mode 100755 index 0000000..dd78945 --- /dev/null +++ b/scripts/test-official.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -ev + +# Test that the official database can be loaded + +if [ -d "state" ]; then + mv state state-old +fi + +git clone --depth 1 https://github.com/aelve/guide-database.git +mv guide-database state + +cabal build +dist/build/guide/guide --dry-run + +rm -rf state + +if [ -d "state-old" ]; then + mv state-old state +fi diff --git a/src/Main.hs b/src/Main.hs index f212726..cfdf23d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -451,6 +451,11 @@ main = do _categoriesDeleted = [], _pendingEdits = [], _editIdCounter = 0 } + do args <- getArgs + when (args == ["--dry-run"]) $ do + db :: DB <- openLocalStateFrom "state/" (error "couldn't load state") + closeAcidState db + exitSuccess -- When we run in GHCi and we exit the main thread, the EKG thread (that -- runs the localhost:5050 server which provides statistics) may keep -- running. This makes running this in GHCi annoying, because you have to diff --git a/src/Utils.hs b/src/Utils.hs index d7545a9..7c69094 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -252,9 +252,6 @@ genVer tyName ver constructors = do [] return [decl] --- TODO: [easy] add a test that takes data from aelve/guide-database and --- checks that the data can be loaded - data MigrateConstructor = CopyM Name | CustomM Name ExpQ migrateVer :: Name -> Int -> [MigrateConstructor] -> Q Exp