summaryrefslogtreecommitdiffstats
path: root/tools/lint/test/files/trojan-source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/lint/test/files/trojan-source/README5
-rw-r--r--tools/lint/test/files/trojan-source/commenting-out.cpp9
-rw-r--r--tools/lint/test/files/trojan-source/early-return.py9
-rw-r--r--tools/lint/test/files/trojan-source/invisible-function.rs15
4 files changed, 38 insertions, 0 deletions
diff --git a/tools/lint/test/files/trojan-source/README b/tools/lint/test/files/trojan-source/README
new file mode 100644
index 0000000000..343a9d0c3c
--- /dev/null
+++ b/tools/lint/test/files/trojan-source/README
@@ -0,0 +1,5 @@
+These examples are taken from trojan source:
+https://github.com/nickboucher/trojan-source
+
+The examples are published under the MIT license.
+
diff --git a/tools/lint/test/files/trojan-source/commenting-out.cpp b/tools/lint/test/files/trojan-source/commenting-out.cpp
new file mode 100644
index 0000000000..d67df70ce1
--- /dev/null
+++ b/tools/lint/test/files/trojan-source/commenting-out.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+
+int main() {
+ bool isAdmin = false;
+ /*‮ } ⁦if (isAdmin)⁩ ⁦ begin admins only */
+ std::cout << "You are an admin.\n";
+ /* end admins only ‮ { ⁦*/
+ return 0;
+} \ No newline at end of file
diff --git a/tools/lint/test/files/trojan-source/early-return.py b/tools/lint/test/files/trojan-source/early-return.py
new file mode 100644
index 0000000000..2797d8ae9f
--- /dev/null
+++ b/tools/lint/test/files/trojan-source/early-return.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+bank = { 'alice': 100 }
+
+def subtract_funds(account: str, amount: int):
+ ''' Subtract funds from bank account then ⁧''' ;return
+ bank[account] -= amount
+ return
+
+subtract_funds('alice', 50) \ No newline at end of file
diff --git a/tools/lint/test/files/trojan-source/invisible-function.rs b/tools/lint/test/files/trojan-source/invisible-function.rs
new file mode 100644
index 0000000000..b32efb0372
--- /dev/null
+++ b/tools/lint/test/files/trojan-source/invisible-function.rs
@@ -0,0 +1,15 @@
+fn isAdmin() {
+ return false;
+}
+
+fn is​Admin() {
+ return true;
+}
+
+fn main() {
+ if is​Admin() {
+ printf("You are an admin\n");
+ } else {
+ printf("You are NOT an admin.\n");
+ }
+} \ No newline at end of file