Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: common/eslint/eslint/smoke_test.py

Issue 2361623007: Add a run_eslint wrapper script (Closed)
Patch Set: Synced to head Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/eslint/eslint/__init__.py ('k') | common/node_runner/bin/test_node_for_smoke » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « common/eslint/eslint/__init__.py ('k') | common/node_runner/bin/test_node_for_smoke » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698