2019-03-26 13:12:09 +00:00
|
|
|
#!/usr/bin/env python3
|
2022-05-10 10:06:48 +00:00
|
|
|
# Copyright (C) 2018 The Qt Company Ltd.
|
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2019-03-26 13:12:09 +00:00
|
|
|
|
|
|
|
from pro2cmake import AddOperation, SetOperation, UniqueAddOperation, RemoveOperation
|
|
|
|
|
|
|
|
def test_add_operation():
|
|
|
|
op = AddOperation(['bar', 'buz'])
|
|
|
|
|
2019-05-17 13:05:49 +00:00
|
|
|
result = op.process(['foo', 'bar'], ['foo', 'bar'], lambda x: x)
|
2019-03-26 13:12:09 +00:00
|
|
|
assert ['foo', 'bar', 'bar', 'buz'] == result
|
|
|
|
|
|
|
|
|
|
|
|
def test_uniqueadd_operation():
|
|
|
|
op = UniqueAddOperation(['bar', 'buz'])
|
|
|
|
|
2019-05-17 13:05:49 +00:00
|
|
|
result = op.process(['foo', 'bar'], ['foo', 'bar'], lambda x: x)
|
2019-03-26 13:12:09 +00:00
|
|
|
assert ['foo', 'bar', 'buz'] == result
|
|
|
|
|
|
|
|
|
|
|
|
def test_set_operation():
|
|
|
|
op = SetOperation(['bar', 'buz'])
|
|
|
|
|
2019-05-17 13:05:49 +00:00
|
|
|
result = op.process(['foo', 'bar'], ['foo', 'bar'], lambda x: x)
|
2019-03-26 13:12:09 +00:00
|
|
|
assert ['bar', 'buz'] == result
|
|
|
|
|
|
|
|
|
|
|
|
def test_remove_operation():
|
|
|
|
op = RemoveOperation(['bar', 'buz'])
|
|
|
|
|
2019-05-17 13:05:49 +00:00
|
|
|
result = op.process(['foo', 'bar'], ['foo', 'bar'], lambda x: x)
|
2019-03-26 13:12:09 +00:00
|
|
|
assert ['foo', '-buz'] == result
|