11// Copyright (c) The nextest Contributors
22// SPDX-License-Identifier: MIT OR Apache-2.0
33
4+ #[ cfg( feature = "timestamps" ) ]
45use chrono:: DateTime ;
56use goldenfile:: Mint ;
67use owo_colors:: OwoColorize ;
@@ -13,9 +14,14 @@ use std::time::Duration;
1314fn fixtures ( ) {
1415 let mut mint = Mint :: new ( "tests/fixtures" ) ;
1516
17+ #[ cfg( all( feature = "timestamps" , feature = "uuids" , feature = "strip-ansi" ) ) ]
1618 let f = mint
1719 . new_goldenfile ( "basic_report.xml" )
1820 . expect ( "creating new goldenfile succeeds" ) ;
21+ #[ cfg( not( any( feature = "timestamps" , feature = "uuids" , feature = "strip-ansi" ) ) ) ]
22+ let f = mint
23+ . new_goldenfile ( "basic_report_no_default_features.xml" )
24+ . expect ( "creating new goldenfile succeeds" ) ;
1925
2026 let basic_report = basic_report ( ) ;
2127 basic_report
@@ -25,13 +31,15 @@ fn fixtures() {
2531
2632fn basic_report ( ) -> Report {
2733 let mut report = Report :: new ( "my-test-run" ) ;
34+ #[ cfg( feature = "timestamps" ) ]
2835 report. set_timestamp (
2936 DateTime :: parse_from_rfc2822 ( "Thu, 1 Apr 2021 10:52:37 -0800" )
3037 . expect ( "valid RFC2822 datetime" ) ,
3138 ) ;
3239 report. set_time ( Duration :: new ( 42 , 234_567_890 ) ) ;
3340
3441 let mut test_suite = TestSuite :: new ( "testsuite0" ) ;
42+ #[ cfg( feature = "timestamps" ) ]
3543 test_suite. set_timestamp (
3644 DateTime :: parse_from_rfc2822 ( "Thu, 1 Apr 2021 10:52:39 -0800" )
3745 . expect ( "valid RFC2822 datetime" ) ,
@@ -74,11 +82,13 @@ fn basic_report() -> Report {
7482 . set_message ( "skipped message" ) ;
7583 // no description to test that.
7684 let mut test_case = TestCase :: new ( "testcase3" , test_case_status) ;
85+ #[ cfg( feature = "timestamps" ) ]
7786 test_case
7887 . set_timestamp (
7988 DateTime :: parse_from_rfc2822 ( "Thu, 1 Apr 2021 11:52:41 -0700" )
8089 . expect ( "valid RFC2822 datetime" ) ,
81- )
90+ ) ;
91+ test_case
8292 . set_assertions ( 20 )
8393 . set_system_out ( "testcase3 output" )
8494 . set_system_err ( "testcase3 error" ) ;
@@ -138,6 +148,8 @@ fn basic_report() -> Report {
138148 test_suite. add_property ( Property :: new ( "env" , "FOOBAR" ) ) ;
139149
140150 report. add_test_suite ( test_suite) ;
151+ #[ cfg( feature = "uuids" ) ]
152+ report. set_uuid ( uuid:: Uuid :: parse_str ( "0500990f-0df3-4722-bbeb-90a75b8aa6bd" ) . expect ( "uuid parsing succeeds" ) ) ;
141153
142154 report
143155}
0 commit comments