-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the duplicate usage flag value (#1231)
The `Xml` in `UsageFlag` accidentally to have a duplicate value with an existing one, this PR fixes it.
- Loading branch information
1 parent
374c373
commit 01e5e0d
Showing
5 changed files
with
46 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: fix | ||
packages: | ||
- "@azure-tools/typespec-client-generator-core" | ||
--- | ||
|
||
fix the duplicate usageflags values for json and xml |
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
16 changes: 16 additions & 0 deletions
16
packages/typespec-client-generator-core/test/types/usage-flags.test.ts
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,16 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { UsageFlags } from "../../src/interfaces.js"; | ||
|
||
describe("typespec-client-generator-core: usage flags", () => { | ||
it("all possible values in UsageFlags should be orthogonal", async () => { | ||
const values = Object.values(UsageFlags).filter( | ||
(value) => typeof value === "number" | ||
) as number[]; | ||
|
||
for (let i = 0; i < values.length; i++) { | ||
for (let j = i + 1; j < values.length; j++) { | ||
expect(values[i] & values[j]).toBe(0); | ||
} | ||
} | ||
}); | ||
}); |