# * check tags
# ** 1. tags can be declared
<
tag atag  ; this is atag. tags: on tags are not allowed and will be ignored.
  indented subdirectives are ignored.
$ hledger -f - check

# ** 2. check tags succeeds when all tags are declared
<
tag atag
tag ttag
tag ptag

account a  ; atag:

2023-01-01 ; ttag:
  (a)  0   ; ptag:

$ hledger -f - check tags

# ** 3. it detects an undeclared account tag
<
account a  ; atag:
$ hledger -f - check tags
>2 /tag "atag" has not been declared/
>=1

# ** 4. it detects an undeclared transaction tag
<
2023-01-01 ; ttag:
$ hledger -f - check tags
>2 /tag "ttag" has not been declared/
>=1

# ** 5. it detects an undeclared posting tag
<
2023-01-01
  (a)  0   ; ptag:
$ hledger -f - check tags
>2 /tag "ptag" has not been declared/
>=1

# ** 6. Built-in special tags are implicitly declared and won't make check tags fail.
# Keep synced with JournalChecks.builtinTags.
<
2024-01-01
  ; date:
  ; date2:
  ; type:
  ; t:
  ; assert:
  ; retain:
  ; start:
  ; generated-transaction:
  ; generated-posting:
  ; modified:
  ; _generated-transaction:
  ; _generated-posting:
  ; _modified:
  ; _conversion-matched:
$ hledger -f - check tags

# ** 7. Declaring the built-in special tags is harmless.
# Keep synced with JournalChecks.builtinTags.
<
tag date                    ; overrides a posting's date
tag date2                   ; overrides a posting's secondary date
tag type                    ; declares an account's type
tag t                       ; generated by letters in timedot data (with the letter as tag value)
tag assert                  ; appears on txns generated by close --assert
tag retain                  ; appears on txns generated by close --retain
tag start                   ; appears on txns generated by close --migrate/--close/--open/--assign
tag generated-transaction   ; with --verbose-tags, appears on generated periodic txns
tag generated-posting       ; with --verbose-tags, appears on generated auto postings
tag modified                ; with --verbose-tags, appears on txns which have had auto postings added
tag _generated-transaction  ; always exists on generated periodic txns
tag _generated-posting      ; always exists on generated auto postings
tag _modified               ; always exists on txns which have had auto postings added
tag _conversion-matched     ; exists on postings which have been matched with a nearby @/@@ cost notation
$ hledger -f - check tags
