Skip to content

Commit

Permalink
feat(#1): clean
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Sep 27, 2024
1 parent 08f7bd0 commit 3883fad
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ pub fn tag(attr: TokenStream, item: TokenStream) -> TokenStream {
};
let name = &input.sig.ident;
let block = &input.block;
let has_test_attr = input.attrs.iter().any(|attr| attr.path.is_ident("test"));
let has_test_attr =
input.attrs.iter().any(|attr| attr.path.is_ident("test"));
let run = std::env::var("TTAG").unwrap_or_else(|_| "<none>".to_string());
let ignore_attr = if run != tag && run != "<none>" {
quote! { #[ignore] }
Expand Down
38 changes: 38 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// The MIT License (MIT)
//
// Copyright (c) 2024 Aliaksei Bialiauski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#[cfg(test)]
mod tests {
use tagrs::tag;

#[tag("fast")]
#[test]
fn runs_fast() -> Result<()> {
assert_eq!(1 + 1, 2);
Ok(())
}

#[tag("slow")]
#[test]
fn runs_slow() -> Result<()> {
Ok(())
}
}

0 comments on commit 3883fad

Please sign in to comment.