Skip to content

Implement new Nudge changes #635

@Manishearth

Description

@Manishearth

tc39/proposal-temporal#3172

Test:

/// Test for https://github.com/tc39/proposal-temporal/pull/3172/
///
/// test262: built-ins/Temporal/Duration/prototype/total/rounding-window
#[test]
#[cfg(feature = "compiled_data")]
fn test_nudge_relative_date_total() {
    let d = Duration::new(1, 0, 0, 0, 1, 0, 0, 0, 0, 0).unwrap();
    let relative = PlainDate::new(2020, 2, 29, Calendar::ISO).unwrap();
    assert_eq!(d.total(Unit::Year, Some(relative.into())).unwrap(), 1.0001141552511414);


    let d = Duration::new(0, 1, 0, 0, 10, 0, 0, 0, 0, 0).unwrap();
    let relative = PlainDate::new(2020, 1, 31, Calendar::ISO).unwrap();
    assert_eq!(d.total(Unit::Month, Some(relative.into())).unwrap(), 1.0134408602150538);
}

(a similar test can be written based on the round test in test262)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions