Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
squash: add test for js2c.py
  • Loading branch information
danbev committed Aug 12, 2019
commit d1dae25ef97ef920fbd7ebee0be29fe4e2fa144f
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()