about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-06-15 23:39:20 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2018-06-16 00:13:28 +0200
commit1fcce48451b5d4484d29ddf0641d2228ba78fdbd (patch)
tree5e70b31cd72b23c95dca20efa5194889c8ad8daf /src/tools
parente28502edcadbf9ab6102493e8774f1af32df4eb9 (diff)
downloadrust-1fcce48451b5d4484d29ddf0641d2228ba78fdbd.tar.gz
rust-1fcce48451b5d4484d29ddf0641d2228ba78fdbd.zip
Add rustdoc-js tester should-fail option
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/rustdoc-js/tester.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js
index a05c8a8ac91..3c1fceaf8fa 100644
--- a/src/tools/rustdoc-js/tester.js
+++ b/src/tools/rustdoc-js/tester.js
@@ -164,6 +164,7 @@ function loadContent(content) {
     m._compile(content, "tmp.js");
     m.exports.ignore_order = content.indexOf("\n// ignore-order\n") !== -1;
     m.exports.exact_check = content.indexOf("\n// exact-check\n") !== -1;
+    m.exports.should_fail = content.indexOf("\n// should-fail\n") !== -1;
     return m.exports;
 }
 
@@ -259,6 +260,7 @@ function main(argv) {
         const query = loadedFile.QUERY;
         const ignore_order = loadedFile.ignore_order;
         const exact_check = loadedFile.exact_check;
+        const should_fail = loadedFile.should_fail;
         var results = loaded.execSearch(loaded.getQuery(query), index);
         process.stdout.write('Checking "' + file + '" ... ');
         var error_text = [];
@@ -289,7 +291,11 @@ function main(argv) {
                 }
             }
         }
-        if (error_text.length !== 0) {
+        if (error_text.length === 0 && should_fail === true) {
+            errors += 1;
+            console.error("FAILED");
+            console.error("==> Test was supposed to fail but all items were found...");
+        } else if (error_text.length !== 0 && should_fail === false) {
             errors += 1;
             console.error("FAILED");
             console.error(error_text.join("\n"));