package net.morilib.sh.builtin;

import net.morilib.sh.ShCommandExecuteTest;

public class ShSedTest extends ShCommandExecuteTest {

	public void test001() {
		piw.println("abca");
		piw.println("bcde");
		piw.close();
		exe("sed 's/a/b/g'", 0);
		eot("bbcb");
		eot("bcde");
		eot();
	}

	public void test002() {
		piw.println("abca");
		piw.println("bcde");
		piw.close();
		exe("sed 's/0/1/g'", 0);
		eot("abca");
		eot("bcde");
		eot();
	}

	public void test003() {
		piw.println("abca");
		piw.println("bcde");
		piw.close();
		exe("sed -n '1p'", 0);
		eot("abca");
		eot();
	}

	public void test004() {
		piw.println("abca");
		piw.println("bcde");
		piw.close();
		exe("sed -e 's/a/b/g'", 0);
		eot("bbcb");
		eot("bcde");
		eot();
	}

	public void test005() {
		piw.println("abca");
		piw.println("bcde");
		piw.close();
		exe("sed -f sed1.sed", 0);
		eot("bbcb");
		eot("bcde");
		eot();
	}

	public void test006() {
		piw.println("abca");
		piw.println("bcde");
		piw.close();
		exe("sed 's/a/b/g' -", 0);
		eot("bbcb");
		eot("bcde");
		eot();
	}

	public void test007() {
		piw.close();
		exe("sed 's/a/b/g' sed1.txt", 0);
		eot("bbcd");
		eot("bcde");
		eot();
	}

	public void testI001() {
		redef(qiw, "EUC-JP");
		redef(qor, "EUC-JP");
		rev.bind("LANG", "ja_JP.EUC-JP");
		piw.println("ｖｖｖｖ");
		piw.close();
		exc("sed 's/ｖ/ｂ/'", 0);
		eot("ｂｖｖｖ");
		eot();
	}

}
