File tree 3 files changed +46
-1
lines changed
3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // ignore-order
12
+
13
+ const QUERY = 'fn' ;
14
+
15
+ const EXPECTED = {
16
+ 'others' : [
17
+ { 'path' : 'std' , 'name' : 'fn' , ty : 15 } , // 15 is for primitive types
18
+ { 'path' : 'std' , 'name' : 'fn' , ty : 21 } , // 21 is for keywords
19
+ ] ,
20
+ } ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // should-fail
12
+
13
+ const QUERY = 'fn' ;
14
+
15
+ const EXPECTED = {
16
+ 'others' : [
17
+ { 'path' : 'std' , 'name' : 'fn' , ty : 14 } ,
18
+ ] ,
19
+ } ;
Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ function loadContent(content) {
164
164
m . _compile ( content , "tmp.js" ) ;
165
165
m . exports . ignore_order = content . indexOf ( "\n// ignore-order\n" ) !== - 1 ;
166
166
m . exports . exact_check = content . indexOf ( "\n// exact-check\n" ) !== - 1 ;
167
+ m . exports . should_fail = content . indexOf ( "\n// should-fail\n" ) !== - 1 ;
167
168
return m . exports ;
168
169
}
169
170
@@ -259,6 +260,7 @@ function main(argv) {
259
260
const query = loadedFile . QUERY ;
260
261
const ignore_order = loadedFile . ignore_order ;
261
262
const exact_check = loadedFile . exact_check ;
263
+ const should_fail = loadedFile . should_fail ;
262
264
var results = loaded . execSearch ( loaded . getQuery ( query ) , index ) ;
263
265
process . stdout . write ( 'Checking "' + file + '" ... ' ) ;
264
266
var error_text = [ ] ;
@@ -289,7 +291,11 @@ function main(argv) {
289
291
}
290
292
}
291
293
}
292
- if ( error_text . length !== 0 ) {
294
+ if ( error_text . length === 0 && should_fail === true ) {
295
+ errors += 1 ;
296
+ console . error ( "FAILED" ) ;
297
+ console . error ( "==> Test was supposed to fail but all items were found..." ) ;
298
+ } else if ( error_text . length !== 0 && should_fail === false ) {
293
299
errors += 1 ;
294
300
console . error ( "FAILED" ) ;
295
301
console . error ( error_text . join ( "\n" ) ) ;
You can’t perform that action at this time.
0 commit comments