doc: Remove extract-tests.js and run-tests.sh

The tutorial tests are run as part of the test suite now.
This commit is contained in:
Brian Anderson 2012-01-20 19:57:45 -08:00
parent 327c8bc733
commit 2aabccc3ba
2 changed files with 0 additions and 52 deletions

View File

@ -1,44 +0,0 @@
#!/usr/local/bin/node
/***
* Script for extracting compilable fragments from markdown
* documentation. See prep.js for a description of the format
* recognized by this tool. Expects a directory fragements/ to exist
* under the current directory, and writes the fragments in there as
* individual .rs files.
*/
var fs = require("fs");
if (!process.argv[2]) {
console.log("Please provide an input file name.");
process.exit(1);
}
var lines = fs.readFileSync(process.argv[2]).toString().split(/\n\r?/g);
var cur = 0, line, chapter, chapter_n;
while ((line = lines[cur++]) != null) {
var chap = line.match(/^# (.*)/);
if (chap) {
chapter = chap[1].toLowerCase().replace(/\W/g, "_");
chapter_n = 1;
} else if (/^~~~/.test(line)) {
var block = "", ignore = false;
while ((line = lines[cur++]) != null) {
if (/^\s*## (?:notrust|ignore)/.test(line)) ignore = true;
else if (/^~~~/.test(line)) break;
else block += line.replace(/^# /, "") + "\n";
}
if (!ignore) {
if (!/\bfn main\b/.test(block)) {
if (/(^|\n) *(native|use|mod|import|export)\b/.test(block))
block += "\nfn main() {}\n";
else block = "fn main() {\n" + block + "\n}\n";
}
if (!/\buse std\b/.test(block)) block = "use std;\n" + block;
var filename = "fragments/" + chapter + "_" + (chapter_n++) + ".rs";
fs.writeFileSync(filename, block);
}
}
}

View File

@ -1,8 +0,0 @@
#!/bin/bash
rm -f fragments/*.rs
mkdir -p fragments
node extract-tests.js $1
for F in `ls fragments/*.rs`; do
$RUSTC $F > /dev/null
if [[ $? != 0 ]] ; then echo $F; fi
done