Completed
Pull Request — master (#1431)
by Abdeali
01:31
created

bears.tests.js.JSHintBearTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %
Metric Value
dl 0
loc 35
rs 10
wmc 2
1
from bears.js.JSHintBear import JSHintBear
2
from bears.tests.LocalBearTestHelper import verify_local_bear
3
from coalib.misc.ContextManagers import prepare_file
4
5
test_file1 = """
6
var name = (function() { return 'Anton' }());
7
""".split("\n")
8
9
10
test_file2 = """
11
function () {
12
}()
13
""".split("\n")
14
15
16
config_file = """
17
{
18
  "lastsemic": true,
19
  "maxlen": 80
20
}
21
""".split("\n")
22
23
24
JSHintBear1Test = verify_local_bear(JSHintBear,
25
                                    valid_files=(),
26
                                    invalid_files=(test_file1, test_file2))
27
28
29
with prepare_file(config_file,
30
                  filename=None,
31
                  force_linebreaks=True,
32
                  create_tempfile=True) as (conf_lines, conf_file):
33
    JSHintBear2Test = verify_local_bear(JSHintBear,
34
                                        valid_files=(test_file1),
35
                                        invalid_files=(),
36
                                        settings={"jshint_config": conf_file})
37