feat: deno base project
This commit is contained in:
1
src/exercises/assets/day_1_input.txt
Normal file
1
src/exercises/assets/day_1_input.txt
Normal file
@@ -0,0 +1 @@
|
||||
Test
|
||||
4
src/exercises/day_1.ts
Normal file
4
src/exercises/day_1.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function FirstDayExerciseName() {
|
||||
console.log("test_module");
|
||||
return 1;
|
||||
}
|
||||
17
src/main.ts
Normal file
17
src/main.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
async function main(): Promise<number> {
|
||||
const args = Deno.args;
|
||||
if (!args || args.length !== 1) {
|
||||
return Promise.resolve(-1);
|
||||
}
|
||||
const day = parseInt(args[0]);
|
||||
|
||||
const module = await import(`./exercises/day_${day}.ts`);
|
||||
module.default();
|
||||
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
|
||||
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
|
||||
if (import.meta.main) {
|
||||
await main();
|
||||
}
|
||||
6
src/main_test.ts
Normal file
6
src/main_test.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { add } from "./main.ts";
|
||||
|
||||
Deno.test(function addTest() {
|
||||
assertEquals(add(2, 3), 5);
|
||||
});
|
||||
Reference in New Issue
Block a user