Skip to content

Commit

Permalink
test: bug #130 reproduced (Go tests are supposed to fail) #129 #130
Browse files Browse the repository at this point in the history
  • Loading branch information
flelli committed Jan 22, 2023
1 parent 8477ff3 commit ce108ac
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
18 changes: 18 additions & 0 deletions modules/go/nyx/test/integration/git/go_git_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,24 @@ func TestGoGitRepositoryIsCleanWithTextFileContainingLineFeedsUsingGitCommand(t
assert.NoError(t, err)
assert.True(t, clean)

// Give the local repository an identity or some further steps may fail
out = new(bytes.Buffer)
cmd = &exec.Cmd{Path: commandPath, Dir: repoDirectory, Env: os.Environ(), Args: []string{"git", "config ", "user.email", "\"jdoe@example.com\""}, Stdout: out, Stderr: out}
err = cmd.Run()
if err != nil {
fmt.Printf("output from '%v' is:\n", cmd.String())
fmt.Printf("%v\n", out.String())
}
assert.NoError(t, err)
out = new(bytes.Buffer)
cmd = &exec.Cmd{Path: commandPath, Dir: repoDirectory, Env: os.Environ(), Args: []string{"git", "config ", "user.name", "\"John Doe\""}, Stdout: out, Stderr: out}
err = cmd.Run()
if err != nil {
fmt.Printf("output from '%v' is:\n", cmd.String())
fmt.Printf("%v\n", out.String())
}
assert.NoError(t, err)

// add one file with a LF and a CRLF and test
fileName := filepath.Join(repoDirectory, "README.txt")
err = os.WriteFile(fileName, []byte("one"), 0644)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1380,8 +1380,23 @@ public void isCleanWithTextFileContainingLineFeedsUsingGitCommandTest()
System.out.println();
System.out.flush();
p.destroy();

assertTrue(JGitRepository.open(repoDirectory).isClean());

// Give the local repository an identity or some further steps may fail
p = new ProcessBuilder(new String[]{"git", "config ", "user.email", "\"jdoe@example.com\""}).directory(repoDirectory).redirectErrorStream(true).start();
p.waitFor();
System.out.println("Output from 'git config user.email \"jdoe@example.com\"' is:");
System.out.write(p.getInputStream().readAllBytes());
System.out.println();
System.out.flush();
p.destroy();
p = new ProcessBuilder(new String[]{"git", "config ", "user.name", "\"John Doe\""}).directory(repoDirectory).redirectErrorStream(true).start();
p.waitFor();
System.out.println("Output from 'git config user.name \"John Doe\"' is:");
System.out.write(p.getInputStream().readAllBytes());
System.out.println();
System.out.flush();
p.destroy();

// add one file with a LF and a CRLF and test
File f = new File(repoDirectory, "README.txt");
Expand Down

0 comments on commit ce108ac

Please sign in to comment.