aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2012-01-17 12:37:07 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-24 14:11:52 +0100
commitb514fecbeae6a4fed9e593ea6405dbeec7fe7883 (patch)
tree05c6dd3f6407a715f6ad482eac9f54a2bcc2b507 /doc
parent47a5c708bf4e555cb8febef583f32c99f7d8ea1e (diff)
Console API: Add console.assert
console.assert tests if an expression is true. If it is false, it writes a message to the console and prints the JavaScript stack trace at that point. Change-Id: I5487552cb8a947e1947914166834e0bdedba3354 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/qdeclarativedebugging.qdoc13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc
index c59952dafc..49fe224a8c 100644
--- a/doc/src/declarative/qdeclarativedebugging.qdoc
+++ b/doc/src/declarative/qdeclarativedebugging.qdoc
@@ -49,6 +49,19 @@ The output is generated using the qDebug, qWarning, qCritical methods in C++
\hint Setting the environment variable QML_CONSOLE_EXTENDED also prints the source
code location of the call.
+\section2 Assert
+
+\c console.assert tests that an expression is true. If not, it will write an optional message
+to the console and print the stack trace.
+
+\qml
+function f() {
+ var x = 12
+ console.assert(x == 12, "This will pass");
+ console.assert(x > 12, "This will fail");
+}
+\endqml
+
\section2 Timer
\c console.time and console.timeEnd log the time (in milliseconds) that was spent between