This repository has been archived by the owner on Feb 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christian Howe
committed
Oct 17, 2018
1 parent
5ee1b61
commit 6aeaab3
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: 2 | ||
|
||
jobs: | ||
build: | ||
docker: | ||
- image: abronan/rust-circleci:latest | ||
|
||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: project-cache | ||
- run: | ||
name: Check formatting | ||
command: | | ||
rustfmt --version | ||
cargo fmt -- --write-mode=diff | ||
- run: | ||
name: Nightly Build | ||
command: | | ||
rustup run nightly rustc --version --verbose | ||
rustup run nightly cargo --version --verbose | ||
rustup run nightly cargo build | ||
- run: | ||
name: Stable Build | ||
command: | | ||
rustup run stable rustc --version --verbose | ||
rustup run stable cargo --version --verbose | ||
rustup run stable cargo build | ||
- run: | ||
name: Test | ||
command: rustup run stable cargo test --lib | ||
- save_cache: | ||
key: project-cache | ||
paths: | ||
- "~/.cargo" | ||
- "./target" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
members = [ | ||
"named_type", | ||
"named_type_derive", | ||
"named_type_test", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "named_type_test" | ||
version = "0.1.0" | ||
authors = ["Christian Howe <cjhowe7@pm.me>"] | ||
|
||
[dependencies] | ||
named_type = { path = "../named_type" } | ||
named_type_derive = { path = "../named_type_derive" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
extern crate named_type; | ||
#[macro_use] | ||
extern crate named_type_derive; | ||
|
||
use named_type::NamedType; | ||
|
||
#[derive(NamedType)] | ||
struct MyStruct {} | ||
|
||
#[test] | ||
fn test_struct() { | ||
assert_eq!(MyStruct::type_name(), concat!(module_path!(), "::MyStruct")); | ||
assert_eq!(MyStruct::short_type_name(), "MyStruct"); | ||
} | ||
|
||
#[derive(NamedType)] | ||
enum MyEnum {} | ||
|
||
#[test] | ||
fn test_enum() { | ||
assert_eq!(MyEnum::type_name(), concat!(module_path!(), "::MyEnum")); | ||
assert_eq!(MyEnum::short_type_name(), "MyEnum"); | ||
} | ||
|
||
#[derive(NamedType)] | ||
#[named_type(short_prefix = "Pre")] | ||
enum Prefixed {} | ||
|
||
#[test] | ||
fn test_prefix() { | ||
assert_eq!(Prefixed::type_name(), concat!(module_path!(), "::Prefixed")); | ||
assert_eq!(Prefixed::short_type_name(), "PrePrefixed"); | ||
} | ||
|
||
#[derive(NamedType)] | ||
#[named_type(short_suffix = "_suffix")] | ||
struct Suffixed {} | ||
|
||
#[test] | ||
fn test_suffix() { | ||
assert_eq!(Suffixed::type_name(), concat!(module_path!(), "::Suffixed")); | ||
assert_eq!(Suffixed::short_type_name(), "Suffixed_suffix"); | ||
} |