@@ -19,9 +19,17 @@ description = \"A \u{202E}test package\"
1919
2020 p. cargo ( "check -Zcargo-lints" )
2121 . masquerade_as_nightly_cargo ( & [ "cargo-lints" ] )
22+ . with_status ( 101 )
2223 . with_stderr_data ( str![ [ r#"
23- [CHECKING] foo v0.0.1 ([ROOT]/foo)
24- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
24+ [ERROR] unicode codepoint changing visible direction of text present in manifest: `/u{202E}` (RIGHT-TO-LEFT OVERRIDE)
25+ --> Cargo.toml:6:18
26+ |
27+ 6 | description = "A �test package"
28+ | ^ this invisible unicode codepoint changes text flow direction
29+ |
30+ = [NOTE] `cargo::text_direction_codepoint` is set to `deny` by default
31+ = [HELP] if their presence wasn't intentional, you can remove them
32+ [ERROR] encountered 1 error while running lints
2533
2634"# ] ] )
2735 . run ( ) ;
@@ -36,6 +44,77 @@ name = \"foo\"
3644version = \" 0.0.1\"
3745edition = \" 2015\"
3846description = \" A \u{202E} test\u{202D} package\"
47+ " ;
48+ let p = project ( )
49+ . file ( "Cargo.toml" , manifest)
50+ . file ( "src/lib.rs" , "" )
51+ . build ( ) ;
52+
53+ p. cargo ( "check -Zcargo-lints" )
54+ . masquerade_as_nightly_cargo ( & [ "cargo-lints" ] )
55+ . with_status ( 101 )
56+ . with_stderr_data ( str![ [ r#"
57+ [ERROR] unicode codepoint changing visible direction of text present in manifest: `/u{202E}` (RIGHT-TO-LEFT OVERRIDE)
58+ --> Cargo.toml:6:18
59+ |
60+ 6 | description = "A �test� package"
61+ | ^ this invisible unicode codepoint changes text flow direction
62+ |
63+ = [NOTE] `cargo::text_direction_codepoint` is set to `deny` by default
64+ = [HELP] if their presence wasn't intentional, you can remove them
65+ [ERROR] unicode codepoint changing visible direction of text present in manifest: `/u{202D}` (LEFT-TO-RIGHT OVERRIDE)
66+ --> Cargo.toml:6:23
67+ |
68+ 6 | description = "A �test� package"
69+ | ^ this invisible unicode codepoint changes text flow direction
70+ |
71+ = [HELP] if their presence wasn't intentional, you can remove them
72+ [ERROR] encountered 2 errors while running lints
73+
74+ "# ] ] )
75+ . run ( ) ;
76+ }
77+
78+ #[ cargo_test]
79+ fn allow_lint ( ) {
80+ // Test that the lint can be allowed
81+ let manifest = "
82+ [package]
83+ name = \" foo\"
84+ version = \" 0.0.1\"
85+ edition = \" 2015\"
86+ description = \" A \u{202E} test package\"
87+
88+ [lints.cargo]
89+ text_direction_codepoint = \" allow\"
90+ " ;
91+ let p = project ( )
92+ . file ( "Cargo.toml" , manifest)
93+ . file ( "src/lib.rs" , "" )
94+ . build ( ) ;
95+
96+ p. cargo ( "check -Zcargo-lints" )
97+ . masquerade_as_nightly_cargo ( & [ "cargo-lints" ] )
98+ . with_stderr_data ( str![ [ r#"
99+ [CHECKING] foo v0.0.1 ([ROOT]/foo)
100+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
101+
102+ "# ] ] )
103+ . run ( ) ;
104+ }
105+
106+ #[ cargo_test]
107+ fn warn_lint ( ) {
108+ // Test that the lint can be set to warn
109+ let manifest = "
110+ [package]
111+ name = \" foo\"
112+ version = \" 0.0.1\"
113+ edition = \" 2015\"
114+ description = \" A \u{202E} test package\"
115+
116+ [lints.cargo]
117+ text_direction_codepoint = \" warn\"
39118" ;
40119 let p = project ( )
41120 . file ( "Cargo.toml" , manifest)
@@ -45,6 +124,14 @@ description = \"A \u{202E}test\u{202D} package\"
45124 p. cargo ( "check -Zcargo-lints" )
46125 . masquerade_as_nightly_cargo ( & [ "cargo-lints" ] )
47126 . with_stderr_data ( str![ [ r#"
127+ [WARNING] unicode codepoint changing visible direction of text present in manifest: `/u{202E}` (RIGHT-TO-LEFT OVERRIDE)
128+ --> Cargo.toml:6:18
129+ |
130+ 6 | description = "A �test package"
131+ | ^ this invisible unicode codepoint changes text flow direction
132+ |
133+ = [NOTE] `cargo::text_direction_codepoint` is set to `warn` in `[lints]`
134+ = [HELP] if their presence wasn't intentional, you can remove them
48135[CHECKING] foo v0.0.1 ([ROOT]/foo)
49136[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
50137
@@ -79,18 +166,24 @@ edition = "2015"
79166}
80167
81168#[ cargo_test]
82- fn workspace_member_bidi ( ) {
83- // Workspace with BiDi in member package
169+ fn workspace_inherited_allow ( ) {
170+ // Workspace-level lint configuration with member package
84171 let manifest = "
85172[workspace]
86173members = [\" foo\" ]
174+
175+ [workspace.lints.cargo]
176+ text_direction_codepoint = \" allow\"
87177" ;
88178 let foo_manifest = "
89179[package]
90180name = \" foo\"
91181version = \" 0.0.1\"
92182edition = \" 2015\"
93183description = \" A \u{202E} test package\"
184+
185+ [lints]
186+ workspace = true
94187" ;
95188 let p = project ( )
96189 . file ( "Cargo.toml" , manifest)
@@ -132,9 +225,17 @@ edition = "2015"
132225
133226 p. cargo ( "check -Zcargo-lints" )
134227 . masquerade_as_nightly_cargo ( & [ "cargo-lints" ] )
228+ . with_status ( 101 )
135229 . with_stderr_data ( str![ [ r#"
136- [CHECKING] foo v0.0.1 ([ROOT]/foo/foo)
137- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
230+ [ERROR] unicode codepoint changing visible direction of text present in manifest: `/u{202E}` (RIGHT-TO-LEFT OVERRIDE)
231+ --> Cargo.toml:6:14
232+ |
233+ 6 | info = "test �info"
234+ | ^ this invisible unicode codepoint changes text flow direction
235+ |
236+ = [NOTE] `cargo::text_direction_codepoint` is set to `deny` by default
237+ = [HELP] if their presence wasn't intentional, you can remove them
238+ [ERROR] encountered 1 error while running lints
138239
139240"# ] ] )
140241 . run ( ) ;
0 commit comments