@@ -379,3 +379,25 @@ TEST_F(PluginManagerTest, UnRegisterSystemRuntimePluginChangesOrder) {
379379 ASSERT_EQ (PluginManager::GetSystemRuntimeCreateCallbackAtIndex (2 ),
380380 CreateSystemRuntimePluginB);
381381}
382+
383+ TEST_F (PluginManagerTest, MatchPluginName) {
384+ PluginNamespace Foo{" foo" , nullptr , nullptr };
385+ RegisteredPluginInfo Bar{" bar" , " bar plugin " , true };
386+ RegisteredPluginInfo Baz{" baz" , " baz plugin " , true };
387+
388+ // Empty pattern matches everything.
389+ ASSERT_TRUE (PluginManager::MatchPluginName (" " , Foo, Bar));
390+
391+ // Plugin namespace matches all plugins in that namespace.
392+ ASSERT_TRUE (PluginManager::MatchPluginName (" foo" , Foo, Bar));
393+ ASSERT_TRUE (PluginManager::MatchPluginName (" foo" , Foo, Baz));
394+
395+ // Fully qualified plugin name matches only that plugin.
396+ ASSERT_TRUE (PluginManager::MatchPluginName (" foo.bar" , Foo, Bar));
397+ ASSERT_FALSE (PluginManager::MatchPluginName (" foo.baz" , Foo, Bar));
398+
399+ // Prefix match should not match.
400+ ASSERT_FALSE (PluginManager::MatchPluginName (" f" , Foo, Bar));
401+ ASSERT_FALSE (PluginManager::MatchPluginName (" foo." , Foo, Bar));
402+ ASSERT_FALSE (PluginManager::MatchPluginName (" foo.ba" , Foo, Bar));
403+ }
0 commit comments