;; This file is part of Beastie <https://purl.org/nxg/dist/beastie>
;; SPDX-FileCopyrightText: 2023 Norman Gray <https://nxg.me.uk>
;; SPDX-License-Identifier: BSD-2-Clause

(check
 (assert-equal (map (λ (k+v)
                      (entry->list/debug (cdr k+v)))
                    DB)
               '((article a.n.other
                          (author . #"Aloysius Norbert Othèr")
                          (journal . #"Irreproducible AÁA")
                          (month . #"feb")
                          (monthyear . #"feb1999")
                          (note . #"BAÁAC")
                          (title . #"Title: XBAÁACY")
                          (year . #"1999"))))
 ;(assert-equal s1 #"AAA")
 ;(assert-equal s2 #"BAAAC")
 ;(assert-equal (get-preamble) '(#"preamble1pre\\amble2préamble3"))
 ;; the following test would be equivalent if it were either
 ;; "...\amble 2..." or "...\amble2...",
 ;; depending on how I've implemented things
 (assert-equal (get-preamble)
               #"preamble1pre\\amble2préamble3"))


@preamble{ "preamble1" }
@preamble{ "pre\amble2" # % includes \cs
           "pr{\'e}amble3" }
@string  {   s1 = "A{\'A}A"}
@string  { s2 = "B" # s1 # "C" }
@string {s3 = "X" # s2 # "Y" }

Note: we can't test the following here, because it should cause the parse to fail.
It's tested in test-bib.scm instead.
string{s4 = "x" # s4}

@ARTICLE{a.n.other,
  author =       "Aloysius Norbert " # "Oth{\`e}r",
  title =        {Title: } # s3,
  journal =      {Irreproducible } # s1,
  year =         1999,
  month =        feb,
  monthyear =    feb # "1999",
  note =         s2,
}

