public void PackFilesTest2() { var target = new SevenZipComponent(new Soba(), new NullArchiver(), "."); Assert.Throws <PMArgException>(() => target.Eval("[7z pack.files({}, \"output\")]") ); using (var tf = new TempFile()) { Assert.Throws <ArgumentException>(() => target.Eval("[7z pack.files({\"" + tf.File + "\", \" \"}, \"output\")]") ); Assert.Throws <ArgumentException>(() => target.Eval("[7z pack.files({\" \", \"" + tf.File + "\"}, \"output\")]") ); Assert.Throws <ArgumentException>(() => target.Eval("[7z pack.files({\"" + tf.File + "\"}, \" \")]") ); } Assert.Throws <NotFoundException>(() => target.Eval("[7z pack.files({\"thisisreallyisnotreal.file\", \" \"}, \"output\")]") ); Assert.Throws <ArgumentException>(() => target.Eval("[7z pack.files({\" \"}, \"output\")]") ); }
public void packFilesTest1() { var target = new SevenZipComponent(); try { target.parse("[7z pack.files(\"files\", \"output\")]"); Assert.Fail("1"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } try { target.parse("[7z pack.files({\"f1\", 12}, \"output\")]"); Assert.Fail("2"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } try { target.parse("[7z pack.files({\"f1\", \"f2\"}, \"output\", SevenZip)]"); Assert.Fail("3"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } try { target.parse("[7z pack.files({\"f1\"}, \"output\").right]"); Assert.Fail("4"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } try { target.parse("[7z pack.files()]"); Assert.Fail("5"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } }
public void PackDirectoryTest1() { var target = new SevenZipComponent(new Soba(), new NullArchiver(), "."); Assert.Throws <ArgumentException>(() => target.Eval("[7z pack.directory(\" \", \"name.zip\")]") ); Assert.Throws <ArgumentException>(() => target.Eval("[7z pack.directory(\"pathtodir\", \" \")]") ); Assert.Throws <PMLevelException>(() => target.Eval("[7z pack.directory(\"dir\")]") ); Assert.Throws <PMLevelException>(() => target.Eval("[7z pack.directory(\"dir\", \"output\", SevenZip)]") ); Assert.Throws <NotSupportedOperationException>(() => target.Eval("[7z pack.directory(\"dir\", \"output\").right]") ); Assert.Throws <PMLevelException>(() => target.Eval("[7z pack.directory()]") ); }
public void ParseTest1() { var target = new SevenZipComponent(new Soba(), new NullArchiver(), "."); Assert.Throws <SubtypeNotFoundException>(() => target.Eval("[7z NotRealSubtype.check]") ); }
public void CheckTest1() { var target = new SevenZipComponent(new Soba(), new NullArchiver(), ""); Assert.Throws <IncorrectNodeException>(() => target.Eval("[7z check]") ); Assert.Throws <PMLevelException>(() => target.Eval("[7z check()]") ); }
public void checkTest1() { var target = new SevenZipComponent(); try { target.parse("[7z check]"); Assert.Fail("1"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } try { target.parse("[7z check()]"); Assert.Fail("2"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } }
public void packFilesTest2() { var target = new SevenZipComponent(); try { target.parse("[7z pack.files({}, \"output\")]"); Assert.Fail("1"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } using (var tf = new TempFile()) { try { target.parse("[7z pack.files({\"" + tf.file + "\", \" \"}, \"output\")]"); Assert.Fail("2"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } try { target.parse("[7z pack.files({\" \", \"" + tf.file + "\"}, \"output\")]"); Assert.Fail("3"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } try { target.parse("[7z pack.files({\"" + tf.file + "\"}, \" \")]"); Assert.Fail("4"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } } try { target.parse("[7z pack.files({\"thisisreallyisnotreal.file\", \" \"}, \"output\")]"); Assert.Fail("5"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } try { target.parse("[7z pack.files({\" \"}, \"output\")]"); Assert.Fail("6"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } }
public void packDirectoryTest1() { var target = new SevenZipComponent(); try { target.parse("[7z pack.directory(\" \", \"name.zip\")]"); Assert.Fail("1"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } try { target.parse("[7z pack.directory(\"pathtodir\", \" \")]"); Assert.Fail("2"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } try { target.parse("[7z pack.directory(\"dir\")]"); Assert.Fail("3"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } try { target.parse("[7z pack.directory(\"dir\", \"output\", SevenZip)]"); Assert.Fail("4"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } try { target.parse("[7z pack.directory(\"dir\", \"output\").right]"); Assert.Fail("5"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } try { target.parse("[7z pack.directory()]"); Assert.Fail("6"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } }
public void packTest1() { var target = new SevenZipComponent(); try { target.parse("[7z pack]"); Assert.Fail("1"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } try { target.parse("[7z pack files]"); Assert.Fail("2"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } try { target.parse("[7z pack.files()]"); Assert.Fail("3"); } catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } }
public static ISobaScript Configure(ISobaScript soba, IEnvironment env) { if (soba == null) { throw new ArgumentNullException(nameof(soba)); } IEncDetector detector = new EncDetector(); var fc = new FileComponent(soba, detector, new Exer(Settings.WPath, detector)); var zc = new SevenZipComponent(soba, new SzArchiver(), Settings.WPath); var nc = new NuGetComponent(soba, Settings.WPath); Settings._.WorkPathUpdated += (object sender, DataArgs <string> e) => { fc.Exer.BasePath = e.Data; zc.BasePath = e.Data; nc.BasePath = e.Data; }; //NOTE: custom order makes sense for vsSBE soba.Register(new TryComponent(soba)); soba.Register(new CommentComponent()); soba.Register(new BoxComponent(soba)); soba.Register(new ConditionComponent(soba)); soba.Register(new UserVariableComponent(soba)); soba.Register(new OwpComponent(soba, new OwpEnv(env))); soba.Register(new DteComponent(soba, new DteEnv(env))); soba.Register(new InternalComponent(soba, env, fc.Exer)); soba.Register(new EvMSBuildComponent(soba)); soba.Register(new BuildComponent(soba, new BuildEnv(env))); soba.Register(new FunctionComponent(soba)); soba.Register(fc); soba.Register(nc); soba.Register(zc); return(soba); }
public void PackFilesTest1() { var target = new SevenZipComponent(new Soba(), new NullArchiver(), "."); Assert.Throws <PMLevelException>(() => target.Eval("[7z pack.files(\"files\", \"output\")]") ); Assert.Throws <PMArgException>(() => target.Eval("[7z pack.files({\"f1\", 12}, \"output\")]") ); Assert.Throws <PMLevelException>(() => target.Eval("[7z pack.files({\"f1\", \"f2\"}, \"output\", SevenZip)]") ); Assert.Throws <NotSupportedOperationException>(() => target.Eval("[7z pack.files({\"f1\"}, \"output\").right]") ); Assert.Throws <PMLevelException>(() => target.Eval("[7z pack.files()]") ); }
public void parseTest1() { var target = new SevenZipComponent(); target.parse("[7z NotRealSubtype.check]"); }