Skip to content

Commit 00b6488

Browse files
Lab hardcoded: Move answers into JavaScript
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 08e3e24 commit 00b6488

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

docs/labs/hardcoded.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,6 @@
1111
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
1212

1313
<!-- See create_labs.md for how to create your own lab! -->
14-
15-
<!-- Sample expected answer -->
16-
<script id="expected0" type="plain/text">
17-
conn = DriverManager.getConnection(url,
18-
System.getenv("USERNAME"), System.getenv("PASSWORD"));
19-
</script>
20-
21-
<!-- Full pattern of correct answer -->
22-
<script id="correct0" type="plain/text">
23-
\s* conn = DriverManager \. getConnection \( url \,
24-
System \. getenv \( "USERNAME" \) \,
25-
System \. getenv \( "PASSWORD" \) \) \; \s*
26-
</script>
27-
2814
</head>
2915
<body>
3016
<!-- For GitHub Pages formatting: -->

docs/labs/hardcoded.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,14 @@ info =
4747
System \. getenv \( "USERNAME" \) \) \; \s* $`,
4848
text: "The order of parameters is wrong. Provide the url, then the username, then the password. You're providing the url, then the password, then the username, which swaps the second and third parameters."
4949
}
50-
]
50+
],
51+
expected: [
52+
`conn = DriverManager.getConnection(url,
53+
System.getenv("USERNAME"), System.getenv("PASSWORD"));`
54+
],
55+
correct: [
56+
String.raw`\s* conn = DriverManager \. getConnection \( url \,
57+
\s* System \. getenv \( "USERNAME" \) \,
58+
\s* System \. getenv \( "PASSWORD" \) \) \; \s*`
59+
],
5160
}

0 commit comments

Comments
 (0)