Skip to content

Commit 76b5eb1

Browse files
authored
Merge pull request #7 from purescript/compiler/0.12
Update for PureScript 0.12
2 parents 4547e98 + c249a01 commit 76b5eb1

File tree

5 files changed

+50
-50
lines changed

5 files changed

+50
-50
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/bower_components/
66
/node_modules/
77
/output/
8+
package-lock.json

LICENSE

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
The MIT License (MIT)
1+
Copyright 2018 PureScript
22

3-
Copyright (c) 2015 PureScript
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
45

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
this software and associated documentation files (the "Software"), to deal in
7-
the Software without restriction, including without limitation the rights to
8-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
the Software, and to permit persons to whom the Software is furnished to do so,
10-
subject to the following conditions:
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
118

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation and/or
11+
other materials provided with the distribution.
1412

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "purescript-assert",
33
"homepage": "https://github.com/purescript/purescript-assert",
4-
"description": "Basic assertions library for low level testing",
5-
"license": "MIT",
4+
"license": "BSD-3-Clause",
65
"repository": {
76
"type": "git",
87
"url": "git://github.com/purescript/purescript-assert.git"
@@ -17,7 +16,8 @@
1716
"package.json"
1817
],
1918
"dependencies": {
20-
"purescript-eff": "^3.0.0",
21-
"purescript-console": "^3.0.0"
19+
"purescript-effect": "^2.0.0",
20+
"purescript-console": "^4.0.0",
21+
"purescript-prelude": "^4.0.0"
2222
}
2323
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"build": "eslint src && pulp build -- --censor-lib --strict"
66
},
77
"devDependencies": {
8-
"eslint": "^3.17.1",
9-
"pulp": "^10.0.4",
10-
"purescript-psa": "^0.5.0-rc.1",
11-
"rimraf": "^2.6.1"
8+
"eslint": "^4.19.1",
9+
"pulp": "^12.2.0",
10+
"purescript-psa": "^0.6.0",
11+
"rimraf": "^2.6.2"
1212
}
1313
}

src/Test/Assert.purs

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Test.Assert
2-
( ASSERT
3-
, assert
2+
( assert
43
, assert'
54
, assertEqual
65
, assertFalse
@@ -11,33 +10,29 @@ module Test.Assert
1110

1211
import Prelude
1312

14-
import Control.Monad.Eff (Eff, kind Effect)
15-
import Control.Monad.Eff.Console (CONSOLE, error)
16-
17-
-- | Assertion effect type.
18-
foreign import data ASSERT :: Effect
13+
import Effect (Effect)
14+
import Effect.Console (error)
1915

2016
-- | Throws a runtime exception with message "Assertion failed" when the boolean
2117
-- | value is false.
22-
assert :: forall e. Boolean -> Eff (assert :: ASSERT | e) Unit
18+
assert :: Boolean -> Effect Unit
2319
assert = assert' "Assertion failed"
2420

2521
-- | Throws a runtime exception with the specified message when the boolean
2622
-- | value is false.
2723
foreign import assert'
28-
:: forall e
29-
. String
24+
:: String
3025
-> Boolean
31-
-> Eff (assert :: ASSERT | e) Unit
26+
-> Effect Unit
3227

3328
-- | Throws a runtime exception with message "Assertion failed: An error should
3429
-- | have been thrown", unless the argument throws an exception when evaluated.
3530
-- |
3631
-- | This function is specifically for testing unsafe pure code; for example,
3732
-- | to make sure that an exception is thrown if a precondition is not
38-
-- | satisfied. Functions which use `Eff (err :: EXCEPTION | eff) a` can be
33+
-- | satisfied. Functions which use `Effect a` can be
3934
-- | tested with `catchException` instead.
40-
assertThrows :: forall e a. (Unit -> a) -> Eff (assert :: ASSERT | e) Unit
35+
assertThrows :: forall a. (Unit -> a) -> Effect Unit
4136
assertThrows =
4237
assertThrows' "Assertion failed: An error should have been thrown"
4338

@@ -46,30 +41,30 @@ assertThrows =
4641
-- |
4742
-- | This function is specifically for testing unsafe pure code; for example,
4843
-- | to make sure that an exception is thrown if a precondition is not
49-
-- | satisfied. Functions which use `Eff (err :: EXCEPTION | eff) a` can be
44+
-- | satisfied. Functions which use `Effect a` can be
5045
-- | tested with `catchException` instead.
5146
assertThrows'
52-
:: forall e a
47+
:: forall a
5348
. String
5449
-> (Unit -> a)
55-
-> Eff (assert :: ASSERT | e) Unit
50+
-> Effect Unit
5651
assertThrows' msg fn = assert' msg =<< checkThrows fn
5752

5853
foreign import checkThrows
59-
:: forall e a
54+
:: forall a
6055
. (Unit -> a)
61-
-> Eff (assert :: ASSERT | e) Boolean
56+
-> Effect Boolean
6257

6358
-- | Compares the `expected` and `actual` values for equality and
6459
-- | throws a runtime exception when the values are not equal.
6560
-- |
6661
-- | The message indicates the expected value and the actual value.
6762
assertEqual
68-
:: forall a e
63+
:: forall a
6964
. Eq a
7065
=> Show a
7166
=> { actual :: a, expected :: a }
72-
-> Eff (assert :: ASSERT, console :: CONSOLE | e) Unit
67+
-> Effect Unit
7368
assertEqual {actual, expected} = do
7469
unless result $ error message
7570
assert' message result
@@ -82,17 +77,15 @@ assertEqual {actual, expected} = do
8277
-- | The message indicates the expected value (`true`)
8378
-- | and the actual value (`false`).
8479
assertTrue
85-
:: forall e
86-
. Boolean
87-
-> Eff (assert :: ASSERT, console :: CONSOLE | e) Unit
80+
:: Boolean
81+
-> Effect Unit
8882
assertTrue actual = assertEqual { actual, expected: true }
8983

9084
-- | Throws a runtime exception when the value is `true`.
9185
-- |
9286
-- | The message indicates the expected value (`false`)
9387
-- | and the actual value (`true`).
9488
assertFalse
95-
:: forall e
96-
. Boolean
97-
-> Eff (assert :: ASSERT, console :: CONSOLE | e) Unit
89+
:: Boolean
90+
-> Effect Unit
9891
assertFalse actual = assertEqual { actual, expected: false }

0 commit comments

Comments
 (0)