Beispiel #1
0
                        // import ConsoleJSTestFoo.Bar
                        // import ConsoleJSTestFoo.Baz
                        print("hello from the test module");
                        '''))

        deps = getDependencies(
                fname,
                ignore=(),
                bootstrap=(),
                packages=self._getPackages())

        script = generateTestScript(
                    fname,
                    dependencies=deps)

        scriptfname = self._outputToTempFile(script)

        def gotResult(s):
            self.assertEqual(s.split('\n'),
                             ['hello from ConsoleJSTestFoo',
                              'hello from ConsoleJSTestFoo.Bar',
                              'hello from ConsoleJSTestFoo.Baz',
                              'hello from the test module',
                              ''])

        result = getProcessOutput(self.javascriptInterpreter, ('-f', scriptfname))
        result.addCallback(gotResult)
        return result

setJavascriptInterpreterOrSkip(JSGenerationTestCase)
Beispiel #2
0
            dedent('''
                        // import ConsoleJSTestFoo.Bar
                        // import ConsoleJSTestFoo.Baz
                        print("hello from the test module");
                        '''))

        deps = getDependencies(fname,
                               ignore=(),
                               bootstrap=(),
                               packages=self._getPackages())

        script = generateTestScript(fname, dependencies=deps)

        scriptfname = self._outputToTempFile(script)

        def gotResult(s):
            self.assertEqual(s.split('\n'), [
                'hello from ConsoleJSTestFoo',
                'hello from ConsoleJSTestFoo.Bar',
                'hello from ConsoleJSTestFoo.Baz',
                'hello from the test module', ''
            ])

        result = getProcessOutput(self.javascriptInterpreter,
                                  ('-f', scriptfname))
        result.addCallback(gotResult)
        return result


setJavascriptInterpreterOrSkip(JSGenerationTestCase)


class QuotientJavaScriptTestSuite(JavaScriptTestSuite):
    """
    Run all the Quotient javascript tests
    """
    path = FilePath(__file__).parent()

    def test_utils(self):
        return self.onetest('test_utils.js')

    def test_messageActions(self):
        return self.onetest('test_messageActions.js')

setJavascriptInterpreterOrSkip(QuotientJavaScriptTestSuite)



from nevow.testutil import JavaScriptTestCase



class JavaScriptTests(JavaScriptTestCase):
    """
    xQuotient Javascript unit tests.
    """
    def test_common(self):
        """
        Tests for C{Quotient.Common}.
        """