Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ language: node_js
dist: trusty
sudo: required
node_js: stable
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:
- bower install --production
- npm run -s build
- bower install
- npm run -s test
after_success:
- >-
test $TRAVIS_TAG &&
Expand Down
14 changes: 7 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
],
"description": "A library for dealing with nulls",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/purescript-contrib/purescript-nullable.git"
},
"ignore": [
"**/.*",
"bower_components",
Expand All @@ -14,14 +18,10 @@
"package.json"
],
"dependencies": {
"purescript-maybe": "^3.0.0",
"purescript-functions": "^3.0.0"
},
"repository": {
"type": "git",
"url": "git://github.com/paf31/purescript-nullable.git"
"purescript-maybe": "^4.0.0",
"purescript-functions": "^4.0.0"
},
"devDependencies": {
"purescript-console": "^3.0.0"
"purescript-assert": "^4.0.0"
}
}
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
"test": "pulp test"
},
"devDependencies": {
"eslint": "^3.19.0",
"pulp": "^11.0.0",
"purescript": "^0.11.1",
"purescript-psa": "^0.5.0",
"rimraf": "^2.6.1"
"eslint": "^4.19.1",
"pulp": "^12.2.0",
"purescript-psa": "^0.6.0",
"rimraf": "^2.6.2"
}
}
30 changes: 19 additions & 11 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ module Test.Main where

import Prelude

import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, logShow)
import Data.Maybe (Maybe(..))
import Data.Nullable (toNullable, toMaybe)
import Effect (Effect)
import Test.Assert (assertEqual)

main :: Eff (console :: CONSOLE) Unit
main :: Effect Unit
main = do
logShow $ toNullable (Nothing :: Maybe Number)
logShow $ toNullable (Just 42)

logShow $ toMaybe $ toNullable (Nothing :: Maybe Number)
logShow $ toMaybe $ toNullable (Just 42)

logShow $ toNullable Nothing == toNullable (Just 42)
logShow $ toNullable Nothing `compare` toNullable (Just 42)
assertEqual
{ actual: toMaybe $ toNullable (Nothing :: Maybe Number)
, expected: Nothing
}
assertEqual
{ actual: toMaybe $ toNullable (Just 42)
, expected: Just 42
}
assertEqual
{ actual: toNullable Nothing == toNullable (Just 42)
, expected: false
}
assertEqual
{ actual: toNullable Nothing `compare` toNullable (Just 42)
, expected: LT
}