diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 0000000..58a5045 --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,52 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +# This workflow will periodically check .NET nanoFramework dependencies and updates them in the repository it's running. + +name: Daily update dependencies + +on: + schedule: + # At 00:00 UTC every day. + - cron: '00 00 * * *' + repository_dispatch: + types: update-dependencies + +defaults: + run: + shell: pwsh + +jobs: + update-dotnet-preview: + name: Update .NET nanoFramework dependencies + timeout-minutes: 15 + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + with: + path: main + - name: Checkout tools repo + uses: actions/checkout@v2.3.1 + with: + repository: nanoframework/nf-tools + path: tools + - name: Update dependencies + run: ./github-actions/update-nf-dependencies.ps1 + working-directory: tools + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + if: env.CREATE_PR == 'true' + with: + title: '${{ env.PR_TITLE }}' + body: | + ${{ env.PR_MESSAGE }} + + [version update] + + ### :warning: This is an automated update. :warning: + committer: 'nfbot ' + branch: ${{ env.BRANCH_NAME }} + path: main + labels: | + Type: dependencies diff --git a/.github_changelog_generator b/.github_changelog_generator index b67564c..e609bbc 100644 --- a/.github_changelog_generator +++ b/.github_changelog_generator @@ -1,5 +1,5 @@ user=nanoframework -project=lib-nanoFramework.System.Text +project=System.Text issues=true add_issues_wo_labels=false add_pr_wo_labels=false diff --git a/.gitignore b/.gitignore index aee5823..674f3a9 100644 --- a/.gitignore +++ b/.gitignore @@ -255,3 +255,5 @@ paket-files/ #SoundCloud *.sonarqube/ +*.slconfig +*.ruleset diff --git a/.sonarlint/nanoframework_lib-nanoframework.system.text/CSharp/SonarLint.xml b/.sonarlint/nanoframework_lib-nanoframework.system.text/CSharp/SonarLint.xml new file mode 100644 index 0000000..21acd70 --- /dev/null +++ b/.sonarlint/nanoframework_lib-nanoframework.system.text/CSharp/SonarLint.xml @@ -0,0 +1,89 @@ + + + + + sonar.cs.analyzeGeneratedCode + false + + + sonar.cs.file.suffixes + .cs + + + sonar.cs.ignoreHeaderComments + true + + + sonar.cs.roslyn.ignoreIssues + false + + + + + S107 + + + max + 7 + + + + + S110 + + + max + 5 + + + + + S1479 + + + maximum + 30 + + + + + S2342 + + + flagsAttributeFormat + ^([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?s$ + + + format + ^([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?$ + + + + + S2436 + + + max + 2 + + + maxMethod + 3 + + + + + S3776 + + + propertyThreshold + 3 + + + threshold + 15 + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ecab28..0eedeb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,84 +1,291 @@ # Changelog -## [v1.0.0](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0) (2020-06-12) +## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/System.Text/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.25...v1.0.0) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.64...HEAD) **Documentation and other chores:** -- Release release-v1.0.0 [\#11](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/11) +- Update 1 nuget dependencies [\#61](https://github.com/nanoframework/System.Text/pull/61) +- Update 1 nuget dependencies [\#60](https://github.com/nanoframework/System.Text/pull/60) +- Update 1 nuget dependencies [\#58](https://github.com/nanoframework/System.Text/pull/58) +- Update 1 nuget dependencies [\#57](https://github.com/nanoframework/System.Text/pull/57) +- Update 1 nuget dependencies [\#56](https://github.com/nanoframework/System.Text/pull/56) -## [v1.0.0-preview.25](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.25) (2020-06-11) +## [v1.1.1-preview.64](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.64) (2021-06-19) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.22...v1.0.0-preview.25) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.61...v1.1.1-preview.64) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.3-preview.4 to 1.7.3 [\#10](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/10) +- Bumps nanoFramework.CoreLibrary from 1.10.5-preview.13 to 1.10.5-preview.18 [\#55](https://github.com/nanoframework/System.Text/pull/55) +- Update 1 nuget dependencies [\#54](https://github.com/nanoframework/System.Text/pull/54) -## [v1.0.0-preview.22](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.22) (2020-05-31) +## [v1.1.1-preview.61](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.61) (2021-06-07) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.16...v1.0.0-preview.22) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.59...v1.1.1-preview.61) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.7 to 1.7.3-preview.4 [\#9](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/9) +- Update 2 NuGet dependencies [\#53](https://github.com/nanoframework/System.Text/pull/53) -## [v1.0.0-preview.16](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.16) (2020-05-08) +## [v1.1.1-preview.59](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.59) (2021-06-06) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.15...v1.0.0-preview.16) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.57...v1.1.1-preview.59) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.6 to 1.7.2-preview.7 [\#8](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/8) +- Update 1 nuget dependencies [\#52](https://github.com/nanoframework/System.Text/pull/52) -## [v1.0.0-preview.15](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.15) (2020-05-08) +## [v1.1.1-preview.57](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.57) (2021-06-01) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.14...v1.0.0-preview.15) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.51...v1.1.1-preview.57) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.5 to 1.7.2-preview.6 [\#7](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/7) +- Update 2 NuGet dependencies [\#47](https://github.com/nanoframework/System.Text/pull/47) +- Update 1 nuget dependencies [\#46](https://github.com/nanoframework/System.Text/pull/46) +- Update 1 nuget dependencies [\#45](https://github.com/nanoframework/System.Text/pull/45) +- Update 1 nuget dependencies [\#44](https://github.com/nanoframework/System.Text/pull/44) -## [v1.0.0-preview.14](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.14) (2020-04-27) +## [v1.1.1-preview.51](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.51) (2021-05-25) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.13...v1.0.0-preview.14) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.50...v1.1.1-preview.51) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.4 to 1.7.2-preview.5 [\#6](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/6) +- Update 1 nuget dependencies [\#43](https://github.com/nanoframework/System.Text/pull/43) -## [v1.0.0-preview.13](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.13) (2020-04-16) +## [v1.1.1-preview.50](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.50) (2021-05-20) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.11...v1.0.0-preview.13) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.49...v1.1.1-preview.50) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.1-preview.4 to 1.7.2-preview.4 [\#5](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/5) +- Update 1 nuget dependencies [\#42](https://github.com/nanoframework/System.Text/pull/42) -## [v1.0.0-preview.11](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.11) (2020-04-14) +## [v1.1.1-preview.49](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.49) (2021-05-19) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.8...v1.0.0-preview.11) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.48...v1.1.1-preview.49) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.7.0-preview.12 to 1.7.1-preview.4 [\#4](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/4) +- Bumps nanoFramework.CoreLibrary from 1.10.4-preview.4 to 1.10.4-preview.11 [\#41](https://github.com/nanoframework/System.Text/pull/41) -## [v1.0.0-preview.8](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.8) (2020-03-10) +## [v1.1.1-preview.48](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.48) (2021-05-15) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.7...v1.0.0-preview.8) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.47...v1.1.1-preview.48) -## [v1.0.0-preview.7](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.7) (2020-03-10) +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#40](https://github.com/nanoframework/System.Text/pull/40) + +## [v1.1.1-preview.47](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.47) (2021-05-13) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.46...v1.1.1-preview.47) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.3-preview.20 to 1.10.4-preview.4 [\#39](https://github.com/nanoframework/System.Text/pull/39) + +## [v1.1.1-preview.46](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.46) (2021-05-06) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.45...v1.1.1-preview.46) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#38](https://github.com/nanoframework/System.Text/pull/38) + +## [v1.1.1-preview.45](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.45) (2021-05-05) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.40...v1.1.1-preview.45) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#37](https://github.com/nanoframework/System.Text/pull/37) + +## [v1.1.1-preview.40](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.40) (2021-04-09) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.35...v1.1.1-preview.40) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#36](https://github.com/nanoframework/System.Text/pull/36) +- Update 1 nuget dependencies [\#29](https://github.com/nanoframework/System.Text/pull/29) +- Update 1 nuget dependencies [\#28](https://github.com/nanoframework/System.Text/pull/28) + +## [v1.1.1-preview.35](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.35) (2021-03-21) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.33...v1.1.1-preview.35) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.11 to 1.10.3-preview.7 [\#27](https://github.com/nanoframework/System.Text/pull/27) + +## [v1.1.1-preview.33](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.33) (2021-03-17) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.29...v1.1.1-preview.33) + +**Implemented enhancements:** + +- Adding Unit Test from .NET Microframework [\#25](https://github.com/nanoframework/System.Text/pull/25) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#26](https://github.com/nanoframework/System.Text/pull/26) + +## [v1.1.1-preview.29](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.29) (2021-03-02) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.24...v1.1.1-preview.29) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.9 to 1.10.1-preview.11 [\#24](https://github.com/nanoframework/System.Text/pull/24) +- Update 2 nuget dependencies [\#23](https://github.com/nanoframework/System.Text/pull/23) + +## [v1.1.1-preview.24](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.24) (2021-01-06) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.22...v1.1.1-preview.24) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.7 to 1.10.1-preview.9 [\#22](https://github.com/nanoframework/System.Text/pull/22) + +## [v1.1.1-preview.22](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.22) (2020-12-29) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.19...v1.1.1-preview.22) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.6 to 1.10.1-preview.7 [\#21](https://github.com/nanoframework/System.Text/pull/21) + +## [v1.1.1-preview.19](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.19) (2020-12-28) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.17...v1.1.1-preview.19) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.0-preview.4 to 1.10.1-preview.6 [\#20](https://github.com/nanoframework/System.Text/pull/20) + +## [v1.1.1-preview.17](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.17) (2020-12-07) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.14...v1.1.1-preview.17) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.9.1-preview.6 to 1.10.0-preview.4 [\#19](https://github.com/nanoframework/System.Text/pull/19) + +## [v1.1.1-preview.14](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.14) (2020-10-21) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.12...v1.1.1-preview.14) + +**Documentation and other chores:** + +- Update dependencies [\#17](https://github.com/nanoframework/System.Text/pull/17) + +## [v1.1.1-preview.12](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.12) (2020-10-20) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.10...v1.1.1-preview.12) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.9.0-preview.5 to 1.9.1-preview.4 [\#15](https://github.com/nanoframework/System.Text/pull/15) + +## [v1.1.1-preview.10](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.10) (2020-10-01) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.1-preview.2...v1.1.1-preview.10) + +**Documentation and other chores:** + +- Update dependencies [\#14](https://github.com/nanoframework/System.Text/pull/14) + +## [v1.1.1-preview.2](https://github.com/nanoframework/System.Text/tree/v1.1.1-preview.2) (2020-09-19) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.1.0...v1.1.1-preview.2) + +**Documentation and other chores:** + +- Update dependencies [\#13](https://github.com/nanoframework/System.Text/pull/13) + +## [v1.1.0](https://github.com/nanoframework/System.Text/tree/v1.1.0) (2020-06-16) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0...v1.1.0) + +## [v1.0.0](https://github.com/nanoframework/System.Text/tree/v1.0.0) (2020-06-12) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.25...v1.0.0) + +## [v1.0.0-preview.25](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.25) (2020-06-11) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.22...v1.0.0-preview.25) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.3-preview.4 to 1.7.3 [\#10](https://github.com/nanoframework/System.Text/pull/10) + +## [v1.0.0-preview.22](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.22) (2020-05-31) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.16...v1.0.0-preview.22) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.7 to 1.7.3-preview.4 [\#9](https://github.com/nanoframework/System.Text/pull/9) + +## [v1.0.0-preview.16](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.16) (2020-05-08) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.15...v1.0.0-preview.16) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.6 to 1.7.2-preview.7 [\#8](https://github.com/nanoframework/System.Text/pull/8) + +## [v1.0.0-preview.15](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.15) (2020-05-08) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.14...v1.0.0-preview.15) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.5 to 1.7.2-preview.6 [\#7](https://github.com/nanoframework/System.Text/pull/7) + +## [v1.0.0-preview.14](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.14) (2020-04-27) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.13...v1.0.0-preview.14) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.2-preview.4 to 1.7.2-preview.5 [\#6](https://github.com/nanoframework/System.Text/pull/6) + +## [v1.0.0-preview.13](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.13) (2020-04-16) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.11...v1.0.0-preview.13) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.1-preview.4 to 1.7.2-preview.4 [\#5](https://github.com/nanoframework/System.Text/pull/5) + +## [v1.0.0-preview.11](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.11) (2020-04-14) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.8...v1.0.0-preview.11) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.7.0-preview.12 to 1.7.1-preview.4 [\#4](https://github.com/nanoframework/System.Text/pull/4) + +## [v1.0.0-preview.8](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.8) (2020-03-10) + +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.7...v1.0.0-preview.8) + +## [v1.0.0-preview.7](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.7) (2020-03-10) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/v1.0.0-preview.1...v1.0.0-preview.7) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/v1.0.0-preview.1...v1.0.0-preview.7) **Documentation and other chores:** -- Bumps nanoFramework.CoreLibrary from 1.6.0-preview.1 to 1.7.0-preview.12 [\#3](https://github.com/nanoframework/lib-nanoFramework.System.Text/pull/3) +- Bumps nanoFramework.CoreLibrary from 1.6.0-preview.1 to 1.7.0-preview.12 [\#3](https://github.com/nanoframework/System.Text/pull/3) -## [v1.0.0-preview.1](https://github.com/nanoframework/lib-nanoFramework.System.Text/tree/v1.0.0-preview.1) (2019-11-14) +## [v1.0.0-preview.1](https://github.com/nanoframework/System.Text/tree/v1.0.0-preview.1) (2019-11-14) -[Full Changelog](https://github.com/nanoframework/lib-nanoFramework.System.Text/compare/c0babc37636fd6509a17c67de79c06299cde628f...v1.0.0-preview.1) +[Full Changelog](https://github.com/nanoframework/System.Text/compare/c0babc37636fd6509a17c67de79c06299cde628f...v1.0.0-preview.1) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8dada3e..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..94286c9 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) .NET Foundation and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/source/NuGet.Config b/NuGet.Config similarity index 100% rename from source/NuGet.Config rename to NuGet.Config index ef0bacf..0521fe6 100644 --- a/source/NuGet.Config +++ b/NuGet.Config @@ -1,7 +1,7 @@ - + diff --git a/README.md b/README.md index 5c506de..035ebb4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.System.Text&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.System.Text) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.System.Text&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.System.Text) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/nanoframework/Home/blob/master/LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.nanoFramework.System.Text.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Text/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.System.Text&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.System.Text) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.System.Text&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.System.Text) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Text.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Text/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) -![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png) +![nanoFramework logo](https://github.com/nanoframework/Home/blob/main/resources/logo/nanoFramework-repo-logo.png) ----- @@ -11,8 +11,8 @@ | Component | Build Status | NuGet Package | |:-|---|---| -| nanoFramework.System.Text | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.System.Text/_apis/build/status/nanoframework.lib-nanoFramework.System.Text?branchName=master)](https://dev.azure.com/nanoframework/nanoFramework.System.Text/_build/latest?definitionId=57&branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Text.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Text/) | -| nanoFramework.System.Text (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.System.Text/_apis/build/status/nanoframework.lib-nanoFramework.System.Text?branchName=develop)](https://dev.azure.com/nanoframework/nanoFramework.System.Text/_build/latest?definitionId=57&branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.nanoFramework.System.Text&protocolType=NuGet&view=overview) | +| nanoFramework.System.Text | [![Build Status](https://dev.azure.com/nanoframework/System.Text/_apis/build/status/System.Text?repoName=nanoframework%2FSystem.Text&branchName=main)](https://dev.azure.com/nanoframework/System.Text/_build/latest?definitionId=57&repoName=nanoframework%2FSystem.Text&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Text.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Text/) | +| nanoFramework.System.Text (preview) | [![Build Status](https://dev.azure.com/nanoframework/System.Text/_apis/build/status/System.Text?repoName=nanoframework%2FSystem.Text&branchName=develop)](https://dev.azure.com/nanoframework/System.Text/_build/latest?definitionId=57&repoName=nanoframework%2FSystem.Text&branchName=develop) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Text.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Text/) | ## Feedback and documentation @@ -22,14 +22,17 @@ Join our Discord community [here](https://discord.gg/gCyBu8T). ## Credits -The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/master/CONTRIBUTORS.md). +The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/main/CONTRIBUTORS.md). ## License -The **nanoFramework** Class Libraries are licensed under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0). +The **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md). ## Code of Conduct -This project has adopted the code of conduct defined by the [Contributor Covenant](http://contributor-covenant.org/) -to clarify expected behavior in our community. - +This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. +For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). + +### .NET Foundation + +This project is supported by the [.NET Foundation](https://dotnetfoundation.org). diff --git a/Tests/NFUnitTestStringBuilder/EncodingTests.cs b/Tests/NFUnitTestStringBuilder/EncodingTests.cs new file mode 100644 index 0000000..665a1c9 --- /dev/null +++ b/Tests/NFUnitTestStringBuilder/EncodingTests.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Text; + +namespace NFUnitTestStringBuilder +{ + [TestClass] + class EncodingTests + { + [TestMethod] + public void Utf8EncodingTests_Test1() + { + string str = "this is a normal string that will be used to convert to bytes then back to a string"; + + byte[] data = new byte[128]; + int len = str.Length; + int idx = 0; + + Random rand = new Random(); + + int cBytes = 0; + + while (len > 0) + { + int size = (len <= 2) ? len : rand.Next(len / 2) + 1; + len -= size; + + int cnt = UTF8Encoding.UTF8.GetBytes(str, idx, size, data, cBytes); + + Assert.Equal(str.Substring(idx, size), new string(UTF8Encoding.UTF8.GetChars(data, cBytes, cnt))); + + cBytes += cnt; + idx += size; + } + Assert.Equal(cBytes, str.Length); + string strAfter = new string(UTF8Encoding.UTF8.GetChars(data, 0, cBytes)); + Assert.Equal(str, strAfter); + } + + [TestMethod] + public void Utf8EncodingTests_Test2() + { + string str = "this is a normal string that will be used to convert to bytes then back to a string"; + byte[] data = UTF8Encoding.UTF8.GetBytes(str); + Assert.Equal(data.Length, str.Length); + string strAfter = new string(UTF8Encoding.UTF8.GetChars(data)); + Assert.Equal(str, strAfter); + } + + [TestMethod] + public void Utf8EncodingTests_Test3() + { + // This tests involves a string with a special character + string str = "AB\u010DAB"; + byte[] data = new byte[4]; + int count = UTF8Encoding.UTF8.GetBytes(str, 1, 3, data, 0); + Assert.Equal(count, 4); + Assert.Equal(new string(UTF8Encoding.UTF8.GetChars(data)), "B\u010DA"); + } + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestStringBuilder/NFUnitTestStringBuilder.nfproj b/Tests/NFUnitTestStringBuilder/NFUnitTestStringBuilder.nfproj new file mode 100644 index 0000000..2823a82 --- /dev/null +++ b/Tests/NFUnitTestStringBuilder/NFUnitTestStringBuilder.nfproj @@ -0,0 +1,69 @@ + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + c5331952-b712-4c77-939b-27589ced5a24 + Library + Properties + 512 + NFUnitTestStringBuilder + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.5\lib\mscorlib.dll + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.147\lib\nanoFramework.TestFramework.dll + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.147\lib\nanoFramework.UnitTestLauncher.exe + True + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + + diff --git a/Tests/NFUnitTestStringBuilder/Properties/AssemblyInfo.cs b/Tests/NFUnitTestStringBuilder/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a3735af --- /dev/null +++ b/Tests/NFUnitTestStringBuilder/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright (c) 2021 nanoFramework contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestStringBuilder/StringBuilderTests.cs b/Tests/NFUnitTestStringBuilder/StringBuilderTests.cs new file mode 100644 index 0000000..960d676 --- /dev/null +++ b/Tests/NFUnitTestStringBuilder/StringBuilderTests.cs @@ -0,0 +1,256 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Text; + +namespace NFUnitTestStringBuilder +{ + [TestClass] + public class StringBuilderTests + { + private static StringBuilder stringBuilder; + + [Setup] + public void InitializeStringBuild() + { + stringBuilder = new StringBuilder(); + } + + [TestMethod] + public void Test_0_AppendTest_0() + { + stringBuilder.Append(true); + Assert.Equal(stringBuilder.ToString(), Boolean.TrueString); + stringBuilder.Append(false); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString)); + stringBuilder.Append(byte.MinValue); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue)); + stringBuilder.Append(new char[] { 'x', 'a' }); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue, char.MinValue, "xa")); + stringBuilder.Append(double.Epsilon); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue, char.MinValue, "xa", double.Epsilon.ToString())); + stringBuilder.Append(float.Epsilon); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue, char.MinValue, "xa", double.Epsilon.ToString(), float.Epsilon.ToString())); + stringBuilder.Append(int.MaxValue); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue, char.MinValue, "xa", double.Epsilon.ToString(), float.Epsilon.ToString(), int.MaxValue)); + stringBuilder.Append(long.MaxValue); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue, char.MinValue, "xa", double.Epsilon.ToString(), float.Epsilon.ToString(), int.MaxValue, long.MaxValue)); + stringBuilder.Append((object)"string"); + Assert.Equal(stringBuilder.ToString(), string.Concat(Boolean.TrueString, Boolean.FalseString, byte.MinValue, char.MinValue, "xa", double.Epsilon.ToString(), float.Epsilon.ToString(), int.MaxValue, long.MaxValue, "string")); + } + + [TestMethod] + public void Test_1_RemoveTest_0() + { + Assert.Equal(stringBuilder.Clear().ToString(), string.Empty); + string testString = "0123456789"; + stringBuilder.Append(testString); + stringBuilder.Remove(0, 1); + Assert.Equal(stringBuilder.ToString(), "123456789"); + stringBuilder.Remove(stringBuilder.Length - 1, 1); + Assert.Equal(stringBuilder.ToString(), "12345678"); + } + + [TestMethod] + public void Test_2_InsertTest_0() + { + stringBuilder.Clear(); + string testString = "0000"; + stringBuilder.Append(testString); + stringBuilder.Insert(0, "x", 2); + Assert.Equal(stringBuilder.ToString(), "xx0000"); + stringBuilder.Insert(stringBuilder.Length, "x", 2); + Assert.Equal(stringBuilder.ToString(), "xx0000xx"); + } + + [TestMethod] + public void Test_3_ReplaceTest_0() + { + stringBuilder.Clear(); + string testString = "0000"; + stringBuilder.Append(testString); + stringBuilder.Append("_"); + stringBuilder.Append(testString); + stringBuilder.Replace(testString, "xx"); + Assert.Equal(stringBuilder.ToString(), "xx_xx"); + } + + [TestMethod] + public void Test_3_ReplaceTest_1() + { + stringBuilder.Clear(); string testString = "BEGIN"; + //stringBuilder.Append("BEGIN_MID_END"); + stringBuilder.Append('B'); + stringBuilder.Append('E'); + stringBuilder.Append('G'); + stringBuilder.Append('I'); + stringBuilder.Append('N'); + stringBuilder.Append('_'); + stringBuilder.Append('M'); + stringBuilder.Append('I'); + stringBuilder.Append('D'); + stringBuilder.Append('_'); + stringBuilder.Append('E'); + stringBuilder.Append('N'); + stringBuilder.Append('D'); + stringBuilder.Replace(testString, "xx"); + Assert.Equal(stringBuilder.ToString(), "xx_MID_END"); + } + + [TestMethod] + public void Test_3_ReplaceTest_2() + { + string testString = "MID"; + stringBuilder.Replace(testString, "xx"); + Assert.Equal(stringBuilder.ToString(), "xx_xx_END"); + } + + [TestMethod] + public void Test_3_ReplaceTest_3() + { + string testString = "END"; + stringBuilder.Replace(testString, "xx"); + Assert.Equal(stringBuilder.ToString(), "xx_xx_xx"); + } + + [TestMethod] + public void Test_3_ReplaceTest_4() + { + string testString = "The quick br!wn d#g jumps #ver the lazy cat."; + stringBuilder = new System.Text.StringBuilder(testString); + stringBuilder.Replace('#', '!', 15, 29); // Some '#' -> '!' + Assert.Equal(stringBuilder.ToString(), "The quick br!wn d!g jumps !ver the lazy cat."); + stringBuilder.Replace('!', 'o'); // All '!' -> 'o' + Assert.Equal(stringBuilder.ToString(), "The quick brown dog jumps over the lazy cat."); + stringBuilder.Replace("cat", "dog"); // All "cat" -> "dog" + Assert.Equal(stringBuilder.ToString(), "The quick brown dog jumps over the lazy dog."); + stringBuilder.Replace("dog", "fox", 15, 20); // Some "dog" -> "fox" + Assert.Equal(stringBuilder.ToString(), "The quick brown fox jumps over the lazy dog."); + } + + [TestMethod] + public void Test_3_ReplaceTest_5() + { + stringBuilder.Clear(); + stringBuilder.Append("12345"); + stringBuilder.Replace("45", "def"); + Assert.Equal(stringBuilder.ToString(), "123def"); + } + + [TestMethod] + public void Test_3_ReplaceTest_6() + { + stringBuilder.Clear(); + + stringBuilder.Append("[{1234}]Test}]"); + stringBuilder.Replace("}]", "}]example"); + Assert.Equal(stringBuilder.ToString(), "[{1234}]exampleTest}]example"); + } + + [TestMethod] + public void Test_3_ReplaceTest_7() + { + var random = new Random(); + for (int i = 0; i < 1000; i++) + { + string sRaw, sFind, sReplace; + GenerateFuzzyParameters(out sRaw, out sFind, out sReplace, random); + stringBuilder.Clear(); + stringBuilder.Append(sRaw); + stringBuilder.Replace(sFind, sReplace); + string sMFOutput = stringBuilder.ToString(); + string sNativeOutput = NativeReplace(sRaw, sFind, sReplace); + + Assert.Equal(sMFOutput, sNativeOutput); + } + } + + void GenerateFuzzyParameters(out string sRaw, out string sFind, out string sReplace, Random random) + { + int cFind = random.Next(1, 4); + sFind = RandomString(random, 2, 6); + sReplace = RandomString(random, 4, 10); + + sRaw = string.Empty; + for (int i = 0; i < cFind; i++) + { + if (i > 0 || random.Next() % 5 > 0) + { + sRaw += RandomString(random, 2, 6); + } + + sRaw += sFind; + } + + if (random.Next() % 5 > 0) + { + sRaw += RandomString(random, 2, 6); + } + } + + string RandomString(Random random, int iLenMin, int iLenMax) + { + string sChars = "abcdefghijklmnopqrstuvwxyz0123456789{}[]-=+()"; + int length = random.Next(iLenMin, iLenMax); + + string sOutput = string.Empty; + for (int i = 0; i < length; i++) + { + sOutput += sChars[random.Next(0, sChars.Length - 1)]; + } + + return sOutput; + } + + string NativeReplace(string sRaw, string sFind, string sReplace) + { + string sOutput = sRaw; + int i = 0; + + while (i < sOutput.Length) + { + int p = sOutput.IndexOf(sFind, i); + if (p < 0) + { + break; + } + + sOutput = sOutput.Substring(0, p) + sReplace + sOutput.Substring(p + sFind.Length); + i = p + sReplace.Length; + } + + return sOutput; + } + + [TestMethod] + public void Test_4_CapacityTest_0() + { + stringBuilder.Length = 0; + stringBuilder.Capacity = 5; + Assert.Equal(stringBuilder.ToString(), string.Empty); string testString = "0000"; + stringBuilder.Append(string.Empty); + stringBuilder.Append(testString); + stringBuilder.Append(string.Empty); + //should allocate here + stringBuilder.Append("_"); + stringBuilder.Append("_"); + //result is true if capacity is > 5 + Assert.True(stringBuilder.Capacity > 5); + } + + } + + static class RandomExtension + { + static public int Next(this Random random, int iMin, int iMax) + { + return random.Next(iMax - iMin) + iMin; + } + } +} + diff --git a/Tests/NFUnitTestStringBuilder/nano.runsettings b/Tests/NFUnitTestStringBuilder/nano.runsettings new file mode 100644 index 0000000..fa881e3 --- /dev/null +++ b/Tests/NFUnitTestStringBuilder/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestStringBuilder/packages.config b/Tests/NFUnitTestStringBuilder/packages.config new file mode 100644 index 0000000..be34a29 --- /dev/null +++ b/Tests/NFUnitTestStringBuilder/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assets/nf-logo.png b/assets/nf-logo.png new file mode 100644 index 0000000..6f576ca Binary files /dev/null and b/assets/nf-logo.png differ diff --git a/source/readme.txt b/assets/readme.txt similarity index 100% rename from source/readme.txt rename to assets/readme.txt diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 78c6993..05d7046 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,8 +1,8 @@ trigger: branches: - include: [master, develop, "release-*" ] + include: [main, develop, "release-*" ] paths: - exclude: ["*.md", .gitignore] + exclude: [README.md, LICENSE.md, NuGet.Config, .github_changelog_generator, .gitignore] tags: include: ["v*"] @@ -22,15 +22,14 @@ jobs: - job: Build_Library condition: or( eq(variables['UPDATE_DEPENDENTS'], 'false'), eq(variables['StartReleaseCandidate'], 'true') ) pool: - vmImage: 'VS2017-Win2016' + vmImage: 'windows-2019' variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - solution: '**/source/*.sln' + DOTNET_NOLOGO: true + solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' nugetPackageName: 'nanoFramework.System.Text' - repoName: 'lib-nanoFramework.System.Text' steps: @@ -39,6 +38,8 @@ jobs: - template: azure-pipelines-templates/class-lib-build.yml@templates parameters: sonarCloudProject: 'nanoframework_lib-nanoFramework.System.Text' + runUnitTests: true + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\Tests\NFUnitTestStringBuilder\nano.runsettings' ############################## - job: Update_Dependencies @@ -48,45 +49,43 @@ jobs: - Build_Library pool: - vmImage: 'VS2017-Win2016' + vmImage: 'windows-2019' variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_NOLOGO: true steps: - checkout: none - - task: NuGetToolInstaller@0 - inputs: - versionSpec: '5.4.0' - displayName: 'Install specific version of NuGet' + - template: azure-pipelines-templates/install-nuget.yml@templates # update dependencies - task: UpdatenFDependencies@1 inputs: gitHubToken: $(GitHubToken) repositoriesToUpdate: | - lib-nanoFramework.System.Net - lib-nanoFramework.System.Net.Http - lib-Windows.Devices.SerialCommunication - lib-Windows.Storage - lib-Windows.Storage.Streams - lib-nanoFramework.Json + System.Net + System.Net.Http + Windows.Devices.SerialCommunication + Windows.Storage + Windows.Storage.Streams + nanoFramework.Json paho.mqtt.m2mqtt displayName: Update dependent class libs ################################## # report build failure to Discord - job: Report_Build_Failure + condition: or( failed('Build_Library'), failed('Update_Dependencies')) dependsOn: - Build_Library - Update_Dependencies - condition: or( failed('Build_Library'), failed('Update_Dependencies')) pool: - vmImage: 'VS2017-Win2016' + vmImage: 'windows-2019' + steps: - checkout: self diff --git a/config/SignClient.json b/config/SignClient.json new file mode 100644 index 0000000..482177d --- /dev/null +++ b/config/SignClient.json @@ -0,0 +1,14 @@ +{ + "SignClient": { + "AzureAd": { + "AADInstance": "https://login.microsoftonline.com/", + "ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8", + "TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e" + }, + "Service": { + "Url": "https://codesign.dotnetfoundation.org/", + "ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001" + } + } + } + \ No newline at end of file diff --git a/config/filelist.txt b/config/filelist.txt new file mode 100644 index 0000000..f066396 --- /dev/null +++ b/config/filelist.txt @@ -0,0 +1 @@ +**/nanoFramework.System.Text.* \ No newline at end of file diff --git a/source/nanoFramework.System.Text.nuspec b/nanoFramework.System.Text.nuspec similarity index 68% rename from source/nanoFramework.System.Text.nuspec rename to nanoFramework.System.Text.nuspec index 2f1e652..ca345da 100644 --- a/source/nanoFramework.System.Text.nuspec +++ b/nanoFramework.System.Text.nuspec @@ -4,23 +4,24 @@ nanoFramework.System.Text $version$ nanoFramework.System.Text - nanoFramework project contributors - nanoFramework project contributors + .NET nanoFramework project contributors + .NET nanoFramework project contributors,dotnetfoundation false - Apache-2.0 + LICENSE.md false - https://github.com/nanoframework/lib-nanoFramework.System.Text + https://github.com/nanoframework/System.Text https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad - - Copyright (c) 2018 The nanoFramework project contributors + images\nf-logo.png + + Copyright (c) .NET Foundation and Contributors This package includes the System.Text assembly for nanoFramework C# projects. -This package requires a target with nanoFramework.System.Text v$nativeVersion$. +This package requires a target with System.Text v$nativeVersion$. System.Text assembly for nanoFramework C# projects nanoFramework C# csharp netmf netnf nanoFramework.System.Text - + @@ -29,7 +30,8 @@ This package requires a target with nanoFramework.System.Text v$nativeVersion$.< - - + + + \ No newline at end of file diff --git a/source/nanoFramework.System.Text.sln b/nanoFramework.System.Text.sln similarity index 60% rename from source/nanoFramework.System.Text.sln rename to nanoFramework.System.Text.sln index b752e88..7e6f942 100644 --- a/source/nanoFramework.System.Text.sln +++ b/nanoFramework.System.Text.sln @@ -1,7 +1,7 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.902 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31025.218 MinimumVisualStudioVersion = 10.0.40219.1 Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.System.Text", "nanoFramework.System.Text\nanoFramework.System.Text.nfproj", "{9B99CAC1-E74B-4DF7-AC98-A4D4923AFB47}" EndProject @@ -12,6 +12,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1A9B4D93-29BC-4314-ABF9-E4BC2A755032}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStringBuilder", "Tests\NFUnitTestStringBuilder\NFUnitTestStringBuilder.nfproj", "{C5331952-B712-4C77-939B-27589CED5A24}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,10 +28,19 @@ Global {9B99CAC1-E74B-4DF7-AC98-A4D4923AFB47}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B99CAC1-E74B-4DF7-AC98-A4D4923AFB47}.Release|Any CPU.Build.0 = Release|Any CPU {9B99CAC1-E74B-4DF7-AC98-A4D4923AFB47}.Release|Any CPU.Deploy.0 = Release|Any CPU + {C5331952-B712-4C77-939B-27589CED5A24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5331952-B712-4C77-939B-27589CED5A24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5331952-B712-4C77-939B-27589CED5A24}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {C5331952-B712-4C77-939B-27589CED5A24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5331952-B712-4C77-939B-27589CED5A24}.Release|Any CPU.Build.0 = Release|Any CPU + {C5331952-B712-4C77-939B-27589CED5A24}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {C5331952-B712-4C77-939B-27589CED5A24} = {1A9B4D93-29BC-4314-ABF9-E4BC2A755032} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {863DB2A2-5555-49B7-A921-C2EF51A150B1} EndGlobalSection diff --git a/source/nanoFramework.System.Text/Properties/AssemblyInfo.cs b/nanoFramework.System.Text/Properties/AssemblyInfo.cs similarity index 91% rename from source/nanoFramework.System.Text/Properties/AssemblyInfo.cs rename to nanoFramework.System.Text/Properties/AssemblyInfo.cs index 1ea7f7f..1419cf4 100644 --- a/source/nanoFramework.System.Text/Properties/AssemblyInfo.cs +++ b/nanoFramework.System.Text/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ [assembly: AssemblyTitle("nanoFramework.System.Text")] [assembly: AssemblyCompany("nanoFramework Contributors")] [assembly: AssemblyProduct("nanoFramework.System.Text")] -[assembly: AssemblyCopyright("Copyright © nanoFramework Contributors 2019")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] //////////////////////////////////////////////////////////////// // update this whenever the native assembly signature changes // diff --git a/source/nanoFramework.System.Text/Text/Decoder.cs b/nanoFramework.System.Text/Text/Decoder.cs similarity index 96% rename from source/nanoFramework.System.Text/Text/Decoder.cs rename to nanoFramework.System.Text/Text/Decoder.cs index 8e1b3a9..ffbb347 100644 --- a/source/nanoFramework.System.Text/Text/Decoder.cs +++ b/nanoFramework.System.Text/Text/Decoder.cs @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The nanoFramework project contributors +// Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // diff --git a/source/nanoFramework.System.Text/Text/Encoding.cs b/nanoFramework.System.Text/Text/Encoding.cs similarity index 99% rename from source/nanoFramework.System.Text/Text/Encoding.cs rename to nanoFramework.System.Text/Text/Encoding.cs index ce747f4..6776ea8 100644 --- a/source/nanoFramework.System.Text/Text/Encoding.cs +++ b/nanoFramework.System.Text/Text/Encoding.cs @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The nanoFramework project contributors +// Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // diff --git a/source/nanoFramework.System.Text/Text/StringBuilder.cs b/nanoFramework.System.Text/Text/StringBuilder.cs similarity index 99% rename from source/nanoFramework.System.Text/Text/StringBuilder.cs rename to nanoFramework.System.Text/Text/StringBuilder.cs index e55b1e0..9b9a317 100644 --- a/source/nanoFramework.System.Text/Text/StringBuilder.cs +++ b/nanoFramework.System.Text/Text/StringBuilder.cs @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The nanoFramework project contributors +// Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // diff --git a/source/nanoFramework.System.Text/Text/UTF8Decoder.cs b/nanoFramework.System.Text/Text/UTF8Decoder.cs similarity index 89% rename from source/nanoFramework.System.Text/Text/UTF8Decoder.cs rename to nanoFramework.System.Text/Text/UTF8Decoder.cs index 0ee0c03..db909bb 100644 --- a/source/nanoFramework.System.Text/Text/UTF8Decoder.cs +++ b/nanoFramework.System.Text/Text/UTF8Decoder.cs @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The nanoFramework project contributors +// Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // diff --git a/source/nanoFramework.System.Text/Text/UTF8Encoding.cs b/nanoFramework.System.Text/Text/UTF8Encoding.cs similarity index 98% rename from source/nanoFramework.System.Text/Text/UTF8Encoding.cs rename to nanoFramework.System.Text/Text/UTF8Encoding.cs index 7688f46..df55c2a 100644 --- a/source/nanoFramework.System.Text/Text/UTF8Encoding.cs +++ b/nanoFramework.System.Text/Text/UTF8Encoding.cs @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The nanoFramework project contributors +// Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // diff --git a/source/nanoFramework.System.Text/key.snk b/nanoFramework.System.Text/key.snk similarity index 100% rename from source/nanoFramework.System.Text/key.snk rename to nanoFramework.System.Text/key.snk diff --git a/source/nanoFramework.System.Text/nanoFramework.System.Text.nfproj b/nanoFramework.System.Text/nanoFramework.System.Text.nfproj similarity index 87% rename from source/nanoFramework.System.Text/nanoFramework.System.Text.nfproj rename to nanoFramework.System.Text/nanoFramework.System.Text.nfproj index eeac3f6..4c13414 100644 --- a/source/nanoFramework.System.Text/nanoFramework.System.Text.nfproj +++ b/nanoFramework.System.Text/nanoFramework.System.Text.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -32,6 +32,7 @@ bin\$(Configuration)\Stubs nf_system_text nanoFramework.System.Text + ..\.sonarlint\nanoframework_lib-nanoframework.system.textcsharp.ruleset @@ -39,7 +40,7 @@ - + false @@ -57,8 +58,11 @@ - - ..\packages\nanoFramework.CoreLibrary.1.7.3\lib\mscorlib.dll + + + + + ..\packages\nanoFramework.CoreLibrary.1.10.5\lib\mscorlib.dll True diff --git a/source/nanoFramework.System.Text/packages.config b/nanoFramework.System.Text/packages.config similarity index 65% rename from source/nanoFramework.System.Text/packages.config rename to nanoFramework.System.Text/packages.config index fde0308..32546da 100644 --- a/source/nanoFramework.System.Text/packages.config +++ b/nanoFramework.System.Text/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/source/version.json b/version.json similarity index 88% rename from source/version.json rename to version.json index 705d7e8..b2fd61a 100644 --- a/source/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.1.0", + "version": "1.1.1", "assemblyVersion": { "precision": "revision" }, @@ -9,7 +9,8 @@ "semVer": 2.0 }, "publicReleaseRefSpec": [ - "^refs/heads/master$", + "^refs/heads/develop$", + "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": {