forked from swc-project/swc
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { parse } from "https://deno.land/std@0.86.0/flags/mod.ts"; | ||
|
||
import { getNumericInput, printQuestion } from "./helpers/mod"; | ||
import printStats from "./print_stats.ts"; | ||
|
||
const args = parse(Deno.args); | ||
|
||
console.log(args.stats); | ||
|
||
printStats(); | ||
printQuestion("How many times have you played"); | ||
|
||
console.log(await getNumericInput()); |
14 changes: 14 additions & 0 deletions
14
bundler/tests/deno-exec/deno-9350/step2/input/helpers/ask_trivia.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { TRIVIA } from "../types/mod"; | ||
import { getUserInput, printQuestion } from "./mod"; | ||
|
||
export async function askTriviaQuestion( | ||
selectedTrivia: TRIVIA, | ||
): Promise<void> { | ||
printQuestion(selectedTrivia.question); | ||
|
||
await getUserInput(); | ||
|
||
console.log("The correct answer is:", selectedTrivia.correctAnswer); | ||
|
||
console.log("Source:", selectedTrivia.source.name, "\n"); | ||
} |
6 changes: 6 additions & 0 deletions
6
bundler/tests/deno-exec/deno-9350/step2/input/helpers/generate_source.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { SOURCE } from "../types/mod"; | ||
|
||
export const generateTVSource = (name: string): SOURCE => ({ | ||
name, | ||
mediaType: "Television", | ||
}); |
12 changes: 12 additions & 0 deletions
12
bundler/tests/deno-exec/deno-9350/step2/input/helpers/get_user_input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { readLines } from "https://deno.land/std@6.0/io/mod.ts"; | ||
import { printQuestion } from "./mod"; | ||
|
||
export const getNumericInput = (): Promise<number> => Promise.resolve(4); | ||
|
||
export async function getUserInput(): Promise<string> { | ||
printQuestion("What would you like to enter"); | ||
|
||
const reader = readLines(Deno.stdin); | ||
|
||
return (await reader.next()).value; | ||
} |
3 changes: 3 additions & 0 deletions
3
bundler/tests/deno-exec/deno-9350/step2/input/helpers/logger.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function printQuestion(question: string): void { | ||
console.log(question, "?????"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from "./ask_trivia"; | ||
export * from "./generate_source"; | ||
export * from "./get_user_input"; | ||
export * from "./logger"; | ||
export * from "./pick_trivia"; |
8 changes: 8 additions & 0 deletions
8
bundler/tests/deno-exec/deno-9350/step2/input/helpers/pick_trivia.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { TRIVIA } from "../types/mod"; | ||
import { ALL_TRIVIA } from "../trivia/mod"; | ||
|
||
export function getFirstTrivia( | ||
providedTrivia: TRIVIA[] = ALL_TRIVIA, | ||
): TRIVIA { | ||
return providedTrivia[0]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ALL_TRIVIA } from "./trivia/mod"; | ||
|
||
export default () => { | ||
console.log("Number of Trivia Questions:", ALL_TRIVIA.length); | ||
}; |
11 changes: 11 additions & 0 deletions
11
bundler/tests/deno-exec/deno-9350/step2/input/trivia/a_tv_show.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { generateTVSource } from "../helpers/mod"; | ||
import { TRIVIA } from "../types/mod"; | ||
|
||
const trivia: TRIVIA[] = [{ | ||
question: "Where did episode 1 take place", | ||
correctAnswer: "On a boat", | ||
wrongAnswers: ["On a plane", "On a mountain", "On a beach"], | ||
source: generateTVSource("A TV Show Episode 1"), | ||
}]; | ||
|
||
export default trivia; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { TRIVIA } from "../types/mod.ts"; | ||
import aTVShow from "./a_tv_show.ts"; | ||
|
||
export const ALL_TRIVIA: TRIVIA[] = [...aTVShow]; |
11 changes: 11 additions & 0 deletions
11
bundler/tests/deno-exec/deno-9350/step2/input/types/mod.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface SOURCE { | ||
name: string; | ||
mediaType: string; | ||
} | ||
|
||
export interface TRIVIA { | ||
question: string; | ||
correctAnswer: string; | ||
wrongAnswers: [string, string, string]; | ||
source: SOURCE; | ||
} |