@@ -127,31 +127,19 @@ pub struct Context {
127
127
}
128
128
129
129
struct State {
130
- /// An optional filter used to restrict which tests are actually executed
131
- /// and which are ignored. This is passed via the `args` function which
132
- /// comes from the command line of `wasm-bindgen-test-runner`. Currently
133
- /// this is the only "CLI option"
134
- filter : RefCell < Option < String > > ,
135
-
136
130
/// Include ignored tests.
137
131
include_ignored : Cell < bool > ,
138
132
139
- /// Include ignored tests.
133
+ /// Only run ignored tests.
140
134
ignored : Cell < bool > ,
141
135
142
- /// Only execute with exactly matching name.
143
- exact : Cell < bool > ,
144
-
145
- /// Tests to skip.
146
- skip : RefCell < Vec < String > > ,
147
-
148
136
/// Counter of the number of tests that have succeeded.
149
137
succeeded_count : Cell < usize > ,
150
138
151
- /// Counter of the number of tests that have been filtered
139
+ /// Number of tests that have been filtered.
152
140
filtered_count : Cell < usize > ,
153
141
154
- /// Counter of the number of tests that have been ignored
142
+ /// Number of tests that have been ignored.
155
143
ignored_count : Cell < usize > ,
156
144
157
145
/// A list of all tests which have failed.
@@ -353,17 +341,14 @@ impl Context {
353
341
354
342
Context {
355
343
state : Rc :: new ( State {
356
- filter : Default :: default ( ) ,
357
344
include_ignored : Default :: default ( ) ,
358
345
ignored : Default :: default ( ) ,
359
- exact : Default :: default ( ) ,
360
- skip : Default :: default ( ) ,
361
346
failures : Default :: default ( ) ,
347
+ succeeded_count : Default :: default ( ) ,
362
348
filtered_count : Default :: default ( ) ,
363
349
ignored_count : Default :: default ( ) ,
364
350
remaining : Default :: default ( ) ,
365
351
running : Default :: default ( ) ,
366
- succeeded_count : Default :: default ( ) ,
367
352
formatter,
368
353
timer,
369
354
} ) ,
@@ -380,19 +365,9 @@ impl Context {
380
365
self . state . ignored . set ( ignored) ;
381
366
}
382
367
383
- /// Handle `--exact` flag.
384
- pub fn exact ( & mut self , exact : bool ) {
385
- self . state . exact . set ( exact) ;
386
- }
387
-
388
- /// Handle `--skip` arguments.
389
- pub fn skip ( & mut self , skip : Vec < String > ) {
390
- * self . state . skip . borrow_mut ( ) = skip;
391
- }
392
-
393
368
/// Handle filter argument.
394
- pub fn filter ( & mut self , filter : Option < String > ) {
395
- * self . state . filter . borrow_mut ( ) = filter ;
369
+ pub fn filtered_count ( & mut self , filtered : usize ) {
370
+ self . state . filtered_count . set ( filtered ) ;
396
371
}
397
372
398
373
/// Executes a list of tests, returning a promise representing their
@@ -558,34 +533,9 @@ impl Context {
558
533
should_panic : Option < Option < & ' static str > > ,
559
534
ignore : Option < Option < & ' static str > > ,
560
535
) {
561
- // Split away
536
+ // Remove the crate name to mimic libtest more closely.
537
+ // This also removes our `__wbgt_` prefix and the `ignored` and `should_panic` modifiers.
562
538
let name = name. split_once ( "::" ) . unwrap ( ) . 1 ;
563
- // If our test is filtered out, record that it was filtered and move
564
- // on, nothing to do here.
565
- let filter = self . state . filter . borrow ( ) ;
566
- if let Some ( filter) = & * filter {
567
- let exact = self . state . exact . get ( ) ;
568
-
569
- let matches = if exact {
570
- name == filter
571
- } else {
572
- name. contains ( filter)
573
- } ;
574
-
575
- if !matches {
576
- let filtered = self . state . filtered_count . get ( ) ;
577
- self . state . filtered_count . set ( filtered + 1 ) ;
578
- return ;
579
- }
580
- }
581
-
582
- for skip in & * self . state . skip . borrow ( ) {
583
- if name. contains ( skip) {
584
- let filtered = self . state . filtered_count . get ( ) ;
585
- self . state . filtered_count . set ( filtered + 1 ) ;
586
- return ;
587
- }
588
- }
589
539
590
540
if self . state . ignored . get ( ) && ignore. is_none ( ) {
591
541
let filtered = self . state . filtered_count . get ( ) ;
0 commit comments