App-Test-Generator
view release on metacpan or search on metacpan
bin/test-generator-index view on Meta::CPAN
#
# Entry: $count - number of surviving mutants on
# a single source line.
#
# Exit: Returns a CSS class name string:
# 'survived-1', 'survived-2', or
# 'survived-3' (for 3 or more).
# Returns 'survived' as a fallback for
# zero (should not occur in practice).
#
# Side effects: None.
# --------------------------------------------------
sub _survivor_class {
my $count = $_[0];
return 'survived-1' if $count == 1;
return 'survived-2' if $count == 2;
return 'survived-3' if $count >= 3;
return 'survived';
}
# --------------------------------------------------
# _relative_link
#
# Purpose: Compute a relative HTML href from one
# per-file mutation page to another, so
# Previous/Next navigation links work
# correctly regardless of directory depth.
#
# Entry: $from - source file path (relative to
# project root, e.g. lib/Foo.pm)
# $to - target file path (same form)
#
# Exit: Returns a relative URL string suitable
# for use in an href attribute.
#
# Side effects: None.
#
# Notes: Both paths are converted to .html
# filenames before computing the relative
# path, mirroring how _mutant_file_report
# names its output files.
# --------------------------------------------------
sub _relative_link {
my ($from, $to) = @_;
# Convert both to .html filenames
$from .= '.html';
$to .= '.html';
# Use File::Spec to compute correct relative path
return File::Spec->abs2rel($to, dirname($from));
}
sub _mutant_file_header {
return qq{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
/* --------------------------------------------------
CSS Variables (Light Mode Default)
-------------------------------------------------- */
:root {
--bg: #ffffff;
--text: #000000;
--table-header: #333;
--table-header-text: #ffffff;
--survived-1: #f8d7da;
--survived-2: #f5b7b1;
--survived-3: #ec7063;
--killed: #d4edda;
--border: #cccccc;
}
/* --------------------------------------------------
Dark Mode Overrides
-------------------------------------------------- */
html[data-theme='dark'] {
--bg: #1e1e1e;
--text: #dddddd;
--table-header: #222;
--table-header-text: #ffffff;
--survived-1: #5c2b2e;
--survived-2: #7b2c2f;
--survived-3: #a93226;
--killed: #1e4620;
--border: #555;
}
/* --------------------------------------------------
Global Styles
-------------------------------------------------- */
body {
font-family: sans-serif;
background: var(--bg);
color: var(--text);
}
table {
border-collapse: collapse;
width: 100%;
}
th {
background: var(--table-header);
color: var(--table-header-text);
}
.survived-1 { background-color: var(--survived-1); }
.survived-2 { background-color: var(--survived-2); }
( run in 0.583 second using v1.01-cache-2.11-cpan-39bf76dae61 )