-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
da4c3dc
commit cc01221
Showing
3 changed files
with
108 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2020 Revcore Technologies Ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Test wallet command line works as expected | ||
#[macro_use] | ||
extern crate clap; | ||
|
||
#[macro_use] | ||
extern crate log; | ||
|
||
use aloevera::Error; | ||
|
||
mod common; | ||
use common::{clean_output_dir, execute_command, setup}; | ||
|
||
#[test] | ||
fn command_line_basic() -> Result<(), Error> { | ||
let test_dir = "target/test_output/command_line_basic"; | ||
setup(test_dir); | ||
let project_file = format!("{}/testproject.av", test_dir); | ||
load_app!(app); | ||
|
||
// Create Project | ||
let arg_vec = vec!["aloevera", "create", "project", &project_file]; | ||
execute_command(&app, arg_vec)?; | ||
|
||
// Import palette | ||
let arg_vec = vec![ | ||
"aloevera", | ||
"-p", | ||
&project_file, | ||
"palette", | ||
"import", | ||
"tile_wall_pal", | ||
"tests/data/input/imageset-4bpp.png", | ||
]; | ||
execute_command(&app, arg_vec)?; | ||
|
||
// Output palette and check formats | ||
let arg_vec = vec![ | ||
"aloevera", | ||
"-p", | ||
&project_file, | ||
"asm", | ||
"-f", | ||
"bin", | ||
"tests/data/input/imageset-4bpp.png", | ||
]; | ||
execute_command(&app, arg_vec)?; | ||
|
||
clean_output_dir(test_dir); | ||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2020 Revcore Technologies Ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Common functions for integration tests | ||
use clap::App; | ||
use std::fs; | ||
|
||
use aloevera::cmd; | ||
use aloevera::Error; | ||
use aloevera_util as util; | ||
|
||
pub fn clean_output_dir(test_dir: &str) { | ||
let _ = fs::remove_dir_all(test_dir); | ||
} | ||
|
||
pub fn setup(test_dir: &str) { | ||
util::init_test_logger(); | ||
clean_output_dir(test_dir); | ||
let _ = fs::create_dir_all(test_dir); | ||
} | ||
|
||
pub fn execute_command(app: &App, arg_vec: Vec<&str>) -> Result<String, Error> { | ||
let args = app.clone().get_matches_from(arg_vec); | ||
cmd::execute::execute_command(&args) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! load_app { | ||
($app: ident) => { | ||
let yml = load_yaml!("../src/bin/aloevera.yml"); | ||
let $app = clap::App::from_yaml(yml); | ||
}; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.