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
51 baseline "+refs/heads/*:refs/remotes/origin/*"51 baseline "+refs/heads/*:refs/remotes/origin/*"
52 baseline "refs/heads/*1:refs/remotes/origin/*1"52 baseline "refs/heads/*1:refs/remotes/origin/*1"
53 baseline "refs/heads/f*:refs/remotes/origin/a*"53 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"
54 baseline "refs/heads/*:refs/remotes/origin/*" "^main"57 baseline "refs/heads/*:refs/remotes/origin/*" "^main"
58 baseline "heads/f1" "f2" "refs/heads/f3" "heads/main"
59 baseline "f*:a*" "refs/heads/main"
55 baseline "^main" "refs/heads/*:refs/remotes/origin/*"60 baseline "^main" "refs/heads/*:refs/remotes/origin/*"
56 baseline "^refs/heads/main" "refs/heads/*:refs/remotes/origin/*"61 baseline "^refs/heads/main" "refs/heads/*:refs/remotes/origin/*"
57 baseline "refs/heads/*:refs/remotes/origin/*" "^refs/heads/main"62 baseline "refs/heads/*:refs/remotes/origin/*" "^refs/heads/main"
git-refspec/tests/match_group/mod.rs+56−37
@@ -1,42 +1,61 @@
1use crate::matching::baseline;1mod single {
2 use crate::matching::baseline;
2 3
3#[test]4 #[test]
4fn fetch_only() {5 fn fetch_only() {
5 baseline::agrees_with_fetch_specs(Some("refs/heads/main"));6 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("heads/main"));
7 baseline::agrees_with_fetch_specs(Some("main"));8 baseline::agrees_with_fetch_specs(Some("main"));
8 baseline::agrees_with_fetch_specs(Some("v0.0-f1"));9 baseline::agrees_with_fetch_specs(Some("v0.0-f1"));
9 baseline::agrees_with_fetch_specs(Some("tags/v0.0-f2"));10 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(
11 baseline::of_objects_always_matches_if_the_server_has_the_object(Some("9d2fab1a0ba3585d0bc50922bfdd04ebb59361df"));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 }
12}48}
13 49
14#[test]50mod multiple {
15fn fetch_and_update() {51 use crate::matching::baseline;
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 );
32 52
33 baseline::agrees_but_observable_refs_are_vague(Some("f1:origin/f1"), ["refs/heads/f1:refs/heads/origin/f1"]);53 #[test]
34 baseline::agrees_but_observable_refs_are_vague(54 fn fetch_only() {
35 Some("f1:remotes/origin/f1"),55 baseline::agrees_with_fetch_specs(["main", "f1"]);
36 ["refs/heads/f1:refs/remotes/origin/f1"],56 baseline::agrees_with_fetch_specs(["heads/main", "heads/f1"]);
37 );57 baseline::agrees_with_fetch_specs(["refs/heads/main", "refs/heads/f1"]);
38 baseline::agrees_but_observable_refs_are_vague(Some("f1:notes/f1"), ["refs/heads/f1:refs/heads/notes/f1"]);58 baseline::agrees_with_fetch_specs(["heads/f1", "f2", "refs/heads/f3", "heads/main"]);
39 baseline::agrees_with_fetch_specs(Some("+refs/heads/*:refs/remotes/origin/*"));59 baseline::agrees_with_fetch_specs(["f*:a*", "refs/heads/main"]);
40 baseline::agrees_with_fetch_specs(Some("refs/heads/f*:refs/remotes/origin/a*"));60 }
41 baseline::agrees_with_fetch_specs(Some("refs/heads/*1:refs/remotes/origin/*1"));
42}61}