Add Phobos public tests extractor script#203
Conversation
| import std.range; | ||
| import std.exception; | ||
| import std.algorithm; | ||
| import std.path; |
There was a problem hiding this comment.
On thing I'd like to add to our usual style guidelines is imports should be ordered alphabetically (it did happen at least to me to import something twice when the imports list is long). Also, I wonder how our opinionated community would feel about preferring comma-separated imports instead of one per line.
There was a problem hiding this comment.
On thing I'd like to add to our usual style guidelines is imports should be ordered alphabetically
Good idea -> dlang-community/D-Scanner#382
Also, I wonder how our opinionated community would feel about preferring comma-separated imports instead of one per line.
I personally prefer line-separated imports because it's easy to add/remove them and the git log is clean.
For such scripts one wants to do sth. like import std.* - I have seen quite many people having their convenience scripting package that public imports most of Phobos
phobos_tests_extractor.d
Outdated
|
|
||
| alias visit = ASTVisitor.visit; | ||
|
|
||
| override void visit(const Unittest u) |
phobos_tests_extractor.d
Outdated
| // scan the previous line for ddoc header | ||
| auto loc = u.location + 0; | ||
| while (sourceCode[loc] != '\n') | ||
| loc--; |
There was a problem hiding this comment.
fix alingment (here, there, and everywhere)
phobos_tests_extractor.d
Outdated
|
|
||
| // write the origin source code line | ||
| outFile.write("// Line "); | ||
| outFile.write(sourceCode[0..loc].count("\n") + 2); |
phobos_tests_extractor.d
Outdated
| "inputdir|i", &inputDir, | ||
| "outputdir|o", &outputDir, | ||
| "ignore", &ignoredFilesStr, | ||
| ); |
b9c0147 to
8ff7fe9
Compare
Sorry - parts of this file were a bit older -> |
phobos_tests_extractor.d
Outdated
|
|
||
| // file name without its parent directory, e.g. std/uni.d | ||
| string fileNameNormalized = (inputDir != ".") ? fileName.replace(inputDir, | ||
| "")[1 .. $] : fileName[1 .. $]; |
There was a problem hiding this comment.
The line break is surprising. Also I'd factor it like this:
string fileNameNormalized = (inputDir == "." ? fileName : fileName.replace(inputDir, ""))[1 .. $];
chmodzip.d
Outdated
| writefln("\texpandedSize = %s", de.expandedSize); | ||
| writefln("\tcompressedSize = %s", de.compressedSize); | ||
| writefln("\teattr = %03o, %03o", de.externalAttributes >> 16, de.externalAttributes & 0xFFFF); | ||
| writefln("\teattr = %03o, %03o", de.fileAttributes); |
There was a problem hiding this comment.
The public fileAttributes does this in the setter
travis.sh
Outdated
| dmd -m$MODEL $file | ||
| done | ||
| # TODO: fix DustMite | ||
| #(cd DustMite && dmd -m$MODEL dustmite.d) |
There was a problem hiding this comment.
There was a problem hiding this comment.
dmd -m$MODEL dustmite.d splitter.d
There was a problem hiding this comment.
There is a Makefile rule for Dustmite already, why duplicate the build commands here?
travis.sh
Outdated
|
|
||
| install_digger() { | ||
| $DIGGER build --model=$MODEL "master" | ||
| run_digger() { |
There was a problem hiding this comment.
Digger gets installed with build_digger, here we really run it
- add module prefix flag - allow single files as input as well - beautify the ddoc comment header parsing - add check for empty files - more resistant leading dot/slashes removal
36d0c0d to
d9762d7
Compare
|
Will merge now. cc @CyberShadow @MartinNowak @WalterBright |
Thanks - I wanted to get the CI working before, but well luckily it does work at Phobos :) |
Adds a simple extraction utility that dumps all public unittests from Phobos in separate files, s.t. we can run them with
rdmdand verify that all snippets on dlang.org are runnable (e.g. don't miss imports).