From e62fc613f97fa91f768d2ad2108dfec9e83c70e4 Mon Sep 17 00:00:00 2001 From: Jelle Hulter Date: Fri, 14 Jan 2022 15:41:39 +0100 Subject: [PATCH] Updated Chroma to v0.10.0 Fixed tests --- go.mod | 2 +- go.sum | 4 +- modules/highlight/highlight_test.go | 54 +++++++++++++------------- modules/markup/orgmode/orgmode_test.go | 8 ++-- services/gitdiff/gitdiff_test.go | 3 +- 5 files changed, 35 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index ea7a3108f5633..a5776c68ca77c 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/NYTimes/gziphandler v1.1.1 github.com/ProtonMail/go-crypto v0.0.0-20210705153151-cc34b1f6908b // indirect github.com/PuerkitoBio/goquery v1.7.0 - github.com/alecthomas/chroma v0.9.4 + github.com/alecthomas/chroma v0.10.0 github.com/andybalholm/brotli v1.0.3 // indirect github.com/andybalholm/cascadia v1.2.0 // indirect github.com/blevesearch/bleve/v2 v2.3.0 diff --git a/go.sum b/go.sum index 71ca3f67e1f6a..492861f039f35 100644 --- a/go.sum +++ b/go.sum @@ -94,8 +94,8 @@ github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4Rq github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.2-0.20200305040604-4f3623dce67a/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s= github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= -github.com/alecthomas/chroma v0.9.4 h1:YL7sOAE3p8HS96T9km7RgvmsZIctqbK1qJ0b7hzed44= -github.com/alecthomas/chroma v0.9.4/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= +github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= +github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= diff --git a/modules/highlight/highlight_test.go b/modules/highlight/highlight_test.go index 3f47b6a48f65d..2f305bb589c93 100644 --- a/modules/highlight/highlight_test.go +++ b/modules/highlight/highlight_test.go @@ -40,20 +40,19 @@ steps: - go test -v -race -coverprofile=coverage.txt -covermode=atomic `, want: []string{ - `kind: pipeline`, - `name: default`, - ` -`, - `steps:`, - `- name: test`, - ` image: golang:1.13`, - ` environment:`, - ` GOPROXY: https://goproxy.cn`, - ` commands:`, - ` - go get -u`, - ` - go build -v`, - ` - go test -v -race -coverprofile=coverage.txt -covermode=atomic -`, + `kind: pipeline`, + `name: default`, + ``, + `steps:`, + `- name: test`, + ` image: golang:1.13`, + ` environment:`, + ` GOPROXY: https://goproxy.cn`, + ` commands:`, + ` - go get -u`, + ` - go build -v`, + ` - go test -v -race -coverprofile=coverage.txt -covermode=atomic +`, ` `, }, @@ -76,20 +75,19 @@ steps: - go test -v -race -coverprofile=coverage.txt -covermode=atomic `, want: []string{ - `kind: pipeline`, - `name: default `, - ` -`, - `steps:`, - `- name: test`, - ` image: golang:1.13`, - ` environment:`, - ` GOPROXY: https://goproxy.cn`, - ` commands:`, - ` - go get -u`, - ` - go build -v`, - ` - go test -v -race -coverprofile=coverage.txt -covermode=atomic`, - ` `, + `kind: pipeline`, + `name: default `, + ``, + `steps:`, + `- name: test`, + ` image: golang:1.13`, + ` environment:`, + ` GOPROXY: https://goproxy.cn`, + ` commands:`, + ` - go get -u`, + ` - go build -v`, + ` - go test -v -race -coverprofile=coverage.txt -covermode=atomic`, + ` `, }, }, } diff --git a/modules/markup/orgmode/orgmode_test.go b/modules/markup/orgmode/orgmode_test.go index 81d0d66a76c5b..38c010ef68d94 100644 --- a/modules/markup/orgmode/orgmode_test.go +++ b/modules/markup/orgmode/orgmode_test.go @@ -77,9 +77,9 @@ func HelloWorld() { } #+end_src `, `
-
// HelloWorld prints "Hello World"
-func HelloWorld() {
-	fmt.Println("Hello World")
-}
+
// HelloWorld prints "Hello World"
+func HelloWorld() {
+	fmt.Println("Hello World")
+}
`) } diff --git a/services/gitdiff/gitdiff_test.go b/services/gitdiff/gitdiff_test.go index b64ac092aadad..104df967885d5 100644 --- a/services/gitdiff/gitdiff_test.go +++ b/services/gitdiff/gitdiff_test.go @@ -715,7 +715,8 @@ func TestDiffToHTML_14231(t *testing.T) { diffRecord := diffMatchPatch.DiffMain(highlight.Code("main.v", "", " run()\n"), highlight.Code("main.v", "", " run(db)\n"), true) diffRecord = diffMatchPatch.DiffCleanupEfficiency(diffRecord) - expected := ` run(db)` + expected := ` run(db) +` output := diffToHTML("main.v", diffRecord, DiffLineAdd) assertEqual(t, expected, output.Content)