File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -97,3 +97,27 @@ fn rustdocflags_misspelled() {
97
97
. with_stderr_contains ( "[WARNING] Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?" )
98
98
. run ( ) ;
99
99
}
100
+
101
+ #[ cargo_test]
102
+ fn whitespace ( ) {
103
+ // Checks behavior of different whitespace characters.
104
+ let p = project ( ) . file ( "src/lib.rs" , "" ) . build ( ) ;
105
+
106
+ // "too many operands"
107
+ p. cargo ( "doc" )
108
+ . env ( "RUSTDOCFLAGS" , "--crate-version this has spaces" )
109
+ . with_stderr_contains ( "[ERROR] could not document `foo`" )
110
+ . with_status ( 101 )
111
+ . run ( ) ;
112
+
113
+ const SPACED_VERSION : & str = "a\n b\t c\u{00a0} d" ;
114
+ p. cargo ( "doc" )
115
+ . env (
116
+ "RUSTDOCFLAGS" ,
117
+ format ! ( "--crate-version {}" , SPACED_VERSION ) ,
118
+ )
119
+ . run ( ) ;
120
+
121
+ let contents = p. read_file ( "target/doc/foo/index.html" ) ;
122
+ assert ! ( contents. contains( SPACED_VERSION ) ) ;
123
+ }
You can’t perform that action at this time.
0 commit comments