From 1a0c7edebacc76a70e57dfd494e24420fa77b56b Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Tue, 18 Oct 2022 15:33:35 +0200 Subject: feat: introduce navigator.language (#12322) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Link to the spec: https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language-dev Co-authored-by: Bartek IwaƄczuk --- cli/tests/integration/run_tests.rs | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'cli/tests/integration/run_tests.rs') diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 004acb469..156940185 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -2377,6 +2377,59 @@ itest!(eval_context_throw_dom_exception { output: "run/eval_context_throw_dom_exception.js.out", }); +#[test] +#[cfg(unix)] +fn navigator_language_unix() { + let (res, _) = util::run_and_collect_output( + true, + "run navigator_language.ts", + None, + Some(vec![("LC_ALL".to_owned(), "pl_PL".to_owned())]), + false, + ); + assert_eq!(res, "pl-PL\n") +} + +#[test] +fn navigator_language() { + let (res, _) = util::run_and_collect_output( + true, + "run navigator_language.ts", + None, + None, + false, + ); + assert!(!res.is_empty()) +} + +#[test] +#[cfg(unix)] +fn navigator_languages_unix() { + let (res, _) = util::run_and_collect_output( + true, + "run navigator_languages.ts", + None, + Some(vec![ + ("LC_ALL".to_owned(), "pl_PL".to_owned()), + ("NO_COLOR".to_owned(), "1".to_owned()), + ]), + false, + ); + assert_eq!(res, "[ \"pl-PL\" ]\n") +} + +#[test] +fn navigator_languages() { + let (res, _) = util::run_and_collect_output( + true, + "run navigator_languages.ts", + None, + None, + false, + ); + assert!(!res.is_empty()) +} + /// Regression test for https://github.com/denoland/deno/issues/12740. #[test] fn issue12740() { -- cgit v1.2.3