Skip to content

Commit

Permalink
fix(all): Fix various typos
Browse files Browse the repository at this point in the history
  • Loading branch information
tingerrr committed Jul 24, 2024
1 parent 18f8841 commit 35b8b80
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ behavior of various commands. Such changes will be documented in the [migration

The branch `ci-semi-stable` is available to use typst-test in CI, see [`tests.yml`][ci-workflow] for
an example workflow which will run typst-test for PRs and pushes to your repo. This branch will only
be moved when critical bugs related to exisiting functionality are fixed. It will be retired once
be moved when critical bugs related to existing functionality are fixed. It will be retired once
typst-test reaches `0.1.0`.

## Tutorial
Expand Down
10 changes: 5 additions & 5 deletions crates/typst-test-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub const EXIT_TEST_FAILURE: u8 = 1;
/// The requested operation failed gracefully.
pub const EXIT_OPERATION_FAILURE: u8 = 2;

/// An unexpected error occured.
/// An unexpected error occurred.
pub const EXIT_ERROR: u8 = 3;

pub struct Context<'a> {
Expand Down Expand Up @@ -130,7 +130,7 @@ impl<'a> Context<'a> {
reporter.operation_failure(|r| {
write!(r, "Project '{}' was not initialized", project.name())
})?;
anyhow::bail!("Project was not initalized");
anyhow::bail!("Project was not initialized");
}

Ok(project)
Expand Down Expand Up @@ -257,7 +257,7 @@ static AFTER_LONG_ABOUT: &str = concat!(
" ", ansi!("0"; b), " Success\n",
" ", ansi!("1"; b), " At least one test failed\n",
" ", ansi!("2"; b), " The requested operation failed\n",
" ", ansi!("3"; b), " An unexpected error occured",
" ", ansi!("3"; b), " An unexpected error occurred",
);

#[derive(clap::Args, Debug, Clone)]
Expand Down Expand Up @@ -293,7 +293,7 @@ pub struct OperationArgs {

/// Allow operating on more than one test if multiple tests match
///
/// This is not requried for comparing or compiling, but for editing,
/// This is not required for comparing or compiling, but for editing,
/// updating or removing tests.
#[arg(long, short)]
pub all: bool,
Expand Down Expand Up @@ -405,7 +405,7 @@ pub struct OutputArgs {
// TODO: add json
#[derive(clap::ValueEnum, Debug, Clone, Copy)]
pub enum OutputFormat {
/// Pretty human-readible color output
/// Pretty human-readable color output
Pretty,

/// Plain output for script processing
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-cli/src/cli/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::Context;
pub struct Args {
/// Whether this test creates it's references on the fly
///
/// An ephemeral test consistes of two scripts which are compared
/// An ephemeral test consists of two scripts which are compared
/// against each other. The reference script must be called `ref.typ`.
#[arg(long, short)]
pub ephemeral: bool,
Expand Down
6 changes: 3 additions & 3 deletions crates/typst-test-cli/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ pub struct Project {

impl Project {
pub fn new(root: PathBuf, config: Config, manifest: Option<Manifest>) -> Self {
let resovler = ResolverV1::new(root, config.tests_root_fallback());
let resolver = ResolverV1::new(root, config.tests_root_fallback());
Self {
config,
manifest,
resolver: resovler,
resolver,
// TODO: vcs support
vcs: None,
tests: BTreeMap::new(),
Expand Down Expand Up @@ -254,7 +254,7 @@ pub enum Error {
#[error("invalid manifest")]
InvalidManifest(#[from] toml::de::Error),

#[error("test already exsits: {0:?}")]
#[error("test already exists: {0:?}")]
TestAlreadyExists(Identifier),

#[error("an io error occurred")]
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-cli/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub struct Reporter {
need_indent: bool,
spec: Option<ColorSpec>,

// other confiuration
// other configuration
format: OutputFormat,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/typst-test-cli/src/test/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct RunnerConfig {
/// Whether to compare ephemeral or persistent tests.
compare: bool,

/// The strategy to use when comparing docuemnts.
/// The strategy to use when comparing documents.
compare_strategy: Option<compare::Strategy>,

/// The hook to run once before all tests.
Expand Down Expand Up @@ -781,7 +781,7 @@ impl<'t> TestRunner<'_, '_, 't> {
let document = self
.store_document
.as_ref()
.context("Output docuemnt not rendered")?;
.context("Output document not rendered")?;

self.test
.create_reference_documents(self.project_runner.project.resolver(), document)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-lib/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct Error {
/// The output page count.
pub output: usize,

/// The refernce page count.
/// The reference page count.
pub reference: usize,

/// The page failures if there are any.
Expand Down
4 changes: 2 additions & 2 deletions crates/typst-test-lib/src/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub enum Error {
#[error("the hook did not run successfully (exit code: {:?})", .0.status)]
Hook(Output),

/// An io error occured.
#[error("an io error occured")]
/// An io error occurred.
#[error("an io error occurred")]
Io(#[from] io::Error),
}

Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-lib/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn define_test_module(scope: &mut Scope) {
define_prelude(scope)
}

/// Retruns a new test module with the items defined by [`define_test_module`].
/// Returns a new test module with the items defined by [`define_test_module`].
pub fn test_module() -> Module {
let mut scope = Scope::new();
define_test_module(&mut scope);
Expand Down
10 changes: 5 additions & 5 deletions crates/typst-test-lib/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ pub mod vcs;
/// An error that may occur during saving of a document.
#[derive(Debug, thiserror::Error)]
pub enum SaveError {
#[error("an io error occured")]
#[error("an io error occurred")]
Io(#[from] io::Error),

#[error("a page error occured")]
#[error("a page error occurred")]
Page(#[from] page::SaveError<page::Png>),
}

/// An error that may occur during loading of a document.
#[derive(Debug, thiserror::Error)]
pub enum LoadError {
#[error("an io error occured")]
#[error("an io error occurred")]
Io(#[from] io::Error),

#[error("a page error occured")]
#[error("a page error occurred")]
Page(#[from] page::LoadError<page::Png>),
}

/// In-memory representation of a Typst document wich can be saved and loaded
/// In-memory representation of a Typst document which can be saved and loaded
/// from disk.
#[derive(Debug, Clone)]
pub struct Document {
Expand Down
12 changes: 6 additions & 6 deletions crates/typst-test-lib/src/store/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl PageFormat for Png {
/// A generic loading error for a format.
#[derive(Error)]
pub enum LoadError<F: PageFormat> {
#[error("an io error occured")]
#[error("an io error occurred")]
Io(#[from] io::Error),

#[error("a page could not be loaded")]
Expand All @@ -74,7 +74,7 @@ where
/// A generic saving error for a format.
#[derive(Error)]
pub enum SaveError<F: PageFormat> {
#[error("an io error occured")]
#[error("an io error occurred")]
Io(#[from] io::Error),

#[error("a page could not be saved")]
Expand All @@ -93,7 +93,7 @@ where
}
}

/// Counts all pages in the given direcory of a given format. Any files which do
/// Counts all pages in the given directory of a given format. Any files which do
/// not have ascii numerals are their file name and the format extension are
/// ignored.
pub fn count_pages<F: PageFormat>(dir: &Path) -> Result<usize, LoadError<F>> {
Expand All @@ -107,7 +107,7 @@ pub fn count_pages<F: PageFormat>(dir: &Path) -> Result<usize, LoadError<F>> {
Ok(count)
}

/// Loads all pages in the given direcory of a given format. Any files which do
/// Loads all pages in the given directory of a given format. Any files which do
/// not have ascii numerals are their file name and the format extension are
/// ignored.
pub fn load_pages<F: PageFormat>(dir: &Path) -> Result<Vec<F::Type>, LoadError<F>> {
Expand Down Expand Up @@ -152,8 +152,8 @@ fn load_pages_internal<F: PageFormat>(
Ok(())
}

/// Loads all pages in the given direcory in the given format. The file names
/// for the indiviual pages are their 1-based index without any 0-padding.
/// Loads all pages in the given directory in the given format. The file names
/// for the individual pages are their 1-based index without any 0-padding.
pub fn save_pages<'p, F>(
dir: &Path,
pages: impl IntoIterator<Item = &'p F::Type>,
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-lib/src/store/project/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Debug for Paths {
}

/// An interner for commonly accessed paths following the current project
/// strucutre. This is the default implementation for [`Resolver`].
/// structure. This is the default implementation for [`Resolver`].
#[derive(Debug)]
pub struct ResolverV1 {
root: PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-lib/src/store/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Test {
self.ref_kind.is_none()
}

/// Returns a reference to this test's anotations.
/// Returns a reference to this test's annotations.
pub fn annotations(&self) -> &[Annotation] {
&self.annotations
}
Expand Down
22 changes: 11 additions & 11 deletions crates/typst-test-lib/src/store/test/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ use crate::test_set::TestSet;
/// An error that can occur during [`Test`] collection using a [`Collector`].
#[derive(Debug, thiserror::Error)]
pub enum CollectError {
/// An error occured while traversing directories.
#[error("an error occured while traversing directories")]
/// An error occurred while traversing directories.
#[error("an error occurred while traversing directories")]
WalkDir(#[from] ignore::Error),

/// An io error occurred.
#[error("an io error occurred")]
Io(#[from] io::Error),

/// An error occured while trying to parse a test identifier.
#[error("an error occured while collecting a test")]
/// An error occurred while trying to parse a test identifier.
#[error("an error occurred while collecting a test")]
Test(#[from] ParseIdentifierError),

/// An error occured while trying parsing a test's annotations.
#[error("an error occured while parsing a test's annotations")]
/// An error occurred while trying parsing a test's annotations.
#[error("an error occurred while parsing a test's annotations")]
Annotation(#[from] ParseAnnotationError),
}

Expand Down Expand Up @@ -83,7 +83,7 @@ impl<'p, R: Resolver + Sync> Collector<'p, R> {
/// Returns a reference to the test root used by this collector.
///
/// The errors may contain the path of the directory at which the error
/// occured.
/// occurred.
pub fn errors(&self) -> &[(Option<PathBuf>, CollectError)] {
&self.errors
}
Expand All @@ -102,7 +102,7 @@ impl<'p, R: Resolver + Sync> Collector<'p, R> {
/// Takes ownership of the test root used by this collector.
///
/// The errors may contain the path of the directory at which the error
/// occured.
/// occurred.
pub fn take_errors(&mut self) -> Vec<(Option<PathBuf>, CollectError)> {
std::mem::take(&mut self.errors)
}
Expand Down Expand Up @@ -249,7 +249,7 @@ mod tests {
use crate::_dev;
use crate::store::project::v1::ResolverV1;

const REFERNCE_BYTES: &[u8] = include_bytes!("../../../../../assets/default-test/test.png");
const REFERENCE_BYTES: &[u8] = include_bytes!("../../../../../assets/default-test/test.png");

#[test]
fn test_collect() {
Expand All @@ -267,13 +267,13 @@ mod tests {
"/// [custom: foo]\nHello World",
)
.setup_file("tests/compare/ephemeral-store/ref.typ", "Hello\nWorld")
.setup_file("tests/compare/ephemeral-store/ref", REFERNCE_BYTES)
.setup_file("tests/compare/ephemeral-store/ref", REFERENCE_BYTES)
// persistent
.setup_file(
"tests/compare/persistent/test.typ",
"/// [custom: foo]\nHello World",
)
.setup_file("tests/compare/persistent/ref", REFERNCE_BYTES)
.setup_file("tests/compare/persistent/ref", REFERENCE_BYTES)
// not a test
.setup_file_empty("tests/not-a-test/test.txt")
// ignored test
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-test-lib/src/store/vcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait Vcs {
}
}

/// An no-op implementation of [`Vcs`] used for porjects which have no vcs.
/// An no-op implementation of [`Vcs`] used for projects which have no vcs.
#[derive(Debug, Clone, Copy)]
pub struct NoVcs;

Expand Down
6 changes: 3 additions & 3 deletions crates/typst-test-lib/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! In memory test represention.
//! In memory test representation.
use std::str::FromStr;

Expand Down Expand Up @@ -32,7 +32,7 @@ pub enum ParseAnnotationError {
#[error("the annotation {id} had unexpected arguments: {args:?}")]
UnexpectedArguments { id: EcoString, args: EcoString },

/// The anotation expected arguments but received none.
/// The annotation expected arguments but received none.
#[error("the annotation {0} expected arguments but received none")]
MissingArguments(EcoString),

Expand Down Expand Up @@ -160,6 +160,6 @@ mod tests {
);

assert!(Annotation::from_str("[ ignored ").is_err());
assert!(Annotation::from_str("[custom : fo o]").is_err());
assert!(Annotation::from_str("[custom : foo bar]").is_err());
}
}
14 changes: 7 additions & 7 deletions crates/typst-test-lib/src/test/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use thiserror::Error;
pub enum ParseIdentifierError {
/// An identifier contained an invalid fragment.
#[error("identifier contained an invalid fragment")]
InvalidFrament,
InvalidFragment,

/// An identifier contained empty or no fragments.
#[error("identifier contained empty or no fragments")]
Expand Down Expand Up @@ -81,10 +81,10 @@ impl Identifier {

id.push_str(comp);
} else {
return Err(ParseIdentifierError::InvalidFrament);
return Err(ParseIdentifierError::InvalidFragment);
}
}
_ => return Err(ParseIdentifierError::InvalidFrament),
_ => return Err(ParseIdentifierError::InvalidFragment),
}
}

Expand All @@ -105,7 +105,7 @@ impl Identifier {

/// Returns whether the given string is a valid identifier.
///
/// # Exmaples
/// # Examples
/// ```
/// # use typst_test_lib::test::id::Identifier;
/// assert!( Identifier::is_valid("a/b/c"));
Expand All @@ -128,7 +128,7 @@ impl Identifier {

/// Returns whether the given string is a valid identifier component.
///
/// # Exmaples
/// # Examples
/// ```
/// # use typst_test_lib::test::id::Identifier;
/// assert!( Identifier::is_component_valid("a"));
Expand All @@ -147,13 +147,13 @@ impl Identifier {

let mut chars = component.chars().peekable();
if !chars.next().unwrap().is_ascii_alphabetic() {
return Err(ParseIdentifierError::InvalidFrament);
return Err(ParseIdentifierError::InvalidFragment);
}

if chars.peek().is_some()
&& !chars.all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')
{
return Err(ParseIdentifierError::InvalidFrament);
return Err(ParseIdentifierError::InvalidFragment);
}

Ok(())
Expand Down
Loading

0 comments on commit 35b8b80

Please sign in to comment.