Search in sources :

Example 36 with Realm

use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.

the class LocaleTest method testLocaleWithRegionAndUnicodeExtension.

@Test
public void testLocaleWithRegionAndUnicodeExtension() throws Exception {
    String languageTag = "de-AT-u-co-phonebk";
    Realm realm = newRealm(languageTag);
    assertEquals(languageTag, realm.getLocale().toLanguageTag());
    for (Intl constructor : Intl.values()) {
        assertEquals("de-AT", resolvedLocale(realm, constructor));
    }
}
Also used : Realm(com.github.anba.es6draft.runtime.Realm) Test(org.junit.Test)

Example 37 with Realm

use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.

the class LocaleTest method testLocaleWithVariant.

@Test
public void testLocaleWithVariant() throws Exception {
    String languageTag = "de-1996";
    Realm realm = newRealm(languageTag);
    assertEquals(languageTag, realm.getLocale().toLanguageTag());
    for (Intl constructor : Intl.values()) {
        assertEquals("de", resolvedLocale(realm, constructor));
    }
}
Also used : Realm(com.github.anba.es6draft.runtime.Realm) Test(org.junit.Test)

Example 38 with Realm

use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.

the class LocaleTest method test_kok.

@Test
public void test_kok() throws Exception {
    // 'kok' is not supported by PluralRules, no fallback is available, hence defaults to 'en'.
    String languageTag = "kok";
    Realm realm = newRealm(languageTag);
    assertEquals(languageTag, realm.getLocale().toLanguageTag());
    for (Intl constructor : Intl.values()) {
        assertEquals("en", resolvedLocale(realm, constructor));
    }
    for (Intl constructor : Intl.values()) {
        assertEquals("en", resolvedLocaleLookup(realm, constructor));
    }
}
Also used : Realm(com.github.anba.es6draft.runtime.Realm) Test(org.junit.Test)

Example 39 with Realm

use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.

the class LocaleTest method testLocaleWithScript.

@Test
public void testLocaleWithScript() throws Exception {
    String languageTag = "de-Latn";
    Realm realm = newRealm(languageTag);
    assertEquals(languageTag, realm.getLocale().toLanguageTag());
    for (Intl constructor : Intl.values()) {
        assertEquals("de", resolvedLocale(realm, constructor));
    }
}
Also used : Realm(com.github.anba.es6draft.runtime.Realm) Test(org.junit.Test)

Example 40 with Realm

use of com.github.anba.es6draft.runtime.Realm in project es6draft by anba.

the class LocaleTest method testLocaleWithUnicodeExtension.

@Test
public void testLocaleWithUnicodeExtension() throws Exception {
    String languageTag = "de-u-co-phonebk";
    Realm realm = newRealm(languageTag);
    assertEquals(languageTag, realm.getLocale().toLanguageTag());
    for (Intl constructor : Intl.values()) {
        assertEquals("de", resolvedLocale(realm, constructor));
    }
}
Also used : Realm(com.github.anba.es6draft.runtime.Realm) Test(org.junit.Test)

Aggregations

Realm (com.github.anba.es6draft.runtime.Realm)96 Test (org.junit.Test)39 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)17 Script (com.github.anba.es6draft.Script)16 ExecutionContext (com.github.anba.es6draft.runtime.ExecutionContext)16 Source (com.github.anba.es6draft.runtime.internal.Source)15 ParserException (com.github.anba.es6draft.parser.ParserException)9 Function (com.github.anba.es6draft.runtime.internal.Properties.Function)9 ModuleRecord (com.github.anba.es6draft.runtime.modules.ModuleRecord)8 ModuleLoader (com.github.anba.es6draft.runtime.modules.ModuleLoader)7 IOException (java.io.IOException)7 CompilationException (com.github.anba.es6draft.compiler.CompilationException)6 ScriptException (com.github.anba.es6draft.runtime.internal.ScriptException)6 ToSource (com.github.anba.es6draft.repl.SourceBuilder.ToSource)5 World (com.github.anba.es6draft.runtime.World)5 RuntimeContext (com.github.anba.es6draft.runtime.internal.RuntimeContext)5 ModuleSource (com.github.anba.es6draft.runtime.modules.ModuleSource)5 SourceIdentifier (com.github.anba.es6draft.runtime.modules.SourceIdentifier)5 GlobalObject (com.github.anba.es6draft.runtime.objects.GlobalObject)5 ExecutionContext.newEvalExecutionContext (com.github.anba.es6draft.runtime.ExecutionContext.newEvalExecutionContext)4