Skip to content

Commit

Permalink
squash: add test for js2c.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danbev committed Aug 12, 2019
1 parent ae47f11 commit d1dae25
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addo
$(CI_JS_SUITES) \
$(CI_NATIVE_SUITES)

.PHONY: tooltest
tooltest:
@$(PYTHON) test/tools/test-js2c.py

.PHONY: coverage-run-js
coverage-run-js:
$(RM) -r out/$(BUILDTYPE)/.coverage
Expand All @@ -311,6 +315,7 @@ test: all ## Runs default tests, linters, and builds docs.
$(MAKE) -s build-node-api-tests
$(MAKE) -s cctest
$(MAKE) -s jstest
$(MAKE) -s tooltest

.PHONY: test-only
test-only: all ## For a quick test, does not run linter or build docs.
Expand All @@ -319,6 +324,7 @@ test-only: all ## For a quick test, does not run linter or build docs.
$(MAKE) build-node-api-tests
$(MAKE) cctest
$(MAKE) jstest
$(MAKE) tooltest

# Used by `make coverage-test`
test-cov: all
Expand Down
14 changes: 14 additions & 0 deletions test/tools/test-js2c.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import unittest
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', 'tools')))
from js2c import NormalizeFileName

class Js2ctest(unittest.TestCase):
def testNormalizeFileName(self):
self.assertEqual(NormalizeFileName('dir/mod.js'), 'mod')
self.assertEqual(NormalizeFileName('deps/mod.js'), 'internal/deps/mod')
self.assertEqual(NormalizeFileName('mod.js'), 'mod')

if __name__ == '__main__':
unittest.main()

0 comments on commit d1dae25

Please sign in to comment.