summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-11-29 14:37:36 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2011-11-30 10:11:28 +0100
commita24c49720a0068826ad1c2d160cf644efabfa20b (patch)
treee8511e31bc5f7ae76d198cb3a63a6cf979aed8a9 /tests
parent9056dc384aaab2802bfa61c8c03599b65be23547 (diff)
downloadqt-creator-a24c49720a0068826ad1c2d160cf644efabfa20b.tar.gz
QmlJS reformatter: Fix object literals.
The comma token seems to be invalid. Change-Id: I859fa58ba0ba1e975e0cf1105c2b53aac848fb0d Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/reformatter/jssyntax.js3
-rw-r--r--tests/auto/qml/reformatter/objectliteral.js12
-rw-r--r--tests/auto/qml/reformatter/tst_reformatter.cpp2
3 files changed, 14 insertions, 3 deletions
diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js
index 17be1401c9..5ef1a2adcd 100644
--- a/tests/auto/qml/reformatter/jssyntax.js
+++ b/tests/auto/qml/reformatter/jssyntax.js
@@ -6,8 +6,7 @@ function foo(a, b) {
x += 4
}
-var foo =
- function (a, b) {}
+var foo = function (a, b) {}
while (true) {
for (var a = 1; a < 5; ++a) {
diff --git a/tests/auto/qml/reformatter/objectliteral.js b/tests/auto/qml/reformatter/objectliteral.js
new file mode 100644
index 0000000000..478d550573
--- /dev/null
+++ b/tests/auto/qml/reformatter/objectliteral.js
@@ -0,0 +1,12 @@
+var x = {
+ x: 12,
+ y: {
+ x: 12,
+ y: "abc",
+ z: function (x) {
+ return a
+ },
+ abc: 15
+ },
+ z: 12
+}
diff --git a/tests/auto/qml/reformatter/tst_reformatter.cpp b/tests/auto/qml/reformatter/tst_reformatter.cpp
index 91fba3d106..6422995cde 100644
--- a/tests/auto/qml/reformatter/tst_reformatter.cpp
+++ b/tests/auto/qml/reformatter/tst_reformatter.cpp
@@ -81,7 +81,7 @@ void tst_Reformatter::test()
{
QFETCH(QString, path);
- Document::Ptr doc = Document::create(path, Document::guessLanguageFromSuffix(path));
+ Document::MutablePtr doc = Document::create(path, Document::guessLanguageFromSuffix(path));
QFile file(doc->fileName());
file.open(QFile::ReadOnly | QFile::Text);
QString source = QString::fromUtf8(file.readAll());