Skip to content

testing: measure coverage inside boolean expressions #8741

@josharian

Description

@josharian
Test coverage works on basic blocks. It could be extended to short-circuiting boolean
expressions like f() && g().

Approach:

func GoCoverBool(ret bool, n int) bool {
  GoCover.Count[n] = 1
  return ret
}

Rewrite f() && g() to f() && GoCoverBool(true, 5) && g() and f()
|| g() to f() || GoCoverBool(false, 5) || g().

I don't know what adjustments to the downstream tools this might require.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions