File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed
main/scala/scaladex/data/cleanup
test/scala/scaladex/data/cleanup Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ object ScmInfoParser extends Parsers:
2020 else v
2121
2222 private def ScmUrl [A : P ] = P (
23- " scm:" .? ~ " git:" .? ~ (" git@" | " https://" | " git://" | " //" ) ~
23+ " scm:" .? ~ " git:" .? ~ (" git@" | " https://" | " git://" | ( " ssh:// " ~ " git@ " . ? ) | " //" ) ~
2424 " github.com" ~ (" :" | " /" ) ~ Segment
2525 .rep(1 )
2626 .! ~ " /" ~ Segment .rep(1 ).! .map(removeDotGit)
Original file line number Diff line number Diff line change 1+ package scaladex .data
2+ package cleanup
3+
4+ import org .scalatest .funspec .AnyFunSpec
5+ import org .scalatest .matchers .should .Matchers
6+
7+ class ScmInfoParserTests extends AnyFunSpec with Matchers :
8+ describe(" ScmInfoParse" ) {
9+ it(" correctly parse valid SCM strings" ) {
10+ // Implicit protocol
11+ ScmInfoParser
12+ .parse(
" scm:git:[email protected] :foobarbuz/example.git" )
13+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
14+ // HTTPS
15+ ScmInfoParser
16+ .parse(" scm:https://github.com/foobarbuz/example.git" )
17+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
18+ ScmInfoParser
19+ .parse(" scm:https://github.com/foobarbuz/example" )
20+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
21+ // Git
22+ ScmInfoParser
23+ .parse(" scm:git:git://github.com:foobarbuz/example.git" )
24+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
25+ ScmInfoParser
26+ .parse(" scm:git://github.com:foobarbuz/example.git" )
27+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
28+ // SSH
29+ ScmInfoParser
30+ .parse(
" scm:git:ssh://[email protected] :foobarbuz/example.git" )
31+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
32+ ScmInfoParser
33+ .parse(" scm:git:ssh://github.com:foobarbuz/example.git" )
34+ .map(_.toString) shouldBe Some (" foobarbuz/example" )
35+ // Unknown protocol
36+ ScmInfoParser
37+ .parse(
" scm:git:unknown://[email protected] :foobarbuz/example.git" )
38+ .map(_.toString) shouldBe None
39+ ScmInfoParser
40+ .parse(" scm:git:unknown://github.com:foobarbuz/example.git" )
41+ .map(_.toString) shouldBe None
42+ }
43+ }
44+ end ScmInfoParserTests
You can’t perform that action at this time.
0 commit comments