Skip to content

Commit

Permalink
[#145] parse_insert_values 테스트코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
myyrakle committed Jul 31, 2024
1 parent 5d181a0 commit e9ef65d
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/parser/test/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,44 @@ fn test_parse_insert_values() {
}],
want_error: false,
},
TestCase {
name: "VALUES(1, 2, 3), (4,5,6)".into(),
input: vec![
Token::Values,
Token::LeftParentheses,
Token::Integer(1),
Token::Comma,
Token::Integer(2),
Token::Comma,
Token::Integer(3),
Token::RightParentheses,
Token::Comma,
Token::LeftParentheses,
Token::Integer(4),
Token::Comma,
Token::Integer(5),
Token::Comma,
Token::Integer(6),
Token::RightParentheses,
],
expected: vec![
InsertValue {
list: vec![
Some(SQLExpression::Integer(1)),
Some(SQLExpression::Integer(2)),
Some(SQLExpression::Integer(3)),
],
},
InsertValue {
list: vec![
Some(SQLExpression::Integer(4)),
Some(SQLExpression::Integer(5)),
Some(SQLExpression::Integer(6)),
],
},
],
want_error: false,
},
TestCase {
name: "실패: SELECT(1, 2, 3)".into(),
input: vec![
Expand All @@ -545,7 +583,7 @@ fn test_parse_insert_values() {
TestCase {
name: "실패: Values)1, 2, 3)".into(),
input: vec![
Token::Select,
Token::Values,
Token::RightParentheses,
Token::Integer(1),
Token::Comma,
Expand All @@ -557,6 +595,12 @@ fn test_parse_insert_values() {
expected: vec![],
want_error: true,
},
TestCase {
name: "실패: Values(".into(),
input: vec![Token::Values, Token::LeftParentheses],
expected: vec![],
want_error: true,
},
TestCase {
name: "실패: 빈 토큰".into(),
input: vec![],
Expand Down

0 comments on commit e9ef65d

Please sign in to comment.