Skip to content

Commit

Permalink
Added a testcase to GetLocaleInfo() function for LDEV-2315
Browse files Browse the repository at this point in the history
  • Loading branch information
cfmitrah committed Feb 14, 2024
1 parent db86320 commit 7f01df0
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions test/tickets/LDEV2315.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
component extends="org.lucee.cfml.test.LuceeTestCase" {

function run( testResults , testBox ) {
describe( "Test suite for LDEV-2315", function() {

it( title='Checking getLocaleInfo() function', body=function( currentSpec ) {

res = getLocaleInfo();

expect(res).toHaveKey("country");
expect(res).toHaveKey("currency");
expect(res).toHaveKey("dateTimeFormat");
expect(res).toHaveKey("display");
expect(res).toHaveKey("iso");
expect(res).toHaveKey("language");
expect(res).toHaveKey("name");
expect(res).toHaveKey("variant");
});

it( title='Checking getLocaleInfo() function with different timeZone', body=function( currentSpec ) {

origLocale = getLocale();

// en_US
setLocale("english (united states)");
res = getLocaleInfo();
expect(res.country).toBe("US");
expect(res.currency.code).toBe("USD");
expect(res.currency.symbol).toBe("$"); // $
expect(res.dateTimeFormat.date).toBe("EEEE, MMMM d, y");
expect(res.dateTimeFormat.time).toBe("h:mm:ss a");

// jpn
setLocale("ja_JP_JP");
res = getLocaleInfo();
expect(res.country).toBe("JP");
expect(res.currency.code).toBe("JPY");
expect(Asc(res.currency.symbol)).toBe("65509"); // د.ج.
expect(res.dateTimeFormat.time).toBe("H:mm:ss");

// dutch (belgium)
setLocale("dutch (belgium)");
res = getLocaleInfo();
expect(res.country).toBe("BE");
expect(res.currency.code).toBe("EUR");
expect(Asc(res.currency.symbol)).toBe("8364"); //
expect(res.dateTimeFormat.date).toBe("EEEE d MMMM y");
expect(res.dateTimeFormat.time).toBe("HH:mm:ss");

// spanish (argentina)
setLocale("spanish (argentina)");
res = getLocaleInfo();
expect(res.country).toBe("AR");
expect(res.currency.code).toBe("ARS");
expect(Asc(res.currency.symbol)).toBe("36"); // $
expect(res.dateTimeFormat.date).toBe("EEEE, d 'de' MMMM 'de' y");
expect(res.dateTimeFormat.time).toBe("HH:mm:ss");

setLocale(origLocale);
});
});
}

}

0 comments on commit 7f01df0

Please sign in to comment.