Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
name: Continuous integration
on: [push, pull_request]

env:
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"

permissions:
contents: read

jobs:
ci:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@e814c742d4444ce2f3f6abddea7faf00161ed941 # 1.88.0
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- run: cargo test --workspace --all-features --no-run
- run: cargo test --workspace --all-features --no-fail-fast
- run: git diff --exit-code

checks:
name: Check clippy, formatting, and documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build
- run: cargo test --features=_test-unicode-conformance
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@e814c742d4444ce2f3f6abddea7faf00161ed941 # 1.88.0
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- run: cargo clippy --workspace --all-targets --all-features
- run: cargo fmt --check --all
- run: cargo doc --workspace --no-deps
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "codex"
version = "0.2.0"
rust-version = "1.88" # also change in ci.yml
authors = ["The Typst Project Developers"]
edition = "2021"
edition = "2024"
description = "Human-friendly notation for Unicode symbols."
repository = "https://github.com/typst/codex"
readme = "README.md"
Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ mod test {
#[test]
fn random_sample() {
for (key, control) in [
(
"backslash",
[("", "\\"), ("not", "⧷"), ("o", "⦸")].as_slice(),
),
("backslash", [("", "\\"), ("not", "⧷"), ("o", "⦸")].as_slice()),
("chi", &[("", "χ")]),
("forces", &[("", "⊩"), ("not", "⊮")]),
("interleave", &[("", "⫴"), ("big", "⫼"), ("struck", "⫵")]),
Expand Down
18 changes: 12 additions & 6 deletions src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,18 @@ mod tests {

#[test]
fn subset() {
assert!(ModifierSet::from_raw_dotted("a")
.is_subset(ModifierSet::from_raw_dotted("a.b")));
assert!(ModifierSet::from_raw_dotted("a")
.is_subset(ModifierSet::from_raw_dotted("b.a")));
assert!(ModifierSet::from_raw_dotted("a.b")
.is_subset(ModifierSet::from_raw_dotted("b.c.a")));
assert!(
ModifierSet::from_raw_dotted("a")
.is_subset(ModifierSet::from_raw_dotted("a.b"))
);
assert!(
ModifierSet::from_raw_dotted("a")
.is_subset(ModifierSet::from_raw_dotted("b.a"))
);
assert!(
ModifierSet::from_raw_dotted("a.b")
.is_subset(ModifierSet::from_raw_dotted("b.c.a"))
);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/styling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ impl MathStyle {
bold: bool,
italic: Option<bool>,
) -> MathStyle {
use conversions::*;
use MathVariant::*;
use conversions::*;
match (variant.unwrap_or(Plain), bold, italic) {
(SansSerif, false, Some(false)) if is_latin(c) => MathStyle::SansSerif,
(SansSerif, false, _) if is_latin(c) => MathStyle::SansSerifItalic,
Expand Down Expand Up @@ -368,8 +368,8 @@ impl fmt::Display for ToStyle {
/// assert_eq!("𝕩ℽΩ𝔸𞺸𞺧𝟙⅀𞺮", s);
/// ```
pub fn to_style(c: char, style: MathStyle) -> ToStyle {
use conversions::*;
use MathStyle::*;
use conversions::*;
let styled = match style {
Plain => [c, '\0'],
Bold => [to_bold(c), '\0'],
Expand Down
Loading