aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
blob: 64108c6cc82e07eb129ec1d833ca87ca85eac8d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! ref: composer/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php

use std::cell::RefCell;
use std::rc::Rc;

use shirabe::config::Config;
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::repository::vcs::SvnDriver;

fn support_provider() -> Vec<(&'static str, bool)> {
    vec![
        ("http://svn.apache.org", true),
        ("https://svn.sf.net", true),
        ("svn://example.org", true),
        ("svn+ssh://example.org", true),
    ]
}

#[test]
fn test_support() {
    for (url, assertion) in support_provider() {
        let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
        let config = Rc::new(RefCell::new(Config::new(true, None)));

        assert_eq!(assertion, SvnDriver::supports(io, config, url, false).unwrap());
    }
}

// Constructs an SvnDriver and runs an svn command via a mocked ProcessExecutor; mocking is
// not available here.
#[test]
#[ignore = "constructs an SvnDriver and mocks a ProcessExecutor for the svn invocation"]
fn test_wrong_credentials_in_url() {
    todo!()
}