Skip to content

Commit 8ea259c

Browse files
committed
Add "verificaton"s to the two tests
1 parent 0a454dc commit 8ea259c

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

tests/test_rust.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_separate_crates(self) -> None:
1717
""").encode(),
1818
pathlib.Path('Cargo.toml'): textwrap.dedent("""\
1919
[workspace]
20-
members = ["crates/*"]
20+
members = ["crates/*/", "verification/"]
2121
""").encode(),
2222
pathlib.Path('crates', 'a', 'Cargo.toml'): textwrap.dedent("""\
2323
[package]
@@ -53,13 +53,35 @@ def test_separate_crates(self) -> None:
5353
pathlib.Path('crates', 'c', 'src', 'lib.rs'): textwrap.dedent("""\
5454
pub struct C;
5555
""").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(),
5674
}
5775

5876
with tests.utils.load_files_pathlib(files) as tempdir:
5977
expected = sorted(tempdir / 'crates' / name / 'src' / 'lib.rs' for name in ['a', 'b', 'c'])
6078
actual = sorted(RustLanguage(config=None).list_dependencies(tempdir / 'crates' / 'a' / 'src' / 'lib.rs', basedir=tempdir))
6179
self.assertEqual(actual, expected)
6280

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+
6385
def test_mono_crate(self) -> None:
6486
files = {
6587
pathlib.Path('rust-toolchain'): textwrap.dedent("""\
@@ -79,6 +101,15 @@ def test_mono_crate(self) -> None:
79101
pathlib.Path('src', 'a.rs'): b'',
80102
pathlib.Path('src', 'b.rs'): b'',
81103
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(),
82113
}
83114

84115
with tests.utils.load_files_pathlib(files) as tempdir:
@@ -88,6 +119,10 @@ def test_mono_crate(self) -> None:
88119
actual = sorted(RustLanguage(config=None).list_dependencies(tempdir / 'src' / f'{file_stem}.rs', basedir=tempdir))
89120
self.assertEqual(actual, expected)
90121

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+
91126

92127
class TestRustVerification(unittest.TestCase):
93128
def test_success(self) -> None:

0 commit comments

Comments
 (0)