jasmine-headless-webkit 0.7.3.1 → 0.7.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. data/Guardfile +3 -2
  2. data/bin/jasmine-headless-webkit +1 -1
  3. data/ext/jasmine-webkit-specrunner/Page.cpp +8 -21
  4. data/ext/jasmine-webkit-specrunner/Page.h +11 -15
  5. data/ext/jasmine-webkit-specrunner/Runner.cpp +86 -110
  6. data/ext/jasmine-webkit-specrunner/Runner.h +23 -26
  7. data/ext/jasmine-webkit-specrunner/common.pri +2 -2
  8. data/ext/jasmine-webkit-specrunner/specrunner.cpp +0 -1
  9. data/ext/jasmine-webkit-specrunner/specrunner.pro +1 -0
  10. data/lib/jasmine/files_list.rb +24 -24
  11. data/lib/jasmine/headless.rb +1 -1
  12. data/lib/jasmine/headless/spec_file_analyzer.rb +1 -1
  13. data/lib/jasmine/headless/version.rb +1 -1
  14. data/lib/qt/qmake.rb +1 -5
  15. data/skel/template.html.erb +8 -45
  16. data/spec/files/UTF-8-test.txt +0 -0
  17. data/spec/javascripts/headless_reporter_result_spec.coffee +14 -0
  18. data/spec/javascripts/{jasmine.headless-reporter_spec.coffee → jasmine.HeadlessConsoleReporter_spec.coffee} +2 -2
  19. data/spec/javascripts/support/jasmine.yml +1 -1
  20. data/spec/lib/jasmine/files_list_spec.rb +6 -3
  21. data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +41 -30
  22. data/spec/lib/qt/qmake_spec.rb +0 -6
  23. data/vendor/assets/coffeescripts/headless_reporter_result.coffee +46 -0
  24. data/vendor/assets/coffeescripts/intense.coffee +27 -0
  25. data/{jasmine/jasmine.headless-reporter.coffee → vendor/assets/coffeescripts/jasmine-extensions.coffee} +5 -90
  26. data/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +86 -0
  27. data/vendor/assets/coffeescripts/prolog.coffee +73 -0
  28. data/{js-lib → vendor/assets/javascripts}/beautify-html.js +0 -0
  29. data/vendor/assets/javascripts/headless_reporter_result.js +72 -0
  30. data/vendor/assets/javascripts/intense.js +37 -0
  31. data/vendor/assets/javascripts/jasmine-extensions.js +101 -0
  32. data/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +96 -0
  33. data/{js-lib → vendor/assets/javascripts}/jsDump.js +0 -0
  34. data/vendor/assets/javascripts/prolog.js +89 -0
  35. metadata +28 -33
  36. data/dev-bin/hooks/pre-commit +0 -5
  37. data/dev-bin/install-hooks +0 -6
  38. data/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp +0 -149
  39. data/ext/jasmine-webkit-specrunner/ConsoleOutput.h +0 -39
  40. data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp +0 -129
  41. data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h +0 -32
  42. data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.pro +0 -7
  43. data/ext/jasmine-webkit-specrunner/Page_test.cpp +0 -43
  44. data/ext/jasmine-webkit-specrunner/Page_test.h +0 -27
  45. data/ext/jasmine-webkit-specrunner/Page_test.pro +0 -6
  46. data/ext/jasmine-webkit-specrunner/ReportFileOutput.cpp +0 -54
  47. data/ext/jasmine-webkit-specrunner/ReportFileOutput.h +0 -37
  48. data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp +0 -88
  49. data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.h +0 -26
  50. data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro +0 -7
  51. data/ext/jasmine-webkit-specrunner/test.pri +0 -3
  52. data/ext/jasmine-webkit-specrunner/test.rb +0 -31
  53. data/jasmine/jasmine.headless-reporter.js +0 -231
@@ -1,39 +0,0 @@
1
- #ifndef JHW_CONSOLE_OUTPUT
2
- #define JHW_CONSOLE_OUTPUT
3
-
4
- #include <QObject>
5
- #include <iostream>
6
- #include <QStack>
7
- #include <QStringList>
8
-
9
- class ConsoleOutput : public QObject {
10
- public:
11
- ConsoleOutput();
12
-
13
- void passed(const QString &specDetail);
14
- void failed(const QString &specDetail);
15
- void errorLog(const QString &msg, int lineNumber, const QString &sourceID);
16
- void internalLog(const QString &note, const QString &msg);
17
- void consoleLog(const QString &msg);
18
- void logSpecFilename(const QString &name);
19
- void logSpecResult(const QString &result);
20
-
21
- void reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration);
22
- void reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration);
23
- void reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration);
24
-
25
- std::ostream *outputIO;
26
- QStack<QString> successes;
27
- QStack<QString> failures;
28
-
29
- bool showColors;
30
- bool consoleLogUsed;
31
- private:
32
- void green();
33
- void clear();
34
- void red();
35
- void yellow();
36
- void formatTestResults(const QString &totalTests, const QString &failedTests, const QString &duration);
37
- };
38
-
39
- #endif
@@ -1,129 +0,0 @@
1
- #include <QtTest/QtTest>
2
-
3
- #include "ConsoleOutput.h"
4
- #include "ConsoleOutput_test.h"
5
-
6
- using namespace std;
7
-
8
- ConsoleOutputTest::ConsoleOutputTest() : QObject() {}
9
-
10
- void ConsoleOutputTest::testPassed() {
11
- stringstream buffer;
12
- ConsoleOutput output;
13
-
14
- output.consoleLogUsed = true;
15
- output.outputIO = &buffer;
16
- output.passed("test");
17
- QVERIFY(buffer.str() == ".");
18
- QVERIFY(output.successes.size() == 1);
19
- QVERIFY(output.failures.size() == 0);
20
- QVERIFY(output.consoleLogUsed == false);
21
- }
22
-
23
- void ConsoleOutputTest::testFailed() {
24
- stringstream buffer;
25
- ConsoleOutput output;
26
-
27
- output.consoleLogUsed = true;
28
- output.outputIO = &buffer;
29
- output.failed("test");
30
- QVERIFY(buffer.str() == "F");
31
- QVERIFY(output.successes.size() == 0);
32
- QVERIFY(output.failures.size() == 1);
33
- QVERIFY(output.consoleLogUsed == false);
34
- }
35
-
36
- void ConsoleOutputTest::testErrorLog() {
37
- stringstream buffer;
38
- ConsoleOutput output;
39
-
40
- output.outputIO = &buffer;
41
- output.errorLog("message", 1, "source");
42
- QVERIFY(buffer.str() == "[error] source:1 : message\n");
43
- }
44
-
45
- void ConsoleOutputTest::testInternalLog() {
46
- stringstream buffer;
47
- ConsoleOutput output;
48
-
49
- output.outputIO = &buffer;
50
- output.internalLog("note", "message");
51
- QVERIFY(buffer.str() == "[note] message\n");
52
- }
53
-
54
- void ConsoleOutputTest::testConsoleLog() {
55
- stringstream buffer;
56
- ConsoleOutput output;
57
-
58
- output.consoleLogUsed = false;
59
- output.outputIO = &buffer;
60
- output.consoleLog("log");
61
- QVERIFY(buffer.str() == "\n[console] log\n");
62
- }
63
-
64
- void ConsoleOutputTest::testConsoleLogUsed() {
65
- stringstream buffer;
66
- ConsoleOutput output;
67
-
68
- output.consoleLogUsed = true;
69
- output.outputIO = &buffer;
70
- output.consoleLog("log");
71
- QVERIFY(buffer.str() == "[console] log\n");
72
- }
73
-
74
- void ConsoleOutputTest::testLogSpecFilename() {
75
- stringstream buffer;
76
- ConsoleOutput output;
77
-
78
- output.outputIO = &buffer;
79
- output.logSpecFilename("whatever");
80
- QVERIFY(buffer.str() == "\n\nwhatever\n");
81
- }
82
-
83
- void ConsoleOutputTest::testLogSpecResult() {
84
- stringstream buffer;
85
- ConsoleOutput output;
86
-
87
- output.outputIO = &buffer;
88
- output.logSpecResult("whatever");
89
- QVERIFY(buffer.str() == " whatever\n");
90
- }
91
-
92
- void ConsoleOutputTest::testReportResultsFailedSingular() {
93
- stringstream buffer;
94
- ConsoleOutput output;
95
-
96
- output.outputIO = &buffer;
97
- output.reportFailure("1", "1", "1");
98
- QVERIFY(buffer.str() == "\nFAIL: 1 test, 1 failure, 1 sec.\n");
99
- }
100
-
101
- void ConsoleOutputTest::testReportResultsFailedPlural() {
102
- stringstream buffer;
103
- ConsoleOutput output;
104
-
105
- output.outputIO = &buffer;
106
- output.reportFailure("2", "2", "2");
107
- QVERIFY(buffer.str() == "\nFAIL: 2 tests, 2 failures, 2 secs.\n");
108
- }
109
-
110
- void ConsoleOutputTest::testReportResultsSucceeded() {
111
- stringstream buffer;
112
- ConsoleOutput output;
113
-
114
- output.outputIO = &buffer;
115
- output.reportSuccess("2", "2", "2");
116
- QVERIFY(buffer.str() == "\nPASS: 2 tests, 2 failures, 2 secs.\n");
117
- }
118
-
119
- void ConsoleOutputTest::testReportResultsSucceededWithJSErrors() {
120
- stringstream buffer;
121
- ConsoleOutput output;
122
-
123
- output.outputIO = &buffer;
124
- output.reportSuccessWithJSErrors("2", "2", "2");
125
- QVERIFY(buffer.str() == "\nPASS with JS errors: 2 tests, 2 failures, 2 secs.\n");
126
- }
127
-
128
- QTEST_MAIN(ConsoleOutputTest);
129
-
@@ -1,32 +0,0 @@
1
- #ifndef JHW_TEST_CONSOLE_OUTPUT
2
- #define JHW_TEST_CONSOLE_OUTPUT
3
-
4
- #include <QtTest/QtTest>
5
- #include <iostream>
6
- #include <sstream>
7
- #include <string>
8
-
9
- #include "ConsoleOutput.h"
10
-
11
- class ConsoleOutputTest : public QObject {
12
- Q_OBJECT
13
- public:
14
- ConsoleOutputTest();
15
-
16
- private slots:
17
- void testPassed();
18
- void testFailed();
19
- void testErrorLog();
20
- void testInternalLog();
21
- void testConsoleLog();
22
- void testConsoleLogUsed();
23
- void testLogSpecFilename();
24
- void testLogSpecResult();
25
-
26
- void testReportResultsFailedSingular();
27
- void testReportResultsFailedPlural();
28
- void testReportResultsSucceeded();
29
- void testReportResultsSucceededWithJSErrors();
30
- };
31
-
32
- #endif
@@ -1,7 +0,0 @@
1
- include(common.pri)
2
- include(test.pri)
3
-
4
- SOURCES += ConsoleOutput_test.cpp
5
- HEADERS += ConsoleOutput_test.h
6
-
7
-
@@ -1,43 +0,0 @@
1
- #include <QtTest/QtTest>
2
-
3
- #include "Page.h"
4
- #include "Page_test.h"
5
-
6
- PageTest::PageTest() : QObject(), internalLogCalled(false) {
7
- }
8
-
9
- void PageTest::internalLog(const QString &, const QString &) {
10
- internalLogCalled = true;
11
- }
12
-
13
- void PageTest::consoleLog(const QString &, int, const QString &) {
14
- consoleLogCalled = true;
15
- }
16
-
17
- void PageTest::testJavaScriptConfirmWithLog() {
18
- connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString)));
19
- internalLogCalled = false;
20
-
21
- page.mainFrame()->setHtml("<script>confirm('test')</script>");
22
- QVERIFY(internalLogCalled);
23
- }
24
-
25
- void PageTest::testJavaScriptConfirmWithoutLog() {
26
- connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString)));
27
- internalLogCalled = false;
28
-
29
- page.oneFalseConfirm();
30
- page.mainFrame()->setHtml("<script>confirm('test')</script>");
31
- QVERIFY(!internalLogCalled);
32
- }
33
-
34
- void PageTest::testJavaScriptConsoleMessage() {
35
- connect(&page, SIGNAL(consoleLog(QString, int, QString)), this, SLOT(consoleLog(QString, int, QString)));
36
- consoleLogCalled = false;
37
-
38
- page.mainFrame()->setHtml("<script>cats();</script>");
39
- QVERIFY(consoleLogCalled);
40
- }
41
-
42
- QTEST_MAIN(PageTest);
43
-
@@ -1,27 +0,0 @@
1
- #ifndef JHW_TEST_PAGE
2
- #define JHW_TEST_PAGE
3
-
4
- #include <QtTest/QtTest>
5
-
6
- #include "Page.h"
7
-
8
- class PageTest : public QObject {
9
- Q_OBJECT
10
- public:
11
- PageTest();
12
-
13
- private:
14
- bool internalLogCalled;
15
- bool consoleLogCalled;
16
- Page page;
17
-
18
- private slots:
19
- void internalLog(const QString &note, const QString &msg);
20
- void consoleLog(const QString &message, int lineNumber, const QString &source);
21
- void testJavaScriptConfirmWithLog();
22
- void testJavaScriptConfirmWithoutLog();
23
- void testJavaScriptConsoleMessage();
24
- };
25
-
26
- #endif
27
-
@@ -1,6 +0,0 @@
1
- include(common.pri)
2
- include(test.pri)
3
-
4
- SOURCES += Page_test.cpp
5
- HEADERS += Page_test.h
6
-
@@ -1,54 +0,0 @@
1
- #include "ReportFileOutput.h"
2
-
3
- using namespace std;
4
-
5
- ReportFileOutput::ReportFileOutput() : QObject() {
6
- reset();
7
- }
8
-
9
- void ReportFileOutput::reset() {
10
- buffer = new stringstream();
11
-
12
- outputIO = buffer;
13
- }
14
-
15
- void ReportFileOutput::passed(const QString &specDetail) {
16
- *outputIO << "PASS||" << qPrintable(specDetail) << std::endl;
17
- successes.push(specDetail);
18
- }
19
-
20
- void ReportFileOutput::failed(const QString &specDetail) {
21
- *outputIO << "FAIL||" << qPrintable(specDetail) << std::endl;
22
- failures.push(specDetail);
23
- }
24
-
25
- void ReportFileOutput::errorLog(const QString &msg, int lineNumber, const QString &sourceID) {
26
- *outputIO << "ERROR||" << qPrintable(msg) << "||" << qPrintable(sourceID) << ":" << lineNumber << std::endl;
27
- }
28
-
29
- void ReportFileOutput::consoleLog(const QString &msg) {
30
- *outputIO << "CONSOLE||" << qPrintable(msg) << std::endl;
31
- }
32
-
33
- void ReportFileOutput::internalLog(const QString &, const QString &) {}
34
- void ReportFileOutput::logSpecFilename(const QString &) {}
35
- void ReportFileOutput::logSpecResult(const QString &) {}
36
-
37
- void ReportFileOutput::reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration) {
38
- reportTotals(totalTests, failedTests, duration, false);
39
- }
40
-
41
- void ReportFileOutput::reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration) {
42
- reportTotals(totalTests, failedTests, duration, false);
43
- }
44
-
45
- void ReportFileOutput::reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration) {
46
- reportTotals(totalTests, failedTests, duration, true);
47
- }
48
-
49
- void ReportFileOutput::reportTotals(const QString &totalTests, const QString &failedTests, const QString &duration, bool hasJavaScriptError) {
50
- *outputIO << "TOTAL||" << qPrintable(totalTests) << "||" << qPrintable(failedTests) << "||" << qPrintable(duration) << "||";
51
- *outputIO << (hasJavaScriptError ? "T" : "F");
52
- *outputIO << std::endl;
53
- }
54
-
@@ -1,37 +0,0 @@
1
- #ifndef JHW_REPORT_FILE_OUTPUT
2
- #define JHW_REPORT_FILE_OUTPUT
3
-
4
- #include <QObject>
5
- #include <iostream>
6
- #include <QStack>
7
- #include <sstream>
8
-
9
- using namespace std;
10
-
11
- class ReportFileOutput : public QObject {
12
- public:
13
- ReportFileOutput();
14
-
15
- void passed(const QString &specDetail);
16
- void failed(const QString &specDetail);
17
- void errorLog(const QString &msg, int lineNumber, const QString &sourceID);
18
- void internalLog(const QString &note, const QString &msg);
19
- void consoleLog(const QString &msg);
20
- void logSpecFilename(const QString &name);
21
- void logSpecResult(const QString &result);
22
-
23
- void reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration);
24
- void reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration);
25
- void reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration);
26
-
27
- void reset();
28
-
29
- stringstream *buffer;
30
- stringstream *outputIO;
31
- QStack<QString> successes;
32
- QStack<QString> failures;
33
- private:
34
- void reportTotals(const QString &totalTests, const QString &failedTests, const QString &duration, bool hasJavaScriptError);
35
- };
36
-
37
- #endif
@@ -1,88 +0,0 @@
1
- #include <QtTest/QtTest>
2
-
3
- #include "ReportFileOutput.h"
4
- #include "ReportFileOutput_test.h"
5
-
6
- using namespace std;
7
-
8
- ReportFileOutputTest::ReportFileOutputTest() : QObject() {}
9
-
10
- void ReportFileOutputTest::testPassed() {
11
- stringstream buffer;
12
- ReportFileOutput output;
13
-
14
- output.outputIO = &buffer;
15
- output.passed("test||done||file.js:23");
16
- QVERIFY(buffer.str() == "PASS||test||done||file.js:23\n");
17
- QVERIFY(output.successes.size() == 1);
18
- QVERIFY(output.failures.size() == 0);
19
- }
20
-
21
- void ReportFileOutputTest::testFailed() {
22
- stringstream buffer;
23
- ReportFileOutput output;
24
-
25
- output.outputIO = &buffer;
26
- output.failed("test||done||file.js:23");
27
- QVERIFY(buffer.str() == "FAIL||test||done||file.js:23\n");
28
- QVERIFY(output.successes.size() == 0);
29
- QVERIFY(output.failures.size() == 1);
30
- }
31
-
32
- void ReportFileOutputTest::testErrorLog() {
33
- stringstream buffer;
34
- ReportFileOutput output;
35
-
36
- output.outputIO = &buffer;
37
- output.errorLog("JS Error", 23, "file.js");
38
- QVERIFY(buffer.str() == "ERROR||JS Error||file.js:23\n");
39
- }
40
-
41
- void ReportFileOutputTest::testConsoleLog() {
42
- stringstream buffer;
43
- ReportFileOutput output;
44
-
45
- output.outputIO = &buffer;
46
- output.consoleLog("Console");
47
- QVERIFY(buffer.str() == "CONSOLE||Console\n");
48
- }
49
-
50
- void ReportFileOutputTest::testStubMethods() {
51
- stringstream buffer;
52
- ReportFileOutput output;
53
-
54
- output.outputIO = &buffer;
55
- output.internalLog("Internal", "Log");
56
- output.logSpecFilename("Filename");
57
- output.logSpecResult("REsult");
58
- }
59
-
60
- void ReportFileOutputTest::testReportFailure() {
61
- stringstream buffer;
62
- ReportFileOutput output;
63
-
64
- output.outputIO = &buffer;
65
- output.reportFailure("5", "2", "1.5");
66
- QVERIFY(buffer.str() == "TOTAL||5||2||1.5||F\n");
67
- }
68
-
69
- void ReportFileOutputTest::testReportSuccess() {
70
- stringstream buffer;
71
- ReportFileOutput output;
72
-
73
- output.outputIO = &buffer;
74
- output.reportSuccess("5", "0", "1.5");
75
- QVERIFY(buffer.str() == "TOTAL||5||0||1.5||F\n");
76
- }
77
-
78
- void ReportFileOutputTest::testReportSuccessWithJSErrors() {
79
- stringstream buffer;
80
- ReportFileOutput output;
81
-
82
- output.outputIO = &buffer;
83
- output.reportSuccessWithJSErrors("5", "0", "1.5");
84
- QVERIFY(buffer.str() == "TOTAL||5||0||1.5||T\n");
85
- }
86
-
87
- QTEST_MAIN(ReportFileOutputTest);
88
-