Skip to content

Commit 7d64c3f

Browse files
Merge pull request #757 from ossf/conversion_no_yaml
Lab conversion: Convert YAML to JavaScript, move answers
2 parents 774927f + 2818b52 commit 7d64c3f

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

docs/labs/conversion.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,11 @@
77
<link rel="stylesheet" href="checker.css">
88
<script src="js-yaml.min.js"></script>
99
<script src="checker.js"></script>
10+
<script src="conversion.js"></script>
1011
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
1112

1213
<!-- See create_labs.md for how to create your own lab! -->
1314

14-
<!-- Sample expected answer -->
15-
<script id="expected0" type="plain/text">
16-
unsigned int queue_count = 0;
17-
</script>
18-
<!--
19-
-->
20-
21-
<!-- Full pattern of correct answer -->
22-
<script id="correct0" type="plain/text">
23-
^ unsigned\s+int\s+queue_count = 0 ; $
24-
</script>
25-
26-
<script id="info" type="application/yaml">
27-
---
28-
hints:
29-
- absent: "unsigned"
30-
text: The type defined for queue_count should exactly match the return type of get_queue.
31-
# debug: true
32-
</script>
3315
</head>
3416
<body>
3517
<!-- For GitHub Pages formatting: -->

docs/labs/conversion.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
info =
2+
{
3+
hints: [
4+
{
5+
absent: "unsigned",
6+
text: "The type defined for queue_count should exactly match the return type of get_queue."
7+
},
8+
{
9+
present: String.raw`unsigned\s+queue_count`,
10+
text: "The declared return type of get_queue is `unsigned int`; you should match it exactly instead of using a synonym like `unsigned`."
11+
}
12+
],
13+
expected: [
14+
'unsigned int queue_count = 0;'
15+
],
16+
correct: [
17+
String.raw`^ unsigned\s+int\s+queue_count = 0 ; $`
18+
],
19+
}

0 commit comments

Comments
 (0)