-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
369 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
use time::macros::date; | ||
|
||
fn main() { | ||
let _ = date!(+1_000_000-01-01); //~ERROR invalid component: year was 1000000 | ||
let _ = date!(10_000 - 01 - 01); //~ERROR years with more than four digits must have an explicit sign | ||
let _ = date!(2021-W 60-1); //~ERROR invalid component: week was 60 | ||
let _ = date!(2021-W 01-0); //~ERROR invalid component: day was 0 | ||
let _ = date!(2021-W 01-8); //~ERROR invalid component: day was 8 | ||
let _ = date!(2021 - 00 - 01); //~ERROR invalid component: month was 0 | ||
let _ = date!(2021 - 13 - 01); //~ERROR invalid component: month was 13 | ||
let _ = date!(2021 - 01 - 00); //~ERROR invalid component: day was 0 | ||
let _ = date!(2021 - 01 - 32); //~ERROR invalid component: day was 32 | ||
let _ = date!(2021 - 000); //~ERROR invalid component: ordinal was 0 | ||
let _ = date!(2021 - 366); //~ERROR invalid component: ordinal was 366 | ||
let _ = date!(0a); //~ERROR invalid component: year was 0a | ||
let _ = date!(2021:); //~ERROR unexpected token: : | ||
let _ = date!(2021-W 0a); //~ERROR invalid component: week was 0a | ||
let _ = date!(2021-W 01:); //~ERROR unexpected token: : | ||
let _ = date!(2021-W 01-0a); //~ERROR invalid component: day was 0a | ||
let _ = date!(2021-0a); //~ERROR invalid component: month or ordinal was 0a | ||
let _ = date!(2021-01-0a); //~ERROR invalid component: day was 0a | ||
let _ = date!(+1_000_000-01-01); | ||
let _ = date!(10_000 - 01 - 01); | ||
let _ = date!(2021-W 60-1); | ||
let _ = date!(2021-W 01-0); | ||
let _ = date!(2021-W 01-8); | ||
let _ = date!(2021 - 00 - 01); | ||
let _ = date!(2021 - 13 - 01); | ||
let _ = date!(2021 - 01 - 00); | ||
let _ = date!(2021 - 01 - 32); | ||
let _ = date!(2021 - 000); | ||
let _ = date!(2021 - 366); | ||
let _ = date!(0a); | ||
let _ = date!(2021:); | ||
let _ = date!(2021-W 0a); | ||
let _ = date!(2021-W 01:); | ||
let _ = date!(2021-W 01-0a); | ||
let _ = date!(2021-0a); | ||
let _ = date!(2021-01-0a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
error: invalid component: year was 1000000 | ||
--> $DIR/invalid_date.rs:4:19 | ||
| | ||
4 | let _ = date!(+1_000_000-01-01); | ||
| ^^^^^^^^^^ | ||
|
||
error: years with more than four digits must have an explicit sign | ||
--> $DIR/invalid_date.rs:5:19 | ||
| | ||
5 | let _ = date!(10_000 - 01 - 01); | ||
| ^^^^^^ | ||
|
||
error: invalid component: week was 60 | ||
--> $DIR/invalid_date.rs:6:24 | ||
| | ||
6 | let _ = date!(2021-W 60-1); | ||
| ^^^^ | ||
|
||
error: invalid component: day was 0 | ||
--> $DIR/invalid_date.rs:7:29 | ||
| | ||
7 | let _ = date!(2021-W 01-0); | ||
| ^ | ||
|
||
error: invalid component: day was 8 | ||
--> $DIR/invalid_date.rs:8:29 | ||
| | ||
8 | let _ = date!(2021-W 01-8); | ||
| ^ | ||
|
||
error: invalid component: month was 0 | ||
--> $DIR/invalid_date.rs:9:26 | ||
| | ||
9 | let _ = date!(2021 - 00 - 01); | ||
| ^^ | ||
|
||
error: invalid component: month was 13 | ||
--> $DIR/invalid_date.rs:10:26 | ||
| | ||
10 | let _ = date!(2021 - 13 - 01); | ||
| ^^ | ||
|
||
error: invalid component: day was 0 | ||
--> $DIR/invalid_date.rs:11:31 | ||
| | ||
11 | let _ = date!(2021 - 01 - 00); | ||
| ^^ | ||
|
||
error: invalid component: day was 32 | ||
--> $DIR/invalid_date.rs:12:31 | ||
| | ||
12 | let _ = date!(2021 - 01 - 32); | ||
| ^^ | ||
|
||
error: invalid component: ordinal was 0 | ||
--> $DIR/invalid_date.rs:13:26 | ||
| | ||
13 | let _ = date!(2021 - 000); | ||
| ^^^ | ||
|
||
error: invalid component: ordinal was 366 | ||
--> $DIR/invalid_date.rs:14:26 | ||
| | ||
14 | let _ = date!(2021 - 366); | ||
| ^^^ | ||
|
||
error: invalid component: year was 0a | ||
--> $DIR/invalid_date.rs:15:19 | ||
| | ||
15 | let _ = date!(0a); | ||
| ^^ | ||
|
||
error: unexpected token: : | ||
--> $DIR/invalid_date.rs:16:23 | ||
| | ||
16 | let _ = date!(2021:); | ||
| ^ | ||
|
||
error: invalid component: week was 0a | ||
--> $DIR/invalid_date.rs:17:26 | ||
| | ||
17 | let _ = date!(2021-W 0a); | ||
| ^^ | ||
|
||
error: unexpected token: : | ||
--> $DIR/invalid_date.rs:18:28 | ||
| | ||
18 | let _ = date!(2021-W 01:); | ||
| ^ | ||
|
||
error: invalid component: day was 0a | ||
--> $DIR/invalid_date.rs:19:29 | ||
| | ||
19 | let _ = date!(2021-W 01-0a); | ||
| ^^ | ||
|
||
error: invalid component: month or ordinal was 0a | ||
--> $DIR/invalid_date.rs:20:24 | ||
| | ||
20 | let _ = date!(2021-0a); | ||
| ^^ | ||
|
||
error: invalid component: day was 0a | ||
--> $DIR/invalid_date.rs:21:27 | ||
| | ||
21 | let _ = date!(2021-01-0a); | ||
| ^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
use time::macros::datetime; | ||
|
||
fn main() { | ||
let _ = datetime!(2021 - 000 0:00); //~ERROR invalid component: ordinal was 0 | ||
let _ = datetime!(2021 - 001 24:00); //~ERROR invalid component: hour was 24 | ||
let _ = datetime!(2021 - 001 0:00 0); //~ERROR unexpected token: 0 | ||
let _ = datetime!(2021 - 001 0:00 UTC x); //~ERROR unexpected token: x | ||
let _ = datetime!(2021 - 000 0:00); | ||
let _ = datetime!(2021 - 001 24:00); | ||
let _ = datetime!(2021 - 001 0:00 0); | ||
let _ = datetime!(2021 - 001 0:00 UTC x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: invalid component: ordinal was 0 | ||
--> $DIR/invalid_datetime.rs:4:30 | ||
| | ||
4 | let _ = datetime!(2021 - 000 0:00); | ||
| ^^^ | ||
|
||
error: invalid component: hour was 24 | ||
--> $DIR/invalid_datetime.rs:5:34 | ||
| | ||
5 | let _ = datetime!(2021 - 001 24:00); | ||
| ^^ | ||
|
||
error: unexpected token: 0 | ||
--> $DIR/invalid_datetime.rs:6:39 | ||
| | ||
6 | let _ = datetime!(2021 - 001 0:00 0); | ||
| ^ | ||
|
||
error: unexpected token: x | ||
--> $DIR/invalid_datetime.rs:7:43 | ||
| | ||
7 | let _ = datetime!(2021 - 001 0:00 UTC x); | ||
| ^ |
16 changes: 8 additions & 8 deletions
16
tests/integration/compile-fail/invalid_format_description.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use time::macros::format_description; | ||
|
||
fn main() { | ||
let _ = format_description!(); //~ERROR expected string | ||
let _ = format_description!("[]"); //~ERROR missing component name at byte index 1 | ||
let _ = format_description!("[foo]"); //~ERROR invalid component name `foo` at byte index 1 | ||
let _ = format_description!("["); //~ERROR unclosed opening bracket at byte index 0 | ||
let _ = format_description!("[hour foo]"); //~ERROR invalid modifier `foo` at byte index 6 | ||
let _ = format_description!("" x); //~ERROR unexpected token: x | ||
let _ = format_description!(x); //~ERROR expected string | ||
let _ = format_description!(0); //~ERROR expected string | ||
let _ = format_description!(); | ||
let _ = format_description!("[]"); | ||
let _ = format_description!("[foo]"); | ||
let _ = format_description!("["); | ||
let _ = format_description!("[hour foo]"); | ||
let _ = format_description!("" x); | ||
let _ = format_description!(x); | ||
let _ = format_description!(0); | ||
} |
49 changes: 49 additions & 0 deletions
49
tests/integration/compile-fail/invalid_format_description.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
error: expected string | ||
--> $DIR/invalid_format_description.rs:4:13 | ||
| | ||
4 | let _ = format_description!(); | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `format_description` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: missing component name at byte index 1 | ||
--> $DIR/invalid_format_description.rs:5:33 | ||
| | ||
5 | let _ = format_description!("[]"); | ||
| ^^^^ | ||
|
||
error: invalid component name `foo` at byte index 1 | ||
--> $DIR/invalid_format_description.rs:6:33 | ||
| | ||
6 | let _ = format_description!("[foo]"); | ||
| ^^^^^^^ | ||
|
||
error: unclosed opening bracket at byte index 0 | ||
--> $DIR/invalid_format_description.rs:7:33 | ||
| | ||
7 | let _ = format_description!("["); | ||
| ^^^ | ||
|
||
error: invalid modifier `foo` at byte index 6 | ||
--> $DIR/invalid_format_description.rs:8:33 | ||
| | ||
8 | let _ = format_description!("[hour foo]"); | ||
| ^^^^^^^^^^^^ | ||
|
||
error: unexpected token: x | ||
--> $DIR/invalid_format_description.rs:9:36 | ||
| | ||
9 | let _ = format_description!("" x); | ||
| ^ | ||
|
||
error: expected string | ||
--> $DIR/invalid_format_description.rs:10:33 | ||
| | ||
10 | let _ = format_description!(x); | ||
| ^ | ||
|
||
error: expected string | ||
--> $DIR/invalid_format_description.rs:11:33 | ||
| | ||
11 | let _ = format_description!(0); | ||
| ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use time::macros::offset; | ||
|
||
fn main() { | ||
let _ = offset!(+24); //~ERROR invalid component: hour was 24 | ||
let _ = offset!(+0:60); //~ERROR invalid component: minute was 60 | ||
let _ = offset!(+0:00:60); //~ERROR invalid component: second was 60 | ||
let _ = offset!(0); //~ERROR unexpected token: 0 | ||
let _ = offset!(); //~ERROR missing component: sign | ||
let _ = offset!(+0a); //~ERROR invalid component: hour was 0a | ||
let _ = offset!(+0:0a); //~ERROR invalid component: minute was 0a | ||
let _ = offset!(+0:00:0a); //~ERROR invalid component: second was 0a | ||
let _ = offset!(+24); | ||
let _ = offset!(+0:60); | ||
let _ = offset!(+0:00:60); | ||
let _ = offset!(0); | ||
let _ = offset!(); | ||
let _ = offset!(+0a); | ||
let _ = offset!(+0:0a); | ||
let _ = offset!(+0:00:0a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
error: invalid component: hour was 24 | ||
--> $DIR/invalid_offset.rs:4:22 | ||
| | ||
4 | let _ = offset!(+24); | ||
| ^^ | ||
|
||
error: invalid component: minute was 60 | ||
--> $DIR/invalid_offset.rs:5:24 | ||
| | ||
5 | let _ = offset!(+0:60); | ||
| ^^ | ||
|
||
error: invalid component: second was 60 | ||
--> $DIR/invalid_offset.rs:6:27 | ||
| | ||
6 | let _ = offset!(+0:00:60); | ||
| ^^ | ||
|
||
error: unexpected token: 0 | ||
--> $DIR/invalid_offset.rs:7:21 | ||
| | ||
7 | let _ = offset!(0); | ||
| ^ | ||
|
||
error: missing component: sign | ||
--> $DIR/invalid_offset.rs:8:13 | ||
| | ||
8 | let _ = offset!(); | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `offset` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: invalid component: hour was 0a | ||
--> $DIR/invalid_offset.rs:9:22 | ||
| | ||
9 | let _ = offset!(+0a); | ||
| ^^ | ||
|
||
error: invalid component: minute was 0a | ||
--> $DIR/invalid_offset.rs:10:24 | ||
| | ||
10 | let _ = offset!(+0:0a); | ||
| ^^ | ||
|
||
error: invalid component: second was 0a | ||
--> $DIR/invalid_offset.rs:11:27 | ||
| | ||
11 | let _ = offset!(+0:00:0a); | ||
| ^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
use time::macros::time; | ||
|
||
fn main() { | ||
let _ = time!(24:00); //~ERROR invalid component: hour was 24 | ||
let _ = time!(0:60); //~ERROR invalid component: minute was 60 | ||
let _ = time!(0:00:60); //~ERROR invalid component: second was 60 | ||
let _ = time!(x); //~ERROR unexpected token: x | ||
let _ = time!(0:00:00 x); //~ERROR unexpected token: x | ||
let _ = time!(""); //~ERROR invalid component: hour was "" | ||
let _ = time!(0:); //~ERROR unexpected end of input | ||
let _ = time!(0,); //~ERROR unexpected token: , | ||
let _ = time!(0:00:0a); //~ERROR invalid component: second was 0a | ||
let _ = time!(0:00 pm); //~ERROR invalid component: hour was 0 | ||
let _ = time!(0); //~ERROR unexpected end of input | ||
let _ = time!(0 pm); //~ERROR invalid component: hour was 0 | ||
let _ = time!(1 am :); //~ERROR unexpected token: : | ||
let _ = time!(24:00); | ||
let _ = time!(0:60); | ||
let _ = time!(0:00:60); | ||
let _ = time!(x); | ||
let _ = time!(0:00:00 x); | ||
let _ = time!(""); | ||
let _ = time!(0:); | ||
let _ = time!(0,); | ||
let _ = time!(0:00:0a); | ||
let _ = time!(0:00 pm); | ||
let _ = time!(0); | ||
let _ = time!(0 pm); | ||
let _ = time!(1 am :); | ||
} |
Oops, something went wrong.