The ‘t’ folder

directory-structureopensource-projectssource

I'm mainly a Windows guy, programming C#, but I often do use technologies that were intended for Linux machines like git, MySQL, perl scripts, memcached, php, etc… And therefore I am exposed to these tools.

I like looking at the code base of these tools every once in a while, and something I realized in many code bases is a folder called t with a bunch of files with the t extension.

What are these files?

How come the folder doesn't have a more descriptive name?

Best Answer

What are these files?

The $PROJECT/t directory is the canonical place for a project to keep its automated unit tests.

How come the folder doesn't have a more descriptive name?

By adhering to what is basically a standard naming convention, it is perfectly descriptive of what files go into this directory.

Other programmers will expect to find a /t subdirectory containing unit tests. It would be confusing if they decided to call it something different.

I am not sure why this is a standard, but presumably it is because /t would not likely be used as a name for some other component of a project (whereas /test could feasibly refer to something different than unit tests in the context of a given project).

It is also faster to type ./t/check_something.

Related Question