Coder Social home page Coder Social logo

Comments (3)

chavacava avatar chavacava commented on June 10, 2024

Hi @mfederowicz, thanks for reporting the issue.
Is not clear to me in which cases tests try to compare strings with color codes.

from revive.

mfederowicz avatar mfederowicz commented on June 10, 2024

in TestReviveFormat test there is:

errorMsgs := []string{
		"(91, 3)  https://revive.run/r#unreachable-code  unreachable code after this statement",
		"(98, 3)  https://revive.run/r#unreachable-code  unreachable code after this statement",
		"(15, 2)  https://revive.run/r#if-return         redundant if ...; err != nil check, just return error instead.",
		"(88, 3)  https://revive.run/r#if-return         redundant if ...; err != nil check, just return error instead.",
		"(95, 3)  https://revive.run/r#if-return         redundant if ...; err != nil check, just return error instead.",
	}
	for _, errorMsg := range errorMsgs {
		if !strings.Contains(failures, errorMsg) {
			t.Fatalf("Expected formatted failures\n'%s'\nto contain\n'%s', but it didn't.", failures, errorMsg)
		}
	}

when we try if !strings.Contains(failures, errorMsg) variable failures have output from formatter with color marks and compare

(91, 3) https://revive.run/r#unreachable-code unreachable code after this statement <- against the same string but wrapped with ascii color markers (under console you see colors: green, red, yellow) results with false :(

of course when you run go test ./... in main directory there is no error, error is when you run go test in /revivelib directory

from revive.

chavacava avatar chavacava commented on June 10, 2024

Closed by #926

from revive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.