Skip to content

Commit

Permalink
Merge pull request #284 from thaJeztah/cleanup_readme
Browse files Browse the repository at this point in the history
fix badges in readme, gofmt, and minor linting fix
  • Loading branch information
dnephin authored Sep 5, 2024
2 parents 9aa7888 + 732dfcf commit 8569bbc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

A collection of packages to augment `testing` and support common patterns.

[![GoDoc](https://godoc.org/gotest.tools?status.svg)](https://pkg.go.dev/gotest.tools/v3/?tab=subdirectories)
[![PkgGoDev](https://pkg.go.dev/badge/gotest.tools/v3?status.svg)](https://pkg.go.dev/gotest.tools/v3)
[![CircleCI](https://circleci.com/gh/gotestyourself/gotest.tools/tree/main.svg?style=shield)](https://circleci.com/gh/gotestyourself/gotest.tools/tree/main)
[![Go Reportcard](https://goreportcard.com/badge/gotest.tools)](https://goreportcard.com/report/gotest.tools)
[![Go Reportcard](https://goreportcard.com/badge/gotest.tools/v3)](https://goreportcard.com/report/gotest.tools/v3)

## Usage

With Go modules enabled (go1.11+)
With Go modules enabled

```
$ go get gotest.tools/v3
Expand All @@ -18,10 +18,6 @@ $ go get gotest.tools/v3
import "gotest.tools/v3/assert"
```

To use `gotest.tools` with an older version of Go that does not understand Go
module paths pin to version `v2.3.0`.


## Packages

* [assert](http://pkg.go.dev/gotest.tools/v3/assert) -
Expand Down
30 changes: 17 additions & 13 deletions internal/difflib/difflib.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
/*Package difflib is a partial port of Python difflib module.
/*
Package difflib is a partial port of Python difflib module.
Original source: https://github.com/pmezard/go-difflib
This file is trimmed to only the parts used by this repository.
*/
package difflib // import "gotest.tools/v3/internal/difflib"

func min(a, b int) int {
func minInt(a, b int) int {
if a < b {
return a
}
return b
}

func max(a, b int) int {
func maxInt(a, b int) int {
if a > b {
return a
}
Expand Down Expand Up @@ -170,12 +171,15 @@ func (m *SequenceMatcher) isBJunk(s string) bool {
// If IsJunk is not defined:
//
// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
// alo <= i <= i+k <= ahi
// blo <= j <= j+k <= bhi
//
// alo <= i <= i+k <= ahi
// blo <= j <= j+k <= bhi
//
// and for all (i',j',k') meeting those conditions,
// k >= k'
// i <= i'
// and if i == i', j <= j'
//
// k >= k'
// i <= i'
// and if i == i', j <= j'
//
// In other words, of all maximal matching blocks, return one that
// starts earliest in a, and of all those maximal matching blocks that
Expand Down Expand Up @@ -393,12 +397,12 @@ func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
if codes[0].Tag == 'e' {
c := codes[0]
i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}
codes[0] = OpCode{c.Tag, maxInt(i1, i2-n), i2, maxInt(j1, j2-n), j2}
}
if codes[len(codes)-1].Tag == 'e' {
c := codes[len(codes)-1]
i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}
codes[len(codes)-1] = OpCode{c.Tag, i1, minInt(i2, i1+n), j1, minInt(j2, j1+n)}
}
nn := n + n
groups := [][]OpCode{}
Expand All @@ -408,11 +412,11 @@ func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
// End the current group and start a new one whenever
// there is a large range with no changes.
if c.Tag == 'e' && i2-i1 > nn {
group = append(group, OpCode{c.Tag, i1, min(i2, i1+n),
j1, min(j2, j1+n)})
group = append(group, OpCode{c.Tag, i1, minInt(i2, i1+n),
j1, minInt(j2, j1+n)})
groups = append(groups, group)
group = []OpCode{}
i1, j1 = max(i1, i2-n), max(j1, j2-n)
i1, j1 = maxInt(i1, i2-n), maxInt(j1, j2-n)
}
group = append(group, OpCode{c.Tag, i1, i2, j1, j2})
}
Expand Down

0 comments on commit 8569bbc

Please sign in to comment.