diff options
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index 31de4068bc5..d885051b93b 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -110,6 +110,8 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do it { is_expected.to match('.source/.full/.path') } it { is_expected.to match('domain_namespace') } it { is_expected.to match('gitlab-migration-test') } + it { is_expected.to match('1-project-path') } + it { is_expected.to match('e-project-path') } it { is_expected.to match('') } # it is possible to pass an empty string for destination_namespace in bulk_import POST request end @@ -710,6 +712,7 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do it { is_expected.to match('libsample0_1.2.3~alpha2_amd64.deb') } it { is_expected.to match('sample-dev_1.2.3~binary_amd64.deb') } it { is_expected.to match('sample-udeb_1.2.3~alpha2_amd64.udeb') } + it { is_expected.to match('sample-ddeb_1.2.3~alpha2_amd64.ddeb') } it { is_expected.not_to match('sample_1.2.3~alpha2_amd64.buildinfo') } it { is_expected.not_to match('sample_1.2.3~alpha2_amd64.changes') } @@ -1015,6 +1018,34 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do it { is_expected.not_to match('/api/v4/groups/1234/packages/debian/pool/compon/a/pkg/file.name') } end + describe 'Packages::MAVEN_SNAPSHOT_DYNAMIC_PARTS' do + subject { described_class::Packages::MAVEN_SNAPSHOT_DYNAMIC_PARTS } + + it { is_expected.to match('test-2.11-20230303.163304-1.jar') } + it { is_expected.to match('test-2.11-20230303.163304-1-javadoc.jar') } + it { is_expected.to match('test-2.11-20230303.163304-1-sources.jar') } + it { is_expected.to match('test-2.11-20230303.163304-1-20230303.163304-1.jar') } + it { is_expected.to match('test-2.11-20230303.163304-1-20230303.163304-1-javadoc.jar') } + it { is_expected.to match('test-2.11-20230303.163304-1-20230303.163304-1-sources.jar') } + it { is_expected.to match("#{'a' * 500}-20230303.163304-1-sources.jar") } + it { is_expected.to match("test-2.11-20230303.163304-1-#{'a' * 500}.jar") } + it { is_expected.to match("#{'a' * 500}-20230303.163304-1-#{'a' * 500}.jar") } + + it { is_expected.not_to match('') } + it { is_expected.not_to match(nil) } + it { is_expected.not_to match('test') } + it { is_expected.not_to match('1.2.3') } + it { is_expected.not_to match('1.2.3-javadoc.jar') } + it { is_expected.not_to match('-202303039.163304-1.jar') } + it { is_expected.not_to match('test-2.11-202303039.163304-1.jar') } + it { is_expected.not_to match('test-2.11-20230303.16330-1.jar') } + it { is_expected.not_to match('test-2.11-202303039.163304.jar') } + it { is_expected.not_to match('test-2.11-202303039.163304-.jar') } + it { is_expected.not_to match("#{'a' * 2000}-20230303.163304-1-sources.jar") } + it { is_expected.not_to match("test-2.11-20230303.163304-1-#{'a' * 2000}.jar") } + it { is_expected.not_to match("#{'a' * 2000}-20230303.163304-1-#{'a' * 2000}.jar") } + end + describe '.composer_package_version_regex' do subject { described_class.composer_package_version_regex } |