about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-01-21 14:55:17 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-01-21 14:55:17 -0800
commitc9c8d6fdd145db125decffed44de396119a01ca9 (patch)
tree099d8867e832b7e6ee45858389a226858ae104a5 /src
parent885f0a2eab092cc69d9dfed347778da0ad582055 (diff)
parentb3cbe9e3c1115239997e806498fa5bc7eea7bc98 (diff)
downloadrust-c9c8d6fdd145db125decffed44de396119a01ca9.tar.gz
rust-c9c8d6fdd145db125decffed44de396119a01ca9.zip
Merge pull request #4563 from cpeterso/fix-doc-tests
Fix various doc tests
Diffstat (limited to 'src')
-rw-r--r--src/etc/extract-tests.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/etc/extract-tests.py b/src/etc/extract-tests.py
index 9d9b7817f4b..5754d234afb 100644
--- a/src/etc/extract-tests.py
+++ b/src/etc/extract-tests.py
@@ -2,11 +2,11 @@
 
 # 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
+# recognized by this tool. Expects a directory fragments/ to exist
 # under the current directory, and writes the fragments in there as
 # individual .rs files.
 
-import sys, re;
+import sys, re
 
 if len(sys.argv) < 3:
     print("Please provide an input filename")
@@ -26,7 +26,7 @@ chapter_n = 0
 while cur < len(lines):
     line = lines[cur]
     cur += 1
-    chap = re.match("# (.*)", line);
+    chap = re.match("# (.*)", line)
     if chap:
         chapter = re.sub(r"\W", "_", chap.group(1)).lower()
         chapter_n = 1
@@ -51,14 +51,30 @@ while cur < len(lines):
             else:
                 # Lines beginning with '# ' are turned into valid code
                 line = re.sub("^# ", "", line)
-                # Allow elipses in code snippets
+                # Allow ellipses in code snippets
                 line = re.sub("\.\.\.", "", line)
                 block += line
         if not ignore:
             if not re.search(r"\bfn main\b", block):
                 block = "fn main() {\n" + block + "\n}\n"
             if not re.search(r"\bextern mod std\b", block):
-                block = "extern mod std;\n" + block;
+                block = "extern mod std;\n" + block
+            block = """#[ forbid(ctypes) ];
+#[ forbid(deprecated_mode) ];
+#[ forbid(deprecated_pattern) ];
+#[ forbid(implicit_copies) ];
+#[ forbid(non_implicitly_copyable_typarams) ];
+#[ forbid(path_statement) ];
+#[ forbid(type_limits) ];
+#[ forbid(unrecognized_lint) ];
+#[ forbid(unused_imports) ];
+#[ forbid(vecs_implicitly_copyable) ];
+#[ forbid(while_true) ];
+
+#[ warn(deprecated_self) ];
+#[ warn(non_camel_case_types) ];
+#[ warn(structural_records) ];\n
+""" + block
             if xfail:
                 block = "// xfail-test\n" + block
             filename = (dest + "/" + str(chapter)