我如何检查重构的时候我没有破坏任何东西? [英] How can I check that I didn't break anything when refactoring?

查看:119
本文介绍了我如何检查重构的时候我没有破坏任何东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将踏上的某些功能重构在我的code一个回合。我有单元​​测试,以确保我没有破坏任何东西,一个漂亮的数额,但我不知道他们给我的覆盖面。是否有可以分析code和看到的功能保持不变的工具吗?

I'm about to embark on a bout of refactoring of some functions in my code. I have a nice amount of unit tests that will ensure I didn't break anything, but I'm not sure about the coverage they give me. Are there any tools that can analyze the code and see that the functionality remains the same?

我打算重构一些比较孤立的code,所以我并不需要检查整个程序,只是我工作的地方。

I plan to refactor some rather isolated code, so I don't need to check the entire program, just the areas that I'm working on.

有关的背景下,code我工作在C / C ++,我在Linux上使用与海湾合作委员会和VIM。

For context, the code I'm working on is in C/C++, and I work in Linux with GCC and VIM.

推荐答案

的gcov 会给你覆盖率信息单元测试。

gcov will give you coverage information for your unit tests.

这是很难回答以精确的方式你的问题不知道更多关于你的计划进行重构。

It's difficult to answer your question in an accurate manner without knowing more about the refactorings you plan to perform.

有人可能会给出一个建议是进行小迭代,而不是重构很多很多你的code基的部分,然后实现一切休息。

An advice one might give is to proceed with small iterations instead of refactoring lots and lots of parts of your code base and then realize everything breaks.

参考:的GNU覆盖工具 - 一个简短的教程

这篇关于我如何检查重构的时候我没有破坏任何东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆