summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Scanner/ScannerTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-12-03 02:53:01 (GMT)
committerSteven Knight <knight@baldmt.com>2001-12-03 02:53:01 (GMT)
commit7543ec6ef46cd3fe5e7861e4c5167a4c562ac92b (patch)
tree6b0c2f2cf0d1ebca4fafe7e97a3fa3d3e1719574 /src/engine/SCons/Scanner/ScannerTests.py
parent94888b28d673f05360670ad3eeac836b5260e44a (diff)
downloadSCons-7543ec6ef46cd3fe5e7861e4c5167a4c562ac92b.zip
SCons-7543ec6ef46cd3fe5e7861e4c5167a4c562ac92b.tar.gz
SCons-7543ec6ef46cd3fe5e7861e4c5167a4c562ac92b.tar.bz2
Refactor the Scanner class(es) into a Prototype pattern.
Diffstat (limited to 'src/engine/SCons/Scanner/ScannerTests.py')
-rw-r--r--src/engine/SCons/Scanner/ScannerTests.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py
index 5d434a6..f1a92cd 100644
--- a/src/engine/SCons/Scanner/ScannerTests.py
+++ b/src/engine/SCons/Scanner/ScannerTests.py
@@ -57,39 +57,60 @@ class DummyEnvironment:
class ScannerPositionalTestCase(ScannerTestBase, unittest.TestCase):
- "Test the Scanner class using the position argument"
+ "Test the Scanner.Base class using the position argument"
def runTest(self):
- s = SCons.Scanner.Base(self.func)
+ s = SCons.Scanner.Base(self.func, "Pos")
env = DummyEnvironment()
env.VARIABLE = "var1"
self.test(s, env, 'f1.cpp', ['f1.h', 'f1.hpp'])
+ env = DummyEnvironment()
+ env.VARIABLE = "i1"
+ i = s.instance(env)
+ self.test(i, env, 'i1.cpp', ['i1.h', 'i1.hpp'])
+
class ScannerKeywordTestCase(ScannerTestBase, unittest.TestCase):
- "Test the Scanner class using the keyword argument"
+ "Test the Scanner.Base class using the keyword argument"
def runTest(self):
- s = SCons.Scanner.Base(function = self.func)
+ s = SCons.Scanner.Base(function = self.func, name = "Key")
env = DummyEnvironment()
env.VARIABLE = "var2"
self.test(s, env, 'f2.cpp', ['f2.h', 'f2.hpp'])
+ env = DummyEnvironment()
+ env.VARIABLE = "i2"
+ i = s.instance(env)
+ self.test(i, env, 'i2.cpp', ['i2.h', 'i2.hpp'])
+
class ScannerPositionalArgumentTestCase(ScannerTestBase, unittest.TestCase):
- "Test the Scanner class using the position argument and optional argument"
+ "Test the Scanner.Base class using both position and optional arguments"
def runTest(self):
arg = "this is the argument"
- s = SCons.Scanner.Base(self.func, arg)
+ s = SCons.Scanner.Base(self.func, "PosArg", arg)
env = DummyEnvironment()
env.VARIABLE = "var3"
self.test(s, env, 'f3.cpp', ['f3.h', 'f3.hpp'], arg)
+ env = DummyEnvironment()
+ env.VARIABLE = "i3"
+ i = s.instance(env)
+ self.test(i, env, 'i3.cpp', ['i3.h', 'i3.hpp'], arg)
+
class ScannerKeywordArgumentTestCase(ScannerTestBase, unittest.TestCase):
- "Test the Scanner class using the keyword argument and optional argument"
+ "Test the Scanner.Base class using both keyword and optional arguments"
def runTest(self):
arg = "this is another argument"
- s = SCons.Scanner.Base(function = self.func, argument = arg)
+ s = SCons.Scanner.Base(function = self.func, name = "KeyArg",
+ argument = arg)
env = DummyEnvironment()
env.VARIABLE = "var4"
self.test(s, env, 'f4.cpp', ['f4.h', 'f4.hpp'], arg)
+ env = DummyEnvironment()
+ env.VARIABLE = "i4"
+ i = s.instance(env)
+ self.test(i, env, 'i4.cpp', ['i4.h', 'i4.hpp'], arg)
+
def suite():
suite = unittest.TestSuite()
suite.addTest(ScannerPositionalTestCase())