Skip to content

Commit

Permalink
Refactor tests/ with a common module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grinkers committed Mar 21, 2024
1 parent 780371d commit 497ad69
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repository = "https://github.com/edn-rs/edn-rs"
keywords = ["EDN", "no_std"]
license = "MIT"
edition = "2021"
resolver = "2"

[lints.rust]
rust_2018_idioms = "warn"
Expand Down
6 changes: 2 additions & 4 deletions tests/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ mod test {

use edn_rs::{edn, from_edn, from_str, hmap, map, Edn, List, Map, Vector};

fn err_as_string(s: &str) -> String {
let err = Edn::from_str(s).err().unwrap();
format!("{err:?}")
}
mod common;
use crate::test::common::err_as_string;

#[test]
fn unit() {
Expand Down
6 changes: 2 additions & 4 deletions tests/deserialize_sets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ mod test {
use edn::{List, Vector};
use edn_rs::{edn, from_edn, from_str, hset, map, set, Edn, EdnError, Map, Set};

fn err_as_string(s: &str) -> String {
let err = Edn::from_str(s).err().unwrap();
format!("{err:?}")
}
mod common;
use crate::test::common::err_as_string;

#[test]
fn parse_set_with_commas() {
Expand Down
14 changes: 0 additions & 14 deletions tests/lib.rs

This file was deleted.

2 changes: 2 additions & 0 deletions tests/ser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![recursion_limit = "512"]

#[cfg(test)]
mod tests {
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
Expand Down
7 changes: 7 additions & 0 deletions tests/test/common.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use core::str::FromStr;
use edn_rs::Edn;

pub fn err_as_string(s: &str) -> String {
let err = Edn::from_str(s).err().unwrap();
format!("{err:?}")
}

0 comments on commit 497ad69

Please sign in to comment.