コード例 #1
0
    def test_string(self):
        CompilerType = EnumString.subclass('gcc', 'clang', 'clang-cl')

        type = CompilerType('gcc')
        self.assertEquals(type, 'gcc')
        self.assertNotEquals(type, 'clang')
        self.assertNotEquals(type, 'clang-cl')
        self.assertIn(type, ('gcc', 'clang-cl'))
        self.assertNotIn(type, ('clang', 'clang-cl'))

        with self.assertRaises(EnumStringComparisonError):
            self.assertEquals(type, 'foo')

        with self.assertRaises(EnumStringComparisonError):
            self.assertNotEquals(type, 'foo')

        with self.assertRaises(EnumStringComparisonError):
            self.assertIn(type, ('foo', 'gcc'))

        with self.assertRaises(ValueError):
            type = CompilerType('foo')
コード例 #2
0
ファイル: test_util.py プロジェクト: Floflis/gecko-b2g
    def test_string(self):
        CompilerType = EnumString.subclass("gcc", "clang", "clang-cl")

        type = CompilerType("gcc")
        self.assertEquals(type, "gcc")
        self.assertNotEquals(type, "clang")
        self.assertNotEquals(type, "clang-cl")
        self.assertIn(type, ("gcc", "clang-cl"))
        self.assertNotIn(type, ("clang", "clang-cl"))

        with self.assertRaises(EnumStringComparisonError):
            self.assertEquals(type, "foo")

        with self.assertRaises(EnumStringComparisonError):
            self.assertNotEquals(type, "foo")

        with self.assertRaises(EnumStringComparisonError):
            self.assertIn(type, ("foo", "gcc"))

        with self.assertRaises(ValueError):
            type = CompilerType("foo")
コード例 #3
0
ファイル: test_util.py プロジェクト: MichaelKohler/gecko-dev
    def test_string(self):
        CompilerType = EnumString.subclass('msvc', 'gcc', 'clang', 'clang-cl')

        type = CompilerType('msvc')
        self.assertEquals(type, 'msvc')
        self.assertNotEquals(type, 'gcc')
        self.assertNotEquals(type, 'clang')
        self.assertNotEquals(type, 'clang-cl')
        self.assertIn(type, ('msvc', 'clang-cl'))
        self.assertNotIn(type, ('gcc', 'clang'))

        with self.assertRaises(EnumStringComparisonError):
            self.assertEquals(type, 'foo')

        with self.assertRaises(EnumStringComparisonError):
            self.assertNotEquals(type, 'foo')

        with self.assertRaises(EnumStringComparisonError):
            self.assertIn(type, ('foo', 'gcc'))

        with self.assertRaises(ValueError):
            type = CompilerType('foo')
コード例 #4
0
ファイル: constants.py プロジェクト: Floflis/gecko-b2g
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import absolute_import, print_function, unicode_literals

from mozbuild.util import EnumString
from collections import OrderedDict

CompilerType = EnumString.subclass(
    "clang",
    "clang-cl",
    "gcc",
    "msvc",
)

OS = EnumString.subclass(
    "Android",
    "DragonFly",
    "FreeBSD",
    "GNU",
    "NetBSD",
    "OpenBSD",
    "OSX",
    "SunOS",
    "WINNT",
    "WASI",
)

Kernel = EnumString.subclass(
    "Darwin",
コード例 #5
0
ファイル: constants.py プロジェクト: MichaelKohler/gecko-dev
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import absolute_import, print_function, unicode_literals

from mozbuild.util import EnumString
from collections import OrderedDict


CompilerType = EnumString.subclass(
    'clang',
    'clang-cl',
    'gcc',
    'msvc',
)

OS = EnumString.subclass(
    'Android',
    'DragonFly',
    'FreeBSD',
    'GNU',
    'iOS',
    'NetBSD',
    'OpenBSD',
    'OSX',
    'WINNT',
)

Kernel = EnumString.subclass(
    'Darwin',
コード例 #6
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import absolute_import, print_function, unicode_literals

from mozbuild.util import EnumString
from collections import OrderedDict


CompilerType = EnumString.subclass(
    'clang',
    'clang-cl',
    'gcc',
    'msvc',
)

OS = EnumString.subclass(
    'Android',
    'DragonFly',
    'FreeBSD',
    'GNU',
    'iOS',
    'NetBSD',
    'OpenBSD',
    'OSX',
    'WINNT',
)

Kernel = EnumString.subclass(
    'Darwin',
コード例 #7
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import absolute_import, print_function, unicode_literals

from mozbuild.util import EnumString
from collections import OrderedDict

CompilerType = EnumString.subclass(
    'clang',
    'clang-cl',
    'gcc',
    'msvc',
)

OS = EnumString.subclass(
    'Android',
    'DragonFly',
    'FreeBSD',
    'GNU',
    'iOS',
    'NetBSD',
    'OpenBSD',
    'OSX',
    'WINNT',
)

Kernel = EnumString.subclass(
    'Darwin',
    'DragonFly',