1
1
use formality:: test_program_ok;
2
2
3
- const PROGRAM_BROKEN : & str = "[
4
- crate Foo {
5
- trait Foo<ty T> where [T: Bar<Self>] {}
6
-
7
- trait Bar<ty T> where [T: Baz<>] {}
8
-
9
- trait Baz<> where [] {}
10
- }
11
- ]" ;
12
-
13
- const PROGRAM_OK : & str = "[
14
- crate Foo {
15
- trait Foo<ty T> where [T: Bar<Self>, Self: Baz<>] {}
16
-
17
- trait Bar<ty T> where [T: Baz<>] {}
18
-
19
- trait Baz<> where [] {}
20
- }
21
- ]" ;
22
-
23
3
#[ test]
24
4
fn test_broken ( ) {
25
5
expect_test:: expect![ [ r#"
@@ -29,7 +9,17 @@ fn test_broken() {
29
9
source: "failed to prove {@ WellFormedTraitRef(Bar(!ty_2, !ty_1))} given {Bar(!ty_2, !ty_1)}, got {}",
30
10
},
31
11
)
32
- "# ] ] . assert_debug_eq ( & test_program_ok ( PROGRAM_BROKEN ) ) ;
12
+ "# ] ] . assert_debug_eq ( & test_program_ok (
13
+ "[
14
+ crate Foo {
15
+ trait Foo<ty T> where [T: Bar<Self>] {}
16
+
17
+ trait Bar<ty T> where [T: Baz<>] {}
18
+
19
+ trait Baz<> where [] {}
20
+ }
21
+ ]" ,
22
+ ) ) ;
33
23
}
34
24
35
25
#[ test]
@@ -39,5 +29,15 @@ fn test_ok() {
39
29
(),
40
30
)
41
31
"# ] ]
42
- . assert_debug_eq ( & test_program_ok ( PROGRAM_OK ) ) ;
32
+ . assert_debug_eq ( & test_program_ok (
33
+ "[
34
+ crate Foo {
35
+ trait Foo<ty T> where [T: Bar<Self>, Self: Baz<>] {}
36
+
37
+ trait Bar<ty T> where [T: Baz<>] {}
38
+
39
+ trait Baz<> where [] {}
40
+ }
41
+ ]" ,
42
+ ) ) ;
43
43
}
0 commit comments