@@ -17,7 +17,7 @@ def test_separate_crates(self) -> None:
17
17
""" ).encode (),
18
18
pathlib .Path ('Cargo.toml' ): textwrap .dedent ("""\
19
19
[workspace]
20
- members = ["crates/*"]
20
+ members = ["crates/*/", "verification/ "]
21
21
""" ).encode (),
22
22
pathlib .Path ('crates' , 'a' , 'Cargo.toml' ): textwrap .dedent ("""\
23
23
[package]
@@ -53,13 +53,35 @@ def test_separate_crates(self) -> None:
53
53
pathlib .Path ('crates' , 'c' , 'src' , 'lib.rs' ): textwrap .dedent ("""\
54
54
pub struct C;
55
55
""" ).encode (),
56
+ pathlib .Path ('verification' , 'Cargo.toml' ): textwrap .dedent ("""\
57
+ [package]
58
+ name = "verification"
59
+ version = "0.0.0"
60
+ edition = "2018"
61
+
62
+ [dependencies]
63
+ a = { path = "../crates/a" }
64
+ """ ).encode (),
65
+ pathlib .Path ('verification' , 'src' , 'bin' , 'aizu-online-judge-itp1-1-a.rs' ): textwrap .dedent ("""\
66
+ // verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A
67
+
68
+ use a as _;
69
+
70
+ fn main() {
71
+ println!("Hello World");
72
+ }
73
+ """ ).encode (),
56
74
}
57
75
58
76
with tests .utils .load_files_pathlib (files ) as tempdir :
59
77
expected = sorted (tempdir / 'crates' / name / 'src' / 'lib.rs' for name in ['a' , 'b' , 'c' ])
60
78
actual = sorted (RustLanguage (config = None ).list_dependencies (tempdir / 'crates' / 'a' / 'src' / 'lib.rs' , basedir = tempdir ))
61
79
self .assertEqual (actual , expected )
62
80
81
+ expected = [tempdir / 'crates' / 'a' / 'src' / 'lib.rs' , tempdir / 'verification' / 'src' / 'bin' / 'aizu-online-judge-itp1-1-a.rs' ]
82
+ actual = sorted (RustLanguage (config = None ).list_dependencies (tempdir / 'verification' / 'src' / 'bin' / 'aizu-online-judge-itp1-1-a.rs' , basedir = tempdir ))
83
+ self .assertEqual (actual , expected )
84
+
63
85
def test_mono_crate (self ) -> None :
64
86
files = {
65
87
pathlib .Path ('rust-toolchain' ): textwrap .dedent ("""\
@@ -79,6 +101,15 @@ def test_mono_crate(self) -> None:
79
101
pathlib .Path ('src' , 'a.rs' ): b'' ,
80
102
pathlib .Path ('src' , 'b.rs' ): b'' ,
81
103
pathlib .Path ('src' , 'c.rs' ): b'' ,
104
+ pathlib .Path ('examples' , 'aizu-online-judge-itp1-1-a.rs' ): textwrap .dedent ("""\
105
+ // verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A
106
+
107
+ use my_competitive_library as _;
108
+
109
+ fn main() {
110
+ println!("Hello World");
111
+ }
112
+ """ ).encode (),
82
113
}
83
114
84
115
with tests .utils .load_files_pathlib (files ) as tempdir :
@@ -88,6 +119,10 @@ def test_mono_crate(self) -> None:
88
119
actual = sorted (RustLanguage (config = None ).list_dependencies (tempdir / 'src' / f'{ file_stem } .rs' , basedir = tempdir ))
89
120
self .assertEqual (actual , expected )
90
121
122
+ expected = sorted ([* expected , tempdir / 'examples' / 'aizu-online-judge-itp1-1-a.rs' ])
123
+ actual = sorted (RustLanguage (config = None ).list_dependencies (tempdir / 'examples' / 'aizu-online-judge-itp1-1-a.rs' , basedir = tempdir ))
124
+ self .assertEqual (actual , expected )
125
+
91
126
92
127
class TestRustVerification (unittest .TestCase ):
93
128
def test_success (self ) -> None :
0 commit comments