Sha256: 75849c0b6138876a916dbf4528b2ed0d11a90c7527cc91ca3bffd69f886262d0
Contents?: true
Size: 1.48 KB
Versions: 35
Compression:
Stored size: 1.48 KB
Contents
require 'test_helper' require 'wovnrb/services/glob' module Wovnrb class GlobTest < WovnMiniTest def test_match assert_equal(false, Glob.new('api/*').match?('api')) assert_equal(true, Glob.new('api/*').match?('api/')) assert_equal(true, Glob.new('api/*').match?('api/a')) assert_equal(false, Glob.new('api/*').match?('api/a/b')) assert_equal(true, Glob.new('api/*.html').match?('api/a.html')) assert_equal(false, Glob.new('api/*.html').match?('api/a/b.html')) end def test_match_2_star assert_equal(false, Glob.new('api/**/*').match?('api')) assert_equal(true, Glob.new('api/**/*').match?('api/')) assert_equal(true, Glob.new('api/**/*').match?('api/a')) assert_equal(true, Glob.new('api/**/*').match?('api/a/b')) assert_equal(true, Glob.new('api/**/*.html').match?('api/a.html')) assert_equal(true, Glob.new('api/**/*.html').match?('api/a/b.html')) assert_equal(false, Glob.new('api/**/*.html').match?('api/a/b')) assert_equal(true, Glob.new('api/**').match?('api/a')) assert_equal(true, Glob.new('api/**').match?('api/a/b.html')) end def test_match_regex_injection assert_equal(false, Glob.new('api/a?*').match?('api/a')) assert_equal(true, Glob.new('api/a?*').match?('api/a?')) assert_equal(true, Glob.new('api/a?*').match?('api/a?b')) assert_equal(false, Glob.new('api/**?').match?('api/a')) assert_equal(true, Glob.new('api/**?').match?('api/?')) end end end
Version data entries
35 entries across 35 versions & 1 rubygems