forked from qt-creator/qt-creator
Utils: Make errors from CommandLine test better readable
Change-Id: Ibea4bbe7c1f7e502849f0ef6985cbf107fc236f0 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -23,7 +23,10 @@ private slots:
|
|||||||
|
|
||||||
cmd.addCommandLineWithAnd(cmd2);
|
cmd.addCommandLineWithAnd(cmd2);
|
||||||
|
|
||||||
QCOMPARE(cmd.toUserOutput(), QString("echo foo && echo bar blizz"));
|
const QString actual = cmd.toUserOutput();
|
||||||
|
const QString wanted = "echo foo && echo bar blizz";
|
||||||
|
|
||||||
|
QCOMPARE(actual, wanted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testAndComplex()
|
void testAndComplex()
|
||||||
@@ -33,9 +36,12 @@ private slots:
|
|||||||
|
|
||||||
cmd.addCommandLineWithAnd(cmd2);
|
cmd.addCommandLineWithAnd(cmd2);
|
||||||
|
|
||||||
QCOMPARE(cmd.toUserOutput(),
|
const QString actual = cmd.toUserOutput();
|
||||||
QString("/tmp/space path/\"echo foo 'long with space' && '/tmp/space \"path/echo' "
|
const QString wanted =
|
||||||
"'bar\"' 'blizz is '\\''great'"));
|
"/tmp/space path/\"echo foo 'long with space' && '/tmp/space \"path/echo' "
|
||||||
|
"'bar\"' 'blizz is '\\''great'";
|
||||||
|
|
||||||
|
QCOMPARE(actual, wanted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testAndAdd()
|
void testAndAdd()
|
||||||
@@ -47,10 +53,13 @@ private slots:
|
|||||||
CommandLine shell("bash", {"-c"});
|
CommandLine shell("bash", {"-c"});
|
||||||
shell.addCommandLineAsSingleArg(cmd);
|
shell.addCommandLineAsSingleArg(cmd);
|
||||||
|
|
||||||
QCOMPARE(shell.toUserOutput(),
|
const QString actual = shell.toUserOutput();
|
||||||
|
const QString wanted =
|
||||||
"bash -c ''\\''/tmp/space path/\"echo'\\'' foo '\\''long with space'\\'' && "
|
"bash -c ''\\''/tmp/space path/\"echo'\\'' foo '\\''long with space'\\'' && "
|
||||||
"'\\''/tmp/space \"path/echo'\\'' '\\''bar\"'\\'' '\\''blizz is "
|
"'\\''/tmp/space \"path/echo'\\'' '\\''bar\"'\\'' '\\''blizz is "
|
||||||
"'\\''\\'\\'''\\''great'\\'''");
|
"'\\''\\'\\'''\\''great'\\'''";
|
||||||
|
|
||||||
|
QCOMPARE(actual, wanted);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user