Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump insta and htmlescape, add similar-asserts #74

Merged
merged 1 commit into from Aug 21, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions minijinja/Cargo.toml
Expand Up @@ -35,15 +35,16 @@ unstable_machinery = ["internal_debug"]

[dependencies]
serde = "1.0.130"
v_htmlescape = { version = "0.14.1", optional = true }
v_htmlescape = { version = "0.15.8", optional = true }
self_cell = { version = "0.10.1", optional = true, features = ["old_rust"] }
serde_json = { version = "1.0.68", optional = true }
percent-encoding = { version = "2.1.0", optional = true }
indexmap = { version = "1.7.0", optional = true }
memo-map = { version = "0.3.1", optional = true }
similar-asserts = "1.4.2"

[dev-dependencies]
insta = { version = "1.18.2", features = ["glob"] }
insta = { version = "1.19.0", features = ["glob"] }
serde_json = "1.0.68"

[[test]]
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/compiler.rs
Expand Up @@ -9,6 +9,9 @@ use crate::tokens::Span;
use crate::utils::matches;
use crate::value::Value;

#[cfg(test)]
use similar_asserts::assert_eq;

/// Represents an open block of code that does not yet have updated
/// jump targets.
#[cfg_attr(feature = "internal_debug", derive(Debug))]
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/context.rs
@@ -1,3 +1,6 @@
#[cfg(test)]
use similar_asserts::assert_eq;

/// Creates a template context with keys and values.
///
/// ```rust
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/environment.rs
Expand Up @@ -12,6 +12,9 @@ use crate::value::{ArgType, FunctionArgs, RcType, Value};
use crate::vm::Vm;
use crate::{filters, functions, tests};

#[cfg(test)]
use similar_asserts::assert_eq;

/// Represents a handle to a template.
///
/// Templates are stored in the [`Environment`] as bytecode instructions. With the
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/filters.rs
Expand Up @@ -180,6 +180,9 @@ mod builtins {
use std::fmt::Write;
use std::mem;

#[cfg(test)]
use similar_asserts::assert_eq;

/// Converts a value to uppercase.
///
/// ```jinja
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/instructions.rs
@@ -1,6 +1,9 @@
#[cfg(feature = "internal_debug")]
use std::fmt;

#[cfg(test)]
use similar_asserts::assert_eq;

use crate::value::Value;

/// This loop has the loop var.
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/lexer.rs
Expand Up @@ -4,6 +4,9 @@ use crate::error::{Error, ErrorKind};
use crate::tokens::{Span, Token};
use crate::utils::{matches, memchr, memstr, unescape};

#[cfg(test)]
use similar_asserts::assert_eq;

enum LexerState {
Template,
InVariable,
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/meta.rs
Expand Up @@ -12,6 +12,9 @@ use crate::ast;
use crate::error::Error;
use crate::parser::parse;

#[cfg(test)]
use similar_asserts::assert_eq;

/// Given a template source returns a set of undeclared variables.
///
/// Returns a set of all variables in the template that will be looked up from
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/source.rs
Expand Up @@ -11,6 +11,9 @@ use crate::environment::CompiledTemplate;
use crate::error::{Error, ErrorKind};
use crate::value::RcType;

#[cfg(test)]
use similar_asserts::assert_eq;

type LoadFunc = dyn for<'a> Fn(&'a str) -> Result<String, Error> + Send + Sync;

/// Utility for dynamic template loading.
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/utils.rs
Expand Up @@ -6,6 +6,9 @@ use std::str::Chars;

use crate::error::{Error, ErrorKind};

#[cfg(test)]
use similar_asserts::assert_eq;

// we target Rust 1.41 and that does not have this macro yet
macro_rules! _matches {
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
Expand Down
3 changes: 3 additions & 0 deletions minijinja/src/value.rs
Expand Up @@ -81,6 +81,9 @@ use crate::key::{Key, KeySerializer};
use crate::utils::{matches, OnDrop};
use crate::vm::State;

#[cfg(test)]
use similar_asserts::assert_eq;

#[cfg(feature = "sync")]
pub(crate) type RcType<T> = std::sync::Arc<T>;

Expand Down
2 changes: 2 additions & 0 deletions minijinja/tests/test_source.rs
Expand Up @@ -2,6 +2,8 @@

use minijinja::{Environment, Source};

use similar_asserts::assert_eq;

fn create_env() -> Environment<'static> {
let mut source = Source::new();
let template = String::from("Hello World!");
Expand Down
2 changes: 2 additions & 0 deletions minijinja/tests/test_templates.rs
Expand Up @@ -3,6 +3,8 @@ use std::fs;

use minijinja::{context, Environment, Error, State};

use similar_asserts::assert_eq;

#[test]
fn test_vm() {
let mut refs = Vec::new();
Expand Down
2 changes: 2 additions & 0 deletions minijinja/tests/test_vm.rs
Expand Up @@ -2,6 +2,8 @@
use minijinja::machinery::{simple_eval, Compiler, Instruction, Instructions};
use minijinja::value::Value;

use similar_asserts::assert_eq;

#[test]
fn test_loop() {
let mut ctx = std::collections::BTreeMap::new();
Expand Down