forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use better temp directory cleanup in tests
Closes dotnet#6233
- Loading branch information
Showing
6 changed files
with
62 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
using Microsoft.CodeAnalysis.Text; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Roslyn.Test.Utilities.Syntax | ||
{ | ||
internal sealed class RandomizedSourceText: SourceText | ||
{ | ||
private char[] buffer = new char[2048]; | ||
|
||
public RandomizedSourceText() | ||
{ | ||
var random = new Random(12345); | ||
for (var i = 0; i < buffer.Length; i++) | ||
{ | ||
buffer[i] = (char)random.Next(); | ||
} | ||
} | ||
|
||
public override char this[int position] => buffer[position % buffer.Length]; | ||
|
||
public override Encoding Encoding => Encoding.UTF8; | ||
|
||
public override int Length | ||
{ | ||
get | ||
{ | ||
return 40 * 1000 * 1000; | ||
} | ||
} | ||
|
||
public override void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) | ||
{ | ||
for (var i = 0; i < count; i++) | ||
{ | ||
destination[destinationIndex + i] = this[sourceIndex + i]; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters