Skip to content

Commit bb7cd71

Browse files
chore: add windows bat scripts for unit tests (#186)
1 parent 98a7ce2 commit bb7cd71

13 files changed

+56
-27
lines changed

era-compiler-solidity/tests/cli/mod.rs

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ mod threads;
4646
mod version;
4747
mod yul;
4848

49+
macro_rules! test_script_path {
50+
($name:ident, $base:expr) => {
51+
#[cfg(target_os = "windows")]
52+
pub const $name: &str = concat!($base, ".bat");
53+
#[cfg(not(target_os = "windows"))]
54+
pub const $name: &str = concat!($base, ".sh");
55+
};
56+
}
57+
4958
/// A test input file.
5059
pub const TEST_CONTRACTS_PATH: &str = "tests/data/contracts/";
5160

@@ -189,27 +198,31 @@ pub const TEST_LINKER_BYTECODE_COPY_PATH: &str = "tests/data/bytecodes/linker_co
189198
/// The broken input file path.
190199
pub const TEST_BROKEN_INPUT_PATH: &str = "tests/data/broken.bad";
191200

192-
/// A test constant.
193-
pub const TEST_SCRIPT_SOLC_VERSION_OUTPUT_ERROR_PATH: &str =
194-
"tests/scripts/solc_version_output_error.sh";
195-
196-
/// A test constant.
197-
pub const TEST_SCRIPT_SOLC_VERSION_TOO_OLD_PATH: &str = "tests/scripts/solc_version_too_old.sh";
198-
199-
/// A test constant.
200-
pub const TEST_SCRIPT_SOLC_VERSION_TOO_NEW_PATH: &str = "tests/scripts/solc_version_too_new.sh";
201-
202-
/// A test constant.
203-
pub const TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_LINES_PATH: &str =
204-
"tests/scripts/solc_version_not_enough_lines.sh";
205-
206-
/// A test constant.
207-
pub const TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_WORDS_IN_2ND_LINE_PATH: &str =
208-
"tests/scripts/solc_version_not_enough_words_in_2nd_line.sh";
209-
210-
/// A test constant.
211-
pub const TEST_SCRIPT_SOLC_VERSION_PARSING_ERROR_PATH: &str =
212-
"tests/scripts/solc_version_parsing_error.sh";
201+
/// Shell script test constants.
202+
test_script_path!(
203+
TEST_SCRIPT_SOLC_VERSION_OUTPUT_ERROR_PATH,
204+
"tests/scripts/solc_version_output_error"
205+
);
206+
test_script_path!(
207+
TEST_SCRIPT_SOLC_VERSION_TOO_OLD_PATH,
208+
"tests/scripts/solc_version_too_old"
209+
);
210+
test_script_path!(
211+
TEST_SCRIPT_SOLC_VERSION_TOO_NEW_PATH,
212+
"tests/scripts/solc_version_too_new"
213+
);
214+
test_script_path!(
215+
TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_LINES_PATH,
216+
"tests/scripts/solc_version_not_enough_lines"
217+
);
218+
test_script_path!(
219+
TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_WORDS_IN_2ND_LINE_PATH,
220+
"tests/scripts/solc_version_not_enough_words_in_2nd_line"
221+
);
222+
test_script_path!(
223+
TEST_SCRIPT_SOLC_VERSION_PARSING_ERROR_PATH,
224+
"tests/scripts/solc_version_parsing_error"
225+
);
213226

214227
/// A test constant.
215228
pub const LIBRARY_DEFAULT: &str = "tests/data/contracts/solidity/MiniMath.sol:MiniMath=0xF9702469Dfb84A9aC171E284F71615bd3D3f1EdC";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@ECHO OFF
2+
echo 'solc, the solidity compiler commandline interface'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
echo 'solc, the solidity compiler commandline interface'
3+
echo 'solc, the solidity compiler commandline interface'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
echo 'solc, the solidity compiler commandline interface'
3+
echo 'Version:'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
echo 'solc, the solidity compiler commandline interface'
4-
echo 'Version:'
4+
echo 'Version:'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@ECHO OFF
2+
exit 1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
exit 1
3+
exit 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
echo 'solc, the solidity compiler commandline interface'
3+
echo 'Version: x.y.z+commit.deadbeef.platform.toolchain'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
echo 'solc, the solidity compiler commandline interface'
4-
echo 'Version: x.y.z+commit.deadbeef.platform.toolchain'
4+
echo 'Version: x.y.z+commit.deadbeef.platform.toolchain'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
echo 'solc, the solidity compiler commandline interface'
3+
echo 'Version: 0.8.29+commit.deadbeef.platform.toolchain'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
echo 'solc, the solidity compiler commandline interface'
4-
echo 'Version: 0.8.29+commit.deadbeef.platform.toolchain'
4+
echo 'Version: 0.8.29+commit.deadbeef.platform.toolchain'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
echo 'solc, the solidity compiler commandline interface'
3+
echo 'Version: 0.4.11+commit.deadbeef.platform.toolchain'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
echo 'solc, the solidity compiler commandline interface'
4-
echo 'Version: 0.4.11+commit.deadbeef.platform.toolchain'
4+
echo 'Version: 0.4.11+commit.deadbeef.platform.toolchain'

0 commit comments

Comments
 (0)