Skip to content

Commit

Permalink
chore: add cover for 300b912
Browse files Browse the repository at this point in the history
  • Loading branch information
go-coverage-action committed May 15, 2024
1 parent 58780a3 commit 2c12b88
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 0 deletions.
108 changes: 108 additions & 0 deletions go-test-app-02/300b91237759a05519a8ea4ccdeb6a227131e0c9-inc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Go Coverage Report</title>
<style>@import url("nord.css");
body {
background: black;
color: rgb(80, 80, 80);
}
body, pre, #legend span {
font-family: Menlo, monospace;
font-weight: bold;
}
#topbar {
background: black;
position: fixed;
top: 0; left: 0; right: 0;
height: 42px;
border-bottom: 1px solid rgb(80, 80, 80);
}
#content {
margin-top: 50px;
}
#nav, #legend {
float: left;
margin-left: 10px;
}
#legend {
margin-top: 12px;
}
#nav {
margin-top: 10px;
}
#legend span {
margin: 0 5px;
}
.cov0 { color: rgb(192, 0, 0) }
.cov1 { color: rgb(128, 128, 128) }
.cov2 { color: rgb(116, 140, 131) }
.cov3 { color: rgb(104, 152, 134) }
.cov4 { color: rgb(92, 164, 137) }
.cov5 { color: rgb(80, 176, 140) }
.cov6 { color: rgb(68, 188, 143) }
.cov7 { color: rgb(56, 200, 146) }
.cov8 { color: rgb(44, 212, 149) }
.cov9 { color: rgb(32, 224, 152) }
.cov10 { color: rgb(20, 236, 155) }

</style>
</head>
<body>
<div id="topbar">
<div id="nav">
<select id="files">

</select>
</div>
<div id="legend">
<span>not tracked</span>

<span class="cov0">no coverage</span>
<span class="cov1">low coverage</span>
<span class="cov2">*</span>
<span class="cov3">*</span>
<span class="cov4">*</span>
<span class="cov5">*</span>
<span class="cov6">*</span>
<span class="cov7">*</span>
<span class="cov8">*</span>
<span class="cov9">*</span>
<span class="cov10">high coverage</span>

</div>
</div>
<div id="content">

</div>
</body>
<script>
(function() {
var files = document.getElementById('files');
var visible;
files.addEventListener('change', onChange, false);
function select(part) {
if (visible)
visible.style.display = 'none';
visible = document.getElementById(part);
if (!visible)
return;
files.value = part;
visible.style.display = 'block';
location.hash = part;
}
function onChange() {
select(files.value);
window.scrollTo(0, 0);
}
if (location.hash != "") {
select(location.hash.substr(1));
}
if (!visible) {
select("file0");
}
})();
</script><script src="ln.js"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mode: set
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
total: (statements) 0.0%
137 changes: 137 additions & 0 deletions go-test-app-02/300b91237759a05519a8ea4ccdeb6a227131e0c9.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>cointoss: Go Coverage Report</title>
<style>@import url("nord.css");
body {
background: black;
color: rgb(80, 80, 80);
}
body, pre, #legend span {
font-family: Menlo, monospace;
font-weight: bold;
}
#topbar {
background: black;
position: fixed;
top: 0; left: 0; right: 0;
height: 42px;
border-bottom: 1px solid rgb(80, 80, 80);
}
#content {
margin-top: 50px;
}
#nav, #legend {
float: left;
margin-left: 10px;
}
#legend {
margin-top: 12px;
}
#nav {
margin-top: 10px;
}
#legend span {
margin: 0 5px;
}
.cov0 { color: rgb(192, 0, 0) }
.cov1 { color: rgb(128, 128, 128) }
.cov2 { color: rgb(116, 140, 131) }
.cov3 { color: rgb(104, 152, 134) }
.cov4 { color: rgb(92, 164, 137) }
.cov5 { color: rgb(80, 176, 140) }
.cov6 { color: rgb(68, 188, 143) }
.cov7 { color: rgb(56, 200, 146) }
.cov8 { color: rgb(44, 212, 149) }
.cov9 { color: rgb(32, 224, 152) }
.cov10 { color: rgb(20, 236, 155) }

</style>
</head>
<body>
<div id="topbar">
<div id="nav">
<select id="files">

<option value="file0">cointoss/main.go (70.0%)</option>

</select>
</div>
<div id="legend">
<span>not tracked</span>

<span class="cov0">not covered</span>
<span class="cov8">covered</span>

</div>
</div>
<div id="content">

<pre class="file" id="file0" style="display: none">package main

import (
"fmt"
"math/rand"
)

const side = "right"

func main() <span class="cov8" title="1">{
if tossCoin() == "heads" </span><span class="cov8" title="1">{
fmt.Println("Heads")
}</span> else<span class="cov0" title="0"> {
fmt.Println("Tails")
}</span>

<span class="cov8" title="1">fmt.Println("Maybe:", maybe())</span>
}

func tossCoin() string <span class="cov8" title="1">{
if rand.Intn(2) == 0 </span><span class="cov8" title="1">{
return "heads"
}</span> else<span class="cov0" title="0"> {
return "tails"
}</span>
}

func maybe() bool <span class="cov8" title="1">{
if side == "right" </span><span class="cov8" title="1">{
return true
}</span> else<span class="cov0" title="0"> {
return false
}</span>
}
</pre>

</div>
</body>
<script>
(function() {
var files = document.getElementById('files');
var visible;
files.addEventListener('change', onChange, false);
function select(part) {
if (visible)
visible.style.display = 'none';
visible = document.getElementById(part);
if (!visible)
return;
files.value = part;
visible.style.display = 'block';
location.hash = part;
}
function onChange() {
select(files.value);
window.scrollTo(0, 0);
}
if (location.hash != "") {
select(location.hash.substr(1));
}
if (!visible) {
select("file0");
}
})();
</script><script src="ln.js"></script>
</html>
11 changes: 11 additions & 0 deletions go-test-app-02/300b91237759a05519a8ea4ccdeb6a227131e0c9.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
mode: set
cointoss/main.go:10.13,11.27 1 1
cointoss/main.go:11.27,13.3 1 1
cointoss/main.go:13.8,15.3 1 0
cointoss/main.go:17.2,17.32 1 1
cointoss/main.go:20.24,21.23 1 1
cointoss/main.go:21.23,23.3 1 1
cointoss/main.go:23.8,25.3 1 0
cointoss/main.go:28.19,29.21 1 1
cointoss/main.go:29.21,31.3 1 1
cointoss/main.go:31.8,33.3 1 0
4 changes: 4 additions & 0 deletions go-test-app-02/300b91237759a05519a8ea4ccdeb6a227131e0c9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cointoss/main.go:10: main 75.0%
cointoss/main.go:20: tossCoin 66.7%
cointoss/main.go:28: maybe 66.7%
total: (statements) 70.0%
78 changes: 78 additions & 0 deletions go-test-app-02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Waiting for GitHub Pages Deployment</title>
<style>
@import url('nord.css');
body {
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
}
#spinner {
display: none;
border: 4px solid var(--nord1);
border-top: 4px solid var(--nord3);
border-radius: 50%;
width: 25px;
height: 25px;
animation: spin 2s linear infinite;
}
p {
font-size: 12px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<script>
function getHashFromQueryString() {
const params = new URLSearchParams(window.location.search);
return params.get("hash");
}

async function checkFileExists(url) {
try {
const response = await fetch(url, { method: "HEAD" });
return response.ok;
} catch (error) {
return false;
}
}

async function waitForFileToExist(url, interval = 2000) {
while (true) {
if (await checkFileExists(url)) {
return true;
}
await new Promise((resolve) => setTimeout(resolve, interval));
}
}

async function loadContent() {
const spinner = document.getElementById("spinner");
const hash = getHashFromQueryString();
const fileUrl = `${hash}.html`;

spinner.style.display = "block";

await waitForFileToExist(fileUrl);

window.location.href = fileUrl;
}

document.addEventListener("DOMContentLoaded", loadContent);

</script>
</head>
<body>
<div id="spinner"></div>
<p>Waiting for GitHub Pages Deployment</p>
</body>
</html>
8 changes: 8 additions & 0 deletions go-test-app-02/ln.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let pres = document.querySelectorAll('#content pre');

pres.forEach((pre) => {
let lines = pre.innerHTML.split('\n');
pre.style.setProperty('--ln-width', lines.length.toString().length);
let linesWithNumbers = lines.map((l, i) => `<span class="ln">${i+1}</span>${l}`);
pre.innerHTML = linesWithNumbers.join('\n');
});
Loading

0 comments on commit 2c12b88

Please sign in to comment.