Skip to content

Commit

Permalink
fix: dont double cd
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy-lmao committed Nov 6, 2024
1 parent 417ce12 commit fbb822b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Run integration tests in `tests`
run: cd tests

- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.5

Expand Down
21 changes: 20 additions & 1 deletion src/common/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,33 @@ pub fn is_key_attr(attr: &Attribute) -> bool {
fn extract_inner_string(input: &str) -> Option<String> {
// Remove leading "= " and surrounding quotes
if let Some(stripped) = input
.strip_prefix("= \"")
.trim()
.strip_prefix("=")?
.trim()
.strip_prefix("\"")
.and_then(|s| s.strip_suffix("\""))
{
return Some(stripped.to_string());
}
None
}

#[test]
fn extract_inner_string_1() {
let result = extract_inner_string("= \"foo\"").expect("couldnt get inner");
assert_eq!(result, "foo");
}
#[test]
fn extract_inner_string_2() {
let result = extract_inner_string("=\"foo\"").expect("couldnt get inner");
assert_eq!(result, "foo");
}
#[test]
fn extract_inner_string_3() {
let result = extract_inner_string(" =\"foo\"").expect("couldnt get inner");
assert_eq!(result, "foo");
}

pub fn get_table_name(input: &DeriveInput) -> String {
let struct_name = &input.ident;
let mut table_name = struct_name.to_string().to_lowercase();
Expand Down

0 comments on commit fbb822b

Please sign in to comment.