Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions apps/browser-demos/test/locale-info.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { expect, test } from "@playwright/test";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";

const __dirname = dirname(fileURLToPath(import.meta.url));
const programPath = resolve(
__dirname,
"../../../examples/locale_info_test.wasm",
);

test("locale object names and alternate months work in Chromium", async ({
page,
baseURL,
browserName,
}) => {
test.skip(
browserName !== "chromium",
"the aggregate browser gate uses Chromium",
);
expect(baseURL).toBeTruthy();

const runtimeErrors: string[] = [];
page.on("console", (message) => {
if (message.type() === "error") {
runtimeErrors.push(`console: ${message.text()}`);
}
});
page.on("pageerror", (error) => {
runtimeErrors.push(`pageerror: ${error.message}`);
});
await page.route("**/favicon.ico", (route) =>
route.fulfill({ status: 204 }),
);

await page.goto(new URL("/pages/test-runner/", baseURL).href);
await page.waitForFunction(() => (window as any).__testRunnerReady === true);

const programUrl = new URL(`/@fs/${programPath}`, baseURL).href;
const result = await page.evaluate(
async ({ programUrl }) => {
const response = await fetch(programUrl);
if (!response.ok) {
throw new Error(`program fetch failed: ${response.status}`);
}
return (window as any).__runTest(
await response.arrayBuffer(),
["locale-info-test"],
60_000,
);
},
{ programUrl },
);

expect(result.exitCode, result.stderr).toBe(0);
expect(result.stdout).toBe("locale-info-ok\n");
expect(result.stderr).toBe("");
expect(runtimeErrors).toEqual([]);
});
7 changes: 7 additions & 0 deletions docs/posix-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ All virtual devices return synthetic `stat()` with `S_IFCHR | 0666`, determinist
| `setenv()` / `unsetenv()` | Full | Kernel-managed. setenv supports overwrite flag. Rejects empty name or name containing '='. |
| `environ` | Partial | Stored as Vec of KEY=VALUE entries in Process. No C-style char** environ pointer yet. |

## Locale

| Function | Status | Notes |
|----------|--------|-------|
| `getlocalename_l()` | Full | Returns the real per-category name from local and global locale objects. LC_ALL returns a `setlocale()`-compatible name, including mixed-category locales. |
| `nl_langinfo()` / `nl_langinfo_l()` | Partial | Implements musl's locale data plus POSIX.1-2024 `ALTMON_1` through `ALTMON_12` and `ABALTMON_1` through `ABALTMON_12`. Musl catalogs do not encode a distinct alternate grammatical month form, so those items fall back to the corresponding full or abbreviated month name. |

## System Information

| Function | Status | Notes |
Expand Down
Loading