faccts 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/faccts/04_exporting_results/{rust_file_writer.rb → rust_main_file_writer.rb} +2 -1
- data/lib/faccts/04_exporting_results/rust_specified_file_writer.rb +50 -0
- data/lib/faccts/integration/basic_acceptance_tester.rb +3 -1
- data/lib/faccts/integration/factories/rust_file_writer_factory.rb +21 -0
- data/lib/faccts/integration/input_fetchers/command_line_arguments_input_fetcher.rb +18 -0
- data/lib/faccts/version.rb +1 -1
- data/lib/faccts.rb +4 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e80c878a07aa3d40019251c067c1f18f9dfa836f79f24610c0898118c7d5ec8a
|
|
4
|
+
data.tar.gz: 57d405fe053c1ae135d828fe4bfb349a5646fa4ef657579cd576f08a6cf294c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1293558b47d9834002a4ed211c1a84418b7a7b7f141751e323ec48382279e25bda585dd07095cacd5cde08a4d2f1e37e03ea19fd653b68054a44a4d36f647c31
|
|
7
|
+
data.tar.gz: 9d557e85e4e3010bcb2ee7867ca4a51d872633d788e41f9139e41113c2d8f8eed2108dc6b202f6f69fa9193482741012c983402cbc2b9f368554a1f6a4f49e78
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Faccts
|
|
4
|
-
class
|
|
4
|
+
class RustMainFileWriter
|
|
5
5
|
TARGET_FILE_PATH = "./src/main.rs"
|
|
6
6
|
|
|
7
7
|
def write_file!(code_to_write)
|
|
8
8
|
raise FileAlreadyExistsError if file_already_exists?
|
|
9
9
|
|
|
10
10
|
@file_contents = code_to_write
|
|
11
|
+
|
|
11
12
|
write_file
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faccts
|
|
4
|
+
class RustSpecifiedFileWriter
|
|
5
|
+
TARGET_FILE_NAME = "acceptance_tests.rs"
|
|
6
|
+
|
|
7
|
+
attr_reader :target_file_path
|
|
8
|
+
|
|
9
|
+
def initialize(target_file_path)
|
|
10
|
+
@target_file_path = target_file_path
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def write_file!(file_contents)
|
|
14
|
+
raise UnknownWriteDestinationError if target_file_path_is_not_specified?
|
|
15
|
+
raise InvalidWriteDestinationError, target_file_path unless target_file_path_is_valid?
|
|
16
|
+
|
|
17
|
+
@file_contents = file_contents
|
|
18
|
+
|
|
19
|
+
write_file
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class UnknownWriteDestinationError < ::StandardError
|
|
23
|
+
def initialize(_message = "")
|
|
24
|
+
super("Please specify a target path to write the generated test file!")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class InvalidWriteDestinationError < ::StandardError
|
|
29
|
+
def initialize(specified_target_path = "")
|
|
30
|
+
super("Unable to write generate test file to path '#{specified_target_path}'")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
attr_reader :file_contents
|
|
37
|
+
|
|
38
|
+
def target_file_path_is_not_specified?
|
|
39
|
+
target_file_path.nil? || target_file_path.empty?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def target_file_path_is_valid?
|
|
43
|
+
File.exist?(target_file_path)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def write_file
|
|
47
|
+
File.write("#{target_file_path}/#{TARGET_FILE_NAME}", file_contents)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -16,7 +16,9 @@ module Faccts
|
|
|
16
16
|
),
|
|
17
17
|
RustCodeGenerator::BasicRustMainProgramTemplateFetcher.new
|
|
18
18
|
)
|
|
19
|
-
@file_writer =
|
|
19
|
+
@file_writer = RustFileWriterFactory.new.get_file_writer_from_input(
|
|
20
|
+
CommandLineArgumentInputFetcher.new.fetch_input
|
|
21
|
+
)
|
|
20
22
|
@feedback_reporter = BasicConsoleOutput.new
|
|
21
23
|
end
|
|
22
24
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faccts
|
|
4
|
+
class RustFileWriterFactory
|
|
5
|
+
def get_file_writer_from_input(given_path)
|
|
6
|
+
@given_path = given_path
|
|
7
|
+
|
|
8
|
+
return RustMainFileWriter.new if no_given_path?
|
|
9
|
+
|
|
10
|
+
RustSpecifiedFileWriter.new(given_path)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
attr_reader :given_path
|
|
16
|
+
|
|
17
|
+
def no_given_path?
|
|
18
|
+
given_path.nil? || given_path.empty?
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faccts
|
|
4
|
+
class CommandLineArgumentInputFetcher
|
|
5
|
+
CONJOINING_DELIMITER = ","
|
|
6
|
+
DEFAULT_EMPTY_VALUE = ""
|
|
7
|
+
|
|
8
|
+
def fetch_input
|
|
9
|
+
conjoined_command_line_arguments || DEFAULT_EMPTY_VALUE
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def conjoined_command_line_arguments
|
|
15
|
+
ARGV.join(CONJOINING_DELIMITER)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/faccts/version.rb
CHANGED
data/lib/faccts.rb
CHANGED
|
@@ -17,10 +17,13 @@ require "faccts/03_generating_code/rust_test_assertion_code_generator"
|
|
|
17
17
|
require "faccts/03_generating_code/templates/basic_rust_main_program_template_fetcher"
|
|
18
18
|
require "faccts/03_generating_code/templates/basic_rust_test_assertion_call_template_fetcher"
|
|
19
19
|
|
|
20
|
-
require "faccts/04_exporting_results/
|
|
20
|
+
require "faccts/04_exporting_results/rust_main_file_writer"
|
|
21
|
+
require "faccts/04_exporting_results/rust_specified_file_writer"
|
|
21
22
|
|
|
22
23
|
require "faccts/05_reporting_feedback/basic_console_output"
|
|
23
24
|
|
|
25
|
+
require "faccts/integration/factories/rust_file_writer_factory"
|
|
26
|
+
require "faccts/integration/input_fetchers/command_line_arguments_input_fetcher"
|
|
24
27
|
require "faccts/integration/acceptance_tester"
|
|
25
28
|
require "faccts/integration/basic_acceptance_tester"
|
|
26
29
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faccts
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- bull313
|
|
@@ -27,11 +27,14 @@ files:
|
|
|
27
27
|
- lib/faccts/03_generating_code/rust_test_assertion_code_generator.rb
|
|
28
28
|
- lib/faccts/03_generating_code/templates/basic_rust_main_program_template_fetcher.rb
|
|
29
29
|
- lib/faccts/03_generating_code/templates/basic_rust_test_assertion_call_template_fetcher.rb
|
|
30
|
-
- lib/faccts/04_exporting_results/
|
|
30
|
+
- lib/faccts/04_exporting_results/rust_main_file_writer.rb
|
|
31
|
+
- lib/faccts/04_exporting_results/rust_specified_file_writer.rb
|
|
31
32
|
- lib/faccts/05_reporting_feedback/basic_console_output.rb
|
|
32
33
|
- lib/faccts/entities/test_assertion.rb
|
|
33
34
|
- lib/faccts/integration/acceptance_tester.rb
|
|
34
35
|
- lib/faccts/integration/basic_acceptance_tester.rb
|
|
36
|
+
- lib/faccts/integration/factories/rust_file_writer_factory.rb
|
|
37
|
+
- lib/faccts/integration/input_fetchers/command_line_arguments_input_fetcher.rb
|
|
35
38
|
- lib/faccts/version.rb
|
|
36
39
|
homepage: https://github.com/bull313/faccts
|
|
37
40
|
licenses: []
|
|
@@ -51,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
51
54
|
- !ruby/object:Gem::Version
|
|
52
55
|
version: '0'
|
|
53
56
|
requirements: []
|
|
54
|
-
rubygems_version:
|
|
57
|
+
rubygems_version: 4.0.3
|
|
55
58
|
specification_version: 4
|
|
56
59
|
summary: FAccTs - Framework for Acceptance Tests
|
|
57
60
|
test_files: []
|