Juggernaut.Mutant (Juggernaut v0.4.0)

Copy Markdown View Source

One replacement at one site (design notes §6, §14.1).

key is the canonical key (the cache and triage key); id is the short id shown everywhere. switch is run-local: the integer that turns this mutant on in its compiled metamutant, nil until schemata are built. location positions are {line, column}, 1-based, in the original source. diff is a unified diff of the original file text.

Summary

Functions

The line the mutant starts on.

Module.fun/arity of the function the mutant is in, without the Elixir. prefix.

The positions a site can be in.

Types

ignore()

@type ignore() :: %{
  prefix: String.t(),
  scope: :line | :region | :file,
  filter: [String.t()],
  reason: String.t(),
  line: pos_integer()
}

location()

@type location() :: %{
  start: {pos_integer(), pos_integer()},
  end: {pos_integer(), pos_integer()}
}

position()

@type position() :: :runtime | :pattern | :guard

t()

@type t() :: %Juggernaut.Mutant{
  category: atom(),
  clause: non_neg_integer(),
  core?: boolean(),
  diff: String.t(),
  file: String.t(),
  function: {atom(), arity()},
  id: String.t(),
  ignore: ignore() | nil,
  key: String.t(),
  location: location(),
  module: module(),
  operator: atom(),
  original: String.t(),
  path: [non_neg_integer()],
  position: position(),
  replacement: String.t(),
  switch: pos_integer() | nil,
  variant: String.t() | nil
}

Functions

line(mutant)

@spec line(t()) :: pos_integer()

The line the mutant starts on.

mfa(mutant)

@spec mfa(t()) :: String.t()

Module.fun/arity of the function the mutant is in, without the Elixir. prefix.

positions()

@spec positions() :: [position()]

The positions a site can be in.