Merge "Add a test for checking that all languages have autonyms"

This commit is contained in:
Siebrand
2012-08-09 21:00:58 +00:00
committed by Gerrit Code Review

View File

@@ -26,15 +26,33 @@ module( "ext.uls", QUnit.newMwEnvironment() );
* Runs over all script codes mentioned in langdb and checks whether * Runs over all script codes mentioned in langdb and checks whether
* they belong to the 'Other' group. * they belong to the 'Other' group.
*/ */
var orphanScript = function () { var orphanScripts = function () {
var result = [];
for ( var language in $.uls.data.languages ) { for ( var language in $.uls.data.languages ) {
var script = $.uls.data.script( language ); var script = $.uls.data.script( language );
if ( $.uls.data.groupOfScript( script ) === 'Other' ) { if ( $.uls.data.groupOfScript( script ) === 'Other' ) {
return script; result.push( script );
} }
} }
return ''; return result;
};
/*
* Runs over all script codes mentioned in langdb and checks whether
* they have something that looks like an autonym.
*/
var languagesWithoutAutonym = function () {
var result = [];
for ( var language in $.uls.data.languages ) {
if ( typeof $.uls.data.autonym( language ) !== 'string' ) {
result.push( language );
}
}
return result;
}; };
test( "-- Initial check", function() { test( "-- Initial check", function() {
@@ -43,11 +61,13 @@ test( "-- Initial check", function() {
} ); } );
test( "-- $.uls.data testing", function() { test( "-- $.uls.data testing", function() {
expect( 19 ); expect( 20 );
// This test assumes that we don't want any scripts to be in the 'Other' // This test assumes that we don't want any scripts to be in the 'Other'
// group. Actually, this may become wrong some day. // group. Actually, this may become wrong some day.
strictEqual( orphanScript(), '', 'No orphan scripts found.' ); deepEqual( orphanScripts(), [], 'All scripts belong to script groups.' );
deepEqual( languagesWithoutAutonym(), [], 'All languages have autonyms.' );
strictEqual( strictEqual(
$.uls.data.groupOfScript( 'Beng' ), $.uls.data.groupOfScript( 'Beng' ),
'SouthAsian', 'SouthAsian',