mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibJS: Implement rawJSON and isRawJSON functions
This commit is contained in:
Notes:
github-actions[bot]
2025-04-24 13:34:52 +00:00
Author: https://github.com/aplefull Commit: https://github.com/LadybirdBrowser/ladybird/commit/223c9c91e6b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4451 Reviewed-by: https://github.com/trflynn89 ✅
14
Libraries/LibJS/Tests/builtins/JSON/JSON.isRawJSON.js
Normal file
14
Libraries/LibJS/Tests/builtins/JSON/JSON.isRawJSON.js
Normal file
@@ -0,0 +1,14 @@
|
||||
test("JSON.isRawJSON basic functionality", () => {
|
||||
const values = [1, 1.1, null, false, true, "123"];
|
||||
|
||||
for (const value of values) {
|
||||
expect(JSON.isRawJSON(value)).toBeFalse();
|
||||
expect(JSON.isRawJSON(JSON.rawJSON(value))).toBeTrue();
|
||||
}
|
||||
|
||||
expect(JSON.isRawJSON(undefined)).toBeFalse();
|
||||
expect(JSON.isRawJSON(Symbol("123"))).toBeFalse();
|
||||
expect(JSON.isRawJSON([])).toBeFalse();
|
||||
expect(JSON.isRawJSON({})).toBeFalse();
|
||||
expect(JSON.isRawJSON({ rawJSON: "123" })).toBeFalse();
|
||||
});
|
||||
Reference in New Issue
Block a user