aboutsummaryrefslogtreecommitdiff
path: root/tests/git-pre-commit.testscript
blob: c50a9dc3b8421e7e5f26ff2d5ccef2aedda97fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# file      : tests/git-pre-commit.testscript
# license   : MIT; see accompanying LICENSE file

.include git-common.testscript git-pre-commit-common.testscript

: version-check
:
{
  $clone_prj;

  cat <<EOI >=prj/manifest;
    : 1
    name: foo
    version: 1.2.3
    summary: Foo
    EOI
  touch prj/TODO;
  $ga .;
  $gc;                       # No committed manifest.

  echo '@@' >=prj/TODO;

  $gc 2>>EOE != 0            # Package with a final version is changed.
    error: changing released package foo 1.2.3 without version increment
      info: use --no-verify git option to suppress
    EOE
}

: copyright-check
:
{
  $clone_prj;

  cat <<EOI >=prj/LICENSE;
    Copyright (c) 2014-2019 the build2 authors.
    EOI
  $ga .;

  # Note that the 'WARNING:' prefix is printed in bold red.
  #
  $gc 2>>~%EOE%
    %.+WARNING:.+ last copyright year in 'LICENSE' is 2019%
    EOE
}