forked from mirrors/jj
tests: move testutils
from src/
to tests/
This commit is contained in:
parent
47bdffed34
commit
710d51c45b
13 changed files with 33 additions and 32 deletions
|
@ -24,6 +24,3 @@ pub mod graphlog;
|
|||
pub mod template_parser;
|
||||
pub mod templater;
|
||||
pub mod ui;
|
||||
|
||||
// TODO: make this a separate crate?
|
||||
pub mod testutils;
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
use std::cell::RefCell;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use itertools::Itertools;
|
||||
use regex::Regex;
|
||||
use tempfile::TempDir;
|
||||
|
||||
pub struct TestEnvironment {
|
||||
|
@ -86,19 +84,3 @@ impl TestEnvironment {
|
|||
pub fn get_stdout_string(assert: &assert_cmd::assert::Assert) -> String {
|
||||
String::from_utf8(assert.get_output().stdout.clone()).unwrap()
|
||||
}
|
||||
|
||||
pub fn capture_matches(
|
||||
assert: assert_cmd::assert::Assert,
|
||||
pattern: &str,
|
||||
) -> (assert_cmd::assert::Assert, Vec<String>) {
|
||||
let stdout_string = get_stdout_string(&assert);
|
||||
let assert = assert.stdout(predicates::str::is_match(pattern).unwrap());
|
||||
let matches = Regex::new(pattern)
|
||||
.unwrap()
|
||||
.captures(&stdout_string)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|m| m.unwrap().as_str().to_owned())
|
||||
.collect_vec();
|
||||
(assert, matches)
|
||||
}
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use crate::common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn smoke_test() {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use crate::common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_concurrent_operation_divergence() {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use crate::common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_git_colocated() {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::{get_stdout_string, TestEnvironment};
|
||||
use crate::common::{get_stdout_string, TestEnvironment};
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_git_push() {
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
|
||||
use std::io::Write;
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use crate::common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_gitignores() {
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
|
||||
use std::io::Write;
|
||||
|
||||
use jujutsu::testutils::{get_stdout_string, TestEnvironment};
|
||||
use crate::common::{get_stdout_string, TestEnvironment};
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_no_commit_working_copy() {
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use crate::common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
fn init_git_repo(git_repo_path: &PathBuf) {
|
||||
let git_repo = git2::Repository::init(&git_repo_path).unwrap();
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_log_with_or_without_diff() {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::{get_stdout_string, TestEnvironment};
|
||||
use crate::common::{get_stdout_string, TestEnvironment};
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_new_with_message() {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu::testutils::TestEnvironment;
|
||||
use crate::common::TestEnvironment;
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_undo_rewrite_with_child() {
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use jujutsu::testutils::{get_stdout_string, TestEnvironment};
|
||||
use crate::common::{get_stdout_string, TestEnvironment};
|
||||
|
||||
pub mod common;
|
||||
|
||||
#[test]
|
||||
fn test_untrack() {
|
||||
|
|
Loading…
Reference in a new issue