@ -70,7 +70,7 @@ fn date_this_time_value() {
}
#[ test ]
fn date_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_call ( ) {
let mut context = Context ::default ( ) ;
let dt1 = forward ( & mut context , "Date()" ) ;
@ -80,11 +80,10 @@ fn date_call() -> Result<(), Box<dyn std::error::Error>> {
let dt2 = forward ( & mut context , "Date()" ) ;
assert_ne! ( dt1 , dt2 ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call ( ) {
let mut context = Context ::default ( ) ;
let dt1 = forward_dt_local ( & mut context , "new Date()" ) ;
@ -94,11 +93,10 @@ fn date_ctor_call() -> Result<(), Box<dyn std::error::Error>> {
let dt2 = forward_dt_local ( & mut context , "new Date()" ) ;
assert_ne! ( dt1 , dt2 ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_string ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_utc ( & mut context , "new Date('2020-06-08T09:16:15.779-06:30')" ) ;
@ -108,20 +106,18 @@ fn date_ctor_call_string() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 06 , 08 ) . and_hms_milli ( 15 , 46 , 15 , 779 ) ) ,
date_time
) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_string_invalid ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_string_invalid ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_local ( & mut context , "new Date('nope')" ) ;
assert_eq! ( None , date_time ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_number ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_number ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_utc ( & mut context , "new Date(1594199775779)" ) ;
@ -129,11 +125,10 @@ fn date_ctor_call_number() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
date_time
) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_date ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_date ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_utc ( & mut context , "new Date(new Date(1594199775779))" ) ;
@ -142,11 +137,10 @@ fn date_ctor_call_date() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
date_time
) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_multiple ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_multiple ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_local ( & mut context , "new Date(2020, 06, 08, 09, 16, 15, 779)" ) ;
@ -155,11 +149,10 @@ fn date_ctor_call_multiple() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
date_time
) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_multiple_90s ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_multiple_90s ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_local ( & mut context , "new Date(99, 06, 08, 09, 16, 15, 779)" ) ;
@ -168,11 +161,10 @@ fn date_ctor_call_multiple_90s() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 1999 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
date_time
) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_call_multiple_nan ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_call_multiple_nan ( ) {
fn check ( src : & str ) {
let mut context = Context ::default ( ) ;
let date_time = forward_dt_local ( & mut context , src ) ;
@ -186,48 +178,43 @@ fn date_ctor_call_multiple_nan() -> Result<(), Box<dyn std::error::Error>> {
check ( "new Date(2020, 06, 08, 09, 1/0, 15, 779)" ) ;
check ( "new Date(2020, 06, 08, 09, 16, 1/0, 779)" ) ;
check ( "new Date(2020, 06, 08, 09, 16, 15, 1/0)" ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_now_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_now_call ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward ( & mut context , "Date.now()" ) ;
let dt1 = date_time . parse ::< u64 > ( ) ? ;
let dt1 = date_time . parse ::< u64 > ( ) . unwrap ( ) ;
std ::thread ::sleep ( std ::time ::Duration ::from_millis ( 1 ) ) ;
let date_time = forward ( & mut context , "Date.now()" ) ;
let dt2 = date_time . parse ::< u64 > ( ) ? ;
let dt2 = date_time . parse ::< u64 > ( ) . unwrap ( ) ;
assert_ne! ( dt1 , dt2 ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_parse_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_parse_call ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_val ( & mut context , "Date.parse('2020-06-08T09:16:15.779-07:30')" ) ;
assert_eq! ( Ok ( JsValue ::new ( 1591634775779 f64 ) ) , date_time ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_utc_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_utc_call ( ) {
let mut context = Context ::default ( ) ;
let date_time = forward_val ( & mut context , "Date.UTC(2020, 06, 08, 09, 16, 15, 779)" ) ;
assert_eq! ( Ok ( JsValue ::new ( 1594199775779 f64 ) ) , date_time ) ;
Ok ( ( ) )
}
#[ test ]
fn date_ctor_utc_call_nan ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_ctor_utc_call_nan ( ) {
fn check ( src : & str ) {
let mut context = Context ::default ( ) ;
let date_time = forward_val ( & mut context , src ) . expect ( "Expected Success" ) ;
@ -241,12 +228,10 @@ fn date_ctor_utc_call_nan() -> Result<(), Box<dyn std::error::Error>> {
check ( "Date.UTC(2020, 06, 08, 09, 1/0, 15, 779)" ) ;
check ( "Date.UTC(2020, 06, 08, 09, 16, 1/0, 779)" ) ;
check ( "Date.UTC(2020, 06, 08, 09, 16, 15, 1/0)" ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_date_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_date_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -257,12 +242,10 @@ fn date_proto_get_date_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getDate()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_day_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_day_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -273,11 +256,10 @@ fn date_proto_get_day_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getDay()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_full_year_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_full_year_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -288,11 +270,10 @@ fn date_proto_get_full_year_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getFullYear()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_hours_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_hours_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -303,11 +284,10 @@ fn date_proto_get_hours_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getHours()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_milliseconds_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_milliseconds_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -318,11 +298,10 @@ fn date_proto_get_milliseconds_call() -> Result<(), Box<dyn std::error::Error>>
let actual = forward_val ( & mut context , "new Date(1/0).getMilliseconds()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_minutes_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_minutes_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -333,11 +312,10 @@ fn date_proto_get_minutes_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getMinutes()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_month ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_month ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -348,12 +326,10 @@ fn date_proto_get_month() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getMonth()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_seconds ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_seconds ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -364,11 +340,10 @@ fn date_proto_get_seconds() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getSeconds()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_time ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_time ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -384,11 +359,10 @@ fn date_proto_get_time() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getTime()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_year ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_year ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -399,11 +373,10 @@ fn date_proto_get_year() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getYear()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_timezone_offset ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_timezone_offset ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -420,7 +393,7 @@ fn date_proto_get_timezone_offset() -> Result<(), Box<dyn std::error::Error>> {
) ;
// The value of now().offset() depends on the host machine, so we have to replicate the method code here.
let offset_seconds = chrono ::Local ::now ( ) . offset ( ) . local_minus_utc ( ) as f64 ;
let offset_seconds = f64 ::from ( chrono ::Local ::now ( ) . offset ( ) . local_minus_utc ( ) ) ;
let offset_minutes = - offset_seconds / 60 f64 ;
assert_eq! ( Ok ( JsValue ::new ( offset_minutes ) ) , actual ) ;
@ -429,11 +402,10 @@ fn date_proto_get_timezone_offset() -> Result<(), Box<dyn std::error::Error>> {
"new Date('1975-08-19T23:15:30+07:00').getTimezoneOffset()" ,
) ;
assert_eq! ( Ok ( JsValue ::new ( offset_minutes ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_date_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_date_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -444,12 +416,10 @@ fn date_proto_get_utc_date_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getUTCDate()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_day_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_day_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -460,11 +430,10 @@ fn date_proto_get_utc_day_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getUTCDay()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_full_year_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_full_year_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -475,11 +444,10 @@ fn date_proto_get_utc_full_year_call() -> Result<(), Box<dyn std::error::Error>>
let actual = forward_val ( & mut context , "new Date(1/0).getUTCFullYear()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_hours_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_hours_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -490,11 +458,10 @@ fn date_proto_get_utc_hours_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getUTCHours()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_milliseconds_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_milliseconds_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -505,11 +472,10 @@ fn date_proto_get_utc_milliseconds_call() -> Result<(), Box<dyn std::error::Erro
let actual = forward_val ( & mut context , "new Date(1/0).getUTCMilliseconds()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_minutes_call ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_minutes_call ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -520,11 +486,10 @@ fn date_proto_get_utc_minutes_call() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getUTCMinutes()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_month ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_month ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -535,12 +500,10 @@ fn date_proto_get_utc_month() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getUTCMonth()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_get_utc_seconds ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_get_utc_seconds ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -551,11 +514,10 @@ fn date_proto_get_utc_seconds() -> Result<(), Box<dyn std::error::Error>> {
let actual = forward_val ( & mut context , "new Date(1/0).getUTCSeconds()" ) ;
assert_eq! ( Ok ( JsValue ::nan ( ) ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_date ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_date ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -582,12 +544,10 @@ fn date_proto_set_date() -> Result<(), Box<dyn std::error::Error>> {
"dt = new Date(2020, 06, 08, 09, 16, 15, 779); dt.setDate(1/0); dt" ,
) ;
assert_eq! ( None , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_full_year ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_full_year ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -654,12 +614,10 @@ fn date_proto_set_full_year() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2010 , 02 , 23 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_hours ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_hours ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -708,12 +666,10 @@ fn date_proto_set_hours() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2021 , 09 , 11 ) . and_hms_milli ( 21 , 40 , 40 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_milliseconds ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_milliseconds ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -736,12 +692,10 @@ fn date_proto_set_milliseconds() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 55 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_minutes ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_minutes ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -782,12 +736,10 @@ fn date_proto_set_minutes() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2021 , 08 , 29 ) . and_hms_milli ( 09 , 20 , 40 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_month ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_month ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -819,12 +771,10 @@ fn date_proto_set_month() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2023 , 07 , 22 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_seconds ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_seconds ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -856,12 +806,10 @@ fn date_proto_set_seconds() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2021 , 11 , 14 ) . and_hms_milli ( 08 , 23 , 20 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn set_year ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn set_year ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -881,12 +829,10 @@ fn set_year() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2001 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_time ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_time ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_local (
@ -897,12 +843,10 @@ fn date_proto_set_time() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_date ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_date ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -929,12 +873,10 @@ fn date_proto_set_utc_date() -> Result<(), Box<dyn std::error::Error>> {
"dt = new Date(Date.UTC(2020, 06, 08, 09, 16, 15, 779)); dt.setUTCDate(1/0); dt" ,
) ;
assert_eq! ( None , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_full_year ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_full_year ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -1001,12 +943,10 @@ fn date_proto_set_utc_full_year() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2010 , 02 , 23 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_hours ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_hours ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -1055,12 +995,10 @@ fn date_proto_set_utc_hours() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2021 , 09 , 11 ) . and_hms_milli ( 21 , 40 , 40 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_milliseconds ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_milliseconds ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -1083,12 +1021,10 @@ fn date_proto_set_utc_milliseconds() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2020 , 07 , 08 ) . and_hms_milli ( 09 , 16 , 55 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_minutes ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_minutes ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -1129,12 +1065,10 @@ fn date_proto_set_utc_minutes() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2021 , 08 , 29 ) . and_hms_milli ( 09 , 20 , 40 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_month ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_month ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -1166,12 +1100,10 @@ fn date_proto_set_utc_month() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2023 , 07 , 22 ) . and_hms_milli ( 09 , 16 , 15 , 779 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_set_utc_seconds ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_set_utc_seconds ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_dt_utc (
@ -1203,12 +1135,10 @@ fn date_proto_set_utc_seconds() -> Result<(), Box<dyn std::error::Error>> {
Some ( NaiveDate ::from_ymd ( 2021 , 11 , 14 ) . and_hms_milli ( 08 , 23 , 20 , 123 ) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_date_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_date_string ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1217,12 +1147,10 @@ fn date_proto_to_date_string() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( "Wed Jul 08 2020" ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_gmt_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_gmt_string ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1231,12 +1159,10 @@ fn date_proto_to_gmt_string() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( "Wed, 08 Jul 2020 09:16:15 GMT" ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_iso_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_iso_string ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1245,12 +1171,10 @@ fn date_proto_to_iso_string() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( "2020-07-08T09:16:15.779Z" ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_json ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_json ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1259,12 +1183,10 @@ fn date_proto_to_json() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( "2020-07-08T09:16:15.779Z" ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_string ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1287,12 +1209,10 @@ fn date_proto_to_string() -> Result<(), Box<dyn std::error::Error>> {
) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_time_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_time_string ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1315,12 +1235,10 @@ fn date_proto_to_time_string() -> Result<(), Box<dyn std::error::Error>> {
) ) ,
actual
) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_to_utc_string ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_to_utc_string ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1329,12 +1247,10 @@ fn date_proto_to_utc_string() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( "Wed, 08 Jul 2020 09:16:15 GMT" ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_proto_value_of ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_proto_value_of ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1343,12 +1259,10 @@ fn date_proto_value_of() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( 1594199775779 f64 ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_neg ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_neg ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1357,12 +1271,10 @@ fn date_neg() -> Result<(), Box<dyn std::error::Error>> {
)
. expect ( "Successful eval" ) ;
assert_eq! ( JsValue ::new ( - 1594199775779 f64 ) , actual ) ;
Ok ( ( ) )
}
#[ test ]
fn date_json ( ) -> Result < ( ) , Box < dyn std ::error ::Error > > {
fn date_json ( ) {
let mut context = Context ::default ( ) ;
let actual = forward_val (
@ -1374,6 +1286,4 @@ fn date_json() -> Result<(), Box<dyn std::error::Error>> {
JsValue ::new ( r#"{"date":"2020-07-08T09:16:15.779Z"}"# ) ,
actual
) ;
Ok ( ( ) )
}