71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
import testcaseData from "./testcases.json" assert { type: "json"};
|
|
|
|
type Testcase = {
|
|
id: number,
|
|
subId: number | null,
|
|
content: string,
|
|
procedure: string,
|
|
testData: string| null,
|
|
expected: string,
|
|
actual: string,
|
|
pass: boolean
|
|
}
|
|
|
|
const testcase: Testcase[] = testcaseData;
|
|
|
|
import {Issue} from "./githubType.ts"
|
|
|
|
const data = await Deno.readTextFile("../cache/issues.json")
|
|
|
|
const issues = JSON.parse(data) as Issue[]
|
|
const table = new Map<string, Issue[]>();
|
|
issues.forEach((x)=>{
|
|
const category = x.title.split(":")[0];
|
|
if(!category) return;
|
|
let c = table.get(category)
|
|
if(!c){
|
|
c = [];
|
|
table.set(category,c);
|
|
}
|
|
c.push(x);
|
|
});
|
|
|
|
const keys = Array.from(table.keys());
|
|
|
|
|
|
keys.forEach(x=>{
|
|
console.log(`\n### ${x}\n`);
|
|
const issues = table.get(x);
|
|
console.log("<table>");
|
|
console.log("<thead>");
|
|
console.log("<tr>");
|
|
//console.log("<th>Category</th>");
|
|
console.log("<th>ID</th>");
|
|
console.log("<th>Content</th>");
|
|
console.log("<th>Procedure</th>");
|
|
console.log("<th>Test Data</th>");
|
|
console.log("<th>P/F</th>");
|
|
console.log("</tr>");
|
|
console.log("</thead>");
|
|
console.log("<tbody>");
|
|
const ts = issues!.map(x=> testcase.filter(y=>y.id==x.number)).flat() as Testcase[];
|
|
|
|
if(ts?.length == 0) return;
|
|
|
|
//console.log(`<tr><th rowspan="${ts?.length}">${x}</th>`);
|
|
|
|
ts.forEach((y,i)=>{
|
|
//if(i>0)
|
|
console.log("<tr>");
|
|
const id = y.subId ? `${y.id}-${y.subId}` : y.id;
|
|
console.log(`<td>${id}</td>`);
|
|
console.log(`<td>${y.content}</td>`);
|
|
console.log(`<td>${y.procedure}</td>`);
|
|
console.log(`<td>${y.testData ?? ""}</td>`);
|
|
console.log(`<td>${y.pass ? "P" : "F"}</td>`);
|
|
console.log("</tr>");
|
|
})
|
|
console.log("</tbody>");
|
|
console.log("</table>");
|
|
})
|