public void MatchRegexTest() { AddressableImportRule rule = new AddressableImportRule(); rule.matchType = AddressableImportRuleMatchType.Regex; rule.path = @"Assets/Sprites/.*/.*\.png"; Assert.IsTrue(rule.Match("Assets/Sprites/cat/cat.png")); Assert.IsFalse(rule.Match("Assets/Sprites/cat/cat.jpg")); }
public void MatchWildcardTest() { AddressableImportRule rule = new AddressableImportRule(); rule.matchType = AddressableImportRuleMatchType.Wildcard; // Raw path rule.path = "Assets/Sprites/"; Assert.IsTrue(rule.Match("Assets/Sprites/cat/cat.png")); Assert.IsFalse(rule.Match("Assets/Fbx/cat/cat.fbx")); // '*' wildcard rule.path = "Assets/Sprites/*/*.png"; Assert.IsTrue(rule.Match("Assets/Sprites/cat/cat.png")); Assert.IsFalse(rule.Match("Assets/Sprites/cat/cat.jpg")); // '?' wildcard rule.path = "Assets/Sprites/*/???.png"; Assert.IsTrue(rule.Match("Assets/Sprites/cat/cat.png")); Assert.IsFalse(rule.Match("Assets/Sprites/cat/bird.png")); // rule.groupName = ""; // rule.LabelMode = LabelWriteMode.Add; // rule.simplified = true; // rule.addressReplacement = ""; }