Skip to content

Commit 219fab5

Browse files
committed
add more info
1 parent e26bf92 commit 219fab5

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
name: Test
3636
runs-on: ${{ matrix.os }}
3737
strategy:
38-
fail-fast: false
38+
fail-fast: true
3939
matrix:
4040
os: [ubuntu-latest, windows-latest, macos-latest]
4141
rust: [nightly]

crates/leetcode-api/tests/leetcode_work.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,6 @@ use leetcode_api::{glob_leetcode, leetcode::IdSlug};
22
use miette::Result;
33
use pretty_assertions::assert_eq;
44

5-
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
6-
async fn get_user_code_work() -> Result<()> {
7-
let id = IdSlug::Id(108);
8-
glob_leetcode()
9-
.await
10-
.get_qs_detail(id.clone(), false)
11-
.await?;
12-
13-
let a = glob_leetcode()
14-
.await
15-
.get_user_code(id)
16-
.await?;
17-
18-
assert!(!a.0.is_empty());
19-
assert_eq!(&a.1, "[-10,-3,0,5,9]\n[1,3]");
20-
21-
Ok(())
22-
}
23-
24-
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
25-
async fn get_qs_detail_none() {
26-
assert!(glob_leetcode()
27-
.await
28-
.get_qs_detail(IdSlug::Id(0), false)
29-
.await
30-
.is_err());
31-
}
32-
335
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
346
async fn get_qs_detail_work() -> Result<()> {
357
// tracing_subscriber::fmt()
@@ -82,3 +54,31 @@ async fn get_qs_detail_work() -> Result<()> {
8254

8355
Ok(())
8456
}
57+
58+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
59+
async fn get_user_code_work() -> Result<()> {
60+
let id = IdSlug::Id(108);
61+
glob_leetcode()
62+
.await
63+
.get_qs_detail(id.clone(), false)
64+
.await?;
65+
66+
let a = glob_leetcode()
67+
.await
68+
.get_user_code(id)
69+
.await?;
70+
71+
assert!(!a.0.is_empty());
72+
assert_eq!(&a.1, "[-10,-3,0,5,9]\n[1,3]");
73+
74+
Ok(())
75+
}
76+
77+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
78+
async fn get_qs_detail_none() {
79+
assert!(glob_leetcode()
80+
.await
81+
.get_qs_detail(IdSlug::Id(0), false)
82+
.await
83+
.is_err());
84+
}

crates/leetcode-api/tests/query_work.rs

+4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ async fn query_base() -> Result<()> {
1515
"hash-table".to_owned(),
1616
]);
1717
let res = Query::query_by_topic(&tags, None).await?;
18+
for ele in &res {
19+
eprintln!("{}", &ele.title_slug);
20+
}
1821

22+
assert!(res.first().unwrap().title_slug == "3sum-with-multiplicity");
1923
assert!(res
2024
.iter()
2125
.any(|v| { v.title_slug == "two-sum" }));

0 commit comments

Comments
 (0)