remove some unnecessary imports and call them inline

This commit is contained in:
Max Bradbury 2020-04-18 10:46:07 +01:00
parent cc0780b9cd
commit c467489dd5
5 changed files with 16 additions and 17 deletions

View File

@ -1,5 +1,3 @@
use crate::mock;
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct Image { pub struct Image {
pub pixels: Vec<u32>, // 64 for SD, 256 for HD pub pixels: Vec<u32>, // 64 for SD, 256 for HD
@ -61,7 +59,7 @@ fn test_image_from_string() {
#[test] #[test]
fn test_image_to_string() { fn test_image_to_string() {
let output = mock::image::chequers_1().to_string(); let output = crate::mock::image::chequers_1().to_string();
let expected = include_str!("test-resources/image-chequers-1").to_string(); let expected = include_str!("test-resources/image-chequers-1").to_string();
assert_eq!(output, expected); assert_eq!(output, expected);
} }

View File

@ -1,4 +1,4 @@
use crate::{AnimationFrames, Image, mock, from_base36, ToBase36, optional_data_line}; use crate::{AnimationFrames, Image, from_base36, ToBase36, optional_data_line};
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct Item { pub struct Item {
@ -75,13 +75,13 @@ impl ToString for Item {
#[test] #[test]
fn test_item_from_string() { fn test_item_from_string() {
let output = Item::from(include_str!("test-resources/item").to_string()); let output = Item::from(include_str!("test-resources/item").to_string());
let expected = mock::item(); let expected = crate::mock::item();
assert_eq!(output, expected); assert_eq!(output, expected);
} }
#[test] #[test]
fn test_item_to_string() { fn test_item_to_string() {
let output = mock::item().to_string(); let output = crate::mock::item().to_string();
let expected = include_str!("test-resources/item").to_string(); let expected = include_str!("test-resources/item").to_string();
assert_eq!(output, expected); assert_eq!(output, expected);
} }

View File

@ -1,4 +1,4 @@
use crate::{Exit, ExitInstance, Instance, mock, Position, from_base36, ToBase36, optional_data_line}; use crate::{Exit, ExitInstance, Instance, Position, from_base36, ToBase36, optional_data_line};
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct Room { pub struct Room {
@ -88,7 +88,7 @@ impl From<String> for Room {
fn test_room_from_string() { fn test_room_from_string() {
assert_eq!( assert_eq!(
Room::from(include_str!("test-resources/room").to_string()), Room::from(include_str!("test-resources/room").to_string()),
mock::room() crate::mock::room()
); );
} }
@ -146,5 +146,5 @@ impl ToString for Room {
#[test] #[test]
fn test_room_to_string() { fn test_room_to_string() {
assert_eq!(mock::room().to_string(), include_str!("test-resources/room").to_string()); assert_eq!(crate::mock::room().to_string(), include_str!("test-resources/room").to_string());
} }

View File

@ -1,4 +1,4 @@
use crate::{AnimationFrames, Image, Position, mock, from_base36, ToBase36, optional_data_line}; use crate::{AnimationFrames, Image, Position, from_base36, ToBase36, optional_data_line};
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct Sprite { pub struct Sprite {
@ -101,12 +101,15 @@ fn test_sprite_from_string() {
include_str!("test-resources/sprite").to_string() include_str!("test-resources/sprite").to_string()
); );
let expected = mock::sprite(); let expected = crate::mock::sprite();
assert_eq!(output, expected); assert_eq!(output, expected);
} }
#[test] #[test]
fn test_sprite_to_string() { fn test_sprite_to_string() {
assert_eq!(mock::sprite().to_string(), include_str!("test-resources/sprite").to_string()); assert_eq!(
crate::mock::sprite().to_string(),
include_str!("test-resources/sprite").to_string()
);
} }

View File

@ -1,6 +1,4 @@
use crate::{AnimationFrames, from_base36, ToBase36, optional_data_line}; use crate::{AnimationFrames, Image, from_base36, ToBase36, optional_data_line};
use crate::image::Image;
use crate::mock;
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct Tile { pub struct Tile {
@ -109,8 +107,8 @@ fn test_tile_to_string() {
name: Some("chequers".to_string()), name: Some("chequers".to_string()),
wall: None, wall: None,
animation_frames: vec![ animation_frames: vec![
mock::image::chequers_1(), crate::mock::image::chequers_1(),
mock::image::chequers_2(), crate::mock::image::chequers_2(),
], ],
colour_id: None colour_id: None
}.to_string(); }.to_string();