Skip to content

Add tests (one skipped) for basic function of operator [] #1660

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

Merged
merged 2 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 15 additions & 3 deletions test/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,20 @@ void main() {
docsAsHtml = doAwesomeStuff.documentationAsHtml;
});

test('operator [] reference within a class works', () {
expect(
docsAsHtml,
contains(
'<a href="fake/BaseForDocComments/operator_get.html">operator []</a> '));
});

test('operator [] reference outside of a class works', () {
expect(
docsAsHtml,
contains(
'<a href="fake/SpecialList/operator_get.html">SpecialList.operator []</a> '));
}, skip: 'https://github.com/dart-lang/dartdoc/issues/1285');

test('codeifies a class from the SDK', () {
expect(docsAsHtml, contains('<code>String</code>'));
});
Expand Down Expand Up @@ -649,9 +663,7 @@ void main() {
() {
expect(docsAsHtml,
contains('<a href="">css.theOnlyThingInTheLibrary</a>'));
},
skip:
'Wait for https://github.com/dart-lang/dartdoc/issues/767 to be fixed');
}, skip: 'https://github.com/dart-lang/dartdoc/issues/1402');

// remove this test when the above test is fixed. just here to
// track when the behavior changes
Expand Down
6 changes: 6 additions & 0 deletions testing/test_package/lib/fake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,15 @@ class BaseForDocComments {
///
/// Reference to a name of a class from an import of a library that exported
/// the name [BaseClass] xx
///
/// Reference to a bracket operator within this class [operator []] xxx
///
/// Reference to a bracket operator in another class [SpecialList.operator []] xxx
String doAwesomeStuff(int value) => null;

void anotherMethod() {}

String operator [](String key) => "${key}'s value";
}

/// Testing if docs for inherited method are correct.
Expand Down
14 changes: 12 additions & 2 deletions testing/test_package_docs/fake/BaseForDocComments-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,18 @@ <h2>Methods</h2>
</dl>
</section>

<section class="summary offset-anchor inherited" id="operators">
<section class="summary offset-anchor" id="operators">
<h2>Operators</h2>
<dl class="callables">
<dt id="operator []" class="callable">
<span class="name"><a href="fake/BaseForDocComments/operator_get.html">operator []</a></span><span class="signature">(<wbr><span class="parameter" id="[]-param-key"><span class="type-annotation">String</span> <span class="parameter-name">key</span></span>)
<span class="returntype parameter">&#8594; String</span>
</span>
</dt>
<dd>


</dd>
<dt id="operator ==" class="callable inherited">
<span class="name"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></span><span class="signature">(<wbr><span class="parameter" id="==-param-other"><span class="type-annotation">dynamic</span> <span class="parameter-name">other</span></span>)
<span class="returntype parameter">&#8594; bool</span>
Expand Down Expand Up @@ -285,7 +294,8 @@ <h2>Operators</h2>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down Expand Up @@ -88,6 +89,8 @@ <h1>doAwesomeStuff method</h1>
in this library <a href="anonymous_library/doesStuff.html">doesStuff</a> xx</p>
<p>Reference to a name of a class from an import of a library that exported
the name <a href="two_exports/BaseClass-class.html">BaseClass</a> xx</p>
<p>Reference to a bracket operator within this class <a href="fake/BaseForDocComments/operator_get.html">operator []</a> xxx</p>
<p>Reference to a bracket operator in another class <code>SpecialList.operator []</code> xxx</p>
</section>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
100 changes: 100 additions & 0 deletions testing/test_package_docs/fake/BaseForDocComments/operator_get.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="API docs for the operator [] method from the BaseForDocComments class, for the Dart programming language.">
<title>operator [] method - BaseForDocComments class - fake library - Dart API</title>
<!-- required because all the links are pseudo-absolute -->
<base href="../..">

<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
<link rel="stylesheet" href="static-assets/github.css">
<link rel="stylesheet" href="static-assets/styles.css">
<link rel="icon" href="static-assets/favicon.png">

</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
<ol class="breadcrumbs gt-separated dark hidden-xs">
<li><a href="index.html">test_package</a></li>
<li><a href="fake/fake-library.html">fake</a></li>
<li><a href="fake/BaseForDocComments-class.html">BaseForDocComments</a></li>
<li class="self-crumb">operator [] method</li>
</ol>
<div class="self-name">operator []</div>
<form class="search navbar-right" role="search">
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>

<main>

<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
<h5>BaseForDocComments class</h5>
<ol>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#constructors">Constructors</a></li>
<li><a href="fake/BaseForDocComments/BaseForDocComments.html">BaseForDocComments</a></li>

<li class="section-title inherited">
<a href="fake/BaseForDocComments-class.html#instance-properties">Properties</a>
</li>
<li class="inherited"><a href="fake/BaseForDocComments/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/runtimeType.html">runtimeType</a></li>

<li class="section-title"><a href="fake/BaseForDocComments-class.html#instance-methods">Methods</a></li>
<li><a href="fake/BaseForDocComments/anotherMethod.html">anotherMethod</a></li>
<li><a href="fake/BaseForDocComments/doAwesomeStuff.html">doAwesomeStuff</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>



</ol>
</div><!--/.sidebar-offcanvas-->

<div class="col-xs-12 col-sm-9 col-md-8 main-content">
<h1>operator [] method</h1>

<section class="multi-line-signature">
<span class="returntype">String</span>
<span class="name ">operator []</span>
(<wbr><span class="parameter" id="[]-param-key"><span class="type-annotation">String</span> <span class="parameter-name">key</span></span>)
</section>



</div> <!-- /.main-content -->

<div class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
</div><!--/.sidebar-offcanvas-->

</main>

<footer>
<span class="no-break">
test_package 0.0.1
</span>

</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h5>BaseForDocComments class</h5>
<li class="inherited"><a href="fake/BaseForDocComments/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/toString.html">toString</a></li>

<li class="section-title inherited"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li class="section-title"><a href="fake/BaseForDocComments-class.html#operators">Operators</a></li>
<li><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>


Expand Down
10 changes: 10 additions & 0 deletions testing/test_package_docs/fake/SubForDocComments-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ <h2>Operators</h2>
<dd class="inherited">

<div class="features">inherited</div>
</dd>
<dt id="operator []" class="callable inherited">
<span class="name"><a href="fake/BaseForDocComments/operator_get.html">operator []</a></span><span class="signature">(<wbr><span class="parameter" id="[]-param-key"><span class="type-annotation">String</span> <span class="parameter-name">key</span></span>)
<span class="returntype parameter">&#8594; String</span>
</span>
</dt>
<dd class="inherited">

<div class="features">inherited</div>
</dd>
</dl>
</section>
Expand Down Expand Up @@ -302,6 +311,7 @@ <h2>Operators</h2>

<li class="section-title inherited"><a href="fake/SubForDocComments-class.html#operators">Operators</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ <h5>SubForDocComments class</h5>

<li class="section-title inherited"><a href="fake/SubForDocComments-class.html#operators">Operators</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ <h5>SubForDocComments class</h5>

<li class="section-title inherited"><a href="fake/SubForDocComments-class.html#operators">Operators</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_equals.html">operator ==</a></li>
<li class="inherited"><a href="fake/BaseForDocComments/operator_get.html">operator []</a></li>



Expand Down
11 changes: 11 additions & 0 deletions testing/test_package_docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4122,6 +4122,17 @@
"type": "class"
}
},
{
"name": "operator []",
"qualifiedName": "fake.BaseForDocComments.[]",
"href": "fake/BaseForDocComments/operator_get.html",
"type": "method",
"overriddenDepth": 0,
"enclosedBy": {
"name": "BaseForDocComments",
"type": "class"
}
},
{
"name": "anotherMethod",
"qualifiedName": "fake.BaseForDocComments.anotherMethod",
Expand Down