|
@@ -1,16 +1,4 @@
|
|
|
-use specs::join::Join;
|
|
|
-
|
|
|
-struct Pos {
|
|
|
- x: usize,
|
|
|
-}
|
|
|
-impl specs::Component for Pos {
|
|
|
- type Storage = specs::VecStorage<Pos>;
|
|
|
-}
|
|
|
-struct Mov;
|
|
|
-impl specs::Component for Mov {
|
|
|
- type Storage = specs::VecStorage<Mov>;
|
|
|
-}
|
|
|
-
|
|
|
+#[macro_export]
|
|
|
macro_rules! system {
|
|
|
($name:ident $pat:tt => $block:block ) => {
|
|
|
struct $name;
|
|
@@ -70,7 +58,24 @@ macro_rules! args_to_join {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-system!{ Foo (_x: Mov, mut y: Pos) => {
|
|
|
- y.x += 1;
|
|
|
-}
|
|
|
+#[cfg(test)]
|
|
|
+mod tests {
|
|
|
+ use specs::join::Join;
|
|
|
+
|
|
|
+ struct Pos {
|
|
|
+ x: usize,
|
|
|
+ }
|
|
|
+ impl specs::Component for Pos {
|
|
|
+ type Storage = specs::VecStorage<Pos>;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct Mov;
|
|
|
+ impl specs::Component for Mov {
|
|
|
+ type Storage = specs::VecStorage<Mov>;
|
|
|
+ }
|
|
|
+
|
|
|
+ system!{ Foo (_x: Mov, mut y: Pos) => {
|
|
|
+ y.x += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|