From d319d355c879902eb0554dcc0b680f5c791ca6b0 Mon Sep 17 00:00:00 2001 From: Koutarou Chikuba Date: Sun, 11 May 2014 19:24:25 +0900 Subject: [PATCH] Remove starter --- .psci | 1 - gruntfile.coffee | 9 ++++---- public/main.js | 28 ------------------------- src/Starter/Kit/Example.purs | 20 ------------------ tests/TestRunner.purs | 21 +++++++++++++++++++ tests/Tests.purs | 40 ------------------------------------ 6 files changed, 26 insertions(+), 93 deletions(-) delete mode 100644 src/Starter/Kit/Example.purs create mode 100644 tests/TestRunner.purs delete mode 100644 tests/Tests.purs diff --git a/.psci b/.psci index 7a0c64d..1db177f 100644 --- a/.psci +++ b/.psci @@ -1,6 +1,5 @@ :m src/Foo.purs :m src/Main.purs -:m src/Starter/Kit/Example.purs :m bower_components/purescript-arrays/src/Data/Array.purs :m bower_components/purescript-arrays/src/Data/Array/Unsafe.purs :m bower_components/purescript-control/src/Control/Apply.purs diff --git a/gruntfile.coffee b/gruntfile.coffee index a5d9eba..58b65f6 100644 --- a/gruntfile.coffee +++ b/gruntfile.coffee @@ -19,9 +19,10 @@ module.exports = (grunt) -> psc: tests: options: - module: ["Main"] - main: true - src: ["tests/Tests.purs", "<%=libFiles%>"] + module: ["TestRunner"] + # main: true + noMagicDo: true + src: ["tests/TestRunner.purs", "<%=libFiles%>"] dest: "tmp/tests.js" app: options: @@ -33,7 +34,7 @@ module.exports = (grunt) -> tests: src: "tmp/tests.js" - grunt.registerTask("test", ["build", "clean:tests", "psc:tests", "execute:tests"]) + grunt.registerTask("test", ["build", "clean:tests", "psc:tests", "execute:tests", "clean:tests"]) grunt.registerTask("build", ["psc:app"]) grunt.registerTask("make", ["pscMake", "dotPsci"]) grunt.registerTask("default", ["make", "build"]) diff --git a/public/main.js b/public/main.js index f995e6e..acfbfa5 100644 --- a/public/main.js +++ b/public/main.js @@ -2240,34 +2240,6 @@ PS.Data_Tuple = (function () { }; })(); var PS = PS || {}; -PS.Starter_Kit_Example = (function () { - "use strict"; - var Prelude = PS.Prelude; - var Data_Maybe = PS.Data_Maybe; - var diffs = function (_2) { - if (_2.length === 0) { - return Prelude["return"](Data_Maybe.monadMaybe({}))([ ]); - }; - if (_2.length === 1) { - return Prelude["return"](Data_Maybe.monadMaybe({}))([ ]); - }; - if (_2.length > 0) { - var _6 = _2.slice(1); - if (_6.length > 0) { - if (_2[0] <= _6[0]) { - return Prelude[">>="](Data_Maybe.bindMaybe({}))(diffs(_6))(function (_1) { - return Prelude["return"](Data_Maybe.monadMaybe({}))(Prelude[":"](_6[0] - _2[0])(_1)); - }); - }; - }; - }; - return Data_Maybe.Nothing; - }; - return { - diffs: diffs - }; -})(); -var PS = PS || {}; PS.Control_Monad_Eff = (function () { "use strict"; var Prelude = PS.Prelude; diff --git a/src/Starter/Kit/Example.purs b/src/Starter/Kit/Example.purs deleted file mode 100644 index a7ca5f4..0000000 --- a/src/Starter/Kit/Example.purs +++ /dev/null @@ -1,20 +0,0 @@ -module Starter.Kit.Example where - -import Data.Array -import Data.Maybe - --- This module defines a single function diffs, which --- returns the differences for an increasing array. --- --- If the input is not increasing, it returns Nothing. --- --- This contrived example was chosen to demonstrate the use --- of the Data.Array and Data.Maybe standard libraries. - -diffs :: [Number] -> Maybe [Number] -diffs [] = return [] -diffs [_] = return [] -diffs (x : tail@(x' : xs)) | x <= x' = do - tailDiffs <- diffs tail - return (x' - x : tailDiffs) -diffs _ = Nothing diff --git a/tests/TestRunner.purs b/tests/TestRunner.purs new file mode 100644 index 0000000..4b93b87 --- /dev/null +++ b/tests/TestRunner.purs @@ -0,0 +1,21 @@ +module TestRunner where + +import Data.Array +import Data.Maybe + +import Debug.Trace +import Control.Monad.Eff + +-- Import Test.QuickCheck, which supports property-based testing +import Test.QuickCheck + +-- Main.main is the entry point of the application +-- +-- In the case of the test suite, Main.main will use QuickCheck to test a collection +-- of properties that we expect of the diffs function. +main = do + -- Use quickCheck' to override the number of tests to perform. + -- In this case, we only need to run the test once, since there is + -- only one empty list. + trace "Write test here" + {- quickCheck' 1 $ true -} diff --git a/tests/Tests.purs b/tests/Tests.purs deleted file mode 100644 index 77b1b1d..0000000 --- a/tests/Tests.purs +++ /dev/null @@ -1,40 +0,0 @@ -module Main where - -import Data.Array -import Data.Maybe - -import Debug.Trace -import Control.Monad.Eff - --- Import the library's module(s) -import Starter.Kit.Example - --- Import Test.QuickCheck, which supports property-based testing -import Test.QuickCheck - --- Main.main is the entry point of the application --- --- In the case of the test suite, Main.main will use QuickCheck to test a collection --- of properties that we expect of the diffs function. -main = do - - -- Use quickCheck' to override the number of tests to perform. - -- In this case, we only need to run the test once, since there is - -- only one empty list. - - trace "The differences of an empty list are empty." - quickCheck' 1 $ diffs [] == Just [] - - trace "The differences of a single-element list are empty." - quickCheck $ \n -> diffs [n] == Just [] - - trace "The differences of a pair of equal elements are zero." - quickCheck $ \n -> diffs [n, n] == Just [0] - - trace "The diffs function returns Just (...) for a sorted list." - quickCheck $ \ns -> isJust $ diffs $ sort ns - - trace "The diffs function returns Nothing for a reverse-sorted list with \ - \at least one pair of unequal elements." - quickCheck $ \n1 ns -> isNothing $ diffs $ reverse $ sort (n1 : (n1 + 1) : ns) -