【问题标题】:How to run leiningen tests having > (greater than) symbol in their name under Windows?如何在 Windows 下运行名称中包含 >(大于)符号的 leiningen 测试?
【发布时间】:2014-09-20 01:09:07
【问题描述】:

我不能引用名称中包含 -> 的测试,因为 > 符号被视为标准输出重定向。

在 PowerShell 4.0 下,我运行当前稳定的 Leiningen 2.4.2,参数被 --% 转义:

PS> lein test :only --% my-project.core/foo->bar

我在控制台中只看到 stderr,但作为副作用,我得到 bar 创建的文件,内容如下:

lein test user

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

【问题讨论】:

  • 我可以假设您尝试将命名空间作为字符串传递:“my-project.core/foo->bar”
  • @ArthurUlfeldt 是的,我做到了。我还尝试使用 ` 来逃避 >。不幸的是,结果是一样的。
  • 你试过用单引号代替双引号吗?
  • 尝试使用^"my-project.core/foo-^>bar" 转义>。 Lein 是通过 Windows 的 .bat 文件启动的?
  • @Entbark 是的,我也试过单引号。

标签: windows powershell clojure leiningen powershell-4.0


【解决方案1】:

问题出在lein.bat 文件中。当%* 扩展到第 303 行传递的所有参数时,我所有的转义都消失了。作为一个临时解决方案,我看到引用带有抑扬符 (^) 的特殊符号,然后引用所有抑扬符,这等于使用 ^^^ 使其工作:

PS> lein test :only my-project.core/foo-^^^>bar

看起来很难看,但确实有效。如果有更好的解决方案,我更喜欢那个。

【讨论】:

    猜你喜欢
    • 2011-12-09
    • 1970-01-01
    • 2015-01-10
    • 2015-10-26
    • 2020-05-12
    • 2019-07-06
    • 2014-02-13
    • 1970-01-01
    • 2021-12-24
    相关资源
    最近更新 更多