Skip to content

Debugging unit test in lib does not seem to work #3680

@ralfbiedert

Description

@ralfbiedert

Environment

  • Intellij-Rust plugin version: 0.2.96.2122-191
  • Rust toolchain version: 1.35.0-nightly (2a65cbeea 2019-03-08)
  • IDE name and version: CLion 2019.01
  • Operating system: macOS 10.14.4

Problem description

When I try to debug unit tests in a library project, CLion never seems to honor or stop at my break points. It seems unit tests run in debug mode behave as if run in default "run" mode.

Steps to reproduce

Cargo.toml:

[package]
name = "breakpoints"
version = "0.1.0"
edition = "2018"

[[bin]]
name = "my_bin"
path = "src/main.rs"

[lib]
name = "my_lib"
path = "src/lib.rs"

src/main.rs:

fn main() {
    println!("Hello world");
}

#[test]
fn test() {
    println!("Hello debug bin"); // a breakpoint here halts
}

src/lib.rs:

#[test]
fn test() {
    println!("Hello debug lib"); // a breakpoint here doesn't halt
}

Setting a breakpoint in main::test and running the debugger works.

Setting a breakpoint in lib::test and running the debugger simply ignores the breakpoint and executes the test as if running in regular mode.

Screen Shot 2019-04-10 at 20 19 49

(Image above is taken from actual library project, effect is the same: when I click "Debug Test ...", I just get the output as depicted on the debug console (1 of 1 test passed), but the breakpoint was never hit.)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions