| Index: third_party/closure_linter/closure_linter/aliaspass_test.py
|
| diff --git a/third_party/closure_linter/closure_linter/aliaspass_test.py b/third_party/closure_linter/closure_linter/aliaspass_test.py
|
| index 1c5578870d5902a9ca117adce3ac18901b90fdb7..7042e5348763cb471b3c49ba056a5e7369ff5100 100644
|
| --- a/third_party/closure_linter/closure_linter/aliaspass_test.py
|
| +++ b/third_party/closure_linter/closure_linter/aliaspass_test.py
|
| @@ -24,6 +24,7 @@ import unittest as googletest
|
|
|
| from closure_linter import aliaspass
|
| from closure_linter import errors
|
| +from closure_linter import javascriptstatetracker
|
| from closure_linter import testutil
|
| from closure_linter.common import erroraccumulator
|
|
|
| @@ -75,10 +76,35 @@ class AliasPassTest(googletest.TestCase):
|
| start_token, 'NonClosurizedClass', 18)
|
| self.assertIsNone(non_closurized_token.metadata.aliased_symbol)
|
|
|
| - long_start_token = _GetTokenByLineAndString(start_token, 'Event.', 21)
|
| + long_start_token = _GetTokenByLineAndString(start_token, 'Event', 24)
|
| self.assertEquals('goog.events.Event.MultilineIdentifier.someMethod',
|
| long_start_token.metadata.aliased_symbol)
|
|
|
| + def testAliasedDoctypes(self):
|
| + """Tests that aliases are correctly expanded within type annotations."""
|
| + start_token = testutil.TokenizeSourceAndRunEcmaPass(_TEST_ALIAS_SCRIPT)
|
| + tracker = javascriptstatetracker.JavaScriptStateTracker()
|
| + tracker.DocFlagPass(start_token, error_handler=None)
|
| +
|
| + alias_pass = aliaspass.AliasPass(set(['goog', 'myproject']))
|
| + alias_pass.Process(start_token)
|
| +
|
| + flag_token = _GetTokenByLineAndString(start_token, '@type', 22)
|
| + self.assertEquals(
|
| + 'goog.events.Event.<goog.ui.Component,Array<myproject.foo.MyClass>>',
|
| + repr(flag_token.attached_object.jstype))
|
| +
|
| + def testModuleAlias(self):
|
| + start_token = testutil.TokenizeSourceAndRunEcmaPass("""
|
| +goog.module('goog.test');
|
| +var Alias = goog.require('goog.Alias');
|
| +Alias.use();
|
| +""")
|
| + alias_pass = aliaspass.AliasPass(set(['goog']))
|
| + alias_pass.Process(start_token)
|
| + alias_token = _GetTokenByLineAndString(start_token, 'Alias', 3)
|
| + self.assertTrue(alias_token.metadata.is_alias_definition)
|
| +
|
| def testMultipleGoogScopeCalls(self):
|
| start_token = testutil.TokenizeSourceAndRunEcmaPass(
|
| _TEST_MULTIPLE_SCOPE_SCRIPT)
|
| @@ -126,7 +152,10 @@ var NonClosurizedClass = aaa.bbb.NonClosurizedClass;
|
| var component = new Component(Event.Something);
|
| var nonClosurized = NonClosurizedClass();
|
|
|
| -// A created namespace with a really long identifier.
|
| +/**
|
| + * A created namespace with a really long identifier.
|
| + * @type {events.Event.<Component,Array<MyClass>}
|
| + */
|
| Event.
|
| MultilineIdentifier.
|
| someMethod = function() {};
|
|
|