Index: common/eslint/eslint/smoke_test.py |
diff --git a/common/eslint/eslint/smoke_test.py b/common/eslint/eslint/smoke_test.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7e5dc7f22c2f6524e67da82b2481f5c13af88251 |
--- /dev/null |
+++ b/common/eslint/eslint/smoke_test.py |
@@ -0,0 +1,34 @@ |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import eslint |
+import os |
+import tempfile |
+import unittest |
+ |
+ |
+_TEMP_FILE_CONTENTS = '''<!DOCTYPE html> |
+<!-- |
+Copyright 2016 The Chromium Authors. All rights reserved. |
+Use of this source code is governed by a BSD-style license that can be |
+found in the LICENSE file. |
+--> |
+<script> |
+// This should cause a linter error because we require camelCase. |
+var non_camel_case = 0; |
+</script> |
+''' |
+ |
+ |
+class SmokeTest(unittest.TestCase): |
+ def testEslintFindsError(self): |
+ try: |
+ tmp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".html") |
+ tmp_file.write(_TEMP_FILE_CONTENTS) |
+ tmp_file.close() |
+ |
+ output = eslint.RunEslintOnFiles([tmp_file.name]) |
+ self.assertTrue('is not in camel case' in output) |
+ finally: |
+ os.remove(tmp_file.name) |