Hopefully cohost doesn't lose this comment this time. (Don't write cohost comments while on wifi that's likely to drop)
So I've been thinking about this and there are many gradations possible for the degree to which tests are colocated with the code they're testing.
At one extreme, you have things like pythons doctest where tests are written in specially formatted documentation comments inside the function that they're testing.
From there you can go slightly further out to "tests are in the same file, and not separated into a separate module/class in that file from what they're testing" and then to "tests are in the same file, but in a separate module/class from what they're testing". (that second one several people below mention doing in rust)
Then there's "separate file, but the file convention is such that main code and test code is shown together by most tools" (there's a strong convention in go code to do this)
Then "separate file, but the convention groups all the test files together in most tools" (I've seen an occasional python project do this, though separate directory is more common).
Then there's "separate directory, but the directory structure mirrors that of the non-test code". (This is generally the way java projects are laid out)
Then "separate directory, and the file/directory structure is something test-specific totally separate from the way the non-test code is laid out". (Think CPAN modules and the t/ directory; I'm also used to Haskell projects using a convention like this)
Then "separate source control repository", which may strike you as horrible but is may be appropriate when you need some sort of conformance suite to test potentially multiple implementations of some standard.
I suppose one could count not writing the tests at all as the ultimate rejection of colocation, in that tests then do not exist in the same universe as the main code, but that seems silly.