Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Nov 29, 2015
1 parent bad6712 commit 625aeab
Show file tree
Hide file tree
Showing 11 changed files with 271 additions and 42 deletions.
231 changes: 231 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions app/src/test/java/com/termux/app/TermuxActivityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

public class TermuxActivityTest extends TestCase {

private void assertUrlsAre(String text, String... urls) {
LinkedHashSet<String> expected = new LinkedHashSet<>();
Collections.addAll(expected, urls);
assertEquals(expected, TermuxActivity.extractUrls(text));
}
private void assertUrlsAre(String text, String... urls) {
LinkedHashSet<String> expected = new LinkedHashSet<>();
Collections.addAll(expected, urls);
assertEquals(expected, TermuxActivity.extractUrls(text));
}

public void testExtractUrls() {
assertUrlsAre("hello http://example.com world", "http://example.com");
public void testExtractUrls() {
assertUrlsAre("hello http://example.com world", "http://example.com");

assertUrlsAre("http://example.com\nhttp://another.com", "http://example.com", "http://another.com");
assertUrlsAre("http://example.com\nhttp://another.com", "http://example.com", "http://another.com");

assertUrlsAre("hello http://example.com world and http://more.example.com with secure https://more.example.com",
"http://example.com", "http://more.example.com", "https://more.example.com");
}
assertUrlsAre("hello http://example.com world and http://more.example.com with secure https://more.example.com",
"http://example.com", "http://more.example.com", "https://more.example.com");
}

}
12 changes: 6 additions & 6 deletions app/src/test/java/com/termux/terminal/ByteQueueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ private static void assertArrayEquals(byte[] expected, byte[] actual) {

public void testCompleteWrites() throws Exception {
ByteQueue q = new ByteQueue(10);
assertEquals(true, q.write(new byte[] { 1, 2, 3 }, 0, 3));
assertEquals(true, q.write(new byte[]{1, 2, 3}, 0, 3));

byte[] arr = new byte[10];
assertEquals(3, q.read(arr, true));
assertArrayEquals(new byte[] { 1, 2, 3 }, new byte[] { arr[0], arr[1], arr[2] });
assertArrayEquals(new byte[]{1, 2, 3}, new byte[]{arr[0], arr[1], arr[2]});

assertEquals(true, q.write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 0, 10));
assertEquals(true, q.write(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 0, 10));
assertEquals(10, q.read(arr, true));
assertArrayEquals(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, arr);
assertArrayEquals(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, arr);
}

public void testQueueWraparound() throws Exception {
ByteQueue q = new ByteQueue(10);

byte[] origArray = new byte[] { 1, 2, 3, 4, 5, 6 };
byte[] origArray = new byte[]{1, 2, 3, 4, 5, 6};
byte[] readArray = new byte[origArray.length];
for (int i = 0; i < 20; i++) {
q.write(origArray, 0, origArray.length);
Expand All @@ -43,7 +43,7 @@ public void testQueueWraparound() throws Exception {
public void testWriteNotesClosing() throws Exception {
ByteQueue q = new ByteQueue(10);
q.close();
assertEquals(false, q.write(new byte[] { 1, 2, 3 }, 0, 3));
assertEquals(false, q.write(new byte[]{1, 2, 3}, 0, 3));
}

public void testReadNonBlocking() throws Exception {
Expand Down
6 changes: 3 additions & 3 deletions app/src/test/java/com/termux/terminal/DecSetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* <pre>
* "CSI ? Pm h", DEC Private Mode Set (DECSET)
* </pre>
*
* <p/>
* and
*
* <p/>
* <pre>
* "CSI ? Pm l", DEC Private Mode Reset (DECRST)
* </pre>
*
* <p/>
* controls various aspects of the terminal
*/
public class DecSetTest extends TerminalTestCase {
Expand Down
1 change: 1 addition & 0 deletions app/src/test/java/com/termux/terminal/KeyHandlerTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.termux.terminal;

import android.view.KeyEvent;

import junit.framework.TestCase;

public class KeyHandlerTest extends TestCase {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.termux.terminal;

import android.util.Base64;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import android.util.Base64;

/** "ESC ]" is the Operating System Command. */
public class OperatingSystemControlTest extends TerminalTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* ${CSI}${top};${bottom}r" - set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM).
*
* <p/>
* "DECSTBM moves the cursor to column 1, line 1 of the page" (http://www.vt100.net/docs/vt510-rm/DECSTBM).
*/
public class ScrollRegionTest extends TerminalTestCase {
Expand Down
8 changes: 4 additions & 4 deletions app/src/test/java/com/termux/terminal/TerminalRowTest.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.termux.terminal;

import junit.framework.TestCase;

import java.util.Arrays;
import java.util.Random;

import junit.framework.TestCase;

public class TerminalRowTest extends TestCase {

/** The properties of these code points are validated in {@link #testStaticConstants()}. */
Expand Down Expand Up @@ -96,7 +96,7 @@ public void testAscii() {
assertEquals(80, row.getSpaceUsed());
assertColumnCharIndicesStartsWith(0, 1, 2, 3);

char[] someChars = new char[] { 'a', 'c', 'e', '4', '5', '6', '7', '8' };
char[] someChars = new char[]{'a', 'c', 'e', '4', '5', '6', '7', '8'};

char[] rawLine = new char[80];
Arrays.fill(rawLine, ' ');
Expand Down Expand Up @@ -373,7 +373,7 @@ public void testCrashATE145() {
assertEquals(0, WcWidth.width(0x009F));
assertEquals(1, Character.charCount(0x009F));

int[] points = new int[] { 0xC2541, 'a', '8', 0x73EE, 0x009F, 0x881F, 0x8324, 0xD4C9, 0xFFFD, 'B', 0x009B, 0x61C9, 'Z' };
int[] points = new int[]{0xC2541, 'a', '8', 0x73EE, 0x009F, 0x881F, 0x8324, 0xD4C9, 0xFFFD, 'B', 0x009B, 0x61C9, 'Z'};
// int[] expected = new int[] { TerminalEmulator.UNICODE_REPLACEMENT_CHAR, 'a', '8', 0x73EE, 0x009F, 0x881F, 0x8324, 0xD4C9, 0xFFFD,
// 'B', 0x009B, 0x61C9, 'Z' };
int currentColumn = 0;
Expand Down
Loading

0 comments on commit 625aeab

Please sign in to comment.