summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-08-14 09:06:21 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-09-07 17:32:20 +0100
commit70461d3af84d1f5363df67f2f50f10b9dce86812 (patch)
treeaf1cb9a840a0ce1a8193b90847dc514e5e812d17 /src
parent204d2e3986ab74853797d7d28f723db1a088ee9f (diff)
downloadsubplot-70461d3af84d1f5363df67f2f50f10b9dce86812.tar.gz
bindings: Remove redundant function/cleanup
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'src')
-rw-r--r--src/bindings.rs29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/bindings.rs b/src/bindings.rs
index 2e87fe0..5b8d013 100644
--- a/src/bindings.rs
+++ b/src/bindings.rs
@@ -210,16 +210,6 @@ impl Binding {
self.impls.get(template).cloned()
}
- /// Return name of function that implements step.
- pub fn function(&self) -> &str {
- self.impls.values().next().unwrap().function()
- }
-
- /// Return name of function that implements cleanup.
- pub fn cleanup(&self) -> Option<&str> {
- self.impls.values().next().unwrap().cleanup()
- }
-
/// Return the compiled regular expression for the pattern of the
/// binding.
///
@@ -313,27 +303,12 @@ mod test_binding {
use std::collections::HashMap;
#[test]
- fn creates_new_without_cleanup() {
- let mut b = Binding::new(StepKind::Given, "I am Tomjon", false, HashMap::new()).unwrap();
- assert_eq!(b.kind(), StepKind::Given);
- assert!(b.regex().is_match("I am Tomjon"));
- assert!(!b.regex().is_match("I am Tomjon of Lancre"));
- assert!(!b.regex().is_match("Hello, I am Tomjon"));
- b.add_impl("", "set_name", None);
- assert_eq!(b.function(), "set_name");
- assert_eq!(b.cleanup(), None);
- }
-
- #[test]
- fn creates_new_with_cleanup() {
- let mut b = Binding::new(StepKind::Given, "I am Tomjon", false, HashMap::new()).unwrap();
+ fn creates_new() {
+ let b = Binding::new(StepKind::Given, "I am Tomjon", false, HashMap::new()).unwrap();
assert_eq!(b.kind(), StepKind::Given);
assert!(b.regex().is_match("I am Tomjon"));
assert!(!b.regex().is_match("I am Tomjon of Lancre"));
assert!(!b.regex().is_match("Hello, I am Tomjon"));
- b.add_impl("", "set_name", Some("unset_name"));
- assert_eq!(b.function(), "set_name");
- assert_eq!(b.cleanup(), Some("unset_name"));
}
#[test]