<commit_before><!DOCTYPE html>
<html>
	<head>
		<title>Revel Test Runner</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<link href="/@tests/public/css/bootstrap.css" type="text/css" rel="stylesheet"></link>
		<script src="/@tests/public/js/jquery-1.9.1.min.js" type="text/javascript"></script>
		<style>
		header { padding:20px 0; background-color:#ADD8E6 }
		.passed td { background-color: #90EE90 !important; }
		.failed td { background-color: #FFB6C1 !important; }
		.tests td.name, .tests td.result { padding-top: 13px; }
		pre { font-size:10px; white-space: pre; }
		</style>
	</head>
	<body>
		<header>
			<div class="container">
				<table><tr><td>
					<h1>Test Runner</h1>
					<p class="lead">Run all of your application's tests from here.</p>
				</td><td style="padding-left:150px;">
					<button class="btn btn-large" all-tests="">Run All Tests</button>
				</td></tr></table>
			</div>
		</header>

		<div class="container">
			{{range .testSuites}}
				<p class="lead" style="margin-top:20px;">{{.Name}}</p>
				<table class="table table-striped tests" suite="{{.Name}}">
					{{range .Tests}}
						<tr>
							<td class="name">{{.Name}}</td>
							<td class="result">
							</td>
							<td><button test="{{.Name}}" class="btn">Run</button></td>
						</tr>
					{{end}}
				</table>
			{{end}}
		</div>

<script>
var running = 0;

$("button[test]").click(function() {
	var button = $(this).addClass("disabled").text("Running");
	runTest(button);
	running += 1;
});

$("button[all-tests]").click(function() {
	var button = $(this).addClass("disabled").text("Running");
	$("button[test]").click();
});

function runTest(button) {
	var suite = button.parents("table").attr("suite");
	var test = button.attr("test");
	var row = button.parents("tr");
	var resultCell = row.children(".result");
	$.ajax({
		dataType: "json",
		url: "/@tests/"+suite+"/"+test,
		async: false,
		success: function(result) {
			row.attr("class", result.Passed ? "passed" : "failed");
			if (result.Passed) {
				resultCell.html("");
			} else {
				resultCell.html(result.ErrorHtml);
			}
			button.removeClass("disabled").text("Run");
			running -= 1;
			if (running == 0) {
				$("button[all-tests]").removeClass("disabled").text("Run All Tests");
			}
		}});
}
</script>

	</body>
</html>
<commit_msg>Fix timing issues with test runner.<commit_after><!DOCTYPE html>
<html>
	<head>
		<title>Revel Test Runner</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<link href="/@tests/public/css/bootstrap.css" type="text/css" rel="stylesheet"></link>
		<script src="/@tests/public/js/jquery-1.9.1.min.js" type="text/javascript"></script>
		<style>
		header { padding:20px 0; background-color:#ADD8E6 }
		.passed td { background-color: #90EE90 !important; }
		.failed td { background-color: #FFB6C1 !important; }
		.tests td.name, .tests td.result { padding-top: 13px; }
		pre { font-size:10px; white-space: pre; }
		</style>
	</head>
	<body>
		<header>
			<div class="container">
				<table><tr><td>
					<h1>Test Runner</h1>
					<p class="lead">Run all of your application's tests from here.</p>
				</td><td style="padding-left:150px;">
					<button class="btn btn-large" all-tests="">Run All Tests</button>
				</td></tr></table>
			</div>
		</header>

		<div class="container">
			{{range .testSuites}}
				<p class="lead" style="margin-top:20px;">{{.Name}}</p>
				<table class="table table-striped tests" suite="{{.Name}}">
					{{range .Tests}}
						<tr>
							<td class="name">{{.Name}}</td>
							<td class="result">
							</td>
							<td><button test="{{.Name}}" class="btn">Run</button></td>
						</tr>
					{{end}}
				</table>
			{{end}}
		</div>

<script>
var running = 0;

$("button[test]").click(function() {
	var button = $(this).addClass("disabled").text("Running");
	running += 1;
	runTest(button);
});

$("button[all-tests]").click(function() {
	var button = $(this).addClass("disabled").text("Running");
	$("button[test]").click();
});

function runTest(button) {
	var suite = button.parents("table").attr("suite");
	var test = button.attr("test");
	var row = button.parents("tr");
	var resultCell = row.children(".result");
	$.ajax({
		dataType: "json",
		url: "/@tests/"+suite+"/"+test,
		async: false,
		success: function(result) {
			row.attr("class", result.Passed ? "passed" : "failed");
			if (result.Passed) {
				resultCell.html("");
			} else {
				resultCell.html(result.ErrorHtml);
			}
			button.removeClass("disabled").text("Run");
			running -= 1;
			if (running == 0) {
				$("button[all-tests]").removeClass("disabled").text("Run All Tests");
			}
		}});
}
</script>

	</body>
</html>

{'fraction_non_alphanumeric': 0.22684592402902262, 'fraction_numerical': 0.012804097311139564, 'mean_word_length': 3.7200402819738168, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3132616', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1657, 'n_words': 325}