summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-08 21:16:16 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-08 21:16:16 +0200
commit551e3af9d09a03aaa246cac46b98124bc10835ba (patch)
treeb075a93df7cb608eae9650e497fb6a1336d80212 /tests/typ
parent5c327e249e03ac303e7fef40e2df6c6ef834db66 (diff)
Replace using with from
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/code/block-scoping.typ2
-rw-r--r--tests/typ/code/import.typ131
-rw-r--r--tests/typ/code/importable/cycle1.typ4
-rw-r--r--tests/typ/code/importable/cycle2.typ4
4 files changed, 71 insertions, 70 deletions
diff --git a/tests/typ/code/block-scoping.typ b/tests/typ/code/block-scoping.typ
index ed689f3d..7970ee1b 100644
--- a/tests/typ/code/block-scoping.typ
+++ b/tests/typ/code/block-scoping.typ
@@ -21,7 +21,7 @@
---
// Double block creates a scope.
{{
- import "target.typ" using b
+ import b from "target.typ"
test(b, 1)
}}
diff --git a/tests/typ/code/import.typ b/tests/typ/code/import.typ
index 30dc556c..18ebd499 100644
--- a/tests/typ/code/import.typ
+++ b/tests/typ/code/import.typ
@@ -4,21 +4,21 @@
// Test importing semantics.
// A named import.
-#import "target.typ" using item
+#import item from "target.typ"
#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
+// Error: 9-10 expected expression, found comma
+#import ,fn, value from "target.typ"
#fn[Like and Subscribe!]
#value
// Code mode
{
- import "target.typ" using b
+ import b from "target.typ"
test(b, 1)
}
@@ -29,91 +29,92 @@
#d
// A wildcard import.
-#import "target.typ" using *
+#import * from "target.typ"
// It exists now!
#d
+// Who needs whitespace anyways?
+#import*from"target.typ"
+
+// Should output `Hi`.
+// Stop at semicolon.
+#import a, c from "target.typ";bye
+
+// Allow the trailing comma.
+#import a, c, from "target.typ"
+
---
// 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: 19-21 file not found
+#import name from ""
-// Error: 9-20 file not found
-#import "lib@0.2.1" using *
+// Error: 16-27 file not found
+#import * from "lib/0.2.1"
// Some non-text stuff.
-// Error: 9-30 file is not valid utf-8
-#import "../../res/rhino.png" using *
+// Error: 16-37 file is not valid utf-8
+#import * from "../../res/rhino.png"
// Unresolved import.
-// Error: 28-40 unresolved import
-#import "target.typ" using non_existing
+// Error: 9-21 unresolved import
+#import non_existing from "target.typ"
// Cyclic import.
-// Error: 9-34 cyclic import
-#import "./importable/cycle1.typ" using *
+// Error: 16-41 cyclic import
+#import * from "./importable/cycle1.typ"
---
-// 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"
+// Test bad syntax.
-// 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
+// Error: 2:8 expected import items
+// Error: 1:8 expected keyword `from`
+#import
-// 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: 2:9-2:19 expected identifier
+// Error: 1:19 expected keyword `from`
+#import "file.typ"
-// 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:16-2:19 expected identifier
+// Error: 1:22 expected keyword `from`
+#import afrom, "b", c
-// Error: 2:21 expected semicolon or line break
-// Error: 1:21 expected keyword `using`
-#import "target.typ" usinga,b,c
+// Error: 8 expected import items
+#import from "target.typ"
-// Error: 27 expected import items
-#import "target.typ" using
+// Error: 2:9-2:10 expected expression, found assignment operator
+// Error: 1:10 expected import items
+#import = from "target.typ"
-// 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,
+// Error: 15 expected expression
+#import * from
// 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
+// Error: 17-18 expected expression, found comma
+#import a, b, c,, from "target.typ"
-// Stop at semicolon.
-#import "target.typ" using a, c;Hi
+// Should output `"target.typ"`.
+// Error: 1-6 unexpected keyword `from`
+#from "target.typ"
-// Who needs whitespace anyways?
-#import "target.typ"using *
-#import"target.typ"using*
-#import "target.typ"using *
+// Should output `target`.
+// Error: 2:16-3:2 file not found
+// Error: 2:2 expected semicolon or line break
+#import * from "target.typ
+"target
+
+// Should output `@ 0.2.1`.
+// Error: 28 expected semicolon or line break
+#import * from "target.typ" @ 0.2.1
+
+// A star in the list.
+// Error: 2:12-2:13 expected expression, found star
+// Error: 1:13-1:14 expected expression, found comma
+#import a, *, b from "target.typ"
+
+// An item after a star.
+// Should output `, a from "target.typ"`.
+// Error: 10 expected keyword `from`
+#import *, a from "target.typ"
diff --git a/tests/typ/code/importable/cycle1.typ b/tests/typ/code/importable/cycle1.typ
index e251686d..ae755fa0 100644
--- a/tests/typ/code/importable/cycle1.typ
+++ b/tests/typ/code/importable/cycle1.typ
@@ -1,7 +1,7 @@
// Ref: false
-// Error: 9-21 cyclic import
-#import "cycle2.typ" using *
+// Error: 16-28 cyclic import
+#import * from "cycle2.typ"
#let inaccessible = "wow"
This is the first element of an import cycle.
diff --git a/tests/typ/code/importable/cycle2.typ b/tests/typ/code/importable/cycle2.typ
index 8071ec6b..d4f94564 100644
--- a/tests/typ/code/importable/cycle2.typ
+++ b/tests/typ/code/importable/cycle2.typ
@@ -1,7 +1,7 @@
// Ref: false
-// Error: 9-21 cyclic import
-#import "cycle1.typ" using *
+// Error: 16-28 cyclic import
+#import * from "cycle1.typ"
#let val = "much cycle"
This is the second element of an import cycle.