diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-29 13:37:25 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-29 14:18:13 +0100 |
| commit | 0efe669278a5e1c3f2985eba2f3360e91159c54a (patch) | |
| tree | 502712857c48f0decb5e698257c0a96d358a436e /tests/typ | |
| parent | 836692e73cff0356e409a9ba5b4887b86809d4ca (diff) | |
Reorganize library and tests
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/base/assert.typ | 23 | ||||
| -rw-r--r-- | tests/typ/base/numbering.typ | 13 | ||||
| -rw-r--r-- | tests/typ/base/type.typ | 7 | ||||
| -rw-r--r-- | tests/typ/basics/desc.typ (renamed from tests/typ/structure/desc.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/basics/enum.typ (renamed from tests/typ/structure/enum.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/basics/heading.typ (renamed from tests/typ/structure/heading.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/basics/list-attach.typ (renamed from tests/typ/structure/attach.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/basics/list.typ (renamed from tests/typ/structure/list.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/basics/table.typ (renamed from tests/typ/structure/table.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/array.typ (renamed from tests/typ/code/array.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/bench.typ (renamed from tests/typ/benches/bench.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/block.typ (renamed from tests/typ/code/block.typ) | 2 | ||||
| -rw-r--r-- | tests/typ/compiler/break-continue.typ (renamed from tests/typ/code/break-continue.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/call.typ (renamed from tests/typ/code/call.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/closure.typ (renamed from tests/typ/code/closure.typ) | 2 | ||||
| -rw-r--r-- | tests/typ/compiler/comment.typ (renamed from tests/typ/code/comment.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/construct.typ (renamed from tests/typ/style/construct.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/dict.typ (renamed from tests/typ/code/dict.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/field.typ (renamed from tests/typ/code/field.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/for.typ (renamed from tests/typ/code/for.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/if.typ (renamed from tests/typ/code/if.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/import.typ (renamed from tests/typ/code/import.typ) | 36 | ||||
| -rw-r--r-- | tests/typ/compiler/include.typ (renamed from tests/typ/code/include.typ) | 10 | ||||
| -rw-r--r-- | tests/typ/compiler/label.typ (renamed from tests/typ/style/label.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/let.typ (renamed from tests/typ/code/let.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/methods-collection.typ (renamed from tests/typ/base/collection.typ) | 2 | ||||
| -rw-r--r-- | tests/typ/compiler/methods-color.typ | 22 | ||||
| -rw-r--r-- | tests/typ/compiler/methods-str.typ (renamed from tests/typ/base/string.typ) | 25 | ||||
| -rw-r--r-- | tests/typ/compiler/methods.typ (renamed from tests/typ/code/methods.typ) | 4 | ||||
| -rw-r--r-- | tests/typ/compiler/module.typ (renamed from tests/typ/code/target.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/modules/chap1.typ (renamed from tests/typ/code/importable/chap1.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/modules/chap2.typ (renamed from tests/typ/code/importable/chap2.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/modules/cycle1.typ (renamed from tests/typ/code/importable/cycle1.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/modules/cycle2.typ (renamed from tests/typ/code/importable/cycle2.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/ops-assoc.typ (renamed from tests/typ/code/ops-assoc.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/ops-invalid.typ (renamed from tests/typ/code/ops-invalid.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/ops-prec.typ (renamed from tests/typ/code/ops-prec.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/ops.typ (renamed from tests/typ/code/ops.typ) | 4 | ||||
| -rw-r--r-- | tests/typ/compiler/repr.typ (renamed from tests/typ/code/repr.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/return.typ (renamed from tests/typ/code/return.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/set.typ (renamed from tests/typ/style/set.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/shorthand.typ (renamed from tests/typ/text/shorthands.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/show-bare.typ (renamed from tests/typ/style/show-bare.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/show-node.typ (renamed from tests/typ/style/show-node.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/show-recursive.typ (renamed from tests/typ/style/show-recursive.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/show-selector.typ (renamed from tests/typ/style/show-selector.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/show-text.typ (renamed from tests/typ/style/show-text.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/spread.typ (renamed from tests/typ/code/spread.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compiler/while.typ (renamed from tests/typ/code/while.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compute/calc.typ (renamed from tests/typ/base/calc.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/compute/create.typ (renamed from tests/typ/base/color.typ) | 36 | ||||
| -rw-r--r-- | tests/typ/compute/data.typ (renamed from tests/typ/base/data.typ) | 2 | ||||
| -rw-r--r-- | tests/typ/compute/foundations.typ (renamed from tests/typ/base/eval.typ) | 28 | ||||
| -rw-r--r-- | tests/typ/compute/utility.typ (renamed from tests/typ/base/blind.typ) | 14 | ||||
| -rw-r--r-- | tests/typ/layout/flow-orphan.typ (renamed from tests/typ/layout/orphan-widow.typ) | 9 | ||||
| -rw-r--r-- | tests/typ/layout/hide.typ (renamed from tests/typ/graphics/hide.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/orphan-heading.typ | 8 | ||||
| -rw-r--r-- | tests/typ/layout/par-bidi.typ (renamed from tests/typ/text/bidi.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/par-indent.typ (renamed from tests/typ/text/indent.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/par-justify.typ (renamed from tests/typ/text/justify.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/par-knuth.typ (renamed from tests/typ/text/knuth.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/par-simple.typ (renamed from tests/typ/text/plain.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/par.typ (renamed from tests/typ/text/par.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/repeat.typ (renamed from tests/typ/text/repeat.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/layout/transform.typ (renamed from tests/typ/graphics/transform.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/math/simple.typ (renamed from tests/typ/layout/math.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/meta/document.typ (renamed from tests/typ/style/document.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/meta/link.typ (renamed from tests/typ/text/link.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/text/case.typ | 12 | ||||
| -rw-r--r-- | tests/typ/text/emphasis.typ (renamed from tests/typ/text/emph-strong.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/text/raw-highlight.typ (renamed from tests/typ/text/code.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/text/shift.typ (renamed from tests/typ/text/shifts.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/text/space.typ (renamed from tests/typ/text/whitespace.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/image.typ (renamed from tests/typ/graphics/image.typ) | 2 | ||||
| -rw-r--r-- | tests/typ/visualize/line.typ (renamed from tests/typ/graphics/line.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-aspect.typ (renamed from tests/typ/graphics/shape-aspect.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-circle.typ (renamed from tests/typ/graphics/shape-circle.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-ellipse.typ (renamed from tests/typ/graphics/shape-ellipse.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-fill-stroke.typ (renamed from tests/typ/graphics/shape-fill-stroke.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-rect.typ (renamed from tests/typ/graphics/shape-rect.typ) | 0 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-square.typ (renamed from tests/typ/graphics/shape-square.typ) | 0 |
81 files changed, 129 insertions, 132 deletions
diff --git a/tests/typ/base/assert.typ b/tests/typ/base/assert.typ deleted file mode 100644 index b0c8aafd..00000000 --- a/tests/typ/base/assert.typ +++ /dev/null @@ -1,23 +0,0 @@ -// Test the `assert` function. -// Ref: false - ---- -#assert(1 + 1 == 2) -#assert(range(2, 5) == (2, 3, 4)) -#assert(not false) - ---- -// Test failing assertions. -// Error: 9-15 assertion failed -#assert(1 == 2) - ---- -// Test failing assertions. -// Error: 9-15 expected boolean, found string -#assert("true") - ---- -// Test the `type` function. -#test(type(1), "integer") -#test(type(ltr), "direction") -#test(type(10 / 3), "float") diff --git a/tests/typ/base/numbering.typ b/tests/typ/base/numbering.typ deleted file mode 100644 index 200850bc..00000000 --- a/tests/typ/base/numbering.typ +++ /dev/null @@ -1,13 +0,0 @@ -// Test integrated numbering patterns. - ---- -#for i in range(9) { - numbering(i, "* and ") - numbering(i, "I") - [ for #i] - parbreak() -} - ---- -// Error: 12-14 must be at least zero -#numbering(-1, "1") diff --git a/tests/typ/base/type.typ b/tests/typ/base/type.typ deleted file mode 100644 index 37cf8623..00000000 --- a/tests/typ/base/type.typ +++ /dev/null @@ -1,7 +0,0 @@ -// Test the `type` function. -// Ref: false - ---- -#test(type(1), "integer") -#test(type(ltr), "direction") -#test(type(10 / 3), "float") diff --git a/tests/typ/structure/desc.typ b/tests/typ/basics/desc.typ index 1bc92625..1bc92625 100644 --- a/tests/typ/structure/desc.typ +++ b/tests/typ/basics/desc.typ diff --git a/tests/typ/structure/enum.typ b/tests/typ/basics/enum.typ index d4c30385..d4c30385 100644 --- a/tests/typ/structure/enum.typ +++ b/tests/typ/basics/enum.typ diff --git a/tests/typ/structure/heading.typ b/tests/typ/basics/heading.typ index 9fd4e648..9fd4e648 100644 --- a/tests/typ/structure/heading.typ +++ b/tests/typ/basics/heading.typ diff --git a/tests/typ/structure/attach.typ b/tests/typ/basics/list-attach.typ index 9d043eb0..9d043eb0 100644 --- a/tests/typ/structure/attach.typ +++ b/tests/typ/basics/list-attach.typ diff --git a/tests/typ/structure/list.typ b/tests/typ/basics/list.typ index 9ed5993a..9ed5993a 100644 --- a/tests/typ/structure/list.typ +++ b/tests/typ/basics/list.typ diff --git a/tests/typ/structure/table.typ b/tests/typ/basics/table.typ index 527141c5..527141c5 100644 --- a/tests/typ/structure/table.typ +++ b/tests/typ/basics/table.typ diff --git a/tests/typ/code/array.typ b/tests/typ/compiler/array.typ index cb8433cb..cb8433cb 100644 --- a/tests/typ/code/array.typ +++ b/tests/typ/compiler/array.typ diff --git a/tests/typ/benches/bench.typ b/tests/typ/compiler/bench.typ index 6aff1ac2..6aff1ac2 100644 --- a/tests/typ/benches/bench.typ +++ b/tests/typ/compiler/bench.typ diff --git a/tests/typ/code/block.typ b/tests/typ/compiler/block.typ index d82d497f..45f63f8e 100644 --- a/tests/typ/code/block.typ +++ b/tests/typ/compiler/block.typ @@ -79,7 +79,7 @@ --- // Double block creates a scope. {{ - import b from "target.typ" + import b from "module.typ" test(b, 1) }} diff --git a/tests/typ/code/break-continue.typ b/tests/typ/compiler/break-continue.typ index fb3222fa..fb3222fa 100644 --- a/tests/typ/code/break-continue.typ +++ b/tests/typ/compiler/break-continue.typ diff --git a/tests/typ/code/call.typ b/tests/typ/compiler/call.typ index dc582c9c..dc582c9c 100644 --- a/tests/typ/code/call.typ +++ b/tests/typ/compiler/call.typ diff --git a/tests/typ/code/closure.typ b/tests/typ/compiler/closure.typ index e9389e13..2c6c1ea0 100644 --- a/tests/typ/code/closure.typ +++ b/tests/typ/compiler/closure.typ @@ -60,7 +60,7 @@ --- // Import bindings. { - let b = "target.typ" + let b = "module.typ" let f() = { import b from b b diff --git a/tests/typ/code/comment.typ b/tests/typ/compiler/comment.typ index 4a4dc7ab..4a4dc7ab 100644 --- a/tests/typ/code/comment.typ +++ b/tests/typ/compiler/comment.typ diff --git a/tests/typ/style/construct.typ b/tests/typ/compiler/construct.typ index f535184c..f535184c 100644 --- a/tests/typ/style/construct.typ +++ b/tests/typ/compiler/construct.typ diff --git a/tests/typ/code/dict.typ b/tests/typ/compiler/dict.typ index d791f77b..d791f77b 100644 --- a/tests/typ/code/dict.typ +++ b/tests/typ/compiler/dict.typ diff --git a/tests/typ/code/field.typ b/tests/typ/compiler/field.typ index abea87fb..abea87fb 100644 --- a/tests/typ/code/field.typ +++ b/tests/typ/compiler/field.typ diff --git a/tests/typ/code/for.typ b/tests/typ/compiler/for.typ index 822f7423..822f7423 100644 --- a/tests/typ/code/for.typ +++ b/tests/typ/compiler/for.typ diff --git a/tests/typ/code/if.typ b/tests/typ/compiler/if.typ index 0d87c689..0d87c689 100644 --- a/tests/typ/code/if.typ +++ b/tests/typ/compiler/if.typ diff --git a/tests/typ/code/import.typ b/tests/typ/compiler/import.typ index 5291af39..0620403d 100644 --- a/tests/typ/code/import.typ +++ b/tests/typ/compiler/import.typ @@ -4,45 +4,45 @@ // Test importing semantics. // A named import. -#import item from "target.typ" +#import item from "module.typ" #test(item(1, 2), 3) // Test that this will be overwritten. #let value = [foo] // Import multiple things. -#import fn, value from "target.typ" +#import fn, value from "module.typ" #fn[Like and Subscribe!] #value // Code mode { - import b from "target.typ" + import b from "module.typ" test(b, 1) } // A wildcard import. -#import * from "target.typ" +#import * from "module.typ" // It exists now! #d // Who needs whitespace anyways? -#import*from"target.typ" +#import*from"module.typ" // Should output `bye`. // Stop at semicolon. -#import a, c from "target.typ";bye +#import a, c from "module.typ";bye // Allow the trailing comma. -#import a, c, from "target.typ" +#import a, c, from "module.typ" --- // Error: 19-21 failed to load file (is a directory) #import name from "" --- -// Error: 16-27 file not found (searched at typ/code/lib/0.2.1) +// Error: 16-27 file not found (searched at typ/compiler/lib/0.2.1) #import * from "lib/0.2.1" --- @@ -53,7 +53,7 @@ --- // Unresolved import. // Error: 9-21 unresolved import -#import non_existing from "target.typ" +#import non_existing from "module.typ" --- // Cyclic import of this very file. @@ -62,7 +62,7 @@ --- // Cyclic import in other file. -#import * from "./importable/cycle1.typ" +#import * from "./modules/cycle1.typ" This is never reached. @@ -80,36 +80,36 @@ This is never reached. #import afrom, "b", c // Error: 9 expected import items -#import from "target.typ" +#import from "module.typ" // Error: 9-10 expected expression, found assignment operator // Error: 10 expected import items -#import = from "target.typ" +#import = from "module.typ" // Error: 15 expected expression #import * from // An additional trailing comma. // Error: 17-18 expected expression, found comma -#import a, b, c,, from "target.typ" +#import a, b, c,, from "module.typ" // Error: 1-6 unexpected keyword `from` -#from "target.typ" +#from "module.typ" // Error: 2:2 expected semicolon or line break -#import * from "target.typ +#import * from "module.typ "target // Error: 28 expected semicolon or line break -#import * from "target.typ" § 0.2.1 +#import * from "module.typ" § 0.2.1 // A star in the list. // Error: 12-13 expected expression, found star -#import a, *, b from "target.typ" +#import a, *, b from "module.typ" // An item after a star. // Error: 10 expected keyword `from` -#import *, a from "target.typ" +#import *, a from "module.typ" --- // Error: 9-13 expected identifier, found named pair diff --git a/tests/typ/code/include.typ b/tests/typ/compiler/include.typ index e862adac..289fea21 100644 --- a/tests/typ/code/include.typ +++ b/tests/typ/compiler/include.typ @@ -6,22 +6,22 @@ = Document // Include a file -#include "/typ/code/importable/chap1.typ" +#include "/typ/compiler/modules/chap1.typ" // Expression as a file name. -#let chap2 = include "import" + "able/chap" + "2.typ" +#let chap2 = include "modu" + "les/chap" + "2.typ" -- _Intermission_ -- #chap2 --- { - // Error: 19-41 file not found (searched at typ/code/importable/chap3.typ) - let x = include "importable/chap3.typ" + // Error: 19-38 file not found (searched at typ/compiler/modules/chap3.typ) + let x = include "modules/chap3.typ" } --- -#include "importable/chap1.typ" +#include "modules/chap1.typ" // The variables of the file should not appear in this scope. // Error: 1-6 unknown variable diff --git a/tests/typ/style/label.typ b/tests/typ/compiler/label.typ index 795c0435..795c0435 100644 --- a/tests/typ/style/label.typ +++ b/tests/typ/compiler/label.typ diff --git a/tests/typ/code/let.typ b/tests/typ/compiler/let.typ index c3be64a5..c3be64a5 100644 --- a/tests/typ/code/let.typ +++ b/tests/typ/compiler/let.typ diff --git a/tests/typ/base/collection.typ b/tests/typ/compiler/methods-collection.typ index 46ff97ab..fcebf640 100644 --- a/tests/typ/base/collection.typ +++ b/tests/typ/compiler/methods-collection.typ @@ -1,4 +1,4 @@ -// Test collection functions. +// Test the collection methods. // Ref: false --- diff --git a/tests/typ/compiler/methods-color.typ b/tests/typ/compiler/methods-color.typ new file mode 100644 index 00000000..1188030a --- /dev/null +++ b/tests/typ/compiler/methods-color.typ @@ -0,0 +1,22 @@ +// Test color modification methods. + +--- +// Test gray color modification. +#test(luma(20%).lighten(50%), luma(60%)) +#test(luma(80%).darken(20%), luma(63.9%)) +#test(luma(80%).negate(), luma(20%)) + +--- +// Test CMYK color conversion. +// Ref: true +#let c = cmyk(50%, 64%, 16%, 17%) +#rect(width: 1cm, fill: cmyk(69%, 11%, 69%, 41%)) +#rect(width: 1cm, fill: c) +#rect(width: 1cm, fill: c.negate()) + +#for x in range(0, 11) { + square(width: 9pt, fill: c.lighten(x * 10%)) +} +#for x in range(0, 11) { + square(width: 9pt, fill: c.darken(x * 10%)) +} diff --git a/tests/typ/base/string.typ b/tests/typ/compiler/methods-str.typ index e724f563..aead4aa4 100644 --- a/tests/typ/base/string.typ +++ b/tests/typ/compiler/methods-str.typ @@ -1,19 +1,7 @@ -// Test string related methods. +// Test the string methods. // Ref: false --- -// Test conversion to string. -#test(str(123), "123") -#test(str(50.14), "50.14") -#test(str(10 / 3).len() > 10, true) -#test(repr(ltr), "ltr") -#test(repr((1, 2, false, )), "(1, 2, false)") - ---- -// Error: 6-8 cannot convert content to string -#str([]) - ---- // Test the `slice` method. #test("abc".slice(1, 2), "b") #test("abc🏡def".slice(2, 7), "c🏡") @@ -127,14 +115,3 @@ #test("abc".split("b"), ("a", "c")) #test("a123c".split(regex("\d")), ("a", "", "", "c")) #test("a123c".split(regex("\d+")), ("a", "c")) - ---- -// Test the `upper` and `lower` functions. -#let memes = "ArE mEmEs gReAt?"; -#test(lower(memes), "are memes great?") -#test(upper(memes), "ARE MEMES GREAT?") -#test(upper("Ελλάδα"), "ΕΛΛΆΔΑ") - ---- -// Error: 8-9 expected string or content, found integer -#upper(1) diff --git a/tests/typ/code/methods.typ b/tests/typ/compiler/methods.typ index f5db8ca0..07f6e410 100644 --- a/tests/typ/code/methods.typ +++ b/tests/typ/compiler/methods.typ @@ -43,8 +43,4 @@ --- // Error: 3-6 cannot mutate a constant -{ box = 1 } - ---- -// Error: 3-6 cannot mutate a constant { box.push(1) } diff --git a/tests/typ/code/target.typ b/tests/typ/compiler/module.typ index b0a3fbf3..b0a3fbf3 100644 --- a/tests/typ/code/target.typ +++ b/tests/typ/compiler/module.typ diff --git a/tests/typ/code/importable/chap1.typ b/tests/typ/compiler/modules/chap1.typ index 06a4c1a1..06a4c1a1 100644 --- a/tests/typ/code/importable/chap1.typ +++ b/tests/typ/compiler/modules/chap1.typ diff --git a/tests/typ/code/importable/chap2.typ b/tests/typ/compiler/modules/chap2.typ index d4aedc60..d4aedc60 100644 --- a/tests/typ/code/importable/chap2.typ +++ b/tests/typ/compiler/modules/chap2.typ diff --git a/tests/typ/code/importable/cycle1.typ b/tests/typ/compiler/modules/cycle1.typ index a9c00f5e..a9c00f5e 100644 --- a/tests/typ/code/importable/cycle1.typ +++ b/tests/typ/compiler/modules/cycle1.typ diff --git a/tests/typ/code/importable/cycle2.typ b/tests/typ/compiler/modules/cycle2.typ index 204da519..204da519 100644 --- a/tests/typ/code/importable/cycle2.typ +++ b/tests/typ/compiler/modules/cycle2.typ diff --git a/tests/typ/code/ops-assoc.typ b/tests/typ/compiler/ops-assoc.typ index ec128c61..ec128c61 100644 --- a/tests/typ/code/ops-assoc.typ +++ b/tests/typ/compiler/ops-assoc.typ diff --git a/tests/typ/code/ops-invalid.typ b/tests/typ/compiler/ops-invalid.typ index 3e9e5478..3e9e5478 100644 --- a/tests/typ/code/ops-invalid.typ +++ b/tests/typ/compiler/ops-invalid.typ diff --git a/tests/typ/code/ops-prec.typ b/tests/typ/compiler/ops-prec.typ index 23afcc5f..23afcc5f 100644 --- a/tests/typ/code/ops-prec.typ +++ b/tests/typ/compiler/ops-prec.typ diff --git a/tests/typ/code/ops.typ b/tests/typ/compiler/ops.typ index c382f34d..a38a527c 100644 --- a/tests/typ/code/ops.typ +++ b/tests/typ/compiler/ops.typ @@ -189,6 +189,10 @@ { x += "thing" } #test(x, "something") --- +// Error: 3-6 cannot mutate a constant +{ box = 1 } + +--- // Test `in` operator. #test("hi" in "worship", true) #test("hi" in ("we", "hi", "bye"), true) diff --git a/tests/typ/code/repr.typ b/tests/typ/compiler/repr.typ index bdea9c82..bdea9c82 100644 --- a/tests/typ/code/repr.typ +++ b/tests/typ/compiler/repr.typ diff --git a/tests/typ/code/return.typ b/tests/typ/compiler/return.typ index 0eea394e..0eea394e 100644 --- a/tests/typ/code/return.typ +++ b/tests/typ/compiler/return.typ diff --git a/tests/typ/style/set.typ b/tests/typ/compiler/set.typ index fc5053b1..fc5053b1 100644 --- a/tests/typ/style/set.typ +++ b/tests/typ/compiler/set.typ diff --git a/tests/typ/text/shorthands.typ b/tests/typ/compiler/shorthand.typ index 5c94dab0..5c94dab0 100644 --- a/tests/typ/text/shorthands.typ +++ b/tests/typ/compiler/shorthand.typ diff --git a/tests/typ/style/show-bare.typ b/tests/typ/compiler/show-bare.typ index 8b8d0852..8b8d0852 100644 --- a/tests/typ/style/show-bare.typ +++ b/tests/typ/compiler/show-bare.typ diff --git a/tests/typ/style/show-node.typ b/tests/typ/compiler/show-node.typ index 98f36f13..98f36f13 100644 --- a/tests/typ/style/show-node.typ +++ b/tests/typ/compiler/show-node.typ diff --git a/tests/typ/style/show-recursive.typ b/tests/typ/compiler/show-recursive.typ index 91a295f2..91a295f2 100644 --- a/tests/typ/style/show-recursive.typ +++ b/tests/typ/compiler/show-recursive.typ diff --git a/tests/typ/style/show-selector.typ b/tests/typ/compiler/show-selector.typ index 0e9823a5..0e9823a5 100644 --- a/tests/typ/style/show-selector.typ +++ b/tests/typ/compiler/show-selector.typ diff --git a/tests/typ/style/show-text.typ b/tests/typ/compiler/show-text.typ index 124d2ed2..124d2ed2 100644 --- a/tests/typ/style/show-text.typ +++ b/tests/typ/compiler/show-text.typ diff --git a/tests/typ/code/spread.typ b/tests/typ/compiler/spread.typ index ff661ead..ff661ead 100644 --- a/tests/typ/code/spread.typ +++ b/tests/typ/compiler/spread.typ diff --git a/tests/typ/code/while.typ b/tests/typ/compiler/while.typ index 5dc5ae41..5dc5ae41 100644 --- a/tests/typ/code/while.typ +++ b/tests/typ/compiler/while.typ diff --git a/tests/typ/base/calc.typ b/tests/typ/compute/calc.typ index 4ccefa22..4ccefa22 100644 --- a/tests/typ/base/calc.typ +++ b/tests/typ/compute/calc.typ diff --git a/tests/typ/base/color.typ b/tests/typ/compute/create.typ index aecd86b8..462f06e9 100644 --- a/tests/typ/base/color.typ +++ b/tests/typ/compute/create.typ @@ -1,4 +1,4 @@ -// Test color creation functions and modification methods. +// Test creation and conversion functions. // Ref: false --- @@ -21,27 +21,6 @@ #rect(fill: luma(80%)) --- -// Test gray color modification. -#test(luma(20%).lighten(50%), luma(60%)) -#test(luma(80%).darken(20%), luma(63.9%)) -#test(luma(80%).negate(), luma(20%)) - ---- -// Test CMYK color conversion. -// Ref: true -#let c = cmyk(50%, 64%, 16%, 17%) -#rect(width: 1cm, fill: cmyk(69%, 11%, 69%, 41%)) -#rect(width: 1cm, fill: c) -#rect(width: 1cm, fill: c.negate()) - -#for x in range(0, 11) { - square(width: 9pt, fill: c.lighten(x * 10%)) -} -#for x in range(0, 11) { - square(width: 9pt, fill: c.darken(x * 10%)) -} - ---- // Error for values that are out of range. // Error: 11-14 must be between 0 and 255 #test(rgb(-30, 15, 50)) @@ -61,3 +40,16 @@ --- // Error: 21-26 expected integer or ratio, found boolean #rgb(10%, 20%, 30%, false) + +--- +// Test conversion to string. +#test(str(123), "123") +#test(str(50.14), "50.14") +#test(str(10 / 3).len() > 10, true) + +--- +// Error: 6-8 cannot convert content to string +#str([]) + +--- +#assert(range(2, 5) == (2, 3, 4)) diff --git a/tests/typ/base/data.typ b/tests/typ/compute/data.typ index 96b12ff5..c1def7d5 100644 --- a/tests/typ/base/data.typ +++ b/tests/typ/compute/data.typ @@ -10,7 +10,7 @@ #table(columns: data(0).len(), ..cells) --- -// Error: 6-16 file not found (searched at typ/base/nope.csv) +// Error: 6-16 file not found (searched at typ/compute/nope.csv) #csv("nope.csv") --- diff --git a/tests/typ/base/eval.typ b/tests/typ/compute/foundations.typ index 80235c0c..6fc93a75 100644 --- a/tests/typ/base/eval.typ +++ b/tests/typ/compute/foundations.typ @@ -1,4 +1,30 @@ -// Test the `eval` function. +// Test foundational functions. +// Ref: false + +--- +#test(type(1), "integer") +#test(type(ltr), "direction") +#test(type(10 / 3), "float") + +--- +#test(repr(ltr), "ltr") +#test(repr((1, 2, false, )), "(1, 2, false)") + +--- +// Test failing assertions. +// Error: 9-15 assertion failed +#assert(1 == 2) + +--- +// Test failing assertions. +// Error: 9-15 expected boolean, found string +#assert("true") + +--- +// Test the `type` function. +#test(type(1), "integer") +#test(type(ltr), "direction") +#test(type(10 / 3), "float") --- #eval("_Hello" + " World!_") diff --git a/tests/typ/base/blind.typ b/tests/typ/compute/utility.typ index 17452dec..f042c769 100644 --- a/tests/typ/base/blind.typ +++ b/tests/typ/compute/utility.typ @@ -1,4 +1,4 @@ -// Test blind text. +// Test integrated numbering patterns. --- // Test basic call. @@ -30,3 +30,15 @@ --- // Error: 7-9 missing argument: number of words #lorem() + +--- +#for i in range(9) { + numbering(i, "* and ") + numbering(i, "I") + [ for #i] + parbreak() +} + +--- +// Error: 12-14 must be at least zero +#numbering(-1, "1") diff --git a/tests/typ/layout/orphan-widow.typ b/tests/typ/layout/flow-orphan.typ index 445b44e3..a51da2b2 100644 --- a/tests/typ/layout/orphan-widow.typ +++ b/tests/typ/layout/flow-orphan.typ @@ -1,4 +1,11 @@ -// Test widow and orphan prevention. +// Test that a heading doesn't become an orphan. + +--- +#set page(height: 100pt) +#lorem(12) + += Introduction +This is the start and it goes on. --- #set page("a8", height: 150pt) diff --git a/tests/typ/graphics/hide.typ b/tests/typ/layout/hide.typ index a979b24f..a979b24f 100644 --- a/tests/typ/graphics/hide.typ +++ b/tests/typ/layout/hide.typ diff --git a/tests/typ/layout/orphan-heading.typ b/tests/typ/layout/orphan-heading.typ deleted file mode 100644 index ef3de885..00000000 --- a/tests/typ/layout/orphan-heading.typ +++ /dev/null @@ -1,8 +0,0 @@ -// Test that a heading doesn't become an orphan. - ---- -#set page(height: 100pt) -#lorem(12) - -= Introduction -This is the start and it goes on. diff --git a/tests/typ/text/bidi.typ b/tests/typ/layout/par-bidi.typ index 11c0cafa..11c0cafa 100644 --- a/tests/typ/text/bidi.typ +++ b/tests/typ/layout/par-bidi.typ diff --git a/tests/typ/text/indent.typ b/tests/typ/layout/par-indent.typ index 8454dda5..8454dda5 100644 --- a/tests/typ/text/indent.typ +++ b/tests/typ/layout/par-indent.typ diff --git a/tests/typ/text/justify.typ b/tests/typ/layout/par-justify.typ index e3d61322..e3d61322 100644 --- a/tests/typ/text/justify.typ +++ b/tests/typ/layout/par-justify.typ diff --git a/tests/typ/text/knuth.typ b/tests/typ/layout/par-knuth.typ index 59349738..59349738 100644 --- a/tests/typ/text/knuth.typ +++ b/tests/typ/layout/par-knuth.typ diff --git a/tests/typ/text/plain.typ b/tests/typ/layout/par-simple.typ index 34a2d626..34a2d626 100644 --- a/tests/typ/text/plain.typ +++ b/tests/typ/layout/par-simple.typ diff --git a/tests/typ/text/par.typ b/tests/typ/layout/par.typ index 558059e9..558059e9 100644 --- a/tests/typ/text/par.typ +++ b/tests/typ/layout/par.typ diff --git a/tests/typ/text/repeat.typ b/tests/typ/layout/repeat.typ index 13e99b51..13e99b51 100644 --- a/tests/typ/text/repeat.typ +++ b/tests/typ/layout/repeat.typ diff --git a/tests/typ/graphics/transform.typ b/tests/typ/layout/transform.typ index 2dde626b..2dde626b 100644 --- a/tests/typ/graphics/transform.typ +++ b/tests/typ/layout/transform.typ diff --git a/tests/typ/layout/math.typ b/tests/typ/math/simple.typ index 55a853cf..55a853cf 100644 --- a/tests/typ/layout/math.typ +++ b/tests/typ/math/simple.typ diff --git a/tests/typ/style/document.typ b/tests/typ/meta/document.typ index 1fcb8109..1fcb8109 100644 --- a/tests/typ/style/document.typ +++ b/tests/typ/meta/document.typ diff --git a/tests/typ/text/link.typ b/tests/typ/meta/link.typ index 8c3e6ddd..8c3e6ddd 100644 --- a/tests/typ/text/link.typ +++ b/tests/typ/meta/link.typ diff --git a/tests/typ/text/case.typ b/tests/typ/text/case.typ new file mode 100644 index 00000000..75574f21 --- /dev/null +++ b/tests/typ/text/case.typ @@ -0,0 +1,12 @@ +// Test the `upper` and `lower` functions. +// Ref: false + +--- +#let memes = "ArE mEmEs gReAt?"; +#test(lower(memes), "are memes great?") +#test(upper(memes), "ARE MEMES GREAT?") +#test(upper("Ελλάδα"), "ΕΛΛΆΔΑ") + +--- +// Error: 8-9 expected string or content, found integer +#upper(1) diff --git a/tests/typ/text/emph-strong.typ b/tests/typ/text/emphasis.typ index cd2191cc..cd2191cc 100644 --- a/tests/typ/text/emph-strong.typ +++ b/tests/typ/text/emphasis.typ diff --git a/tests/typ/text/code.typ b/tests/typ/text/raw-highlight.typ index d89f1c05..d89f1c05 100644 --- a/tests/typ/text/code.typ +++ b/tests/typ/text/raw-highlight.typ diff --git a/tests/typ/text/shifts.typ b/tests/typ/text/shift.typ index 01a83f6e..01a83f6e 100644 --- a/tests/typ/text/shifts.typ +++ b/tests/typ/text/shift.typ diff --git a/tests/typ/text/whitespace.typ b/tests/typ/text/space.typ index 8dcc59e3..8dcc59e3 100644 --- a/tests/typ/text/whitespace.typ +++ b/tests/typ/text/space.typ diff --git a/tests/typ/graphics/image.typ b/tests/typ/visualize/image.typ index e97365cd..6a2c37e1 100644 --- a/tests/typ/graphics/image.typ +++ b/tests/typ/visualize/image.typ @@ -51,7 +51,7 @@ A #image("/res/tiger.jpg", height: 1cm, width: 80%) B #image("/res/pattern.svg") --- -// Error: 8-29 file not found (searched at typ/graphics/path/does/not/exist) +// Error: 8-29 file not found (searched at typ/visualize/path/does/not/exist) #image("path/does/not/exist") --- diff --git a/tests/typ/graphics/line.typ b/tests/typ/visualize/line.typ index 2cb2fc9c..2cb2fc9c 100644 --- a/tests/typ/graphics/line.typ +++ b/tests/typ/visualize/line.typ diff --git a/tests/typ/graphics/shape-aspect.typ b/tests/typ/visualize/shape-aspect.typ index f2dd9b51..f2dd9b51 100644 --- a/tests/typ/graphics/shape-aspect.typ +++ b/tests/typ/visualize/shape-aspect.typ diff --git a/tests/typ/graphics/shape-circle.typ b/tests/typ/visualize/shape-circle.typ index 13ff67de..13ff67de 100644 --- a/tests/typ/graphics/shape-circle.typ +++ b/tests/typ/visualize/shape-circle.typ diff --git a/tests/typ/graphics/shape-ellipse.typ b/tests/typ/visualize/shape-ellipse.typ index ba4d0d0a..ba4d0d0a 100644 --- a/tests/typ/graphics/shape-ellipse.typ +++ b/tests/typ/visualize/shape-ellipse.typ diff --git a/tests/typ/graphics/shape-fill-stroke.typ b/tests/typ/visualize/shape-fill-stroke.typ index d14d0981..d14d0981 100644 --- a/tests/typ/graphics/shape-fill-stroke.typ +++ b/tests/typ/visualize/shape-fill-stroke.typ diff --git a/tests/typ/graphics/shape-rect.typ b/tests/typ/visualize/shape-rect.typ index 94686da2..94686da2 100644 --- a/tests/typ/graphics/shape-rect.typ +++ b/tests/typ/visualize/shape-rect.typ diff --git a/tests/typ/graphics/shape-square.typ b/tests/typ/visualize/shape-square.typ index 622fa9c8..622fa9c8 100644 --- a/tests/typ/graphics/shape-square.typ +++ b/tests/typ/visualize/shape-square.typ |
