summaryrefslogtreecommitdiff
path: root/test/D/CoreScanner
diff options
context:
space:
mode:
Diffstat (limited to 'test/D/CoreScanner')
-rw-r--r--test/D/CoreScanner/Common/__init__.py0
-rw-r--r--test/D/CoreScanner/Common/common.py99
-rw-r--r--test/D/CoreScanner/Common/sconstest.skip0
-rw-r--r--test/D/CoreScanner/Image/SConstruct_template8
-rw-r--r--test/D/CoreScanner/Image/ignored.d3
-rw-r--r--test/D/CoreScanner/Image/module1.d3
-rw-r--r--test/D/CoreScanner/Image/module2.d3
-rw-r--r--test/D/CoreScanner/Image/module3.di3
-rw-r--r--test/D/CoreScanner/Image/p/ignored.d3
-rw-r--r--test/D/CoreScanner/Image/p/submodule1.d3
-rw-r--r--test/D/CoreScanner/Image/p/submodule2.d3
-rw-r--r--test/D/CoreScanner/Image/test1.d9
-rw-r--r--test/D/CoreScanner/Image/test2.d11
-rw-r--r--test/D/CoreScanner/sconstest-dmd.py37
-rw-r--r--test/D/CoreScanner/sconstest-gdc.py37
-rw-r--r--test/D/CoreScanner/sconstest-ldc.py37
16 files changed, 259 insertions, 0 deletions
diff --git a/test/D/CoreScanner/Common/__init__.py b/test/D/CoreScanner/Common/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/D/CoreScanner/Common/__init__.py
diff --git a/test/D/CoreScanner/Common/common.py b/test/D/CoreScanner/Common/common.py
new file mode 100644
index 000000000..1d2fde071
--- /dev/null
+++ b/test/D/CoreScanner/Common/common.py
@@ -0,0 +1,99 @@
+"""
+Verify that the D scanner can return multiple modules imported by
+a single statement.
+"""
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+from os.path import abspath, dirname
+
+import sys
+sys.path.insert(1, abspath(dirname(__file__) + '/../../Support'))
+
+from executablesSearch import isExecutableOfToolAvailable
+
+def testForTool(tool):
+
+ test = TestSCons.TestSCons()
+
+ _obj = TestSCons._obj
+
+ if not isExecutableOfToolAvailable(test, tool) :
+ test.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))
+
+ test.dir_fixture('Image')
+ test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))
+
+ arguments = 'test1%(_obj)s test2%(_obj)s' % locals()
+
+ if tool == 'dmd':
+ # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
+ # that cause inappropriate failure of the tests, so simply ignore them.
+ test.run(arguments=arguments, stderr=None)
+ else:
+ test.run(arguments=arguments)
+
+ test.up_to_date(arguments=arguments)
+
+ test.write(['module2.d'], """\
+module module2;
+
+int something_else;
+""")
+
+ if tool == 'dmd':
+ # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
+ # that cause inappropriate failure of the tests, so simply ignore them.
+ test.not_up_to_date(arguments=arguments, stderr=None)
+ else:
+ test.not_up_to_date(arguments=arguments)
+
+ test.up_to_date(arguments=arguments)
+
+ test.write(['p', 'submodule2.d'], """\
+module p.submodule2;
+
+int something_else;
+""")
+
+ if tool == 'dmd':
+ # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
+ # that cause inappropriate failure of the tests, so simply ignore them.
+ test.not_up_to_date(arguments=arguments, stderr=None)
+ else:
+ test.not_up_to_date(arguments=arguments)
+
+ test.up_to_date(arguments=arguments)
+
+ test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/D/CoreScanner/Common/sconstest.skip b/test/D/CoreScanner/Common/sconstest.skip
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/D/CoreScanner/Common/sconstest.skip
diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template
new file mode 100644
index 000000000..e91343be8
--- /dev/null
+++ b/test/D/CoreScanner/Image/SConstruct_template
@@ -0,0 +1,8 @@
+# -*- mode:python; coding:utf-8; -*-
+
+import os
+
+environment = Environment(
+ tools=['link', '{}'])
+environment.Program('test1.d')
+environment.Program('test2.d')
diff --git a/test/D/CoreScanner/Image/ignored.d b/test/D/CoreScanner/Image/ignored.d
new file mode 100644
index 000000000..5b54a07b9
--- /dev/null
+++ b/test/D/CoreScanner/Image/ignored.d
@@ -0,0 +1,3 @@
+module ignored;
+
+int something;
diff --git a/test/D/CoreScanner/Image/module1.d b/test/D/CoreScanner/Image/module1.d
new file mode 100644
index 000000000..487c35830
--- /dev/null
+++ b/test/D/CoreScanner/Image/module1.d
@@ -0,0 +1,3 @@
+module module1;
+
+int something;
diff --git a/test/D/CoreScanner/Image/module2.d b/test/D/CoreScanner/Image/module2.d
new file mode 100644
index 000000000..198fb7480
--- /dev/null
+++ b/test/D/CoreScanner/Image/module2.d
@@ -0,0 +1,3 @@
+module module2;
+
+int something;
diff --git a/test/D/CoreScanner/Image/module3.di b/test/D/CoreScanner/Image/module3.di
new file mode 100644
index 000000000..effd4ebea
--- /dev/null
+++ b/test/D/CoreScanner/Image/module3.di
@@ -0,0 +1,3 @@
+module module3;
+
+int something;
diff --git a/test/D/CoreScanner/Image/p/ignored.d b/test/D/CoreScanner/Image/p/ignored.d
new file mode 100644
index 000000000..43d2bd872
--- /dev/null
+++ b/test/D/CoreScanner/Image/p/ignored.d
@@ -0,0 +1,3 @@
+module p.ignored;
+
+int something;
diff --git a/test/D/CoreScanner/Image/p/submodule1.d b/test/D/CoreScanner/Image/p/submodule1.d
new file mode 100644
index 000000000..1ec03693e
--- /dev/null
+++ b/test/D/CoreScanner/Image/p/submodule1.d
@@ -0,0 +1,3 @@
+module p.submodule1;
+
+int something;
diff --git a/test/D/CoreScanner/Image/p/submodule2.d b/test/D/CoreScanner/Image/p/submodule2.d
new file mode 100644
index 000000000..57a282565
--- /dev/null
+++ b/test/D/CoreScanner/Image/p/submodule2.d
@@ -0,0 +1,3 @@
+module p.submodule2;
+
+int something;
diff --git a/test/D/CoreScanner/Image/test1.d b/test/D/CoreScanner/Image/test1.d
new file mode 100644
index 000000000..d386d9775
--- /dev/null
+++ b/test/D/CoreScanner/Image/test1.d
@@ -0,0 +1,9 @@
+import module1;
+import module2;
+import module3;
+import p.submodule1;
+import p.submodule2;
+
+int main() {
+ return 0;
+}
diff --git a/test/D/CoreScanner/Image/test2.d b/test/D/CoreScanner/Image/test2.d
new file mode 100644
index 000000000..f880d2fa4
--- /dev/null
+++ b/test/D/CoreScanner/Image/test2.d
@@ -0,0 +1,11 @@
+import
+ module1,
+ module2,
+ module3;
+import
+ p.submodule1,
+ p.submodule2;
+
+int main() {
+ return 0;
+}
diff --git a/test/D/CoreScanner/sconstest-dmd.py b/test/D/CoreScanner/sconstest-dmd.py
new file mode 100644
index 000000000..df6ddebd0
--- /dev/null
+++ b/test/D/CoreScanner/sconstest-dmd.py
@@ -0,0 +1,37 @@
+"""
+Test compiling and executing using the dmd tool.
+"""
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+from Common.common import testForTool
+testForTool('dmd')
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/D/CoreScanner/sconstest-gdc.py b/test/D/CoreScanner/sconstest-gdc.py
new file mode 100644
index 000000000..068f2c4a1
--- /dev/null
+++ b/test/D/CoreScanner/sconstest-gdc.py
@@ -0,0 +1,37 @@
+"""
+Test compiling and executing using the gdc tool.
+"""
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+from Common.common import testForTool
+testForTool('gdc')
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/D/CoreScanner/sconstest-ldc.py b/test/D/CoreScanner/sconstest-ldc.py
new file mode 100644
index 000000000..f61efbc6f
--- /dev/null
+++ b/test/D/CoreScanner/sconstest-ldc.py
@@ -0,0 +1,37 @@
+"""
+Test compiling and executing using the ldc tool.
+"""
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+from Common.common import testForTool
+testForTool('ldc')
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: