Unit Testing File Modifications

后端 未结 6 1044
轮回少年
轮回少年 2020-12-29 05:47

A common task in programs I\'ve been working on lately is modifying a text file in some way. (Hey, I\'m on Linux. Everything\'s a file. And I do large-scale system admin.)

6条回答
  •  粉色の甜心
    2020-12-29 06:16

    You might want to setup the test so that it runs inside a chroot jail, so you have all the environment the test needs, even if paths and file locations are hardcoded in the code [not really a good practice, but sometimes one gets the file locations from other places...] and then check the results via the exit code.

提交回复
热议问题