Skip to content

Commit 5755e86

Browse files
committed
make jar runnable to run tests
1 parent 0472707 commit 5755e86

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ set -e
66
mkdir -p bin;
77

88
javac $(find src -name "*.java") $(find test -name "*.java") -d bin
9-
cd bin && jar -cvf ./java-redis-client-$(git describe)--$(javac -version 2>&1 | sed 's/[^a-z0-9._]\+/-/g').jar $(find . -name "*.class")
9+
(
10+
cd bin;
11+
jar -cvfe \
12+
./java-redis-client-$(git describe)--$(javac -version 2>&1 | sed 's/[^a-z0-9._]\+/-/g').jar \
13+
nl.melp.redis.RedisTest \
14+
$(find . -name "*.class")
15+
);

src/nl/melp/redis/Redis.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void write(long val) throws IOException {
7171
* @throws IllegalArgumentException If the list contains unencodable objects.
7272
* @link https://redis.io/topics/protocol#resp-arrays
7373
*/
74-
void write(List<Object> list) throws IOException, IllegalArgumentException {
74+
void write(List<?> list) throws IOException, IllegalArgumentException {
7575
out.write('*');
7676
out.write(Long.toString(list.size()).getBytes());
7777
out.write(CRLF);
@@ -86,7 +86,7 @@ void write(List<Object> list) throws IOException, IllegalArgumentException {
8686
} else if (o instanceof Integer) {
8787
write(((Integer) o).longValue());
8888
} else if (o instanceof List) {
89-
write((List) o);
89+
write((List<?>) o);
9090
} else {
9191
throw new IllegalArgumentException("Unexpected type " + o.getClass().getCanonicalName());
9292
}

test.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ set -x
33
set -e
44

55
./build.sh
6-
java -cp ./bin/java-redis-client*.jar nl.melp.redis.RedisTest
6+
VERSION=$(java -version 2>&1 | head -1 | egrep -o '"[^"]+"' | tr -d '"')
7+
JAR=$(echo ./bin/java-redis-client-*$VERSION*.jar)
78

9+
for f in $JAR; do java -jar $f; done;

0 commit comments

Comments
 (0)