denzyldick / phanalist

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code.
https://denzyldick.github.io/phanalist/
MIT License
131 stars 5 forks source link

feat: Added unit tests #26

Closed SerheyDolgushev closed 9 months ago

SerheyDolgushev commented 9 months ago

We should cover all the rules with similar tests to rules::e1::tests:

% cargo test                                                                   
    Finished test [unoptimized + debuginfo] target(s) in 0.34s
     Running unittests src/main.rs (target/debug/deps/phanalist-c1fb44641648e901)

running 15 tests
test results::tests::test_has_any_violations_expected_false ... ok
test analyse::tests::test_filter_active_codes_some_disabled ... ok
test analyse::tests::test_filter_active_codes_some_enabled ... ok
test analyse::tests::test_filter_active_codes_all_enabled ... ok
test analyse::tests::test_filter_active_codes_some_enabled_and_disabled ... ok
test rules::e9::calculate ... ok
test results::tests::test_add_file_violations_expected_codes_count ... ok
test results::tests::test_has_any_violations_expected_true ... ok
test results::tests::test_add_file_violations_expected_file_violations ... ok
test rules::e1::tests::test_full_opening_tag_not_first_column ... ok
test rules::e1::tests::short_full_opening_tag_not_first_column ... ok
test rules::e1::tests::full_opening_tag_valid ... ok
test rules::e1::tests::short_opening_tag_not_first_line ... ok
test rules::e1::tests::full_opening_tag_not_first_line ... ok
test rules::e1::tests::short_opening_tag_valid ... ok

test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s