mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
style: 自动格式化
This commit is contained in:
@@ -845,11 +845,7 @@ pub fn bind_temporal(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
oxide_builtins::temporal::plain_date_time_with_plain_time::<crate::vm::Vm> as *const (),
|
||||
0,
|
||||
),
|
||||
(
|
||||
"round",
|
||||
oxide_builtins::temporal::plain_date_time_round::<crate::vm::Vm> as *const (),
|
||||
1,
|
||||
),
|
||||
("round", oxide_builtins::temporal::plain_date_time_round::<crate::vm::Vm> as *const (), 1),
|
||||
],
|
||||
);
|
||||
bind_well_known_data_property(
|
||||
@@ -1145,11 +1141,7 @@ pub fn bind_temporal(env: BindEnv<'_>, global: &mut JsObject) {
|
||||
),
|
||||
("until", oxide_builtins::temporal::plain_year_month_until::<crate::vm::Vm> as *const (), 1),
|
||||
("since", oxide_builtins::temporal::plain_year_month_since::<crate::vm::Vm> as *const (), 1),
|
||||
(
|
||||
"round",
|
||||
oxide_builtins::temporal::plain_year_month_round::<crate::vm::Vm> as *const (),
|
||||
1,
|
||||
),
|
||||
("round", oxide_builtins::temporal::plain_year_month_round::<crate::vm::Vm> as *const (), 1),
|
||||
],
|
||||
);
|
||||
bind_well_known_data_property(
|
||||
|
||||
@@ -4386,12 +4386,18 @@ fn plain_date_round_calendar_units() {
|
||||
fn plain_date_round_errors_and_calendar() {
|
||||
let mut vm = Vm::new();
|
||||
// 缺参 / undefined → TypeError(roundTo 非串非对象)。
|
||||
let r = eval(&mut vm, "try { new Temporal.PlainDate(1976, 11, 18).round() } catch (e) { e.constructor.name }")
|
||||
.unwrap();
|
||||
let r = eval(
|
||||
&mut vm,
|
||||
"try { new Temporal.PlainDate(1976, 11, 18).round() } catch (e) { e.constructor.name }",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(str_val(&vm, r), "TypeError");
|
||||
// 对象缺 smallestUnit → RangeError。
|
||||
let r = eval(&mut vm, "try { new Temporal.PlainDate(1976, 11, 18).round({}) } catch (e) { e.constructor.name }")
|
||||
.unwrap();
|
||||
let r = eval(
|
||||
&mut vm,
|
||||
"try { new Temporal.PlainDate(1976, 11, 18).round({}) } catch (e) { e.constructor.name }",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(str_val(&vm, r), "RangeError");
|
||||
// 非法最小单位(PD 限 year/month/week/day)→ RangeError。
|
||||
let r = eval(
|
||||
@@ -4408,11 +4414,7 @@ fn plain_date_round_errors_and_calendar() {
|
||||
.unwrap();
|
||||
assert_eq!(str_val(&vm, r), "RangeError");
|
||||
// 日历槽继承 receiver。
|
||||
let r = eval(
|
||||
&mut vm,
|
||||
"new Temporal.PlainDate(1976, 11, 18, 'hebrew').round('month').calendarId",
|
||||
)
|
||||
.unwrap();
|
||||
let r = eval(&mut vm, "new Temporal.PlainDate(1976, 11, 18, 'hebrew').round('month').calendarId").unwrap();
|
||||
assert_eq!(str_val(&vm, r), "hebrew");
|
||||
}
|
||||
|
||||
@@ -4573,11 +4575,7 @@ fn plain_year_month_round_errors_and_calendar() {
|
||||
.unwrap();
|
||||
assert_eq!(str_val(&vm, r), "RangeError");
|
||||
// 日历槽继承 receiver。
|
||||
let r = eval(
|
||||
&mut vm,
|
||||
"new Temporal.PlainYearMonth(1976, 11, 'hebrew').round('year').calendarId",
|
||||
)
|
||||
.unwrap();
|
||||
let r = eval(&mut vm, "new Temporal.PlainYearMonth(1976, 11, 'hebrew').round('year').calendarId").unwrap();
|
||||
assert_eq!(str_val(&vm, r), "hebrew");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user