【问题标题】:Programatically set breakpoint for ruby-debug-ide (RubyMine)以编程方式为 ruby​​-debug-ide (RubyMine) 设置断点
【发布时间】:2014-11-14 09:39:29
【问题描述】:

是否可以以编程方式设置断点...即...启动 RubyMine 使用的调试器 ruby​​-debug-ide?​​p>

我的目标是在测试失败时以某种方式自动启动它。

【问题讨论】:

    标签: ruby debugging rubymine ruby-debug-ide


    【解决方案1】:

    当您的问题突然出现时,我正在寻找与此相关的内容。所以你想要做的是在某些(或任何)测试失败时中断?为此,您可以使用 debugger 命令。

    只需将 begin...rescue 块添加到您的测试中,如下所示

    begin
      test 'todo' do
        result = todo
        assert_equal 25, result
      end
    rescue Minitest::Assertion => e
      debugger
    

    如果您不使用 Minitest,请将 Minitest::Assertion 替换为适当的,例如 Test::Unit::AssertionFailedError for Test::Unit .

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 1970-01-01
      • 2013-04-07
      相关资源
      最近更新 更多