Skip to content

Commit

Permalink
Merge pull request #243 from epage/test
Browse files Browse the repository at this point in the history
 test: Port remaining conformance tests
  • Loading branch information
epage authored Nov 30, 2018
2 parents 8046789 + fe98508 commit 9235289
Show file tree
Hide file tree
Showing 23 changed files with 1,351 additions and 1,030 deletions.
2 changes: 0 additions & 2 deletions tests/conformance_ruby/assign_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use liquid;

use test_helper::*;

#[test]
fn test_assign_with_hyphen_in_variable_name() {
let template_source = r#"
Expand Down
39 changes: 32 additions & 7 deletions tests/conformance_ruby/blank_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use test_helper::*;
use liquid;

const N: usize = 10;

Expand Down Expand Up @@ -30,6 +30,15 @@ fn repeat<S: AsRef<str>>(content: S, count: usize) -> String {
(0..count).map(|_| content).collect::<String>()
}

#[derive(Clone)]
struct BlankTestFilesystem;

impl liquid::compiler::Include for BlankTestFilesystem {
fn include(&self, relative_path: &str) -> Result<String, liquid::Error> {
Ok(relative_path.to_owned())
}
}

#[test]
fn test_new_tags_are_not_blank_by_default() {
assert_template_result!(
Expand Down Expand Up @@ -130,12 +139,28 @@ fn test_raw_is_not_blank() {
#[test]
#[ignore]
fn test_include_is_blank() {
/* Too lazy to implement atm
Liquid::Template.file_system = BlankTestFileSystem.new
assert_template_result! "foobar" * (N + 1), wrap("{% include 'foobar' %}")
assert_template_result! " foobar " * (N + 1), wrap("{% include ' foobar ' %}")
assert_template_result! " " * (N + 1), wrap(" {% include ' ' %} ")
*/
let liquid = liquid::ParserBuilder::with_liquid()
.include_source(Box::new(BlankTestFilesystem))
.build();

assert_template_result!(
repeat("foobar", N + 1),
wrap("{% include 'foobar' %}"),
v!({}),
liquid
);
assert_template_result!(
repeat(" foobar ", N + 1),
wrap("{% include ' foobar ' %}"),
v!({}),
liquid
);
assert_template_result!(
repeat(" ", N + 1),
wrap(" {% include ' ' %} "),
v!({}),
liquid
);
}

#[test]
Expand Down
2 changes: 0 additions & 2 deletions tests/conformance_ruby/capture_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use liquid;

use test_helper::*;

#[test]
#[ignore]
fn test_captures_block_content_in_variable() {
Expand Down
Loading

0 comments on commit 9235289

Please sign in to comment.