|
1 | | -package com.goyeau.mill.git |
2 | | - |
3 | | -import munit.FunSuite |
4 | | -import scala.concurrent.duration.* |
5 | | - |
6 | | -class CustomProjectIntegrationTests extends FunSuite { |
7 | | - override val munitTimeout: Duration = 1.minute |
8 | | - |
9 | | - test("Uncommitted changes") { |
10 | | - val tester = Tester.create(os.rel / "custom") |
11 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
12 | | - |
13 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
14 | | - assert(result.isSuccess, result.err) |
15 | | - assert(result.out.matches(""""[\da-f]{7}""""), s"${result.out} is not a 7 chars hash") |
16 | | - } |
17 | | - |
18 | | - test("Commit without tag") { |
19 | | - val tester = Tester.create(os.rel / "custom") |
20 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
21 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
22 | | - val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
23 | | - val hash = os.proc("git", "rev-parse", "HEAD").call(cwd = tester.workspacePath).out.trim().take(7) |
24 | | - |
25 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
26 | | - assert(result.isSuccess, result.err) |
27 | | - assertEquals(result.out, s""""$hash"""") |
28 | | - } |
29 | | - |
30 | | - test("Uncommitted changes after commit without tag") { |
31 | | - val tester = Tester.create(os.rel / "custom") |
32 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
33 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
34 | | - val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
35 | | - val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
36 | | - |
37 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
38 | | - assert(result.isSuccess, result.err) |
39 | | - assert(result.out.matches(""""[\da-f]{7}""""), s"${result.out} is not a 7 chars hash") |
40 | | - } |
41 | | - |
42 | | - test("Head tagged") { |
43 | | - val tester = Tester.create(os.rel / "custom") |
44 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
45 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
46 | | - val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
47 | | - val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
48 | | - |
49 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
50 | | - assert(result.isSuccess, result.err) |
51 | | - assertEquals(result.out, """"1.0.0"""") |
52 | | - } |
53 | | - |
54 | | - test("Uncommitted changes after tag") { |
55 | | - val tester = Tester.create(os.rel / "custom") |
56 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
57 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
58 | | - val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
59 | | - val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
60 | | - val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
61 | | - |
62 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
63 | | - assert(result.isSuccess, result.err) |
64 | | - assert( |
65 | | - result.out.matches(""""1\.0\.0-1-[\da-f]{7}""""), |
66 | | - s"${result.out} is not a version and distance from it, followed by a 7 chars hash" |
67 | | - ) |
68 | | - } |
69 | | - |
70 | | - test("Commit after tag") { |
71 | | - val tester = Tester.create(os.rel / "custom") |
72 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
73 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
74 | | - val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
75 | | - val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
76 | | - val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
77 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
78 | | - val _ = os.proc("git", "commit", "-m", "Some commit 2").call(cwd = tester.workspacePath) |
79 | | - val hash = os.proc("git", "rev-parse", "HEAD").call(cwd = tester.workspacePath).out.trim().take(7) |
80 | | - |
81 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
82 | | - assert(result.isSuccess, result.err) |
83 | | - assertEquals(result.out, s""""1.0.0-1-$hash"""") |
84 | | - } |
85 | | - |
86 | | - test("Uncommitted changes after tag and after commit") { |
87 | | - val tester = Tester.create(os.rel / "custom") |
88 | | - val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
89 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
90 | | - val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
91 | | - val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
92 | | - val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
93 | | - val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
94 | | - val _ = os.proc("git", "commit", "-m", "Some commit 2").call(cwd = tester.workspacePath) |
95 | | - val _ = os.write.append(tester.workspacePath / "some-file", "Some change 2!") |
96 | | - |
97 | | - val result = tester.eval(Seq("show", "project.jobVersion")) |
98 | | - assert(result.isSuccess, result.err) |
99 | | - assert( |
100 | | - result.out.matches(""""1\.0\.0-2-[\da-f]{7}""""), |
101 | | - s"${result.out} is not a version and distance from it, followed by a 7 chars hash" |
102 | | - ) |
103 | | - } |
104 | | -} |
| 1 | +//package com.goyeau.mill.git |
| 2 | +// |
| 3 | +//import munit.FunSuite |
| 4 | +//import scala.concurrent.duration.* |
| 5 | +// |
| 6 | +//class CustomProjectIntegrationTests extends FunSuite { |
| 7 | +// override val munitTimeout: Duration = 1.minute |
| 8 | +// |
| 9 | +// test("Uncommitted changes") { |
| 10 | +// val tester = Tester.create(os.rel / "custom") |
| 11 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 12 | +// |
| 13 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 14 | +// assert(result.isSuccess, result.err) |
| 15 | +// assert(result.out.matches(""""[\da-f]{7}""""), s"${result.out} is not a 7 chars hash") |
| 16 | +// } |
| 17 | +// |
| 18 | +// test("Commit without tag") { |
| 19 | +// val tester = Tester.create(os.rel / "custom") |
| 20 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 21 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 22 | +// val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
| 23 | +// val hash = os.proc("git", "rev-parse", "HEAD").call(cwd = tester.workspacePath).out.trim().take(7) |
| 24 | +// |
| 25 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 26 | +// assert(result.isSuccess, result.err) |
| 27 | +// assertEquals(result.out, s""""$hash"""") |
| 28 | +// } |
| 29 | +// |
| 30 | +// test("Uncommitted changes after commit without tag") { |
| 31 | +// val tester = Tester.create(os.rel / "custom") |
| 32 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 33 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 34 | +// val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
| 35 | +// val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
| 36 | +// |
| 37 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 38 | +// assert(result.isSuccess, result.err) |
| 39 | +// assert(result.out.matches(""""[\da-f]{7}""""), s"${result.out} is not a 7 chars hash") |
| 40 | +// } |
| 41 | +// |
| 42 | +// test("Head tagged") { |
| 43 | +// val tester = Tester.create(os.rel / "custom") |
| 44 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 45 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 46 | +// val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
| 47 | +// val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
| 48 | +// |
| 49 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 50 | +// assert(result.isSuccess, result.err) |
| 51 | +// assertEquals(result.out, """"1.0.0"""") |
| 52 | +// } |
| 53 | +// |
| 54 | +// test("Uncommitted changes after tag") { |
| 55 | +// val tester = Tester.create(os.rel / "custom") |
| 56 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 57 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 58 | +// val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
| 59 | +// val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
| 60 | +// val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
| 61 | +// |
| 62 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 63 | +// assert(result.isSuccess, result.err) |
| 64 | +// assert( |
| 65 | +// result.out.matches(""""1\.0\.0-1-[\da-f]{7}""""), |
| 66 | +// s"${result.out} is not a version and distance from it, followed by a 7 chars hash" |
| 67 | +// ) |
| 68 | +// } |
| 69 | +// |
| 70 | +// test("Commit after tag") { |
| 71 | +// val tester = Tester.create(os.rel / "custom") |
| 72 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 73 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 74 | +// val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
| 75 | +// val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
| 76 | +// val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
| 77 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 78 | +// val _ = os.proc("git", "commit", "-m", "Some commit 2").call(cwd = tester.workspacePath) |
| 79 | +// val hash = os.proc("git", "rev-parse", "HEAD").call(cwd = tester.workspacePath).out.trim().take(7) |
| 80 | +// |
| 81 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 82 | +// assert(result.isSuccess, result.err) |
| 83 | +// assertEquals(result.out, s""""1.0.0-1-$hash"""") |
| 84 | +// } |
| 85 | +// |
| 86 | +// test("Uncommitted changes after tag and after commit") { |
| 87 | +// val tester = Tester.create(os.rel / "custom") |
| 88 | +// val _ = os.proc("git", "init").call(cwd = tester.workspacePath) |
| 89 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 90 | +// val _ = os.proc("git", "commit", "-m", "Some commit").call(cwd = tester.workspacePath) |
| 91 | +// val _ = os.proc("git", "tag", "-a", "v1.0.0", "-m", "v1.0.0").call(cwd = tester.workspacePath) |
| 92 | +// val _ = os.write(tester.workspacePath / "some-file", "Some change!") |
| 93 | +// val _ = os.proc("git", "add", "--all").call(cwd = tester.workspacePath) |
| 94 | +// val _ = os.proc("git", "commit", "-m", "Some commit 2").call(cwd = tester.workspacePath) |
| 95 | +// val _ = os.write.append(tester.workspacePath / "some-file", "Some change 2!") |
| 96 | +// |
| 97 | +// val result = tester.eval(Seq("show", "project.jobVersion")) |
| 98 | +// assert(result.isSuccess, result.err) |
| 99 | +// assert( |
| 100 | +// result.out.matches(""""1\.0\.0-2-[\da-f]{7}""""), |
| 101 | +// s"${result.out} is not a version and distance from it, followed by a 7 chars hash" |
| 102 | +// ) |
| 103 | +// } |
| 104 | +//} |
0 commit comments