git.iko.soy/purescript-intl
on master help sign in
Use en_US locale - fixes test in travis.
ca5d0b9Coot
.travis.yml+2−9
@@ -4,14 +4,6 @@ sudo: required
4node_js: stable
4node_js: stable
5env:
5env:
6 - PATH=$HOME/purescript:$PATH
6 - PATH=$HOME/purescript:$PATH
7− - global:
8− - LANG=en_GB.utf8
9− - LC_TIME=en_GB.utf8
10− - LC_MEASUREMENT=en_GB.utf8
11− - LC_NUMERIC=en_GB.utf8
12− - LC_MONETARY=en_GB.utf8
13−before_install:
14− - sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-en
15install:
7install:
16 - 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')
8 - 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')
17 - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
9 - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
@@ -20,10 +12,11 @@ install:
20 - npm install -g bower
12 - npm install -g bower
21 - npm install
13 - npm install
22script:
14script:
15+ - locale
23 - bower install --production
16 - bower install --production
24 - npm run -s build
17 - npm run -s build
25 - bower install
18 - bower install
26− - npm -s test
19+ - LC_TIME="en_GB.UTF-8" npm -s test
27after_success:
20after_success:
28- >-
21- >-
29 test $TRAVIS_TAG &&
22 test $TRAVIS_TAG &&
test/Test/Main.purs+8−7
@@ -3,6 +3,7 @@ module Test.Main where
3import Prelude
3import Prelude
4
4
5import Control.Monad.Eff (Eff)
5import Control.Monad.Eff (Eff)
6+import Control.Monad.Eff.Unsafe (unsafePerformEff)
6import Control.Monad.Eff.Console (CONSOLE)
7import Control.Monad.Eff.Console (CONSOLE)
7import Data.DateTime (Date, DateTime(..), Month(..), canonicalDate)
8import Data.DateTime (Date, DateTime(..), Month(..), canonicalDate)
8import Data.Enum (toEnum)
9import Data.Enum (toEnum)
@@ -49,7 +50,7 @@ main = do
49 let
50 let
50
51
51 locales :: LocalesOption
52 locales :: LocalesOption
52− locales = inj (SProxy :: SProxy "locale") "en-GB"
53+ locales = inj (SProxy :: SProxy "locale") "en-US"
53
54
54 fmtHourMinute =
55 fmtHourMinute =
55 createDateTimeFormatter locales opts
56 createDateTimeFormatter locales opts
@@ -259,23 +260,23 @@ main = do
259 Nothing -> unsafeCrashWith "jsDate not parsed"
260 Nothing -> unsafeCrashWith "jsDate not parsed"
260 Just d -> do
261 Just d -> do
261 let fmtDate1 = formatJSDate fmtWeekdayYearMonthDayHourMinuteSecond d
262 let fmtDate1 = formatJSDate fmtWeekdayYearMonthDayHourMinuteSecond d
262− fmtDate1Expected = "Tue, 2 January 2018, 12:00:00 pm"
263+ fmtDate1Expected = "Tue, January 2, 2018, 12:00:00 PM"
263 assert' ("fmtWeekdayYearMonthDayHourMinuteSecond: got: '" <> fmtDate1 <> "' expected: '" <> fmtDate1Expected <> "'")
264 assert' ("fmtWeekdayYearMonthDayHourMinuteSecond: got: '" <> fmtDate1 <> "' expected: '" <> fmtDate1Expected <> "'")
264 $ fmtDate1 == fmtDate1Expected
265 $ fmtDate1 == fmtDate1Expected
265 let fmtDate2 = formatJSDate fmtWeekdayYearMonthDay d
266 let fmtDate2 = formatJSDate fmtWeekdayYearMonthDay d
266− fmtDate2Expected = "Tuesday, 02 Jan 18"
267+ fmtDate2Expected = "Tuesday, Jan 02, 18"
267 assert' ("fmtWeekdayYearMonthDayString: got '" <> fmtDate2 <> "' expected: '" <> fmtDate2Expected <> "'")
268 assert' ("fmtWeekdayYearMonthDayString: got '" <> fmtDate2 <> "' expected: '" <> fmtDate2Expected <> "'")
268 $ fmtDate2 == fmtDate2Expected
269 $ fmtDate2 == fmtDate2Expected
269 let fmtDate3 = formatJSDate fmtYearMonthDay d
270 let fmtDate3 = formatJSDate fmtYearMonthDay d
270− fmtDate3Expected = "02 J 18"
271+ fmtDate3Expected = "J 02, 18"
271 assert' ("fmtYearMonthDayString: got '" <> fmtDate3 <> "' expected: '" <> fmtDate3Expected <> "'")
272 assert' ("fmtYearMonthDayString: got '" <> fmtDate3 <> "' expected: '" <> fmtDate3Expected <> "'")
272 $ fmtDate3 == fmtDate3Expected
273 $ fmtDate3 == fmtDate3Expected
273 let fmtDate4 = formatJSDate fmtYearMonth d
274 let fmtDate4 = formatJSDate fmtYearMonth d
274− fmtDate4Expected = "01/2018"
275+ fmtDate4Expected = "1/2018"
275 assert' ("fmtYearMonthString: got '" <> fmtDate4 <> "' expected: '" <> fmtDate4Expected <> "'")
276 assert' ("fmtYearMonthString: got '" <> fmtDate4 <> "' expected: '" <> fmtDate4Expected <> "'")
276 $ fmtDate4 == fmtDate4Expected
277 $ fmtDate4 == fmtDate4Expected
277 let fmtDate5 = formatJSDate fmtMonthDay d
278 let fmtDate5 = formatJSDate fmtMonthDay d
278− fmtDate5Expected = "02/01"
279+ fmtDate5Expected = "01/02"
279 assert' ("fmtMonthDayString: got '" <> fmtDate5 <> "' expected: '" <> fmtDate5Expected <> "'")
280 assert' ("fmtMonthDayString: got '" <> fmtDate5 <> "' expected: '" <> fmtDate5Expected <> "'")
280 $ fmtDate5 == fmtDate5Expected
281 $ fmtDate5 == fmtDate5Expected
281 let fmtDate6 = formatJSDate fmtHourMinuteSecond d
282 let fmtDate6 = formatJSDate fmtHourMinuteSecond d
@@ -291,6 +292,6 @@ main = do
291 assert' ("fmtEraYear: got '" <> fmtDate8 <> "' expected: '" <> fmtDate8Expected <> "'")
292 assert' ("fmtEraYear: got '" <> fmtDate8 <> "' expected: '" <> fmtDate8Expected <> "'")
292 $ fmtDate8 == fmtDate8Expected
293 $ fmtDate8 == fmtDate8Expected
293 let fmtDate9 = formatJSDate fmtEra d
294 let fmtDate9 = formatJSDate fmtEra d
294− fmtDate9Expected = "2 1 2018 AD"
295+ fmtDate9Expected = "1 2, 2018 AD"
295 assert' ("fmtEra: got '" <> fmtDate9 <> "' expected: '" <> fmtDate9Expected <> "'")
296 assert' ("fmtEra: got '" <> fmtDate9 <> "' expected: '" <> fmtDate9Expected <> "'")
296 $ fmtDate9 == fmtDate9Expected
297 $ fmtDate9 == fmtDate9Expected