Home >Backend Development >Golang >Can Gomega print complete strings like ginkgo?

Can Gomega print complete strings like ginkgo?

PHPz
PHPzforward
2024-02-09 08:33:32590browse

Can Gomega print complete strings like ginkgo?

php editor Yuzu Hello! Regarding the question you mentioned, Gomega and ginkgo are both popular testing frameworks in the Go language. While they have similarities in terms of testing, there are some differences in printing the complete string. In the case of Gomega, it provides some convenient functions and assertions, but when printing a string, only part of it is displayed, not the complete string. Ginkgo can print the complete string, which is very helpful for debugging and troubleshooting problems. Therefore, if you need to print the complete string, it is recommended to use ginkgo for testing. hope it is of help to you!

Question content

Error printing example of unit test:

expected
              <string>: "...up - finish..."
          to equal               |
              <string>: "...up - vault ..."

Is there a way to increase the printing limit, this is simply impractical... There were at least 100 signs or something like that...

edit: I may not have provided enough information:

Vault ...
Finish...

This is not the only different part of the string, if an error occurs it can be difficult to read without more context. There should be a way to allow full comparison printing shouldn't there? Similar to the situation in nodejs chai.

Solution

https://www.php.cn/link/e3c92f539bc17efbcc0c2e5229efa268Look at this, onsi replied. Check out the format package.

The above is the detailed content of Can Gomega print complete strings like ginkgo?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete