Skip to content

Commit

Permalink
[#110] handle_create_database_query 테스트케이스 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
myyrakle committed Aug 13, 2024
1 parent c854da3 commit 4558fbd
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/parser/test/create_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ fn test_handle_create_database_query() {
.into(),
want_error: false,
},
TestCase {
name: "CREATE DATABASE test_db".into(),
input: vec![Token::Identifier("test_db".to_owned())],
expected: CreateDatabaseQuery::builder()
.set_name("test_db".to_owned())
.build()
.into(),
want_error: false,
},
TestCase {
name: "CREATE DATABASE IF NOT EXISTS test_db;".into(),
input: vec![
Expand All @@ -39,6 +48,36 @@ fn test_handle_create_database_query() {
.into(),
want_error: false,
},
TestCase {
name: "오류: 빈 토큰".into(),
input: vec![],
expected: Default::default(),
want_error: true,
},
TestCase {
name: "오류: CREATE DATABASE IF NOT EXISTS".into(),
input: vec![Token::If, Token::Not, Token::Exists],
expected: Default::default(),
want_error: true,
},
TestCase {
name: "CREATE DATABASE IF NOT EXISTS DELETE;".into(),
input: vec![
Token::If,
Token::Not,
Token::Exists,
Token::Delete,
Token::SemiColon,
],
expected: Default::default(),
want_error: true,
},
TestCase {
name: "CREATE DATABASE test_db DELETE".into(),
input: vec![Token::Identifier("test_db".to_owned()), Token::Delete],
expected: Default::default(),
want_error: true,
},
];

for t in test_cases {
Expand Down

0 comments on commit 4558fbd

Please sign in to comment.