Skip to content

Commit b699746

Browse files
authored
Merge pull request purescript#64 from purescript/count
Export `count` again
2 parents 018455d + f37336c commit b699746

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && psa \"src/**/*.purs\" \"bower_components/purescript-*/src/**/*.purs\" --censor-lib --strict",
6-
"test": "psc \"src/**/*.purs\" \"bower_components/purescript-*/src/**/*.purs\" \"test/**/*.purs\" && psc-bundle \"output/**/*.js\" --module Test.Main --main Test.Main | node"
5+
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
6+
"test": "pulp test"
77
},
88
"devDependencies": {
99
"jscs": "^2.8.0",
1010
"jshint": "^2.9.1",
11-
"pulp": "^8.2.0",
12-
"purescript-psa": "^0.3.8",
11+
"pulp": "^9.0.1",
12+
"purescript-psa": "^0.3.9",
1313
"rimraf": "^2.5.0"
1414
}
1515
}

src/Data/String.purs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module Data.String
2323
, dropWhile
2424
, stripPrefix
2525
, stripSuffix
26+
, count
2627
, split
2728
, toCharArray
2829
, toLower

test/Test/Data/String.purs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ testString = do
142142
assert $ drop 3 "ab" == ""
143143
assert $ drop (-1) "ab" == "ab"
144144

145+
log "count"
146+
assert $ count (_ == 'a') "" == 0
147+
assert $ count (_ == 'a') "ab" == 1
148+
assert $ count (_ == 'a') "aaab" == 3
149+
assert $ count (_ == 'a') "abaa" == 1
150+
145151
log "split"
146152
assert $ split "" "" == []
147153
assert $ split "" "a" == ["a"]
@@ -167,4 +173,3 @@ testString = do
167173
assert $ joinWith "" [] == ""
168174
assert $ joinWith "" ["a", "b"] == "ab"
169175
assert $ joinWith "--" ["a", "b", "c"] == "a--b--c"
170-

0 commit comments

Comments
 (0)