Changeset View
Changeset View
Standalone View
Standalone View
plugins/cmake/cmakeutils.cpp
Show First 20 Lines • Show All 692 Lines • ▼ Show 20 Line(s) | 692 | if (entry.name == QLatin1String("add_test")) { | |||
---|---|---|---|---|---|
693 | auto args = entry.arguments; | 693 | auto args = entry.arguments; | ||
694 | 694 | | |||
695 | Test test; | 695 | Test test; | ||
696 | test.name = args.takeFirst().value; | 696 | test.name = args.takeFirst().value; | ||
697 | test.executable = args.takeFirst().value; | 697 | test.executable = args.takeFirst().value; | ||
698 | test.arguments = kTransform<QStringList>(args, [](const CMakeFunctionArgument& arg) { return arg.value; }); | 698 | test.arguments = kTransform<QStringList>(args, [](const CMakeFunctionArgument& arg) { return arg.value; }); | ||
699 | tests += test; | 699 | tests += test; | ||
700 | } else if (entry.name == QLatin1String("subdirs")) { | 700 | } else if (entry.name == QLatin1String("subdirs")) { | ||
701 | tests += importTestSuites(Path(buildDir, entry.arguments.constFirst().value)); | 701 | tests += importTestSuites(Path(buildDir, entry.arguments.first().value)); | ||
702 | } else if (entry.name == QLatin1String("set_tests_properties")) { | 702 | } else if (entry.name == QLatin1String("set_tests_properties")) { | ||
703 | if(entry.arguments.count() < 4 || entry.arguments.count() % 2) { | 703 | if(entry.arguments.count() < 4 || entry.arguments.count() % 2) { | ||
704 | qCWarning(CMAKE) << "found set_tests_properties() with unexpected number of arguments:" | 704 | qCWarning(CMAKE) << "found set_tests_properties() with unexpected number of arguments:" | ||
705 | << entry.arguments.count(); | 705 | << entry.arguments.count(); | ||
706 | continue; | 706 | continue; | ||
707 | } | 707 | } | ||
708 | if (tests.isEmpty() || entry.arguments.constFirst().value != tests.constLast().name) { | 708 | if (tests.isEmpty() || entry.arguments.first().value != tests.last().name) { | ||
709 | qCWarning(CMAKE) << "found set_tests_properties(" << entry.arguments.constFirst().value | 709 | qCWarning(CMAKE) << "found set_tests_properties(" << entry.arguments.first().value | ||
710 | << " ...), but expected test " << tests.constLast().name; | 710 | << " ...), but expected test " << tests.last().name; | ||
711 | continue; | 711 | continue; | ||
712 | } | 712 | } | ||
713 | if (entry.arguments[1].value != QLatin1String("PROPERTIES")) { | 713 | if (entry.arguments[1].value != QLatin1String("PROPERTIES")) { | ||
714 | qCWarning(CMAKE) << "found set_tests_properties(" << entry.arguments.constFirst().value | 714 | qCWarning(CMAKE) << "found set_tests_properties(" << entry.arguments.first().value | ||
715 | << entry.arguments.at(1).value << "...), but expected PROPERTIES as second argument"; | 715 | << entry.arguments.at(1).value << "...), but expected PROPERTIES as second argument"; | ||
716 | continue; | 716 | continue; | ||
717 | } | 717 | } | ||
718 | Test &test = tests.last(); | 718 | Test &test = tests.last(); | ||
719 | for (int i = 2; i < entry.arguments.count(); i += 2) | 719 | for (int i = 2; i < entry.arguments.count(); i += 2) | ||
720 | test.properties[entry.arguments[i].value] = entry.arguments[i + 1].value; | 720 | test.properties[entry.arguments[i].value] = entry.arguments[i + 1].value; | ||
721 | } | 721 | } | ||
722 | } | 722 | } | ||
723 | 723 | | |||
724 | return tests; | 724 | return tests; | ||
725 | } | 725 | } | ||
726 | 726 | | |||
727 | } | 727 | } |