-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathis_ssh_url_test.dart
47 lines (41 loc) · 1.42 KB
/
is_ssh_url_test.dart
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
37
38
39
40
41
42
43
44
45
46
47
import 'package:test/test.dart';
import 'package:dart_git/git_url_parse.dart';
var INPUT = {
// Secure Shell Transport Protocol (SSH)
'ssh://user@host.xz:port/path/to/repo.git/': true,
'ssh://user@host.xz/path/to/repo.git/': true,
'ssh://host.xz:port/path/to/repo.git/': true,
'ssh://host.xz/path/to/repo.git/': true,
'ssh://user@host.xz/~user/path/to/repo.git/': true,
'ssh://host.xz/~user/path/to/repo.git/': true,
'ssh://user@host.xz/~/path/to/repo.git': true,
'ssh://host.xz/~/path/to/repo.git': true,
'user@host.xz:/path/to/repo.git/': true,
'user@host.xz:~user/path/to/repo.git/': true,
'user@host.xz:path/to/repo.git': true,
'host.xz:/path/to/repo.git/': true,
'host.xz:path/to/repo.git': true,
'host.xz:~user/path/to/repo.git/': true,
'rsync://host.xz/path/to/repo.git/': true,
// Git Transport Protocol
'git://host.xz/path/to/repo.git/': false,
'git://host.xz/~user/path/to/repo.git/': false,
// HTTP/S Transport Protocol
'http://host.xz/path/to/repo.git/': false,
'https://host.xz/path/to/repo.git/': false,
// Local (Filesystem) Transport Protocol
'/path/to/repo.git/': false,
'path/to/repo.git/': false,
'~/path/to/repo.git': false,
'file:///path/to/repo.git/': false,
'file://~/path/to/repo.git/': false,
};
void main() {
group('all', () {
INPUT.forEach((String url, bool result) {
test(url, () {
expect(isSshUrl(url), result);
});
});
});
}