summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorGregory Becker <becker33@llnl.gov>2018-12-05 20:12:47 -0800
committerGreg Becker <becker33@llnl.gov>2018-12-06 15:48:23 -0800
commitb072c9b457d04347f21ed86a15f7da618fd9027d (patch)
treeaebba4d201d37b476e62d1fa44a356a0fab4e3f2 /var
parent2621af41d16201020b6c0965b0f6b1762b81346b (diff)
downloadspack-b072c9b457d04347f21ed86a15f7da618fd9027d.tar.gz
spack-b072c9b457d04347f21ed86a15f7da618fd9027d.tar.bz2
spack-b072c9b457d04347f21ed86a15f7da618fd9027d.tar.xz
spack-b072c9b457d04347f21ed86a15f7da618fd9027d.zip
multimethod: slight refactoring, documentation for code review
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py2
-rw-r--r--var/spack/repos/builtin.mock/packages/multimethod/package.py21
2 files changed, 21 insertions, 2 deletions
diff --git a/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py b/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py
index d3413a36b5..e10e5497af 100644
--- a/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py
+++ b/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py
@@ -18,4 +18,4 @@ class MultimethodDiamondParent(MultimethodBase):
@when('@4.0, 2.0')
def diamond_inheritance(self):
- return "should never be reached"
+ return "should never be reached by diamond inheritance test"
diff --git a/var/spack/repos/builtin.mock/packages/multimethod/package.py b/var/spack/repos/builtin.mock/packages/multimethod/package.py
index 738e41be41..558d99717f 100644
--- a/var/spack/repos/builtin.mock/packages/multimethod/package.py
+++ b/var/spack/repos/builtin.mock/packages/multimethod/package.py
@@ -148,4 +148,23 @@ class Multimethod(MultimethodBase):
@when('@4.0')
def diamond_inheritance(self):
- return "should_not_be_reached"
+ return "should_not_be_reached by diamond inheritance test"
+
+ #
+ # Check that multimethods work with boolean values
+ #
+ @when(True)
+ def boolean_true_first(self):
+ return 'True'
+
+ @when(False)
+ def boolean_true_first(self):
+ return 'False'
+
+ @when(False)
+ def boolean_false_first(self):
+ return 'False'
+
+ @when(True)
+ def boolean_false_first(self):
+ return 'True'