summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/lsp_tests.rs502
-rw-r--r--cli/tests/integration/run_tests.rs14
-rw-r--r--cli/tests/testdata/run/unstable_temporal_api/main.out12
-rw-r--r--cli/tests/testdata/run/unstable_temporal_api/main.ts71
-rw-r--r--cli/tests/testdata/run/unstable_temporal_api/missing_flag.js1
-rw-r--r--cli/tests/testdata/run/unstable_temporal_api/missing_flag.out4
6 files changed, 548 insertions, 56 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index 94982c0a7..018dc9330 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -9012,68 +9012,458 @@ fn lsp_workspace_symbol() {
);
assert_eq!(
res,
- json!([{
- "name": "fieldA",
- "kind": 8,
- "location": {
- "uri": "file:///a/file.ts",
- "range": {
- "start": { "line": 1, "character": 2 },
- "end": { "line": 1, "character": 17 }
- }
+ json!([
+ {
+ "name": "fieldA",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file.ts",
+ "range": {
+ "start": {
+ "line": 1,
+ "character": 2
+ },
+ "end": {
+ "line": 1,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "A"
},
- "containerName": "A"
- }, {
- "name": "fieldB",
- "kind": 8,
- "location": {
- "uri": "file:///a/file.ts",
- "range": {
- "start": { "line": 2, "character": 2 },
- "end": { "line": 2, "character": 17 }
- }
+ {
+ "name": "fieldB",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file.ts",
+ "range": {
+ "start": {
+ "line": 2,
+ "character": 2
+ },
+ "end": {
+ "line": 2,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "A"
},
- "containerName": "A"
- }, {
- "name": "fieldC",
- "kind": 8,
- "location": {
- "uri": "file:///a/file_01.ts",
- "range": {
- "start": { "line": 1, "character": 2 },
- "end": { "line": 1, "character": 17 }
- }
+ {
+ "name": "fieldC",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file_01.ts",
+ "range": {
+ "start": {
+ "line": 1,
+ "character": 2
+ },
+ "end": {
+ "line": 1,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "B"
},
- "containerName": "B"
- }, {
- "name": "fieldD",
- "kind": 8,
- "location": {
- "uri": "file:///a/file_01.ts",
- "range": {
- "start": { "line": 2, "character": 2 },
- "end": { "line": 2, "character": 17 }
- }
+ {
+ "name": "fieldD",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file_01.ts",
+ "range": {
+ "start": {
+ "line": 2,
+ "character": 2
+ },
+ "end": {
+ "line": 2,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "B"
},
- "containerName": "B"
- }, {
- "name": "ClassFieldDecoratorContext",
- "kind": 11,
- "location": {
- "uri": "deno:/asset/lib.decorators.d.ts",
- "range": {
- "start": {
- "line": 343,
- "character": 0,
- },
- "end": {
- "line": 385,
- "character": 1,
- },
+ {
+ "name": "fields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3139,
+ "character": 4
+ },
+ "end": {
+ "line": 3139,
+ "character": 55
+ }
+ }
},
+ "containerName": "CalendarProtocol"
},
- "containerName": "",
- }])
+ {
+ "name": "fields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3309,
+ "character": 4
+ },
+ "end": {
+ "line": 3309,
+ "character": 47
+ }
+ }
+ },
+ "containerName": "Calendar"
+ },
+ {
+ "name": "ClassFieldDecoratorContext",
+ "kind": 11,
+ "location": {
+ "uri": "deno:/asset/lib.decorators.d.ts",
+ "range": {
+ "start": {
+ "line": 343,
+ "character": 0
+ },
+ "end": {
+ "line": 385,
+ "character": 1
+ }
+ }
+ },
+ "containerName": ""
+ },
+ {
+ "name": "dateFromFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3117,
+ "character": 4
+ },
+ "end": {
+ "line": 3120,
+ "character": 26
+ }
+ }
+ },
+ "containerName": "CalendarProtocol"
+ },
+ {
+ "name": "dateFromFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3287,
+ "character": 4
+ },
+ "end": {
+ "line": 3290,
+ "character": 26
+ }
+ }
+ },
+ "containerName": "Calendar"
+ },
+ {
+ "name": "getISOFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3413,
+ "character": 4
+ },
+ "end": {
+ "line": 3413,
+ "character": 39
+ }
+ }
+ },
+ "containerName": "PlainDate"
+ },
+ {
+ "name": "getISOFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3576,
+ "character": 4
+ },
+ "end": {
+ "line": 3576,
+ "character": 43
+ }
+ }
+ },
+ "containerName": "PlainDateTime"
+ },
+ {
+ "name": "getISOFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3625,
+ "character": 4
+ },
+ "end": {
+ "line": 3625,
+ "character": 39
+ }
+ }
+ },
+ "containerName": "PlainMonthDay"
+ },
+ {
+ "name": "getISOFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3744,
+ "character": 4
+ },
+ "end": {
+ "line": 3744,
+ "character": 39
+ }
+ }
+ },
+ "containerName": "PlainTime"
+ },
+ {
+ "name": "getISOFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3897,
+ "character": 4
+ },
+ "end": {
+ "line": 3897,
+ "character": 39
+ }
+ }
+ },
+ "containerName": "PlainYearMonth"
+ },
+ {
+ "name": "getISOFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 4056,
+ "character": 4
+ },
+ "end": {
+ "line": 4056,
+ "character": 43
+ }
+ }
+ },
+ "containerName": "ZonedDateTime"
+ },
+ {
+ "name": "mergeFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3140,
+ "character": 4
+ },
+ "end": {
+ "line": 3143,
+ "character": 31
+ }
+ }
+ },
+ "containerName": "CalendarProtocol"
+ },
+ {
+ "name": "mergeFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3310,
+ "character": 4
+ },
+ "end": {
+ "line": 3313,
+ "character": 31
+ }
+ }
+ },
+ "containerName": "Calendar"
+ },
+ {
+ "name": "monthDayFromFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3125,
+ "character": 4
+ },
+ "end": {
+ "line": 3128,
+ "character": 30
+ }
+ }
+ },
+ "containerName": "CalendarProtocol"
+ },
+ {
+ "name": "monthDayFromFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3295,
+ "character": 4
+ },
+ "end": {
+ "line": 3298,
+ "character": 30
+ }
+ }
+ },
+ "containerName": "Calendar"
+ },
+ {
+ "name": "PlainDateISOFields",
+ "kind": 5,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3329,
+ "character": 2
+ },
+ "end": {
+ "line": 3334,
+ "character": 4
+ }
+ }
+ },
+ "containerName": "Temporal"
+ },
+ {
+ "name": "PlainDateTimeISOFields",
+ "kind": 5,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3440,
+ "character": 2
+ },
+ "end": {
+ "line": 3451,
+ "character": 4
+ }
+ }
+ },
+ "containerName": "Temporal"
+ },
+ {
+ "name": "PlainTimeISOFields",
+ "kind": 5,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3645,
+ "character": 2
+ },
+ "end": {
+ "line": 3652,
+ "character": 4
+ }
+ }
+ },
+ "containerName": "Temporal"
+ },
+ {
+ "name": "yearMonthFromFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3121,
+ "character": 4
+ },
+ "end": {
+ "line": 3124,
+ "character": 31
+ }
+ }
+ },
+ "containerName": "CalendarProtocol"
+ },
+ {
+ "name": "yearMonthFromFields",
+ "kind": 6,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3291,
+ "character": 4
+ },
+ "end": {
+ "line": 3294,
+ "character": 31
+ }
+ }
+ },
+ "containerName": "Calendar"
+ },
+ {
+ "name": "ZonedDateTimeISOFields",
+ "kind": 5,
+ "location": {
+ "uri": "deno:/asset/lib.deno.unstable.d.ts",
+ "range": {
+ "start": {
+ "line": 3926,
+ "character": 2
+ },
+ "end": {
+ "line": 3939,
+ "character": 4
+ }
+ }
+ },
+ "containerName": "Temporal"
+ }
+ ])
);
client.shutdown();
}
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 38408c0f9..8db06470d 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -4925,3 +4925,17 @@ Warning Sloppy module resolution (hint: specify path to index.tsx file in direct
",
);
}
+
+itest!(unstable_temporal_api {
+ args: "run --unstable-temporal --check run/unstable_temporal_api/main.ts",
+ output: "run/unstable_temporal_api/main.out",
+ http_server: false,
+ exit_code: 0,
+});
+
+itest!(unstable_temporal_api_missing_flag {
+ args: "run run/unstable_temporal_api/missing_flag.js",
+ output: "run/unstable_temporal_api/missing_flag.out",
+ http_server: false,
+ exit_code: 1,
+});
diff --git a/cli/tests/testdata/run/unstable_temporal_api/main.out b/cli/tests/testdata/run/unstable_temporal_api/main.out
new file mode 100644
index 000000000..46d25c3ea
--- /dev/null
+++ b/cli/tests/testdata/run/unstable_temporal_api/main.out
@@ -0,0 +1,12 @@
+Check [WILDCARD]
+Temporal.Now [WILDCARD]
+Temporal.Instant 1969-07-20T20:17:00Z
+Temporal.ZonedDateTime 1995-12-07T03:24:30.0000035-08:00[America/Los_Angeles]
+Temporal.PlainDate 2006-08-24
+Temporal.PlainTime 19:39:09.068346205
+Temporal.PlainDateTime 1995-12-07T15:00:00
+Temporal.PlainYearMonth 2020-10
+Temporal.PlainMonthDay 07-14
+Temporal.Duration PT130H20M
+Temporal.TimeZone Africa/Cairo
+Temporal.Calendar 1999-12-31
diff --git a/cli/tests/testdata/run/unstable_temporal_api/main.ts b/cli/tests/testdata/run/unstable_temporal_api/main.ts
new file mode 100644
index 000000000..1641b90bf
--- /dev/null
+++ b/cli/tests/testdata/run/unstable_temporal_api/main.ts
@@ -0,0 +1,71 @@
+console.log("Temporal.Now", Temporal.Now.instant());
+console.log(
+ "Temporal.Instant",
+ Temporal.Instant.from("1969-07-20T20:17Z"),
+);
+console.log(
+ "Temporal.ZonedDateTime",
+ Temporal.ZonedDateTime.from({
+ timeZone: "America/Los_Angeles",
+ year: 1995,
+ month: 12,
+ day: 7,
+ hour: 3,
+ minute: 24,
+ second: 30,
+ millisecond: 0,
+ microsecond: 3,
+ nanosecond: 500,
+ }),
+);
+console.log(
+ "Temporal.PlainDate",
+ Temporal.PlainDate.from({ year: 2006, month: 8, day: 24 }),
+);
+console.log(
+ "Temporal.PlainTime",
+ Temporal.PlainTime.from({
+ hour: 19,
+ minute: 39,
+ second: 9,
+ millisecond: 68,
+ microsecond: 346,
+ nanosecond: 205,
+ }),
+);
+console.log(
+ "Temporal.PlainDateTime",
+ Temporal.PlainDateTime.from({
+ year: 1995,
+ month: 12,
+ day: 7,
+ hour: 15,
+ }),
+);
+console.log(
+ "Temporal.PlainYearMonth",
+ Temporal.PlainYearMonth.from({ year: 2020, month: 10 }),
+);
+console.log(
+ "Temporal.PlainMonthDay",
+ Temporal.PlainMonthDay.from({ month: 7, day: 14 }),
+);
+console.log(
+ "Temporal.Duration",
+ Temporal.Duration.from({
+ hours: 130,
+ minutes: 20,
+ }),
+);
+console.log(
+ "Temporal.TimeZone",
+ Temporal.TimeZone.from("Africa/Cairo"),
+);
+console.log(
+ "Temporal.Calendar",
+ Temporal.Calendar.from("iso8601").dateFromFields({
+ year: 1999,
+ month: 12,
+ day: 31,
+ }, {}),
+);
diff --git a/cli/tests/testdata/run/unstable_temporal_api/missing_flag.js b/cli/tests/testdata/run/unstable_temporal_api/missing_flag.js
new file mode 100644
index 000000000..92aed7931
--- /dev/null
+++ b/cli/tests/testdata/run/unstable_temporal_api/missing_flag.js
@@ -0,0 +1 @@
+Temporal.Now.instant();
diff --git a/cli/tests/testdata/run/unstable_temporal_api/missing_flag.out b/cli/tests/testdata/run/unstable_temporal_api/missing_flag.out
new file mode 100644
index 000000000..8f8e23e70
--- /dev/null
+++ b/cli/tests/testdata/run/unstable_temporal_api/missing_flag.out
@@ -0,0 +1,4 @@
+error: Uncaught (in promise) ReferenceError: Temporal is not defined
+Temporal.Now.instant();
+^
+ at [WILDCARD]missing_flag.js:1:1