Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit 98fbacd

Browse files
committed
Create main binary
In addition to being a solid library, the chess package should also end up as a decent command line program with a playable game. This is possible because a package can be a library as well as a binary. Because the main function isn't tested, and may be difficult to test, using submodules is a pain, because they show up as unused imports. The main function as well shows up as an unused function when testing. Since main is such a special case, there is an open issue to make the test runner not show that warning. rust-lang/rust#12327 For the time being though, I've done as the OP of that issue said he does: putting #[cfg(not(test))] before the main function so that the linter ignores it.
1 parent 8e1d298 commit 98fbacd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extern crate chess;
2+
3+
4+
#[cfg(not(test))]
5+
fn main() {
6+
let notation = &chess::notation::ZeroIntegersNotation;
7+
let game = &chess::Game::new();
8+
game.parse(notation, "01 02");
9+
println!("This is chess!");
10+
}

0 commit comments

Comments
 (0)