aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/suggestion.rs74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/suggestion.rs b/src/suggestion.rs
index 0e9b7b8..2c92e6a 100644
--- a/src/suggestion.rs
+++ b/src/suggestion.rs
@@ -200,80 +200,6 @@ mod tests {
use super::*;
#[test]
- fn unified_diff() {
- use unidiff::PatchSet;
-
- let diff = r#"--- a/command/pr.go
-+++ b/command/pr.go
-@@ -1,9 +1,11 @@
- package command
-
- import (
-+ "bufio" // used to input comment
- "errors"
- "fmt"
- "io"
-+ "os" // used to input comment
-"#;
-
- let mut patch = PatchSet::new();
- patch.parse(diff).unwrap();
-
- println!("{:?}", patch);
- println!("{}", patch);
-
- let lines = patch.files_mut()[0].hunks_mut()[0].lines_mut();
-
- // for line in &lines {
- // if line.is_removed() {
- // } else if line.is_added() {
- // line.line_type = unidiff::LINE_TYPE_CONTEXT.to_owned();
- // }
- // }
-
- lines
- .iter_mut()
- .filter(|l| !l.is_removed())
- // .map(|l| {
- .for_each(|l| {
- if l.is_added() {
- l.line_type = unidiff::LINE_TYPE_CONTEXT.to_owned();
- }
- });
-
- lines[lines.len() - 2].line_type = unidiff::LINE_TYPE_REMOVED.to_owned();
-
- patch.files_mut()[0].hunks_mut()[0].append(unidiff::Line::new(
- r#" "os""#,
- unidiff::LINE_TYPE_ADDED,
- ));
-
- println!("{}", patch);
- }
-
- #[test]
- fn read_git_blob() {
- use std::path::Path;
-
- use git2::Repository;
-
- let repo = Repository::open("./private/suggestion-test").unwrap();
- let commit = repo.find_commit("b58be52880a0a0c0d397052351be31f19acdeca4".parse().unwrap()).unwrap();
-
- let object = commit
- .tree().unwrap()
- .get_path(Path::new("src/server.rs")).unwrap()
- .to_object(&repo).unwrap();
-
- let blob = object
- .as_blob().unwrap()
- .content();
-
- println!("{:?}", commit);
- println!("{}", std::str::from_utf8(blob).unwrap());
- }
-
- #[test]
fn suggestion_diff_with_repo_generates_diff() {
use tempfile::tempdir;