-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# rust-sql | ||
# rust-sql | ||
|
||
To do: | ||
Custom row types defined through JSON. | ||
HTTP connectivity support. | ||
Include a SQL Driver to test out connectivity. Likely written in GoLang. | ||
|
||
Stretch goals: | ||
Custom CLI GUI. | ||
Multiple tables in database. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ use crate::parser::*; | |
fn execute_command_unrecognized() { | ||
let cmd = String::from(".dummy"); | ||
let out = execute_command(&cmd); | ||
assert_eq!(out, MetaCommandResult::UNRECOGNIZED); | ||
assert_eq!(out, MetaCommandResult::Unrecognized); | ||
} | ||
|
||
// Testing whether the enum is set properly. | ||
|
@@ -15,7 +15,7 @@ fn prepare_statement_set_insert() { | |
let mut out_statement = Statement::default(); | ||
let cmd = String::from("insert"); | ||
prepare_statement(&cmd, &mut out_statement); | ||
assert_eq!(out_statement.cmd, StatementType::INSERT); | ||
assert_eq!(out_statement.cmd, StatementType::Insert); | ||
} | ||
|
||
// Testing whether the enum is set properly. | ||
|
@@ -24,25 +24,23 @@ fn prepare_statement_set_select() { | |
let mut out_statement = Statement::default(); | ||
let cmd = String::from("select"); | ||
prepare_statement(&cmd, &mut out_statement); | ||
assert_eq!(out_statement.cmd, StatementType::SELECT); | ||
assert_eq!(out_statement.cmd, StatementType::Select); | ||
} | ||
|
||
// Testing whether the output result is correct. | ||
#[test] | ||
fn prepare_statement_out_success() { | ||
let mut out_statement = Statement::default(); | ||
let cmd = String::from("insert 10 monkeylover [email protected]"); | ||
let out_result = prepare_statement(&cmd, &mut out_statement); | ||
assert_eq!(out_result, PrepareResult::SUCCESS); | ||
let out_result = prepare_statement(&cmd, &mut Statement::default()); | ||
assert_eq!(out_result, PrepareResult::Success); | ||
} | ||
|
||
// Testing whether the output result handles bad commands. | ||
#[test] | ||
fn prepare_statement_out_failure() { | ||
let mut out_statement = Statement::default(); | ||
let cmd = String::from("dummy"); | ||
let out_result = prepare_statement(&cmd, &mut out_statement); | ||
assert_eq!(out_result, PrepareResult::UNRECOGNIZED); | ||
let out_result = prepare_statement(&cmd, &mut Statement::default()); | ||
assert_eq!(out_result, PrepareResult::Unrecognized); | ||
} | ||
|
||
// Testing whether the insert syntax error is handled. | ||
|
@@ -51,7 +49,7 @@ fn prepare_statement_out_syntax_error() { | |
let mut out_statement = Statement::default(); | ||
let cmd = String::from("insert"); | ||
let out_result = prepare_statement(&cmd, &mut out_statement); | ||
assert_eq!(out_result, PrepareResult::SYNTAX_ERROR); | ||
assert_eq!(out_result, PrepareResult::SyntaxError); | ||
} | ||
|
||
// Testing whether the parsing works. | ||
|