summaryrefslogtreecommitdiffstats
path: root/tools/check-moz-style/tests
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /tools/check-moz-style/tests
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'tools/check-moz-style/tests')
-rw-r--r--tools/check-moz-style/tests/test1.cpp0
-rw-r--r--tools/check-moz-style/tests/test1.out1
-rw-r--r--tools/check-moz-style/tests/test1.patch1
-rw-r--r--tools/check-moz-style/tests/test2.cpp3
-rw-r--r--tools/check-moz-style/tests/test2.out4
-rw-r--r--tools/check-moz-style/tests/test2.patch9
-rw-r--r--tools/check-moz-style/tests/test3.out3
-rw-r--r--tools/check-moz-style/tests/test3.patch12
-rw-r--r--tools/check-moz-style/tests/test4.cpp40
-rw-r--r--tools/check-moz-style/tests/test4.out13
-rw-r--r--tools/check-moz-style/tests/test4.patch49
-rw-r--r--tools/check-moz-style/tests/test5.cpp24
-rw-r--r--tools/check-moz-style/tests/test5.out7
-rw-r--r--tools/check-moz-style/tests/test5.patch33
14 files changed, 199 insertions, 0 deletions
diff --git a/tools/check-moz-style/tests/test1.cpp b/tools/check-moz-style/tests/test1.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tools/check-moz-style/tests/test1.cpp
diff --git a/tools/check-moz-style/tests/test1.out b/tools/check-moz-style/tests/test1.out
new file mode 100644
index 000000000..3c313c18a
--- /dev/null
+++ b/tools/check-moz-style/tests/test1.out
@@ -0,0 +1 @@
+patch:0: Patch does not appear to diff against any file. [patch/notempty] [3]
diff --git a/tools/check-moz-style/tests/test1.patch b/tools/check-moz-style/tests/test1.patch
new file mode 100644
index 000000000..8c56b2416
--- /dev/null
+++ b/tools/check-moz-style/tests/test1.patch
@@ -0,0 +1 @@
+Bad patch that doesn't diff any files
diff --git a/tools/check-moz-style/tests/test2.cpp b/tools/check-moz-style/tests/test2.cpp
new file mode 100644
index 000000000..4cce7f667
--- /dev/null
+++ b/tools/check-moz-style/tests/test2.cpp
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}
diff --git a/tools/check-moz-style/tests/test2.out b/tools/check-moz-style/tests/test2.out
new file mode 100644
index 000000000..0648d555e
--- /dev/null
+++ b/tools/check-moz-style/tests/test2.out
@@ -0,0 +1,4 @@
+patch:0: Patch does not have a summary. [patch/nosummary] [3]
+patch:0: Patch does not have a description. [patch/nodescription] [3]
+tests/test2.cpp:1: No copyright message found. [legal/copyright] [3]
+Done processing tests/test2.cpp
diff --git a/tools/check-moz-style/tests/test2.patch b/tools/check-moz-style/tests/test2.patch
new file mode 100644
index 000000000..e497ec0cf
--- /dev/null
+++ b/tools/check-moz-style/tests/test2.patch
@@ -0,0 +1,9 @@
+# Test
+diff --git a/tests/test2.cpp b/tests/test2.cpp
+new file mode 100644
+--- /dev/null
++++ b/tests/test2.cpp
+@@ -0,0 +1,3 @@
++int main() {
++ return 0;
++}
diff --git a/tools/check-moz-style/tests/test3.out b/tools/check-moz-style/tests/test3.out
new file mode 100644
index 000000000..5a2cc7385
--- /dev/null
+++ b/tools/check-moz-style/tests/test3.out
@@ -0,0 +1,3 @@
+patch:0: Patch summary should begin with 'Bug XXXXX - ' or 'No bug -'. [patch/bugnumber] [3]
+tests/test2.cpp:1: No copyright message found. [legal/copyright] [3]
+Done processing tests/test2.cpp
diff --git a/tools/check-moz-style/tests/test3.patch b/tools/check-moz-style/tests/test3.patch
new file mode 100644
index 000000000..d0443fa52
--- /dev/null
+++ b/tools/check-moz-style/tests/test3.patch
@@ -0,0 +1,12 @@
+# Test
+patch summary with no bug number
+
+Some bogus patch description
+diff --git a/tests/test2.cpp b/tests/test2.cpp
+new file mode 100644
+--- /dev/null
++++ b/tests/test2.cpp
+@@ -0,0 +1,3 @@
++int main() {
++ return 0;
++}
diff --git a/tools/check-moz-style/tests/test4.cpp b/tools/check-moz-style/tests/test4.cpp
new file mode 100644
index 000000000..64ceae0b6
--- /dev/null
+++ b/tools/check-moz-style/tests/test4.cpp
@@ -0,0 +1,40 @@
+class ShouldUseExplicit {
+ // runtime/explicit
+ ShouldUseExplicit(int i);
+};
+
+// readability/function
+int foo(int) {
+}
+
+int main() {
+ int i = 0;
+
+ // readability/control_flow
+ // XXX This doesn't trigger it. It needs to be fixed.
+ if (i) {
+ return;
+ } else {
+ i++;
+ }
+
+ // whitespace/parens
+ if(i){}
+
+ // readability/casting
+ void* bad = (void*)i;
+
+ // readability/comparison_to_zero
+ if (i == true) {}
+ if (i == false) {}
+ if (i != true) {}
+ if (i != false) {}
+ if (i == NULL) {}
+ if (i != NULL) {}
+ if (i == nullptr) {}
+ if (i != nullptr) {}
+ if (i) {}
+ if (!i) {}
+
+ return 0;
+}
diff --git a/tools/check-moz-style/tests/test4.out b/tools/check-moz-style/tests/test4.out
new file mode 100644
index 000000000..21eadcca1
--- /dev/null
+++ b/tools/check-moz-style/tests/test4.out
@@ -0,0 +1,13 @@
+tests/test4.cpp:1: No copyright message found. [legal/copyright] [3]
+tests/test4.cpp:3: Single-argument constructors should be marked explicit. [runtime/explicit] [5]
+tests/test4.cpp:7: All parameters should be named in a function [readability/function] [3]
+tests/test4.cpp:22: Missing space before ( in if( [whitespace/parens] [5]
+tests/test4.cpp:22: Missing space before { [whitespace/braces] [5]
+tests/test4.cpp:25: Using C-style cast. Use reinterpret_cast<void*>(...) instead [readability/casting] [4]
+tests/test4.cpp:28: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
+tests/test4.cpp:29: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
+tests/test4.cpp:30: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
+tests/test4.cpp:31: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
+tests/test4.cpp:32: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
+tests/test4.cpp:33: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
+Done processing tests/test4.cpp
diff --git a/tools/check-moz-style/tests/test4.patch b/tools/check-moz-style/tests/test4.patch
new file mode 100644
index 000000000..735ef82ca
--- /dev/null
+++ b/tools/check-moz-style/tests/test4.patch
@@ -0,0 +1,49 @@
+# Test
+Bug 12 - patch summary with no bug number
+
+Some bogus patch description
+diff --git a/tests/test4.cpp b/tests/test4.cpp
+new file mode 100644
+--- /dev/null
++++ b/tests/test4.cpp
+@@ -0,0 +1,49 @@
++class ShouldUseExplicit {
++ // runtime/explicit
++ ShouldUseExplicit(int i);
++};
++
++// readability/function
++int foo(int) {
++}
++
++int main() {
++ int i = 0;
++
++ // readability/control_flow
++ // XXX This doesn't trigger it. It needs to be fixed.
++ if (i) {
++ return;
++ } else {
++ i++;
++ }
++
++ // whitespace/parens
++ if(i){}
++
++ // readability/casting
++ void* bad = (void*)i;
++
++ // readability/comparison_to_zero
++ if (i == true) {}
++ if (i == false) {}
++ if (i != true) {}
++ if (i != false) {}
++ if (i == NULL) {}
++ if (i != NULL) {}
++ if (i == nullptr) {}
++ if (i != nullptr) {}
++ if (i) {}
++ if (!i) {}
++
++ return 0;
++}
diff --git a/tools/check-moz-style/tests/test5.cpp b/tools/check-moz-style/tests/test5.cpp
new file mode 100644
index 000000000..95c756151
--- /dev/null
+++ b/tools/check-moz-style/tests/test5.cpp
@@ -0,0 +1,24 @@
+// License bogus
+
+// runtime/virtual
+class ShouldHaveVirtualDes {
+ virtual foo();
+};
+
+int main() {
+ // runtime/memset
+ memset(blah, sizeof(blah), 0);
+
+ // runtime/rtti
+ dynamic_cast<Derived*>(obj);
+
+ // runtime/sizeof
+ int varname = 0;
+ int mySize = sizeof(int);
+
+ // runtime/threadsafe_fn
+ getpwuid();
+ strtok();
+
+ return 0;
+}
diff --git a/tools/check-moz-style/tests/test5.out b/tools/check-moz-style/tests/test5.out
new file mode 100644
index 000000000..68c0eab8a
--- /dev/null
+++ b/tools/check-moz-style/tests/test5.out
@@ -0,0 +1,7 @@
+tests/test5.cpp:4: The class ShouldHaveVirtualDes probably needs a virtual destructor due to having virtual method(s), one declared at line 5. [runtime/virtual] [4]
+tests/test5.cpp:10: Did you mean "memset(blah, 0, sizeof(blah))"? [runtime/memset] [4]
+tests/test5.cpp:13: Do not use dynamic_cast<>. If you need to cast within a class hierarchy, use static_cast<> to upcast. Mozilla doesn't support RTTI. [runtime/rtti] [5]
+tests/test5.cpp:17: Using sizeof(type). Use sizeof(varname) instead if possible [runtime/sizeof] [1]
+tests/test5.cpp:20: Consider using getpwuid_r(...) instead of getpwuid(...) for improved thread safety. [runtime/threadsafe_fn] [2]
+tests/test5.cpp:21: Consider using strtok_r(...) instead of strtok(...) for improved thread safety. [runtime/threadsafe_fn] [2]
+Done processing tests/test5.cpp
diff --git a/tools/check-moz-style/tests/test5.patch b/tools/check-moz-style/tests/test5.patch
new file mode 100644
index 000000000..19f7bee8c
--- /dev/null
+++ b/tools/check-moz-style/tests/test5.patch
@@ -0,0 +1,33 @@
+# Test
+Bug 12 - patch summary with no bug number
+
+Some bogus patch description
+diff --git a/tests/test5.cpp b/tests/test5.cpp
+new file mode 100644
+--- /dev/null
++++ b/tests/test5.cpp
+@@ -0,0 +1,24 @@
++// License bogus
++
++// runtime/virtual
++class ShouldHaveVirtualDes {
++ virtual foo();
++};
++
++int main() {
++ // runtime/memset
++ memset(blah, sizeof(blah), 0);
++
++ // runtime/rtti
++ dynamic_cast<Derived*>(obj);
++
++ // runtime/sizeof
++ int varname = 0;
++ int mySize = sizeof(int);
++
++ // runtime/threadsafe_fn
++ getpwuid();
++ strtok();
++
++ return 0;
++}