Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Fix #15. Add tests cases using other languages. #16

Merged
merged 5 commits into from
Dec 18, 2013

Conversation

apipkin
Copy link
Contributor

@apipkin apipkin commented Dec 13, 2013

Fix #15. Add tests cases using other languages using test parameters provided by @lwelti

});


it('en-US', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this test be called fr-FR instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was a copy paste error.

@drewfish
Copy link
Contributor

It'd be nice to have some pluralization tests in here as well (such as testing that count:3 matches "few" in some specific languages but "other" in en)

@apipkin
Copy link
Contributor Author

apipkin commented Dec 13, 2013

@drewfish yeah i can totally see that, but I'm not familiar with any other languages to know what the best course of a test would be.

@lwelti
Copy link

lwelti commented Dec 13, 2013

i am in the process to give you some plural examples, give me 3mins.

@apipkin
Copy link
Contributor Author

apipkin commented Dec 13, 2013

Of course the CLDR stuff will need to be in to test plurals :)

@lwelti
Copy link

lwelti commented Dec 13, 2013

here is a basic plural + gender with French. be aware that the list pattern is created by hand.

en-US: {TRAVELLERS} went to {CITY}.
fr-FR: {TRAVELLERS} {TRAVELLER_COUNT, plural, one {est {GENDER, select, female {allée} other {allé}}} other {sont {GENDER, select, female {allées} other {allés}}}} à {CITY}.

1st
values: TRAVELLERS= "Lucas, Tony and Drew" // Yes a fix list
TRAVELLER_COUNT = 3
GENDER = male

2nd
then you can change the list of TRAVELLERS and change to female

3rd
values: TRAVELLERS="Monica"
TRAVELLER_COUNT = 1
GENDER = female

@lwelti
Copy link

lwelti commented Dec 13, 2013

for few, many let me get some, I am not 100% sure if the one I have in mind is correct, so give me some mins

@lwelti
Copy link

lwelti commented Dec 13, 2013

en-US
text: {COMPANY_COUNT, plural, one {One company} other {# companies}} published new books.

ru-RU
text: {COMPANY_COUNT, plural, one {Одна компания опубликовала} few {# компании опубликовали} many {# компаний опубликовали} other {# компаний опубликовали}} новые книги.

for en-US it is clear the expected result, so i will only paste the one for ru-RU

1st test:
COMPANY_COUNT => 0
expected: 0 компаний опубликовали новые книги.

2nd test
COMPANY_COUNT=>1
expected: Одна компания опубликовала новые книги.

3rd test
COMPANY_COUNT=>2
expected: 2 компании опубликовали новые книги.

4t test
COMPANY_COUNT=>5
expected: 5 компаний опубликовали новые книги.

5t test
COMPANY_COUNT=> 10
expected: 10 компаний опубликовали новые книги.

@apipkin
Copy link
Contributor Author

apipkin commented Dec 13, 2013

One of the tests for Russian is now failing, though it should pass when CLDR is in place. I'm leaving it as is to verify CLDR is working later on.

@lwelti
Copy link

lwelti commented Dec 13, 2013

ok so you are not committing the russian one? and which one is failing just to know

@apipkin
Copy link
Contributor Author

apipkin commented Dec 13, 2013

No I would commit it, there would just be a failing test.

@apipkin
Copy link
Contributor Author

apipkin commented Dec 16, 2013

Is this okay to merge in?

@drewfish
Copy link
Contributor

+1

@ericf
Copy link
Collaborator

ericf commented Dec 17, 2013

Is this okay to merge in?

We should fix this failing test before we merge.

@lwelti
Copy link

lwelti commented Dec 17, 2013

can you confirm why is failing? which test is the one failing?

@apipkin
Copy link
Contributor Author

apipkin commented Dec 17, 2013

It's failing because there is no CLDR available yet :)

@lwelti
Copy link

lwelti commented Dec 17, 2013

ok let be more clear :) which specific test is failing? or all of them are failing?

@apipkin
Copy link
Contributor Author

apipkin commented Dec 17, 2013

@lwelti
Copy link

lwelti commented Dec 17, 2013

then why don't you remove the ru-RU and then after we have the cldr you commit the ru-RU ?

@lwelti
Copy link

lwelti commented Dec 17, 2013

i am actually double checking ru-RU as I have some doubts, so you can remove it for now and then I can double check and when CLDR is there we can test it again.

@lwelti
Copy link

lwelti commented Dec 17, 2013

based on this: https://github.com/papandreou/node-cldr/blob/master/3rdparty/cldr/common/supplemental/plurals.xml#L188

ru seems to have only "one many other" but i know that it has "few" too, and even the twitter implementation has it:

https://github.com/twitter/twitter-cldr-js/blob/master/lib/assets/javascripts/twitter_cldr/ru.js#L150

I definitely need to double check.

@drewfish
Copy link
Contributor

Yeah, Russian appears to have "few" as witnessed on this page:
http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html

@drewfish
Copy link
Contributor

BTW it appears that Arabic ("ar") and Welsh ("cy") have the full complement of groups ("zero", "one", "two", "few", "many", "other") so those might be good candidates for testing.

@lwelti
Copy link

lwelti commented Dec 17, 2013

correct, because at the implementation level:
https://raw.github.com/drewfish/intl-messageformat/7a79385bbd4f58eb0c5368c18c87ee55c360cdb3/locale-data/ru.js

it only has: one, many, other.

so remove ru test case for now.

@drewfish
Copy link
Contributor

I've filed papandreou/node-cldr#11 on the upstream cldr package.

@lwelti
Copy link

lwelti commented Dec 17, 2013

ok, i found that on the latest version of CLDR they merged few -> other:

http://cldr.unicode.org/index/downloads/cldr-24 then search for: "few (2-4,…) ➞ other (all fractions): Russian"

@lwelti
Copy link

lwelti commented Dec 17, 2013

let me update the test case for ru-RU without "few"

@lwelti
Copy link

lwelti commented Dec 17, 2013

@drewfish here is the latest one (version 24):
http://www.unicode.org/cldr/charts/24/supplemental/language_plural_rules.html

which has one many other

@lwelti
Copy link

lwelti commented Dec 17, 2013

@apipkin feel free to remove "few" from ru-RU test case.

@apipkin
Copy link
Contributor Author

apipkin commented Dec 17, 2013

I'm okay with waiting on this until CLDR is merged. I just wasn't sure if this was good to merge in before. I'm quite okay with waiting.

@apipkin
Copy link
Contributor Author

apipkin commented Dec 18, 2013

  message resolvedOptions
    ✓ empty options

  message creation
    ✓ simple string formatting
    ✓ simple object formatting
    ✓ simple object with post processing tokens
    ✓ complex object formatter
    ✓ complex object formatter with invalid valueName
    ✓ complex object formatter with offset
    ✓ Simple string formatter using a custom formatter for a token
    ✓ Simple string formatter using an inline formatter for a token
    ✓ Simple string formatter using a nonexistent formatter for a token
    ✓ Custom formatters with hidden inheritance
    ✓ broken pattern

  message creation for plurals
    ✓ zero
    ✓ one
    ✓ two
    ✓ few
    ✓ many
    ✓ other

  locale switching
    ✓ en-US simple
    ✓ fr-FR simple
    ✓ en-US complex
    ✓ fr-FR complex

  locale switching with counts
    ✓ en-US
    ✓ ru-RU


  24 passing (10ms)

=============================================================================
Writing coverage object [/Users/apipkin/Projects/intl-messageformat/coverage/coverage.json]
Writing coverage reports at [/Users/apipkin/Projects/intl-messageformat/coverage]
=============================================================================

======================== Coverage summary (IntlMessageFormat) =========================
Statements   : 96.08% (49 / 51) 
Branches     : 87.91% (80 / 91)  
Functions    :  90.91% (10 / 11)   
Lines        : 100% ( 3/3 )
================================================================================

=========================== Coverage summary + Languages ============================
Statements   : 91.89% ( 68/74 )
Branches     : 79.07% ( 102/129 )
Functions    : 92.31% ( 12/13 )
Lines        : 100% ( 3/3 )
================================================================================

@lwelti
Copy link

lwelti commented Dec 18, 2013

yeahhh

@apipkin apipkin merged commit 9c7d23a into formatjs:master Dec 18, 2013
@apipkin apipkin deleted the tests branch January 16, 2014 16:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Test cases using other Languages
4 participants