Git Product home page Git Product logo

catchr's People

Contributors

dzejkop avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

catchr's Issues

Skip empty scopes when quoting

Right now this code

describe! {
	case "one" {
		case "two" {
			case "three" {
				assert!(true);
			}
		}
	}
}

expands to

mod one {
	use super::*;

	mod two {
		use super::*;

		#[test]
		fn three() {
			{ { { { assert!(true); } } } }
		}
	}
}

Ideally we'd want

mod one {
	use super::*;

	mod two {
		use super::*;

		#[test]
		fn three() {
			assert!(true);
		}
	}
}

Feature: Case enumeration

Syntax:

section "whatever" {
  each msg in ["Hello", "World"] {
    then "should be true" { 
      assert!(false, msg);
    }
  }
}

Should expand into

mod section_whatever {
    use super::*;
    
    mod msg_is_hello {
        use super::*;
        
        #[test]
        fn then_should_be_true() {
			{
            	let msg = "Hello";
            	assert!(false, msg);
			}
        }
    }
    
    mod msg_is_world {
        use super::*;
        
        #[test]
        fn then_should_be_true() {
            { 
                let msg = "World";
                assert!(false, msg);
            }
        }
    }
}

Notes:

  1. in each item in items item should be a pattern and items a list of pattern.
  2. item should inserted as the first item in the respective scope

Feature: Pretty messages

Catch does this

Scenario: vectors can be sized and resized
     Given: A vector with some items
      When: more capacity is reserved
      Then: the capacity changes but not the size

catchr will show you the path to the test, but paths cannot contain any special characters. It'd be nice to be able to do something like:

section "Very descriptive comment" {
	case "-- special chars ???" {
		assert!(false, catchr_msg!());
	}
}

and for it to output:

running 1 test
test very_descriptive_comment::special_chars ... FAILED

failures:

---- very_descriptive_comment::special_chars stdout ----
thread 'very_descriptive_comment::special_chars' panicked at '
Section: Very descriptive comment
	Case: -- special chars ???
', src/lib.rs:4:9

or something simmilar

Testing async-infected code

Currently the catchr uses #[test] to mark tests.

Which is good for usual tests, but async is so contagious that even tests are affected.

For async code (with tokio in my case) common way is to use #[tokio::test] instead of #[test] (and other runtimes have similar, eg actix_rt::test).

Can we have support for that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.