tangled
alpha
login
or
join now
bwc9876.dev
/
gh-grader-preview
0
fork
atom
Local runner for GitHub autograder
0
fork
atom
overview
issues
pulls
pipelines
Update v0.4.0
bwc9876.dev
6 months ago
c4da97ef
a3e28a9c
verified
This commit was signed with the committer's
known signature
.
bwc9876.dev
SSH Key Fingerprint:
SHA256:DanMEP/RNlSC7pAVbnXO6wzQV00rqyKj053tz4uH5gQ=
+43
-39
4 changed files
expand all
collapse all
unified
split
Cargo.lock
Cargo.toml
flake.lock
src
grader.rs
+22
-21
Cargo.lock
···
81
81
82
82
[[package]]
83
83
name = "clap"
84
84
-
version = "4.5.46"
84
84
+
version = "4.5.47"
85
85
source = "registry+https://github.com/rust-lang/crates.io-index"
86
86
-
checksum = "2c5e4fcf9c21d2e544ca1ee9d8552de13019a42aa7dbf32747fa7aaf1df76e57"
86
86
+
checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931"
87
87
dependencies = [
88
88
"clap_builder",
89
89
"clap_derive",
···
91
91
92
92
[[package]]
93
93
name = "clap_builder"
94
94
-
version = "4.5.46"
94
94
+
version = "4.5.47"
95
95
source = "registry+https://github.com/rust-lang/crates.io-index"
96
96
-
checksum = "fecb53a0e6fcfb055f686001bc2e2592fa527efaf38dbe81a6a9563562e57d41"
96
96
+
checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6"
97
97
dependencies = [
98
98
"anstream",
99
99
"anstyle",
···
112
112
113
113
[[package]]
114
114
name = "clap_derive"
115
115
-
version = "4.5.45"
115
115
+
version = "4.5.47"
116
116
source = "registry+https://github.com/rust-lang/crates.io-index"
117
117
-
checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6"
117
117
+
checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c"
118
118
dependencies = [
119
119
"heck",
120
120
"proc-macro2",
···
165
165
166
166
[[package]]
167
167
name = "gh-grader-preview"
168
168
-
version = "0.3.0"
168
168
+
version = "0.4.0"
169
169
dependencies = [
170
170
"anyhow",
171
171
"clap",
···
212
212
213
213
[[package]]
214
214
name = "js-sys"
215
215
-
version = "0.3.77"
215
215
+
version = "0.3.78"
216
216
source = "registry+https://github.com/rust-lang/crates.io-index"
217
217
-
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
217
217
+
checksum = "0c0b063578492ceec17683ef2f8c5e89121fbd0b172cbc280635ab7567db2738"
218
218
dependencies = [
219
219
"once_cell",
220
220
"wasm-bindgen",
···
228
228
229
229
[[package]]
230
230
name = "log"
231
231
-
version = "0.4.27"
231
231
+
version = "0.4.28"
232
232
source = "registry+https://github.com/rust-lang/crates.io-index"
233
233
-
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
233
233
+
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
234
234
235
235
[[package]]
236
236
name = "memchr"
···
399
399
400
400
[[package]]
401
401
name = "wasm-bindgen"
402
402
-
version = "0.2.100"
402
402
+
version = "0.2.101"
403
403
source = "registry+https://github.com/rust-lang/crates.io-index"
404
404
-
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
404
404
+
checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b"
405
405
dependencies = [
406
406
"cfg-if",
407
407
"once_cell",
408
408
"wasm-bindgen-macro",
409
409
+
"wasm-bindgen-shared",
409
410
]
410
411
411
412
[[package]]
412
413
name = "wasm-bindgen-backend"
413
413
-
version = "0.2.100"
414
414
+
version = "0.2.101"
414
415
source = "registry+https://github.com/rust-lang/crates.io-index"
415
415
-
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
416
416
+
checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb"
416
417
dependencies = [
417
418
"bumpalo",
418
419
"log",
···
424
425
425
426
[[package]]
426
427
name = "wasm-bindgen-macro"
427
427
-
version = "0.2.100"
428
428
+
version = "0.2.101"
428
429
source = "registry+https://github.com/rust-lang/crates.io-index"
429
429
-
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
430
430
+
checksum = "7c3d463ae3eff775b0c45df9da45d68837702ac35af998361e2c84e7c5ec1b0d"
430
431
dependencies = [
431
432
"quote",
432
433
"wasm-bindgen-macro-support",
···
434
435
435
436
[[package]]
436
437
name = "wasm-bindgen-macro-support"
437
437
-
version = "0.2.100"
438
438
+
version = "0.2.101"
438
439
source = "registry+https://github.com/rust-lang/crates.io-index"
439
439
-
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
440
440
+
checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa"
440
441
dependencies = [
441
442
"proc-macro2",
442
443
"quote",
···
447
448
448
449
[[package]]
449
450
name = "wasm-bindgen-shared"
450
450
-
version = "0.2.100"
451
451
+
version = "0.2.101"
451
452
source = "registry+https://github.com/rust-lang/crates.io-index"
452
452
-
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
453
453
+
checksum = "f143854a3b13752c6950862c906306adb27c7e839f7414cec8fea35beab624c1"
453
454
dependencies = [
454
455
"unicode-ident",
455
456
]
+1
-1
Cargo.toml
···
1
1
[package]
2
2
name = "gh-grader-preview"
3
3
-
version = "0.3.0"
3
3
+
version = "0.4.0"
4
4
edition = "2024"
5
5
6
6
[dependencies]
+12
-12
flake.lock
···
2
2
"nodes": {
3
3
"crane": {
4
4
"locked": {
5
5
-
"lastModified": 1755993354,
6
6
-
"narHash": "sha256-FCRRAzSaL/+umLIm3RU3O/+fJ2ssaPHseI2SSFL8yZU=",
5
5
+
"lastModified": 1756705356,
6
6
+
"narHash": "sha256-dpBFe8SqYKr7W6KN5QOVCr8N76SBKwTslzjw+4BVBVs=",
7
7
"owner": "ipetkov",
8
8
"repo": "crane",
9
9
-
"rev": "25bd41b24426c7734278c2ff02e53258851db914",
9
9
+
"rev": "305707bbc27d83aa1039378e91d7dd816f4cac10",
10
10
"type": "github"
11
11
},
12
12
"original": {
···
22
22
]
23
23
},
24
24
"locked": {
25
25
-
"lastModified": 1756126213,
26
26
-
"narHash": "sha256-iSmyMn8r5NJfTWEsp6R/5jmMHrVLnQ/icebYfNP5QnQ=",
25
25
+
"lastModified": 1756730985,
26
26
+
"narHash": "sha256-Uv5lLUZfFxQv6RHi1TqLTKso0j0eUVMQQwud29LTV/s=",
27
27
"owner": "nix-community",
28
28
"repo": "flakelight",
29
29
-
"rev": "4415f8e61c770441f01a5b2550da5815aeebe144",
29
29
+
"rev": "950121d809b75c32e73684b32ccba8d4e8a67703",
30
30
"type": "github"
31
31
},
32
32
"original": {
···
41
41
"flakelight": "flakelight"
42
42
},
43
43
"locked": {
44
44
-
"lastModified": 1756212791,
45
45
-
"narHash": "sha256-90/xH2TwrCluU3ROooeeBYNxpeRqdGDQQptiqZN6FlA=",
44
44
+
"lastModified": 1756817437,
45
45
+
"narHash": "sha256-O8xyYYBJucwHMnqjoaNFEDYPJQ5nzwnuXjPoW2TCvYo=",
46
46
"owner": "accelbread",
47
47
"repo": "flakelight-rust",
48
48
-
"rev": "ce31f0d6c3adea38a4d8011c5e0b55d16888f21e",
48
48
+
"rev": "af3cc6a17c210efb85d99ed3ea601f5d0b55b50f",
49
49
"type": "github"
50
50
},
51
51
"original": {
···
56
56
},
57
57
"nixpkgs": {
58
58
"locked": {
59
59
-
"lastModified": 1756288264,
60
60
-
"narHash": "sha256-Om8adB1lfkU7D33VpR+/haZ2gI5r3Q+ZbIPzE5sYnwE=",
59
59
+
"lastModified": 1756911493,
60
60
+
"narHash": "sha256-6n/n1GZQ/vi+LhFXMSyoseKdNfc2QQaSBXJdgamrbkE=",
61
61
"owner": "NixOS",
62
62
"repo": "nixpkgs",
63
63
-
"rev": "ddd1826f294a0ee5fdc198ab72c8306a0ea73aa9",
63
63
+
"rev": "c6a788f552b7b7af703b1a29802a7233c0067908",
64
64
"type": "github"
65
65
},
66
66
"original": {
+8
-5
src/grader.rs
···
72
72
}
73
73
74
74
impl TestCase {
75
75
-
pub fn check_output(&self, output: String) -> Result<bool> {
75
75
+
fn check_output(&self, output: String) -> Result<bool> {
76
76
if let Some(ref expected_output) = self.output {
77
77
+
let expected_output = expected_output.replace("\r\n", "\n");
78
78
+
77
79
match self.comparison {
78
78
-
ComparisonType::Included => Ok(output.contains(expected_output)),
79
79
-
ComparisonType::Excluded => Ok(!output.contains(expected_output)),
80
80
+
ComparisonType::Included => Ok(output.contains(&expected_output)),
81
81
+
ComparisonType::Excluded => Ok(!output.contains(&expected_output)),
80
82
ComparisonType::Exact => Ok(output.trim() == expected_output.trim()),
81
83
ComparisonType::Regex => {
82
82
-
let re = regex::Regex::new(expected_output)?;
84
84
+
let re = regex::Regex::new(&expected_output)?;
83
85
Ok(re.is_match(&output))
84
86
}
85
87
ComparisonType::Pass => Ok(true),
···
94
96
runner::setup_phase(setup)?;
95
97
}
96
98
let res = runner::run_phase(&self.run, &self.input, self.timeout as u64)?;
97
97
-
let matches = self.check_output(res.stdout.clone())?;
99
99
+
let output = res.stdout.replace("\r\n", "\n");
100
100
+
let matches = self.check_output(output)?;
98
101
Ok((matches, res))
99
102
}
100
103
}