dounuogong0358
2013-04-04 19:22
浏览 62
已采纳

在哪里可以找到多种语言的正则表达式的单元测试?

I'm building a regex helper at http://www.debuggex.com. The amount of detail I want to show requires me to write my own parser and matcher.

To make sure my parser and matcher work correctly, I've written my own unit tests for the Javascript flavor of regexes, but these only cover edge cases I know about. I would like to use a standard test suite, and was recently pointed to http://hg.ecmascript.org/tests/test262/summary, which I will be using.

My question is, where can I find such test suites for other regex flavors? I'd like to support other flavors in the future. I have not been able to find anything by googling ("test" pollutes the results with regex testers). I am looking for test suites for the languages python, php, perl, java, ruby, and .net.

图片转代码服务由CSDN问答提供 功能建议

我正在构建一个正则表达式助手 http://www.debuggex.com 。 我想要显示的细节数量要求我编写自己的解析器和匹配器。

为了确保我的解析器和匹配器正常工作,我已经为Javascript编写了自己的单元测试 正则表达的味道,但这些只涵盖我所知道的边缘情况。 我想使用标准测试套件,最近指向 http://hg.ecmascript.org/tests/test262 / summary ,我将使用它。

我的问题是,我在哪里可以找到其他正则表达式的测试套件? 我想在将来支持其他口味。 我无法通过谷歌搜索找到任何东西(“测试”用正则表达式测试员污染结果)。 我正在寻找语言 python php perl java ruby​​ <的测试套件 / strong>,和 .net

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dqdfpmmi022763 2013-04-04 23:30
    已采纳

    Most of those languages are open source. Any decent project should have their test cases in said repo, otherwise I would be pretty concerned.

    • Python's regex tests
    • PHP's regex tests
    • Perl's regex tests looks really extensive
    • Open JDK's unit tests (an open source flavour of Java)
    • Ruby's regex tests
    • Mono's regex tests (open source version of .NET)
    • RE2's tests (C++ regex engine developed at Google)
    • C test suite (developed by AT&T Research)
    • PCRE regex tests (Perl Compatible Regular Expressions C library)
    • JavaScript regex tests (Ecma Technical Committee 39 compatability suite)

    I also found an extensive chart on this page which might be of some help to you.

    打赏 评论
  • dreamworld2007 2013-04-05 18:13

    To have a complete list on one page, I've found the ones omitted from the accepted answer:

    • Mono's regex tests (it's an open source version of .net)
    • PHP's regex tests
    打赏 评论
  • drrog9853 2015-10-31 08:37

    Additional regex test suites for additional languages:

    Bonus

    • Regfuzz (C toolkit for testing regular expression robustness using randomly generated and invalid regexes)
    打赏 评论

相关推荐 更多相似问题