Test case details

Preparation Code

<script> var str = 'inline-block'; var arr = ['inline', 'inline-block', 'inline-table', 'ruby']; var obj = {'inline': true, 'inline-block': true, 'inline-table': true, 'ruby': true}; </script>
var precompiledRegex = /(inline|ruby)/;

Test cases

Test #1

/(inline|ruby)/.test(str);

Test #2

str.search(/(inline|ruby)/) > -1;

Test #3

str.match(/(inline|ruby)/).length > 0;

Test #4

str.indexOf(/(inline|ruby)/) > -1;

Test #5

precompiledRegex.test(str);

Test #6

str.search(precompiledRegex) > -1;

Test #7

str.match(precompiledRegex).length > 0;

Test #8

str.indexOf(precompiledRegex) > -1;

Test #9

str.indexOf('inline') > -1 || str.indexOf('ruby') > -1;

Test #10

str === "inline" || str === "inline-block" || str === "inline-table" || str === "ruby";

Test #11

arr.indexOf(str) > -1;

Test #12

obj[str] === true;