-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
48 changed files
with
359 additions
and
764 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
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
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,20 @@ | ||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_require_task_direct() { | ||
#[derive(Clone, PartialEq, Eq, Hash, Debug)] | ||
struct ReturnHelloWorld; | ||
|
||
impl Task for ReturnHelloWorld { | ||
type Output = String; | ||
fn execute<C: Context<Self>>(&self, _context: &mut C) -> Self::Output { | ||
"Hello World!".to_string() | ||
} | ||
} | ||
|
||
let mut context = NonIncrementalContext; | ||
assert_eq!("Hello World!", context.require_task(&ReturnHelloWorld)); | ||
} | ||
} |
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 @@ | ||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_require_task_direct() { | ||
#[derive(Clone, PartialEq, Eq, Hash, Debug)] | ||
struct ReturnHelloWorld; | ||
|
||
impl Task for ReturnHelloWorld { | ||
type Output = String; | ||
fn execute<C: Context<Self>>(&self, _context: &mut C) -> Self::Output { | ||
"Hello World!".to_string() | ||
} | ||
} | ||
|
||
let mut context = NonIncrementalContext; | ||
assert_eq!("Hello World!", context.require_task(&ReturnHelloWorld)); | ||
} | ||
|
||
#[test] | ||
fn test_require_task() { | ||
#[derive(Clone, PartialEq, Eq, Hash, Debug)] | ||
enum Test { | ||
ReturnHelloWorld, | ||
ToLowerCase, | ||
} | ||
|
||
impl Task for Test { | ||
type Output = String; | ||
fn execute<C: Context<Self>>(&self, context: &mut C) -> Self::Output { | ||
match self { | ||
Self::ReturnHelloWorld => "Hello World!".to_string(), | ||
Self::ToLowerCase => context.require_task(&Self::ReturnHelloWorld).to_lowercase(), | ||
} | ||
} | ||
} | ||
|
||
let mut context = NonIncrementalContext; | ||
assert_eq!("Hello World!", context.require_task(&Test::ReturnHelloWorld)); | ||
assert_eq!("hello world!", context.require_task(&Test::ToLowerCase)); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.