mkdir() private méthode

private mkdir ( ) : bool
Résultat bool
		private void saveBytecode(String className, byte[] bytecode) {
			var generatedPath = PathHelper.combine(System.getProperty("user.dir"), "Tests/resources/TypeBuilderTest/stab");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var stream = new FileOutputStream(PathHelper.combine(generatedPath, className + ".class"));
			stream.write(bytecode);
			stream.close();
		}
		private void doTest(String test) {
			var userDir = System.getProperty("user.dir");
			var sourcePath = PathHelper.combine(PathHelper.combine(userDir, "tests/resources/ParseExpressionTest/sources"), test + ".txt");
			var fileReader = new InputStreamReader(new FileInputStream((sourcePath)), Charset.forName("UTF-8"));
			var code = readToEnd(fileReader);
			text = code.toCharArray();
			var parser = new Parser();
			var scanner = new SourceCodeScanner(new CodeErrorManager(), text);
			var expression = parser.parseExpression(scanner);
			var result = expressionToString(expression);
			
			var generatedPath = PathHelper.combine(userDir, "tests/resources/ParseExpressionTest/generated");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var fileWriter = new FileWriter(PathHelper.combine(generatedPath, test + ".txt"));
			fileWriter.write(result);
			fileWriter.close();
			
			var expectedPath = PathHelper.combine(userDir, "tests/resources/ParseExpressionTest/expected");
			var expectedFile = new File(PathHelper.combine(expectedPath, test + ".txt"));
			Assert.assertTrue("Expected file not found: " + expectedFile, expectedFile.exists());
			fileReader = new InputStreamReader(new FileInputStream((expectedFile)), Charset.forName("UTF-8"));
			var reference = readToEnd(fileReader);
			
			var genReader = new BufferedReader(new StringReader(result));
			var refReader = new BufferedReader(new StringReader(reference));
			for (;;) {
				var genLine = genReader.readLine();
				var refLine = refReader.readLine();
				if (genLine == null && refLine == null) {
					break;
				}
				Assert.assertEquals(refLine, genLine);
			}
		}
Exemple #3
0
 private File chunkFileForXZ(int i, int j)
 {
     string s =
         (new StringBuilder()).append("c.").append(Integer.toString(i, 36)).append(".").append(
             Integer.toString(j, 36)).append(".dat").toString();
     string s1 = Integer.toString(i & 0x3f, 36);
     string s2 = Integer.toString(j & 0x3f, 36);
     var file = new File(saveDir, s1);
     if (!file.exists())
     {
         if (createIfNecessary)
         {
             file.mkdir();
         }
         else
         {
             return null;
         }
     }
     file = new File(file, s2);
     if (!file.exists())
     {
         if (createIfNecessary)
         {
             file.mkdir();
         }
         else
         {
             return null;
         }
     }
     file = new File(file, s);
     if (!file.exists() && !createIfNecessary)
     {
         return null;
     }
     else
     {
         return file;
     }
 }
		private void doTest(String test, LambdaExpression lambda) {
			variables = new ArrayList<VariableExpression>();
			labels = new ArrayList<Label>();
			switchLabels = new ArrayList<SwitchLabel>();
			
			var result = lambdaToString(lambda);
			
			var userDir = System.getProperty("user.dir");
			var generatedPath = PathHelper.combine(userDir, "tests/resources/ExpressionTreesTest/generated");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var fileWriter = new FileWriter(PathHelper.combine(generatedPath, test + ".txt"));
			fileWriter.write(result);
			fileWriter.close();
		
			var referencePath = PathHelper.combine(PathHelper.combine(userDir, "tests/resources/ExpressionTreesTest/references"), test + ".txt");
			var referenceFile = new File(referencePath);
			String reference = null;
			if (referenceFile.exists()) {
				var fileReader = new InputStreamReader(new FileInputStream((referencePath)), Charset.forName("UTF-8"));
				reference = readToEnd(fileReader);
			} else {
				Assert.fail("No reference for '" + test + "'");
			}
			
			if (reference != null) {
				var genReader = new BufferedReader(new StringReader(result));
				var refReader = new BufferedReader(new StringReader(reference));
				for (;;) {
					var genLine = genReader.readLine();
					var refLine = refReader.readLine();
					if (genLine == null && refLine == null) {
						break;
					}
					Assert.assertEquals(refLine, genLine);
				}
			}
		}
 public virtual File newFolder(string folderName)
 {
   File.__\u003Cclinit\u003E();
   File file = new File(this.folder, folderName);
   file.mkdir();
   return file;
 }
		private void doTest(String test, TypeInfo typeInfo) {
			String result = typeToString(typeInfo, "");
			
			var userDir = System.getProperty("user.dir");
			var generatedPath = PathHelper.combine(userDir, "Tests/resources/TypeSystemTest/generated");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var fileWriter = new FileWriter(PathHelper.combine(generatedPath, test + ".txt"));
			fileWriter.write(result);
			fileWriter.close();
			
			var expectedPath = PathHelper.combine(userDir, "Tests/resources/TypeSystemTest/expected");
			var expectedFile = new File(PathHelper.combine(expectedPath, test + ".txt"));
			Assert.assertTrue("Expected file not found: " + expectedFile, expectedFile.exists());
			var fileReader = new InputStreamReader(new FileInputStream((expectedFile)), Charset.forName("UTF-8"));
			var reference = readToEnd(fileReader);
			
			var genReader = new BufferedReader(new StringReader(result));
			var refReader = new BufferedReader(new StringReader(reference));
			for (;;) {
				var genLine = genReader.readLine();
				var refLine = refReader.readLine();
				if (genLine == null && refLine == null) {
					break;
				}
				Assert.assertEquals(refLine, genLine);
			}
		}