Skip to content

Commit

Permalink
Merge pull request #2 from purescript/0.8-updates
Browse files Browse the repository at this point in the history
Updates for PureScript 0.8
  • Loading branch information
garyb committed Mar 13, 2016
2 parents 3ede58f + 459b88d commit cc21708
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 88 deletions.
5 changes: 5 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"preset": "grunt",
"disallowSpacesInFunctionExpression": null,
"requireSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": null,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
Expand Down
5 changes: 3 additions & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"freeze": true,
"funcscope": true,
"futurehostile": true,
"globalstrict": true,
"strict": "global",
"latedef": true,
"maxparams": 1,
"noarg": true,
Expand All @@ -15,5 +15,6 @@
"singleGroups": true,
"undef": true,
"unused": true,
"eqnull": true
"eqnull": true,
"predef": ["exports"]
}
16 changes: 13 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
language: node_js
sudo: false
node_js:
- 0.10
sudo: required
dist: trusty
node_js: 5
env:
- PATH=$HOME/purescript:$PATH
install:
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
- chmod a+x $HOME/purescript
- npm install -g bower
- npm install
- bower install
script:
- npm run build
after_success:
- >-
test $TRAVIS_TAG &&
psc-publish > .pursuit.json &&
curl -X POST http://pursuit.purescript.org/packages \
-d @.pursuit.json \
-H 'Accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Basic assertions library for low level testing. This is primarily for testing th
bower install purescript-assert
```

## Module documentation
## Documentation

[`Test.Assert`](docs/Test/Assert.md)
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-assert).
6 changes: 1 addition & 5 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"name": "purescript-assert",
"homepage": "https://github.com/purescript/purescript-assert",
"description": "Basic assertions library for low level testing",
"keywords": [
"purescript",
"assert"
],
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -21,6 +17,6 @@
"package.json"
],
"dependencies": {
"purescript-eff": "^0.1.0"
"purescript-eff": "^1.0.0-rc.1"
}
}
57 changes: 0 additions & 57 deletions docs/Test/Assert.md

This file was deleted.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"private": true,
"scripts": {
"postinstall": "pulp dep install",
"build": "jshint src && jscs src && pulp build && rimraf docs && pulp docs"
"clean": "rimraf output && rimraf .pulp-cache",
"build": "jshint src && jscs src && pulp build"
},
"devDependencies": {
"jscs": "^1.13.1",
"jshint": "^2.8.0",
"pulp": "^4.0.1",
"rimraf": "^2.4.1"
"jscs": "^2.8.0",
"jshint": "^2.9.1",
"pulp": "^8.1.0",
"rimraf": "^2.5.0"
}
}
1 change: 0 additions & 1 deletion src/Test/Assert.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global exports */
"use strict";

// module Test.Assert
Expand Down
35 changes: 23 additions & 12 deletions src/Test/Assert.purs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module Test.Assert
( assert'
( ASSERT
, assert
, assert'
, assertThrows
, assertThrows'
, ASSERT()
) where

import Control.Monad.Eff (Eff())
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad ((=<<))
import Data.Unit (Unit)

-- | Assertion effect type.
foreign import data ASSERT :: !
Expand All @@ -19,7 +20,11 @@ assert = assert' "Assertion failed"

-- | Throws a runtime exception with the specified message when the boolean
-- | value is false.
foreign import assert' :: forall e. String -> Boolean -> Eff (assert :: ASSERT | e) Unit
foreign import assert'
:: forall e
. String
-> Boolean
-> Eff (assert :: ASSERT | e) Unit

-- | Throws a runtime exception with message "Assertion failed: An error should
-- | have been thrown", unless the argument throws an exception when evaluated.
Expand All @@ -29,7 +34,8 @@ foreign import assert' :: forall e. String -> Boolean -> Eff (assert :: ASSERT |
-- | satisfied. Functions which use `Eff (err :: EXCEPTION | eff) a` can be
-- | tested with `catchException` instead.
assertThrows :: forall e a. (Unit -> a) -> Eff (assert :: ASSERT | e) Unit
assertThrows = assertThrows' "Assertion failed: An error should have been thrown"
assertThrows =
assertThrows' "Assertion failed: An error should have been thrown"

-- | Throws a runtime exception with the specified message, unless the argument
-- | throws an exception when evaluated.
Expand All @@ -38,9 +44,14 @@ assertThrows = assertThrows' "Assertion failed: An error should have been thrown
-- | to make sure that an exception is thrown if a precondition is not
-- | satisfied. Functions which use `Eff (err :: EXCEPTION | eff) a` can be
-- | tested with `catchException` instead.
assertThrows' :: forall e a. String -> (Unit -> a) -> Eff (assert :: ASSERT | e) Unit
assertThrows' msg fn =
checkThrows fn >>= assert' msg


foreign import checkThrows :: forall e a. (Unit -> a) -> Eff (assert :: ASSERT | e) Boolean
assertThrows'
:: forall e a
. String
-> (Unit -> a)
-> Eff (assert :: ASSERT | e) Unit
assertThrows' msg fn = assert' msg =<< checkThrows fn

foreign import checkThrows
:: forall e a
. (Unit -> a)
-> Eff (assert :: ASSERT | e) Boolean

0 comments on commit cc21708

Please sign in to comment.