1. Shlomi Fish
  2. Quad-Pres

Commits

shl...@6a489e09-e8c2-0310-a3fb-a128a961c0b2  committed 5f49f9d

Converted stop-on-error to TAP.

  • Participants
  • Parent commits 350741c
  • Branches default

Comments (0)

Files changed (17)

File installer/tests/MANIFEST

View file
  • Ignore whitespace
 perl/t/to-be-added-later/stages.t
 perl/t/tree.t
 perl/t/workflow.t
-stop-on-error/template/slides/Contents.pm
-stop-on-error/template/slides/src/index.html.wml
-stop-on-error/template/slides/src/one.html.wml
-stop-on-error/template/slides/src/style.css
-stop-on-error/template/slides/src/three.html.wml
-stop-on-error/template/slides/src/two.html.wml
-stop-on-error/test1.bash
 template-toolkit/template/Contents.pm
 template-toolkit/template/src/index.html.wml
 template-toolkit/template/src/two.html.wml

File installer/tests/MANIFEST-DIRS

View file
  • Ignore whitespace
 credit/template/
 credit/template/src/
 gen-hd-html/
-html-correctness/
 lang-settings/
 perl/
 perl/t/

File installer/tests/Makefile

View file
  • Ignore whitespace
 all:
 
-BASH_TESTS = stop-on-error lang-settings body-dir credit gen-hd-html template-toolkit bolded-nav-links update-images
+BASH_TESTS = lang-settings body-dir credit gen-hd-html template-toolkit bolded-nav-links update-images
 
 BASH_TESTS_TARGETS = $(addprefix test-,$(BASH_TESTS))
 

File installer/tests/perl/t/lib/stop-on-error/template/slides/Contents.pm

View file
  • Ignore whitespace
+package Contents;
+
+use strict;
+
+my $contents =
+{
+    'title' => "My Lecture Title",
+    'subs' =>
+    [
+        {
+            'url' => "one.html",
+            'title' => "One - Good",
+        },
+        {
+            'url' => "two.html",
+            'title' => "Error",
+        },
+        {
+            'url' => "three.html",
+            'title' => "Three - Good",
+        },
+    ],
+    'images' =>
+    [
+        'style.css',
+    ],
+};
+
+sub get_contents
+{
+    return $contents;
+}
+
+1;

File installer/tests/perl/t/lib/stop-on-error/template/slides/src/index.html.wml

View file
  • Ignore whitespace
+#include 'template.wml'
+
+<h1><font color="red">FILL IN</font></h1>

File installer/tests/perl/t/lib/stop-on-error/template/slides/src/one.html.wml

View file
  • Ignore whitespace
+#include 'template.wml'
+
+<h1><font color="red">FILL IN</font></h1>

File installer/tests/perl/t/lib/stop-on-error/template/slides/src/style.css

View file
  • Ignore whitespace
+a.nav:link { color: green }
+a.nav:visited { color: #FF1493 /* The DeepPink Colour */  }
+a.nav:active { color: blue }
+b.nav { color : Black}
+b.plain {color : Black}
+a:hover { background-color: yellow }
+body { background-color : #FFFFFF }
+a.contents:active { color: red }
+table.mycode { border-style : solid ; border-width : thin }
+td.mycode { width : 60em }
+table.mydemo { border-style : solid ; border-width : thin }
+td.mydemo { width : 60em }
+table.note { border-style : double ; border-width : 3em}
+h3.notbold { font-weight: normal }
+font.menupath { font-family: monospace }
+b.menupathcomponent { color: red }
+font.menupathseparator { color: green }
+tt.mycode { color : #8A2BE2 /* The BlueViolet Colour */ }
+tt { color : #8A2BE2 /* The BlueViolet Colour */ }
+li.notbold { padding-bottom : 15em }
+ul.contents { list-style-type : none ; padding-left : 2em }
+ul.contentsmain { list-style-type : none ; padding-left : 0em }
+ul.point { font-size : large }
+ol.point { font-size : large }
+table.frame { border-style : solid ; border-width : thin }
+/* The border1 class for border="1"-like tables */
+table.border1 
+{
+    border-style: solid; 
+    border-width: 1px; 
+    border-color: #eeeeee gray gray #eeeeee;
+}
+table.border1 > tbody > tr > th, table.border1 > tbody > tr > td 
+{
+    border-style : solid; 
+    border-width: 1px; 
+    border-color: gray #eeeeee #eeeeee gray;
+}
+/* Vim-HTML markup codes */
+.Comment { color: #0000ff; }
+.Constant { color: #ff00ff; }
+.Identifier { color: #008b8b; }
+.Special { color: #6a5acd; }
+.Statement { color: #a52a2a; font-weight: bold; }
+.PreProc { color: #a020f0; }
+.Type { color: #2e8b57; font-weight: bold; }

File installer/tests/perl/t/lib/stop-on-error/template/slides/src/three.html.wml

View file
  • Ignore whitespace
+#include 'template.wml'
+
+<h1><font color="red">FILL IN</font></h1>

File installer/tests/perl/t/lib/stop-on-error/template/slides/src/two.html.wml

View file
  • Ignore whitespace
+#include 'template.wml'
+
+<ol
+
+<li>
+Hello.
+</li>
+</ol>

File installer/tests/perl/t/stop-on-error.t

View file
  • Ignore whitespace
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use File::Path;
+use File::Copy::Recursive qw(dircopy fcopy);
+use Cwd;
+use IO::All;
+use Test::Trap qw( trap $trap :flow:stderr(systemsafe):stdout(systemsafe):warn );
+
+my $io_dir = "t/data/in-out-stop-on-error";
+rmtree ($io_dir);
+mkpath ($io_dir);
+
+sub check_files
+{
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    my $output_dir = shift;
+
+    return ok (((-e "$output_dir/index.html") && (-e "$output_dir/two.html")),
+        "The requested files exist in the output directory"
+    );
+}
+
+sub perform_test
+{
+    my $orig_dir = Cwd::getcwd();
+
+    chdir($io_dir);
+
+    # TEST
+    ok (!system("quadp", "setup", "slides", "--dest-dir=$io_dir/dest"),
+        "Quadp setup is OK."
+    );
+
+    my $slides_dir = "$io_dir/slides";
+    my $tmpl_dir = "$orig_dir/t/lib/stop-on-error/template";
+
+    fcopy("$tmpl_dir/Contents.pm", "$slides_dir/Contents.pm",);
+    foreach my $file (glob("$tmpl_dir/src/*.html.wml"))
+    {
+        fcopy($file, "$slides_dir/src");
+    }
+
+    my $pwd = Cwd::getcwd();
+
+    # TEST
+    trap {
+        chdir($slides_dir);
+        ok(
+            system("quadp", "render", "-a") != 0,
+            "quadp render -a fails",
+        );
+    };
+
+    chdir ($pwd);
+
+    # TEST
+    like ($trap->stderr(),
+        qr{Quad-Pres Error:},
+        "Find an error in the error file",
+    );
+
+    # TEST
+    ok (!(-e "dest/two.html"), 
+        "Faulty file was not found in the directory"
+    );
+
+    chdir($orig_dir);
+}
+
+perform_test();

File installer/tests/stop-on-error/template/slides/Contents.pm

  • Ignore whitespace
-package Contents;
-
-use strict;
-
-my $contents =
-{
-    'title' => "My Lecture Title",
-    'subs' =>
-    [
-        {
-            'url' => "one.html",
-            'title' => "One - Good",
-        },
-        {
-            'url' => "two.html",
-            'title' => "Error",
-        },
-        {
-            'url' => "three.html",
-            'title' => "Three - Good",
-        },
-    ],
-    'images' =>
-    [
-        'style.css',
-    ],
-};
-
-sub get_contents
-{
-    return $contents;
-}
-
-1;

File installer/tests/stop-on-error/template/slides/src/index.html.wml

  • Ignore whitespace
-#include 'template.wml'
-
-<h1><font color="red">FILL IN</font></h1>

File installer/tests/stop-on-error/template/slides/src/one.html.wml

  • Ignore whitespace
-#include 'template.wml'
-
-<h1><font color="red">FILL IN</font></h1>

File installer/tests/stop-on-error/template/slides/src/style.css

  • Ignore whitespace
-a.nav:link { color: green }
-a.nav:visited { color: #FF1493 /* The DeepPink Colour */  }
-a.nav:active { color: blue }
-b.nav { color : Black}
-b.plain {color : Black}
-a:hover { background-color: yellow }
-body { background-color : #FFFFFF }
-a.contents:active { color: red }
-table.mycode { border-style : solid ; border-width : thin }
-td.mycode { width : 60em }
-table.mydemo { border-style : solid ; border-width : thin }
-td.mydemo { width : 60em }
-table.note { border-style : double ; border-width : 3em}
-h3.notbold { font-weight: normal }
-font.menupath { font-family: monospace }
-b.menupathcomponent { color: red }
-font.menupathseparator { color: green }
-tt.mycode { color : #8A2BE2 /* The BlueViolet Colour */ }
-tt { color : #8A2BE2 /* The BlueViolet Colour */ }
-li.notbold { padding-bottom : 15em }
-ul.contents { list-style-type : none ; padding-left : 2em }
-ul.contentsmain { list-style-type : none ; padding-left : 0em }
-ul.point { font-size : large }
-ol.point { font-size : large }
-table.frame { border-style : solid ; border-width : thin }
-/* The border1 class for border="1"-like tables */
-table.border1 
-{
-    border-style: solid; 
-    border-width: 1px; 
-    border-color: #eeeeee gray gray #eeeeee;
-}
-table.border1 > tbody > tr > th, table.border1 > tbody > tr > td 
-{
-    border-style : solid; 
-    border-width: 1px; 
-    border-color: gray #eeeeee #eeeeee gray;
-}
-/* Vim-HTML markup codes */
-.Comment { color: #0000ff; }
-.Constant { color: #ff00ff; }
-.Identifier { color: #008b8b; }
-.Special { color: #6a5acd; }
-.Statement { color: #a52a2a; font-weight: bold; }
-.PreProc { color: #a020f0; }
-.Type { color: #2e8b57; font-weight: bold; }

File installer/tests/stop-on-error/template/slides/src/three.html.wml

  • Ignore whitespace
-#include 'template.wml'
-
-<h1><font color="red">FILL IN</font></h1>

File installer/tests/stop-on-error/template/slides/src/two.html.wml

  • Ignore whitespace
-#include 'template.wml'
-
-<ol
-
-<li>
-Hello.
-</li>
-</ol>

File installer/tests/stop-on-error/test1.bash

  • Ignore whitespace
-#!/bin/bash
-
-if [ -e in-out ] ; then
-    rm -fr in-out
-fi
-
-mkdir "in-out"
-
-cd "in-out"
-quadp setup slides --dest-dir=`pwd`/dest
-cp -rf ../template/slides/{Contents.pm,src} ./slides/
-if (cd slides && quadp render -a) > dump.txt 2>&1 ; then
-    echo "Error! quadp render -a did not stop on a broken input." 1>&2
-    exit 1
-fi
-if ! grep '^Quad-Pres Error:' dump.txt > /dev/null ; then
-    echo "Could not find an error in the error file" 1>&2
-    exit 1
-fi
-if [ -e dest/two.html ] ; then
-    echo "Error! The faulty file was found in the directory." 1>&2
-    exit 1
-fi
-
-echo "Stop on WML Error Test Passed"
-
-