mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
* Implement builtin `time.add_date` method * Implement builtin `time.clock` method * Implement builtin `time.date` method * Implement builtin `time.diff` method * Implement builtin `time.format` method * Migrate `time.now_ns` to `chrono` * Implement builtin `time.parse_ns` method * Implement builtin `time.parse_rfc3339_ns` method * Implement builtin `time.weekday` method * Add conditional `test` module for OPA tests * Cache result of `time.now_ns` * Fail in strict mode if timestamp is outside of range * Add `ensure_i32` util * Move `diff_between_datetimes` into its own file and include appropriate license
28 lines
637 B
YAML
28 lines
637 B
YAML
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
|
|
cases:
|
|
- note: parse-rfc3339
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
|
|
a := time.parse_rfc3339_ns("1985-04-12T23:20:50.52Z")
|
|
b := time.parse_rfc3339_ns("1996-12-19T16:39:57-08:00")
|
|
|
|
query: data.test
|
|
want_result:
|
|
a: 482196050520000000
|
|
b: 851042397000000000
|
|
|
|
- note: invalid-type
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
|
|
a := time.parse_rfc3339_ns(482196050520000000)
|
|
query: data.test
|
|
error: '`time.parse_rfc3339_ns` expects string argument. Got `482196050520000000` instead'
|