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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// Test import statements.
---
// Test importing semantics.
// A named import.
#import "target.typ" using item
#test(item(1, 2), 3)
// Test that this will be overwritten.
#let value = [foo]
// Import multiple things.
// Error: 28-29 expected expression, found comma
#import "target.typ" using ,fn, value
#fn[Like and Subscribe!]
#value
// Code mode
{
import "target.typ" using b
test(b, 1)
}
#test(b, 1)
// This should not exist yet
// Error: 1-3 unknown variable
#d
// A wildcard import.
#import "target.typ" using *
// It exists now!
#d
---
// Test bad imports.
// Ref: false
// Error: 9-11 file not found
#import "" using name
// Error: 9-20 file not found
#import "lib/0.2.1" using *
// Error: 9-20 file not found
#import "lib@0.2.1" using *
// Some non-text stuff.
// Error: 9-30 file is not valid utf-8
#import "../../res/rhino.png" using *
// Unresolved import.
// Error: 28-40 unresolved import
#import "target.typ" using non_existing
// Cyclic import.
// Error: 9-34 cyclic import
#import "./importable/cycle1.typ" using *
---
// Test syntax.
// Missing file.
// Error: 9-10 expected expression, found star
#import *
// Should output `"target.typ"`.
// Error: 1-7 unexpected keyword `using`
#using "target.typ"
// Should output `target`.
// Error: 3:9-4:8 file not found
// Error: 3:8 expected semicolon or line break
// Error: 2:8 expected keyword `using`
#import "target.typ
using "target
// Should output `@ 0.2.1 using`.
// Error: 2:21 expected semicolon or line break
// Error: 1:21 expected keyword `using`
#import "target.typ" @ 0.2.1 using *
// Error: 3:21 expected keyword `using`
// Error: 2:21 expected semicolon or line break
// Error: 1:22-1:28 unexpected keyword `using`
#import "target.typ" #using *
// Error: 2:21 expected semicolon or line break
// Error: 1:21 expected keyword `using`
#import "target.typ" usinga,b,c
// Error: 27 expected import items
#import "target.typ" using
// Error: 2:28-2:29 expected expression, found assignment operator
// Error: 1:29 expected import items
#import "target.typ" using =
// Allow the trailing comma.
#import "target.typ" using a, c,
// An additional trailing comma.
// Error: 36-37 expected expression, found comma
#import "target.typ" using a, b, c,,
// Star in the list.
// Error: 2:31-2:32 expected expression, found star
// Error: 32-33 expected expression, found comma
#import "target.typ" using a, *, b
// Stop at semicolon.
#import "target.typ" using a, c;Hi
// Who needs whitespace anyways?
#import "target.typ"using *
#import"target.typ"using*
#import "target.typ"using *
|