@return Boolean: true if this test should be ran
( test )
| 883 | |
| 884 | /** @return Boolean: true if this test should be ran */ |
| 885 | function validTest( test ) { |
| 886 | var include, |
| 887 | filter = config.filter && config.filter.toLowerCase(), |
| 888 | module = config.module && config.module.toLowerCase(), |
| 889 | fullName = ( test.module + ": " + test.testName ).toLowerCase(); |
| 890 | |
| 891 | // Internally-generated tests are always valid |
| 892 | if ( test.callback && test.callback.validTest === validTest ) { |
| 893 | delete test.callback.validTest; |
| 894 | return true; |
| 895 | } |
| 896 | |
| 897 | if ( config.testNumber.length > 0 ) { |
| 898 | if ( inArray( test.testNumber, config.testNumber ) < 0 ) { |
| 899 | return false; |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { |
| 904 | return false; |
| 905 | } |
| 906 | |
| 907 | if ( !filter ) { |
| 908 | return true; |
| 909 | } |
| 910 | |
| 911 | include = filter.charAt( 0 ) !== "!"; |
| 912 | if ( !include ) { |
| 913 | filter = filter.slice( 1 ); |
| 914 | } |
| 915 | |
| 916 | // If the filter matches, we need to honour include |
| 917 | if ( fullName.indexOf( filter ) !== -1 ) { |
| 918 | return include; |
| 919 | } |
| 920 | |
| 921 | // Otherwise, do the opposite |
| 922 | return !include; |
| 923 | } |
| 924 | |
| 925 | // so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) |
| 926 | // Later Safari and IE10 are supposed to support error.stack as well |