-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format parameters better #3731
Format parameters better #3731
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,14 +84,14 @@ class A { | |
var named = library.constructor('A.named'); | ||
|
||
expect(named.linkedParams, matchesCompressed(r''' | ||
\{ | ||
<span class="parameter" id="named-param-f"> | ||
\{ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">f</span> | ||
\} | ||
</span> | ||
\} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the opening bracket for all the closing brackets in these tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch; these all moved to where you'd expect, based on where the closing ones moved. Updated the tests. |
||
''')); | ||
} | ||
|
||
|
@@ -105,16 +105,16 @@ class A { | |
var namedWithDefault = library.constructor('A.namedWithDefault'); | ||
|
||
expect(namedWithDefault.linkedParams, matchesCompressed(r''' | ||
\{ | ||
<span class="parameter" id="namedWithDefault-param-f"> | ||
\{ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">f</span> | ||
= | ||
<span class="default-value">0</span> | ||
\} | ||
</span> | ||
\} | ||
''')); | ||
} | ||
|
||
|
@@ -128,15 +128,15 @@ class A { | |
var requiredNamed = library.constructor('A.requiredNamed'); | ||
|
||
expect(requiredNamed.linkedParams, matchesCompressed(r''' | ||
\{ | ||
<span class="parameter" id="requiredNamed-param-f"> | ||
\{ | ||
<span>required</span> | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">f</span> | ||
\} | ||
</span> | ||
\} | ||
''')); | ||
} | ||
|
||
|
@@ -150,14 +150,14 @@ class A { | |
var optionalPositional = library.constructor('A.optionalPositional'); | ||
|
||
expect(optionalPositional.linkedParams, matchesCompressed(r''' | ||
\[ | ||
<span class="parameter" id="optionalPositional-param-f"> | ||
\[ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">f</span> | ||
\] | ||
</span> | ||
\] | ||
''')); | ||
} | ||
|
||
|
@@ -171,16 +171,16 @@ class A { | |
var defaultValue = library.constructor('A.defaultValue'); | ||
|
||
expect(defaultValue.linkedParams, matchesCompressed(r''' | ||
\[ | ||
<span class="parameter" id="defaultValue-param-f"> | ||
\[ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">f</span> | ||
= | ||
<span class="default-value">0</span> | ||
\] | ||
</span> | ||
\] | ||
''')); | ||
} | ||
|
||
|
@@ -283,13 +283,12 @@ class D extends C { | |
|
||
expect(named.linkedParams, matchesCompressed(r''' | ||
<span class="parameter" id="named-param-a"> | ||
\{ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">a</span> | ||
\} | ||
</span> | ||
\} | ||
''')); | ||
} | ||
|
||
|
@@ -306,15 +305,14 @@ class D extends C { | |
|
||
expect(namedWithDefault.linkedParams, matchesCompressed(r''' | ||
<span class="parameter" id="namedWithDefault-param-a"> | ||
\{ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a> | ||
</span> | ||
<span class="parameter-name">a</span> | ||
= | ||
<span class="default-value">0</span> | ||
\} | ||
</span> | ||
\} | ||
''')); | ||
} | ||
|
||
|
@@ -331,14 +329,13 @@ class D extends C { | |
|
||
expect(requiredNamed.linkedParams, matchesCompressed(r''' | ||
<span class="parameter" id="requiredNamed-param-a"> | ||
\{ | ||
<span>required</span> | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a> | ||
</span> | ||
<span class="parameter-name">a</span> | ||
\} | ||
</span> | ||
\} | ||
''')); | ||
} | ||
|
||
|
@@ -355,13 +352,12 @@ class D extends C { | |
|
||
expect(optionalPositional.linkedParams, matchesCompressed(r''' | ||
<span class="parameter" id="optionalPositional-param-a"> | ||
\[ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a>\? | ||
</span> | ||
<span class="parameter-name">a</span> | ||
\] | ||
</span> | ||
\] | ||
''')); | ||
} | ||
|
||
|
@@ -378,15 +374,14 @@ class D extends C { | |
|
||
expect(defaultValue.linkedParams, matchesCompressed(r''' | ||
<span class="parameter" id="defaultValue-param-a"> | ||
\[ | ||
<span class="type-annotation"> | ||
<a href=".*/dart-core/int-class\.html">int</a> | ||
</span> | ||
<span class="parameter-name">a</span> | ||
= | ||
<span class="default-value">0</span> | ||
\] | ||
</span> | ||
\] | ||
''')); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make a helper to avoid the duplicate logic of each parameter type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I was able to fold more things into
_renderParameter
, much simpler. Thanks!