Fix example code just showing endless spinner when deployed from Windows (#14878)

* If example code is not found, render a message instead of an endless spinner
* Trim codeTags to avoid lookup issues with windows carriage returns
* Trim \r on Windows off the end of code blocks so they're consistently \n
* Add a test to ensure sample code parses if built on Windows
* Add a comment about why we trimRight()

Fixes #14820.
This commit is contained in:
Danny Tuppeny
2018-02-28 20:39:48 +00:00
committed by GitHub
parent e0956cbdb7
commit ae9fdefa4f
3 changed files with 10 additions and 3 deletions

View File

@@ -18,6 +18,9 @@ void main() {
final String codeSnippet1 = await getExampleCode('test_1', bundle);
expect(codeSnippet1, 'test 1 0\ntest 1 1');
final String codeSnippet3 = await getExampleCode('test_2_windows_breaks', bundle);
expect(codeSnippet3, 'windows test 2 0\nwindows test 2 1');
});
}
@@ -32,6 +35,8 @@ test 0 1
test 1 0
test 1 1
// END
// START test_2_windows_breaks\r\nwindows test 2 0\r\nwindows test 2 1\r\n// END
''';
class TestAssetBundle extends AssetBundle {