summaryrefslogtreecommitdiff
path: root/tests/suite/pdf/embed.typ
blob: 4546532b7781cafb20f0bef6794fe184e0f8e636 (plain) (blame)
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
// Test file embeddings. The tests here so far are unsatisfactory because we
// have no PDF testing infrastructure. That should be improved in the future.

--- pdf-embed ---
#pdf.embed("/assets/text/hello.txt")
#pdf.embed(
  "/assets/data/details.toml",
  relationship: "supplement",
  mime-type: "application/toml",
  description: "Information about a secret project",
)

--- pdf-embed-bytes ---
#pdf.embed("hello.txt", read("/assets/text/hello.txt", encoding: none))
#pdf.embed(
  "a_file_name.txt",
  read("/assets/text/hello.txt", encoding: none),
  relationship: "supplement",
  mime-type: "text/plain",
  description: "A description",
)

--- pdf-embed-invalid-relationship ---
#pdf.embed(
  "/assets/text/hello.txt",
  // Error: 17-23 expected "source", "data", "alternative", "supplement", or none
  relationship: "test",
  mime-type: "text/plain",
  description: "A test file",
)

--- pdf-embed-invalid-data ---
// Error: 38-45 expected bytes, found string
#pdf.embed("/assets/text/hello.txt", "hello")