当前位置: 首页>>代码示例>>C++>>正文


C++ Suppressions::isSuppressed方法代码示例

本文整理汇总了C++中Suppressions::isSuppressed方法的典型用法代码示例。如果您正苦于以下问题:C++ Suppressions::isSuppressed方法的具体用法?C++ Suppressions::isSuppressed怎么用?C++ Suppressions::isSuppressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Suppressions的用法示例。


在下文中一共展示了Suppressions::isSuppressed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: suppressionsFileNameWithColon

 void suppressionsFileNameWithColon() const {
     Suppressions suppressions;
     std::istringstream s("errorid:c:\\foo.cpp\nerrorid:c:\\bar.cpp:12");
     ASSERT_EQUALS("", suppressions.parseFile(s));
     ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "c:/foo.cpp", 1111));
     ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "c:/bar.cpp", 10));
     ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "c:/bar.cpp", 12));
 }
开发者ID:Nicobubu,项目名称:cppcheck,代码行数:8,代码来源:testsuppressions.cpp

示例2: suppressionsPathSeparator

    void suppressionsPathSeparator() const {
        Suppressions suppressions;
        suppressions.addSuppressionLine("*:test\\*");
        ASSERT_EQUALS(true, suppressions.isSuppressed("someid", "test/foo/bar.cpp", 142));

        suppressions.addSuppressionLine("abc:include/1.h");
        ASSERT_EQUALS(true, suppressions.isSuppressed("abc", "include\\1.h", 142));
    }
开发者ID:Nicobubu,项目名称:cppcheck,代码行数:8,代码来源:testsuppressions.cpp

示例3: suppressionsGlob

    void suppressionsGlob() const {
        // Check for syntax errors in glob
        {
            Suppressions suppressions;
            std::istringstream s("errorid:**.cpp\n");
            ASSERT_EQUALS("Failed to add suppression. Syntax error in glob.", suppressions.parseFile(s));
        }

        // Check that globbing works
        {
            Suppressions suppressions;
            std::istringstream s("errorid:x*.cpp\nerrorid:y?.cpp\nerrorid:test.c*");
            ASSERT_EQUALS("", suppressions.parseFile(s));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 1));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp.cpp", 1));
            ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "abc.cpp", 1));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "ya.cpp", 1));
            ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "y.cpp", 1));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "test.c", 1));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "test.cpp", 1));
        }

        // Check that both a filename match and a glob match apply
        {
            Suppressions suppressions;
            std::istringstream s("errorid:x*.cpp\nerrorid:xyz.cpp:1\nerrorid:a*.cpp:1\nerrorid:abc.cpp:2");
            ASSERT_EQUALS("", suppressions.parseFile(s));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 1));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 2));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 1));
            ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 2));
        }
    }
开发者ID:Nicobubu,项目名称:cppcheck,代码行数:33,代码来源:testsuppressions.cpp

示例4: suppressionsDosFormat

 void suppressionsDosFormat() const {
     Suppressions suppressions;
     std::istringstream s("abc\r\ndef\r\n");
     ASSERT_EQUALS("", suppressions.parseFile(s));
     ASSERT_EQUALS(true, suppressions.isSuppressed("abc", "test.cpp", 1));
     ASSERT_EQUALS(true, suppressions.isSuppressed("def", "test.cpp", 1));
 }
开发者ID:Nicobubu,项目名称:cppcheck,代码行数:7,代码来源:testsuppressions.cpp

示例5: suppressionsFileNameWithExtraPath

 void suppressionsFileNameWithExtraPath() const {
     // Ticket #2797
     Suppressions suppressions;
     suppressions.addSuppression("errorid", "./a.c", 123);
     ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "a.c", 123));
 }
开发者ID:Nicobubu,项目名称:cppcheck,代码行数:6,代码来源:testsuppressions.cpp


注:本文中的Suppressions::isSuppressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。