-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from 1Password/lumina/determinism-tests
Add determinism ensurance tests
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
input | ||
out |
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 @@ | ||
#[typeshare] | ||
pub struct CustomType {} | ||
|
||
#[typeshare] | ||
pub struct Types { | ||
pub s: String, | ||
pub static_s: &'static str, | ||
pub int8: i8, | ||
pub float: f32, | ||
pub double: f64, | ||
pub array: Vec<String>, | ||
pub fixed_length_array: [String; 4], | ||
pub dictionary: HashMap<String, i32>, | ||
pub optional_dictionary: Option<HashMap<String, i32>>, | ||
pub custom_type: CustomType, | ||
} |
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,19 @@ | ||
determinism_qty := '100' | ||
|
||
all: determinism | ||
|
||
generate-determinism-files: | ||
#!/bin/sh | ||
mkdir -p input | ||
for i in $(seq 1 {{determinism_qty}}); do | ||
cat data/determinism-base.rs | sd '(struct )(\w+)' "\${1}\${2}$i" > "input/input$i.rs" | ||
done | ||
determinism: clean generate-determinism-files | ||
mkdir -p out | ||
cargo run -p typeshare-cli -- -l typescript -o "out/output1.ts" input | ||
cargo run -p typeshare-cli -- -l typescript -o "out/output2.ts" input | ||
diff -q out/*.ts | ||
|
||
clean: | ||
rm -rf out | ||
rm -rf input |