Skip to content

Commit

Permalink
Реализована поддержка использования переноса строк
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco committed Oct 5, 2023
1 parent aeb5a3b commit 815dece
Show file tree
Hide file tree
Showing 4 changed files with 598,612 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* This file is a part of Support Configuration.
*
* Copyright (c) 2019 - 2023
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* Support Configuration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* Support Configuration is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Support Configuration.
*/
package com.github._1c_syntax.bsl.supconf;
/*
* This file is a part of Support Configuration.
*
* Copyright (c) 2019 - 2023
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* Support Configuration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* Support Configuration is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Support Configuration.
*/
package com.github._1c_syntax.bsl.supconf;

import com.github._1c_syntax.bsl.support.SupportVariant;
import lombok.experimental.UtilityClass;
Expand All @@ -46,7 +46,7 @@
public class ParseSupportData {

// взято из https://stackoverflow.com/questions/18144431/regex-to-split-a-csv
private static final String REGEX = "(?:,|\\n|^)(\"(?:(?:\"\")*[^\"]*)*\"|[^\",\\n]*|(?:\\n|$))";
private static final String REGEX = "(?:,\\n?|\\n|^)(\"(?:(?:\"\")*[^\"]*)*\"|[^\",\\n]*|(?:\\n|$))";
private static final Pattern patternSplit = Pattern.compile(REGEX);

private static final int POINT_COUNT_CONFIGURATION = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* This file is a part of Support Configuration.
*
* Copyright (c) 2019 - 2023
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* Support Configuration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* Support Configuration is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Support Configuration.
*/
package com.github._1c_syntax.supconf;
/*
* This file is a part of Support Configuration.
*
* Copyright (c) 2019 - 2023
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* Support Configuration is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* Support Configuration is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Support Configuration.
*/
package com.github._1c_syntax.supconf;

import com.github._1c_syntax.bsl.supconf.ParseSupportData;
import com.github._1c_syntax.bsl.support.SupportVariant;
Expand Down Expand Up @@ -79,6 +79,27 @@ void readSimpleCorrectSupport() {
;
}

@Test
void readSimpleCorrectSupportClrf() {
var path = Path.of("src/test/resources/correct_crlf/Ext/ParentConfigurations.bin");
var result = ParseSupportData.readSimple(path);

assertThat(result)
.hasSize(39784)
.contains(MapEntry.entry("00035364-b591-4e6a-9219-e27dac18f687", SupportVariant.EDITABLE_SUPPORT_ENABLED))
;
}

@Test
void readSimpleCorrectSupportClrf2() {
var path = Path.of("src/test/resources/correct_crlf2/Ext/ParentConfigurations.bin");
var result = ParseSupportData.readSimple(path);

assertThat(result)
.hasSize(109840)
.contains(MapEntry.entry("00009f6c-9712-4a66-a48a-50b59fc617b6", SupportVariant.NOT_EDITABLE))
;
}
@Test
void readSimpleIncorrectSupport() {
var path = Path.of("src/test/resources/incorrect/Ext/ParentConfigurations.bin");
Expand Down
Loading

0 comments on commit 815dece

Please sign in to comment.