aboutsummaryrefslogtreecommitdiff
path: root/tests/git-pre-commit-copyright-check.testscript
blob: f6c2b45a45673fd56ecd3cd8ec06eb77d6fa73dd (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
# file      : tests/git-pre-commit-copyright-check.testscript
# license   : MIT; see accompanying LICENSE file

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

: basic
:
{
  $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

  date +"%Y" | set year;
  cat <<"EOI" >=prj/LICENSE;
    Copyright (c) 2014-$year the build2 authors.
    EOI
  $gc
}