Fixes: Tests should have unique names.

Details: Autotests need to be named uniquely, otherwise
all sorts of databases get lost and confused.
This commit is contained in:
Bill King
2010-08-19 11:54:51 +10:00
parent 5b2fb4bb67
commit 7f9a448eeb
10 changed files with 54 additions and 62 deletions

View File

@@ -1,6 +1,6 @@
TEMPLATE = app TEMPLATE = app
CONFIG += qt warn_on console depend_includepath CONFIG += qt warn_on console depend_includepath qtestlib testcase
QT += testlib network QT += network
SRCDIR = ../../../../../src SRCDIR = ../../../../../src
@@ -11,7 +11,7 @@ include($$SRCDIR/libs/utils/utils-lib.pri)
#LIBS += -L$$IDE_LIBRARY_PATH #LIBS += -L$$IDE_LIBRARY_PATH
SOURCES += \ SOURCES += \
tst_codeformatter.cpp \ tst_qmlcodeformatter.cpp \
$$SRCDIR/plugins/qmljseditor/qmljseditorcodeformatter.cpp \ $$SRCDIR/plugins/qmljseditor/qmljseditorcodeformatter.cpp \
$$SRCDIR/plugins/texteditor/basetextdocumentlayout.cpp $$SRCDIR/plugins/texteditor/basetextdocumentlayout.cpp
@@ -20,5 +20,3 @@ HEADERS += \
$$SRCDIR/plugins/texteditor/basetextdocumentlayout.h \ $$SRCDIR/plugins/texteditor/basetextdocumentlayout.h \
INCLUDEPATH += $$SRCDIR/plugins $$SRCDIR/libs INCLUDEPATH += $$SRCDIR/plugins $$SRCDIR/libs
TARGET=tst_$$TARGET

View File

@@ -8,7 +8,7 @@
using namespace QmlJSEditor; using namespace QmlJSEditor;
class tst_CodeFormatter: public QObject class tst_QMLCodeFormatter: public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -105,7 +105,7 @@ void checkIndent(QList<Line> data, int style = 0)
} }
} }
void tst_CodeFormatter::objectDefinitions1() void tst_QMLCodeFormatter::objectDefinitions1()
{ {
QList<Line> data; QList<Line> data;
data << Line("import Qt 4.7") data << Line("import Qt 4.7")
@@ -127,7 +127,7 @@ void tst_CodeFormatter::objectDefinitions1()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::objectDefinitions2() void tst_QMLCodeFormatter::objectDefinitions2()
{ {
QList<Line> data; QList<Line> data;
data << Line("import Qt 4.7") data << Line("import Qt 4.7")
@@ -141,7 +141,7 @@ void tst_CodeFormatter::objectDefinitions2()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::expressionEndSimple() void tst_QMLCodeFormatter::expressionEndSimple()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -156,7 +156,7 @@ void tst_CodeFormatter::expressionEndSimple()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::expressionEnd() void tst_QMLCodeFormatter::expressionEnd()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -172,7 +172,7 @@ void tst_CodeFormatter::expressionEnd()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::expressionEndParen() void tst_QMLCodeFormatter::expressionEndParen()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -190,7 +190,7 @@ void tst_CodeFormatter::expressionEndParen()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::expressionEndBracket() void tst_QMLCodeFormatter::expressionEndBracket()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -208,7 +208,7 @@ void tst_CodeFormatter::expressionEndBracket()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::objectBinding() void tst_QMLCodeFormatter::objectBinding()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -227,7 +227,7 @@ void tst_CodeFormatter::objectBinding()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::arrayBinding() void tst_QMLCodeFormatter::arrayBinding()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -258,7 +258,7 @@ void tst_CodeFormatter::arrayBinding()
void tst_CodeFormatter::moreIfThenElse() void tst_QMLCodeFormatter::moreIfThenElse()
{ {
QList<Line> data; QList<Line> data;
data << Line("Image {") data << Line("Image {")
@@ -276,7 +276,7 @@ void tst_CodeFormatter::moreIfThenElse()
} }
void tst_CodeFormatter::functionDeclaration() void tst_QMLCodeFormatter::functionDeclaration()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -310,7 +310,7 @@ void tst_CodeFormatter::functionDeclaration()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::functionExpression() void tst_QMLCodeFormatter::functionExpression()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -329,7 +329,7 @@ void tst_CodeFormatter::functionExpression()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::propertyDeclarations() void tst_QMLCodeFormatter::propertyDeclarations()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -352,7 +352,7 @@ void tst_CodeFormatter::propertyDeclarations()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::signalDeclarations() void tst_QMLCodeFormatter::signalDeclarations()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -371,7 +371,7 @@ void tst_CodeFormatter::signalDeclarations()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifBinding1() void tst_QMLCodeFormatter::ifBinding1()
{ {
QList<Line> data; QList<Line> data;
data << Line("A.Rectangle {") data << Line("A.Rectangle {")
@@ -401,7 +401,7 @@ void tst_CodeFormatter::ifBinding1()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifBinding2() void tst_QMLCodeFormatter::ifBinding2()
{ {
QList<Line> data; QList<Line> data;
data << Line("A.Rectangle {") data << Line("A.Rectangle {")
@@ -427,7 +427,7 @@ void tst_CodeFormatter::ifBinding2()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementWithoutBraces1() void tst_QMLCodeFormatter::ifStatementWithoutBraces1()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -450,7 +450,7 @@ void tst_CodeFormatter::ifStatementWithoutBraces1()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementWithoutBraces2() void tst_QMLCodeFormatter::ifStatementWithoutBraces2()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -480,7 +480,7 @@ void tst_CodeFormatter::ifStatementWithoutBraces2()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementWithBraces1() void tst_QMLCodeFormatter::ifStatementWithBraces1()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -505,7 +505,7 @@ void tst_CodeFormatter::ifStatementWithBraces1()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementWithBraces2() void tst_QMLCodeFormatter::ifStatementWithBraces2()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -540,7 +540,7 @@ void tst_CodeFormatter::ifStatementWithBraces2()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementMixed() void tst_QMLCodeFormatter::ifStatementMixed()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -559,7 +559,7 @@ void tst_CodeFormatter::ifStatementMixed()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementAndComments() void tst_QMLCodeFormatter::ifStatementAndComments()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -583,7 +583,7 @@ void tst_CodeFormatter::ifStatementAndComments()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ifStatementLongCondition() void tst_QMLCodeFormatter::ifStatementLongCondition()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -600,7 +600,7 @@ void tst_CodeFormatter::ifStatementLongCondition()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::strayElse() void tst_QMLCodeFormatter::strayElse()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -613,7 +613,7 @@ void tst_CodeFormatter::strayElse()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::oneLineIf() void tst_QMLCodeFormatter::oneLineIf()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -624,7 +624,7 @@ void tst_CodeFormatter::oneLineIf()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::forStatement() void tst_QMLCodeFormatter::forStatement()
{ {
QList<Line> data; QList<Line> data;
data << Line("for (var i = 0; i < 20; ++i) {") data << Line("for (var i = 0; i < 20; ++i) {")
@@ -647,7 +647,7 @@ void tst_CodeFormatter::forStatement()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::whileStatement() void tst_QMLCodeFormatter::whileStatement()
{ {
QList<Line> data; QList<Line> data;
data << Line("while (i < 20) {") data << Line("while (i < 20) {")
@@ -670,7 +670,7 @@ void tst_CodeFormatter::whileStatement()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::tryStatement() void tst_QMLCodeFormatter::tryStatement()
{ {
QList<Line> data; QList<Line> data;
data << Line("try {") data << Line("try {")
@@ -688,7 +688,7 @@ void tst_CodeFormatter::tryStatement()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::doWhile() void tst_QMLCodeFormatter::doWhile()
{ {
QList<Line> data; QList<Line> data;
data << Line("function foo() {") data << Line("function foo() {")
@@ -705,7 +705,7 @@ void tst_CodeFormatter::doWhile()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::cStyleComments() void tst_QMLCodeFormatter::cStyleComments()
{ {
QList<Line> data; QList<Line> data;
data << Line("/*") data << Line("/*")
@@ -735,7 +735,7 @@ void tst_CodeFormatter::cStyleComments()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::cppStyleComments() void tst_QMLCodeFormatter::cppStyleComments()
{ {
QList<Line> data; QList<Line> data;
data << Line("// abc") data << Line("// abc")
@@ -751,7 +751,7 @@ void tst_CodeFormatter::cppStyleComments()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::ternary() void tst_QMLCodeFormatter::ternary()
{ {
QList<Line> data; QList<Line> data;
data << Line("function foo() {") data << Line("function foo() {")
@@ -774,7 +774,7 @@ void tst_CodeFormatter::ternary()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::switch1() void tst_QMLCodeFormatter::switch1()
{ {
QList<Line> data; QList<Line> data;
data << Line("function foo() {") data << Line("function foo() {")
@@ -803,7 +803,7 @@ void tst_CodeFormatter::switch1()
checkIndent(data); checkIndent(data);
} }
//void tst_CodeFormatter::gnuStyle() //void tst_QMLCodeFormatter::gnuStyle()
//{ //{
// QList<Line> data; // QList<Line> data;
// data << Line("struct S") // data << Line("struct S")
@@ -830,7 +830,7 @@ void tst_CodeFormatter::switch1()
// checkIndent(data, 1); // checkIndent(data, 1);
//} //}
//void tst_CodeFormatter::whitesmithsStyle() //void tst_QMLCodeFormatter::whitesmithsStyle()
//{ //{
// QList<Line> data; // QList<Line> data;
// data << Line("struct S") // data << Line("struct S")
@@ -850,7 +850,7 @@ void tst_CodeFormatter::switch1()
// checkIndent(data, 2); // checkIndent(data, 2);
//} //}
void tst_CodeFormatter::qmlKeywords() void tst_QMLCodeFormatter::qmlKeywords()
{ {
QList<Line> data; QList<Line> data;
data << Line("Rectangle {") data << Line("Rectangle {")
@@ -868,7 +868,7 @@ void tst_CodeFormatter::qmlKeywords()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::expressionContinuation() void tst_QMLCodeFormatter::expressionContinuation()
{ {
QList<Line> data; QList<Line> data;
data << Line("var x = 1 ? 2") data << Line("var x = 1 ? 2")
@@ -883,6 +883,6 @@ void tst_CodeFormatter::expressionContinuation()
} }
QTEST_APPLESS_MAIN(tst_CodeFormatter) QTEST_APPLESS_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc" #include "tst_qmlcodeformatter.moc"

View File

@@ -1,3 +1,2 @@
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS += qmllookup qmlcodeformatter
SUBDIRS += lookup codeformatter

View File

@@ -1,18 +1,13 @@
TEMPLATE = app TEMPLATE = app
CONFIG += qt warn_on console depend_includepath CONFIG += qt warn_on console depend_includepath qtestlib testcase
QT += testlib
include(../../../../../src/libs/qmljs/qmljs-lib.pri) include(../../../../../src/libs/qmljs/qmljs-lib.pri)
DEFINES += QML_BUILD_STATIC_LIB DEFINES += QML_BUILD_STATIC_LIB
EDITOR_DIR=../../../../../src/plugins/qmljseditor EDITOR_DIR=../../../../../src/plugins/qmljseditor
INCLUDEPATH += $$EDITOR_DIR INCLUDEPATH += $$EDITOR_DIR
TARGET=tst_$$TARGET SOURCES += tst_qmllookup.cpp
SOURCES += tst_lookup.cpp \
$$EDITOR_DIR/qmllookupcontext.cpp
HEADERS += $$EDITOR_DIR/qmllookupcontext.h
RESOURCES += testfiles.qrc RESOURCES += testfiles.qrc
OTHER_FILES += \ OTHER_FILES += \

View File

@@ -15,13 +15,13 @@ using namespace QmlJSEditor::Internal;
using namespace QmlJS; using namespace QmlJS;
using namespace QmlJS::AST; using namespace QmlJS::AST;
class tst_Lookup: public QObject class tst_QMLLookup: public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
tst_Lookup(): _typeSystem(0) {} tst_QMLLookup(): _typeSystem(0) {}
~tst_Lookup() { if (_typeSystem) resetTypeSystem(); } ~tst_QMLLookup() { if (_typeSystem) resetTypeSystem(); }
void resetTypeSystem() { if (_typeSystem) { delete _typeSystem; _typeSystem = 0; }} void resetTypeSystem() { if (_typeSystem) { delete _typeSystem; _typeSystem = 0; }}
@@ -72,7 +72,7 @@ private:
TypeSystem *_typeSystem; TypeSystem *_typeSystem;
}; };
void tst_Lookup::basicSymbolTest() void tst_QMLLookup::basicSymbolTest()
{ {
const QLatin1String input( const QLatin1String input(
"import Qt 4.6\n" "import Qt 4.6\n"
@@ -121,7 +121,7 @@ void tst_Lookup::basicSymbolTest()
QCOMPARE(xSymbol->name(), QLatin1String("x")); QCOMPARE(xSymbol->name(), QLatin1String("x"));
} }
void tst_Lookup::basicLookupTest() void tst_QMLLookup::basicLookupTest()
{ {
const QLatin1String input( const QLatin1String input(
"import Qt 4.6\n" "import Qt 4.6\n"
@@ -170,7 +170,7 @@ void tst_Lookup::basicLookupTest()
QVERIFY(fontPropFound); QVERIFY(fontPropFound);
} }
void tst_Lookup::localIdLookup() void tst_QMLLookup::localIdLookup()
{ {
QFile input(":/data/localIdLookup.qml"); QFile input(":/data/localIdLookup.qml");
QVERIFY(input.open(QIODevice::ReadOnly)); QVERIFY(input.open(QIODevice::ReadOnly));
@@ -208,7 +208,7 @@ void tst_Lookup::localIdLookup()
} }
} }
void tst_Lookup::localScriptMethodLookup() void tst_QMLLookup::localScriptMethodLookup()
{ {
QFile input(":/data/localScriptMethodLookup.qml"); QFile input(":/data/localScriptMethodLookup.qml");
QVERIFY(input.open(QIODevice::ReadOnly)); QVERIFY(input.open(QIODevice::ReadOnly));
@@ -246,7 +246,7 @@ void tst_Lookup::localScriptMethodLookup()
} }
} }
void tst_Lookup::localScopeLookup() void tst_QMLLookup::localScopeLookup()
{ {
QFile input(":/data/localScopeLookup.qml"); QFile input(":/data/localScopeLookup.qml");
QVERIFY(input.open(QIODevice::ReadOnly)); QVERIFY(input.open(QIODevice::ReadOnly));
@@ -284,7 +284,7 @@ void tst_Lookup::localScopeLookup()
} }
} }
void tst_Lookup::localRootLookup() void tst_QMLLookup::localRootLookup()
{ {
QFile input(":/data/localRootLookup.qml"); QFile input(":/data/localRootLookup.qml");
QVERIFY(input.open(QIODevice::ReadOnly)); QVERIFY(input.open(QIODevice::ReadOnly));
@@ -321,4 +321,4 @@ void tst_Lookup::localRootLookup()
} }
QTEST_APPLESS_MAIN(tst_Lookup) QTEST_APPLESS_MAIN(tst_Lookup)
#include "tst_lookup.moc" #include "tst_qmllookup.moc"