Skip to content

Commit

Permalink
extract model spec into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
jcornaz committed Nov 1, 2024
1 parent cb17404 commit dd40b7f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
30 changes: 30 additions & 0 deletions tests/model_spec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use rstest::rstest;

use fun_html::{Attribute, Element};

#[rstest]
#[cfg(debug_assertions)]
#[should_panic]
fn should_panic_for_invalid_attribute_name(
#[values("hello world", "hello\tworld", "hello\nworld", "")] name: &'static str,
) {
Attribute::new(name, "value");
}

#[rstest]
#[cfg(debug_assertions)]
#[should_panic]
fn should_panic_for_invalid_tag_name(
#[values("hello world", "hello\tworld", "hello\nworld", "")] name: &'static str,
) {
Element::new(name, [], []);
}

#[rstest]
#[cfg(debug_assertions)]
#[should_panic]
fn should_panic_for_invalid_void_element_name(
#[values("hello world", "hello\tworld", "hello\nworld", "")] name: &'static str,
) {
Element::new_void(name, []);
}
27 changes: 0 additions & 27 deletions tests/render_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,3 @@ fn attribute_should_be_escaped() {
"<div foo=\"&lt;script&gt;&quot;&quot; { open: !close }\">hello</div>"
);
}

#[rstest]
#[cfg(debug_assertions)]
#[should_panic]
fn should_panic_for_invalid_attribute_name(
#[values("hello world", "hello\tworld", "hello\nworld", "")] name: &'static str,
) {
Attribute::new(name, "value");
}

#[rstest]
#[cfg(debug_assertions)]
#[should_panic]
fn should_panic_for_invalid_tag_name(
#[values("hello world", "hello\tworld", "hello\nworld", "")] name: &'static str,
) {
Element::new(name, [], []);
}

#[rstest]
#[cfg(debug_assertions)]
#[should_panic]
fn should_panic_for_invalid_void_element_name(
#[values("hello world", "hello\tworld", "hello\nworld", "")] name: &'static str,
) {
Element::new_void(name, []);
}

0 comments on commit dd40b7f

Please sign in to comment.