History

first tests for multiple refspecs (#450)

Sebastian Thiel committed 4 years ago

Commit 77db1121 parent 4c73a192 files · +61 −37Browse files

Unified · Split

2 files
  1. git-refspec/tests/fixtures/match_baseline.sh +5 −0
  2. git-refspec/tests/match_group/mod.rs +56 −37
git-refspec/tests/fixtures/match_baseline.sh+5−0
@@ -51,7 +51,12 @@ git clone --shared ./base clone · 50 unmodified lines
5151 baseline "+refs/heads/*:refs/remotes/origin/*"
5252 baseline "refs/heads/*1:refs/remotes/origin/*1"
5353 baseline "refs/heads/f*:refs/remotes/origin/a*"
54+ baseline "main" "f1"
55+ baseline "heads/main" "heads/f1"
56+ baseline "refs/heads/main" "refs/heads/f1"
5457 baseline "refs/heads/*:refs/remotes/origin/*" "^main"
58+ baseline "heads/f1" "f2" "refs/heads/f3" "heads/main"
59+ baseline "f*:a*" "refs/heads/main"
5560 baseline "^main" "refs/heads/*:refs/remotes/origin/*"
5661 baseline "^refs/heads/main" "refs/heads/*:refs/remotes/origin/*"
5762 baseline "refs/heads/*:refs/remotes/origin/*" "^refs/heads/main"
git-refspec/tests/match_group/mod.rs+56−37
@@ -1,42 +1,61 @@
1−use crate::matching::baseline;
1+mod single {
2+ use crate::matching::baseline;
23
3−#[test]
4−fn fetch_only() {
5− baseline::agrees_with_fetch_specs(Some("refs/heads/main"));
6− baseline::agrees_with_fetch_specs(Some("heads/main"));
7− baseline::agrees_with_fetch_specs(Some("main"));
8− baseline::agrees_with_fetch_specs(Some("v0.0-f1"));
9− baseline::agrees_with_fetch_specs(Some("tags/v0.0-f2"));
10− baseline::of_objects_always_matches_if_the_server_has_the_object(Some("78b1c1be9421b33a49a7a8176d93eeeafa112da1"));
11− baseline::of_objects_always_matches_if_the_server_has_the_object(Some("9d2fab1a0ba3585d0bc50922bfdd04ebb59361df"));
4+ #[test]
5+ fn fetch_only() {
6+ baseline::agrees_with_fetch_specs(Some("refs/heads/main"));
7+ baseline::agrees_with_fetch_specs(Some("heads/main"));
8+ baseline::agrees_with_fetch_specs(Some("main"));
9+ baseline::agrees_with_fetch_specs(Some("v0.0-f1"));
10+ baseline::agrees_with_fetch_specs(Some("tags/v0.0-f2"));
11+ baseline::of_objects_always_matches_if_the_server_has_the_object(Some(
12+ "78b1c1be9421b33a49a7a8176d93eeeafa112da1",
13+ ));
14+ baseline::of_objects_always_matches_if_the_server_has_the_object(Some(
15+ "9d2fab1a0ba3585d0bc50922bfdd04ebb59361df",
16+ ));
17+ }
18+
19+ #[test]
20+ fn fetch_and_update() {
21+ baseline::of_objects_with_destinations_are_written_into_given_local_branches(
22+ Some("78b1c1be9421b33a49a7a8176d93eeeafa112da1:special"),
23+ ["78b1c1be9421b33a49a7a8176d93eeeafa112da1:refs/heads/special"],
24+ );
25+ baseline::of_objects_with_destinations_are_written_into_given_local_branches(
26+ Some("78b1c1be9421b33a49a7a8176d93eeeafa112da1:1111111111111111111111111111111111111111"),
27+ ["78b1c1be9421b33a49a7a8176d93eeeafa112da1:refs/heads/1111111111111111111111111111111111111111"],
28+ );
29+ baseline::of_objects_with_destinations_are_written_into_given_local_branches(
30+ Some("9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:tags/special"),
31+ ["9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"],
32+ );
33+ baseline::of_objects_with_destinations_are_written_into_given_local_branches(
34+ Some("9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"),
35+ ["9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"],
36+ );
37+
38+ baseline::agrees_but_observable_refs_are_vague(Some("f1:origin/f1"), ["refs/heads/f1:refs/heads/origin/f1"]);
39+ baseline::agrees_but_observable_refs_are_vague(
40+ Some("f1:remotes/origin/f1"),
41+ ["refs/heads/f1:refs/remotes/origin/f1"],
42+ );
43+ baseline::agrees_but_observable_refs_are_vague(Some("f1:notes/f1"), ["refs/heads/f1:refs/heads/notes/f1"]);
44+ baseline::agrees_with_fetch_specs(Some("+refs/heads/*:refs/remotes/origin/*"));
45+ baseline::agrees_with_fetch_specs(Some("refs/heads/f*:refs/remotes/origin/a*"));
46+ baseline::agrees_with_fetch_specs(Some("refs/heads/*1:refs/remotes/origin/*1"));
47+ }
1248 }
1349
14−#[test]
15−fn fetch_and_update() {
16− baseline::of_objects_with_destinations_are_written_into_given_local_branches(
17− Some("78b1c1be9421b33a49a7a8176d93eeeafa112da1:special"),
18− ["78b1c1be9421b33a49a7a8176d93eeeafa112da1:refs/heads/special"],
19− );
20− baseline::of_objects_with_destinations_are_written_into_given_local_branches(
21− Some("78b1c1be9421b33a49a7a8176d93eeeafa112da1:1111111111111111111111111111111111111111"),
22− ["78b1c1be9421b33a49a7a8176d93eeeafa112da1:refs/heads/1111111111111111111111111111111111111111"],
23− );
24− baseline::of_objects_with_destinations_are_written_into_given_local_branches(
25− Some("9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:tags/special"),
26− ["9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"],
27− );
28− baseline::of_objects_with_destinations_are_written_into_given_local_branches(
29− Some("9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"),
30− ["9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"],
31− );
50+mod multiple {
51+ use crate::matching::baseline;
3252
33− baseline::agrees_but_observable_refs_are_vague(Some("f1:origin/f1"), ["refs/heads/f1:refs/heads/origin/f1"]);
34− baseline::agrees_but_observable_refs_are_vague(
35− Some("f1:remotes/origin/f1"),
36− ["refs/heads/f1:refs/remotes/origin/f1"],
37− );
38− baseline::agrees_but_observable_refs_are_vague(Some("f1:notes/f1"), ["refs/heads/f1:refs/heads/notes/f1"]);
39− baseline::agrees_with_fetch_specs(Some("+refs/heads/*:refs/remotes/origin/*"));
40− baseline::agrees_with_fetch_specs(Some("refs/heads/f*:refs/remotes/origin/a*"));
41− baseline::agrees_with_fetch_specs(Some("refs/heads/*1:refs/remotes/origin/*1"));
53+ #[test]
54+ fn fetch_only() {
55+ baseline::agrees_with_fetch_specs(["main", "f1"]);
56+ baseline::agrees_with_fetch_specs(["heads/main", "heads/f1"]);
57+ baseline::agrees_with_fetch_specs(["refs/heads/main", "refs/heads/f1"]);
58+ baseline::agrees_with_fetch_specs(["heads/f1", "f2", "refs/heads/f3", "heads/main"]);
59+ baseline::agrees_with_fetch_specs(["f*:a*", "refs/heads/main"]);
60+ }
4261 }