ceedling 0.29.0 → 0.29.1
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/assets/project_as_gem.yml +2 -5
- data/assets/project_with_guts.yml +2 -5
- data/assets/project_with_guts_gcov.yml +2 -5
- data/bin/ceedling +14 -12
- data/ceedling.sublime-project +26 -23
- data/docs/CeedlingPacket.md +17 -2
- data/docs/CeedlingUpgrade.md +83 -0
- data/lib/ceedling/build_invoker_utils.rb +1 -1
- data/lib/ceedling/cacheinator_helper.rb +2 -2
- data/lib/ceedling/dependinator.rb +2 -2
- data/lib/ceedling/generator_test_results.rb +13 -2
- data/lib/ceedling/tasks_base.rake +17 -23
- data/lib/ceedling/tasks_filesystem.rake +12 -3
- data/lib/ceedling/tasks_tests.rake +1 -1
- data/lib/ceedling/test_invoker.rb +1 -1
- data/lib/ceedling/version.rb +28 -14
- data/plugins/gcov/gcov.rake +3 -3
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +4 -3
- data/spec/spec_system_helper.rb +42 -2
- data/spec/support/test_example.fail +2 -0
- data/spec/support/test_example.pass +2 -0
- data/spec/support/test_example_ignore.pass +2 -0
- data/spec/support/test_example_mangled.pass +1 -0
- data/spec/support/test_example_with_time.pass +2 -0
- data/spec/system/deployment_spec.rb +6 -0
- data/vendor/cmock/docs/CMock_Summary.md +8 -1
- data/vendor/cmock/lib/cmock_config.rb +11 -1
- data/vendor/cmock/lib/cmock_generator.rb +7 -0
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +2 -2
- data/vendor/cmock/lib/cmock_header_parser.rb +123 -13
- data/vendor/cmock/src/cmock.h +1 -1
- data/vendor/cmock/test/system/test_compilation/config.yml +1 -0
- data/vendor/cmock/test/system/test_compilation/inline.h +23 -0
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +1 -0
- data/vendor/cmock/test/unit/cmock_config_test.rb +3 -0
- data/vendor/cmock/test/unit/cmock_config_test.yml +2 -1
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +3 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +4 -4
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +272 -0
- metadata +4 -3
- data/out.fail +0 -22
data/vendor/cmock/src/cmock.h
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
#define CMOCK_VERSION_MAJOR 2
|
13
13
|
#define CMOCK_VERSION_MINOR 5
|
14
|
-
#define CMOCK_VERSION_BUILD
|
14
|
+
#define CMOCK_VERSION_BUILD 1
|
15
15
|
#define CMOCK_VERSION ((CMOCK_VERSION_MAJOR << 16) | (CMOCK_VERSION_MINOR << 8) | CMOCK_VERSION_BUILD)
|
16
16
|
|
17
17
|
//should be big enough to index full range of CMOCK_MEM_MAX
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
static inline int dummy_func_0(void) {
|
3
|
+
return 5;
|
4
|
+
}
|
5
|
+
|
6
|
+
inline static int dummy_func_1(int a) {
|
7
|
+
int a = dummy_func_0();
|
8
|
+
int b = 10;
|
9
|
+
|
10
|
+
return a + b;
|
11
|
+
}
|
12
|
+
|
13
|
+
int inline static dummy_func_2(int a, char b, float c) {
|
14
|
+
c += 3.14;
|
15
|
+
b -= 32;
|
16
|
+
return a + (int)(b) + (int)c;
|
17
|
+
}
|
18
|
+
|
19
|
+
void dummy_normal_func(int a);
|
20
|
+
|
21
|
+
inline void dummy_func_3(void) {
|
22
|
+
//NOP
|
23
|
+
}
|
@@ -19,6 +19,7 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
|
19
19
|
assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes)
|
20
20
|
assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins)
|
21
21
|
assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs)
|
22
|
+
assert_equal(CMockConfig::CMockDefaultOptions[:treat_inlines], config.treat_inlines)
|
22
23
|
end
|
23
24
|
|
24
25
|
it "replace only options specified in a hash" do
|
@@ -30,6 +31,7 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
|
30
31
|
assert_equal(test_attributes, config.attributes)
|
31
32
|
assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins)
|
32
33
|
assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs)
|
34
|
+
assert_equal(CMockConfig::CMockDefaultOptions[:treat_inlines], config.treat_inlines)
|
33
35
|
end
|
34
36
|
|
35
37
|
it "replace only options specified in a yaml file" do
|
@@ -40,6 +42,7 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
|
40
42
|
assert_nil(config.includes)
|
41
43
|
assert_equal(test_plugins, config.plugins)
|
42
44
|
assert_equal(:include, config.treat_externs)
|
45
|
+
assert_equal(:include, config.treat_inlines)
|
43
46
|
end
|
44
47
|
|
45
48
|
it "populate treat_as map with internal standard_treat_as_map defaults, redefine defaults, and add custom values" do
|
@@ -54,6 +54,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
54
54
|
@config.expect :includes_c_post_header, nil
|
55
55
|
@config.expect :subdir, nil
|
56
56
|
@config.expect :fail_on_unexpected_calls, true
|
57
|
+
@config.expect :treat_inlines, :exclude
|
57
58
|
@cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
|
58
59
|
@cmock_generator.module_name = @module_name
|
59
60
|
@cmock_generator.mock_name = "Mock#{@module_name}"
|
@@ -72,6 +73,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
72
73
|
@config.expect :includes_c_post_header, nil
|
73
74
|
@config.expect :subdir, nil
|
74
75
|
@config.expect :fail_on_unexpected_calls, true
|
76
|
+
@config.expect :treat_inlines, :exclude
|
75
77
|
@cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
|
76
78
|
@cmock_generator_strict.module_name = @module_name
|
77
79
|
@cmock_generator_strict.mock_name = "Mock#{@module_name}"
|
@@ -133,6 +135,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
133
135
|
@config.expect :includes_c_post_header, nil
|
134
136
|
@config.expect :subdir, nil
|
135
137
|
@config.expect :fail_on_unexpected_calls, true
|
138
|
+
@config.expect :treat_inlines, :exclude
|
136
139
|
@cmock_generator2 = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
|
137
140
|
@cmock_generator2.module_name = "Pout-Pout Fish"
|
138
141
|
@cmock_generator2.mock_name = "MockPout-Pout Fish"
|
@@ -191,9 +191,9 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|
191
191
|
expected = [" if (!Mock.Apple_CallbackBool &&\n",
|
192
192
|
" Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
193
193
|
" {\n",
|
194
|
-
" int
|
194
|
+
" int cmock_cb_ret = Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n",
|
195
195
|
" UNITY_CLR_DETAILS();\n",
|
196
|
-
" return
|
196
|
+
" return cmock_cb_ret;\n",
|
197
197
|
" }\n"
|
198
198
|
].join
|
199
199
|
returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function)
|
@@ -246,9 +246,9 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|
246
246
|
expected = [" if (!Mock.Apple_CallbackBool &&\n",
|
247
247
|
" Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
248
248
|
" {\n",
|
249
|
-
" int
|
249
|
+
" int cmock_cb_ret = Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n",
|
250
250
|
" UNITY_CLR_DETAILS();\n",
|
251
|
-
" return
|
251
|
+
" return cmock_cb_ret;\n",
|
252
252
|
" }\n"
|
253
253
|
].join
|
254
254
|
returned = @cmock_generator_plugin_callback.mock_implementation_precheck(function)
|
@@ -23,6 +23,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
23
23
|
@config.expect :when_no_prototypes, :error
|
24
24
|
@config.expect :verbosity, 1
|
25
25
|
@config.expect :treat_externs, :exclude
|
26
|
+
@config.expect :treat_inlines, :exclude
|
26
27
|
@config.expect :array_size_type, ['int', 'size_t']
|
27
28
|
@config.expect :array_size_name, 'size|len'
|
28
29
|
|
@@ -453,6 +454,60 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
453
454
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
454
455
|
end
|
455
456
|
|
457
|
+
it "leave inline functions if inline to be included" do
|
458
|
+
source =
|
459
|
+
"extern uint32 foobar(unsigned int);\n" +
|
460
|
+
"uint32 extern_name_func(unsigned int);\n" +
|
461
|
+
"uint32 funcinline(unsigned int);\n" +
|
462
|
+
"inline void inlineBar(unsigned int);\n" +
|
463
|
+
"extern int extern_bar(void);\n" +
|
464
|
+
"static inline void staticinlineBar(unsigned int);\n" +
|
465
|
+
"static inline void bar(unsigned int);\n" +
|
466
|
+
"static inline void bar(unsigned int)\n" +
|
467
|
+
"{\n" +
|
468
|
+
" // NOP\n" +
|
469
|
+
"}\n"
|
470
|
+
|
471
|
+
expected =
|
472
|
+
[ "uint32 extern_name_func(unsigned int)",
|
473
|
+
"uint32 funcinline(unsigned int)",
|
474
|
+
"void inlineBar(unsigned int)",
|
475
|
+
"void staticinlineBar(unsigned int)",
|
476
|
+
"void bar(unsigned int)"
|
477
|
+
]
|
478
|
+
|
479
|
+
@parser.treat_inlines = :include
|
480
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
481
|
+
end
|
482
|
+
|
483
|
+
it "leave inline and extern functions if inline and extern to be included" do
|
484
|
+
source =
|
485
|
+
"extern uint32 foobar(unsigned int);\n" +
|
486
|
+
"uint32 extern_name_func(unsigned int);\n" +
|
487
|
+
"uint32 funcinline(unsigned int);\n" +
|
488
|
+
"inline void inlineBar(unsigned int);\n" +
|
489
|
+
"extern int extern_bar(void);\n" +
|
490
|
+
"static inline void staticinlineBar(unsigned int);\n" +
|
491
|
+
"static inline void bar(unsigned int);\n" +
|
492
|
+
"static inline void bar(unsigned int)\n" +
|
493
|
+
"{\n" +
|
494
|
+
" // NOP\n" +
|
495
|
+
"}\n"
|
496
|
+
|
497
|
+
expected =
|
498
|
+
[ "extern uint32 foobar(unsigned int)",
|
499
|
+
"uint32 extern_name_func(unsigned int)",
|
500
|
+
"uint32 funcinline(unsigned int)",
|
501
|
+
"void inlineBar(unsigned int)",
|
502
|
+
"extern int extern_bar(void)",
|
503
|
+
"void staticinlineBar(unsigned int)",
|
504
|
+
"void bar(unsigned int)"
|
505
|
+
]
|
506
|
+
|
507
|
+
@parser.treat_externs = :include
|
508
|
+
@parser.treat_inlines = :include
|
509
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
510
|
+
end
|
456
511
|
|
457
512
|
it "remove defines" do
|
458
513
|
source =
|
@@ -1725,4 +1780,221 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
1725
1780
|
end
|
1726
1781
|
end
|
1727
1782
|
|
1783
|
+
it "Transform inline functions doesn't change a header with no inlines" do
|
1784
|
+
source =
|
1785
|
+
"#ifndef _NOINCLUDES\n" +
|
1786
|
+
"#define _NOINCLUDES\n" +
|
1787
|
+
"#include \"unity.h\"\n" +
|
1788
|
+
"#include \"cmock.h\"\n" +
|
1789
|
+
"#include \"YetAnotherHeader.h\"\n" +
|
1790
|
+
"\n" +
|
1791
|
+
"/* Ignore the following warnings since we are copying code */\n" +
|
1792
|
+
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" +
|
1793
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" +
|
1794
|
+
"#pragma GCC diagnostic push\n" +
|
1795
|
+
"#endif\n" +
|
1796
|
+
"#if !defined(__clang__)\n" +
|
1797
|
+
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n" +
|
1798
|
+
"#endif\n" +
|
1799
|
+
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" +
|
1800
|
+
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" +
|
1801
|
+
"#endif\n" +
|
1802
|
+
"\n" +
|
1803
|
+
"struct my_struct {\n" +
|
1804
|
+
"int a;\n" +
|
1805
|
+
"int b;\n" +
|
1806
|
+
"int b;\n" +
|
1807
|
+
"char c;\n" +
|
1808
|
+
"};\n" +
|
1809
|
+
"int my_function(int a);\n" +
|
1810
|
+
"int my_better_function(struct my_struct *s);\n" +
|
1811
|
+
"\n" +
|
1812
|
+
"#endif _NOINCLUDES\n"
|
1813
|
+
|
1814
|
+
assert_equal(source, @parser.transform_inline_functions(source))
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
it "Transform inline functions changes inline functions to function declarations" do
|
1818
|
+
source =
|
1819
|
+
"#ifndef _NOINCLUDES\n" +
|
1820
|
+
"#define _NOINCLUDES\n" +
|
1821
|
+
"#include \"unity.h\"\n" +
|
1822
|
+
"#include \"cmock.h\"\n" +
|
1823
|
+
"#include \"YetAnotherHeader.h\"\n" +
|
1824
|
+
"\n" +
|
1825
|
+
"/* Ignore the following warnings since we are copying code */\n" +
|
1826
|
+
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" +
|
1827
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" +
|
1828
|
+
"#pragma GCC diagnostic push\n" +
|
1829
|
+
"#endif\n" +
|
1830
|
+
"#if !defined(__clang__)\n" +
|
1831
|
+
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n" +
|
1832
|
+
"#endif\n" +
|
1833
|
+
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" +
|
1834
|
+
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" +
|
1835
|
+
"#endif\n" +
|
1836
|
+
"\n" +
|
1837
|
+
"struct my_struct {\n" +
|
1838
|
+
"int a;\n" +
|
1839
|
+
"int b;\n" +
|
1840
|
+
"int b;\n" +
|
1841
|
+
"char c;\n" +
|
1842
|
+
"};\n" +
|
1843
|
+
"int my_function(int a);\n" +
|
1844
|
+
"int my_better_function(struct my_struct *s);\n" +
|
1845
|
+
"static inline int staticinlinebar(struct my_struct *s)\n" + # This is a function with a lot of indentation levels, we should be able to handle it
|
1846
|
+
"{\n" +
|
1847
|
+
"\t{\n" +
|
1848
|
+
"\t\t{\n" +
|
1849
|
+
"\t\t\treturn s->a;\n" +
|
1850
|
+
"\t\t}\n" +
|
1851
|
+
"\t}\n" +
|
1852
|
+
"}\n" +
|
1853
|
+
"static inline int staticinlinefunc(struct my_struct *s)\n" +
|
1854
|
+
"{\n" +
|
1855
|
+
" return s->a;\n" +
|
1856
|
+
"}\n" +
|
1857
|
+
"int bar(struct my_struct *s);\n" + # A normal function to screw with our parser
|
1858
|
+
"inline static int inlinestaticfunc(int a) {\n" +
|
1859
|
+
" return a + 42;\n" +
|
1860
|
+
"}\n" +
|
1861
|
+
"inline int StaticInlineFunc(struct my_struct *s)\n" +
|
1862
|
+
"{\n" +
|
1863
|
+
" return get_member_a(s) + 42;\n" +
|
1864
|
+
"}\n" +
|
1865
|
+
"int inline StaticInlineBar(struct my_struct *s)\n" +
|
1866
|
+
"{\n" +
|
1867
|
+
" return get_member_a(s) + 42;\n" +
|
1868
|
+
"}\n" +
|
1869
|
+
"struct staticinlinestruct {\n" + # Add a structure declaration between the inline functions, just to make sure we don't touch it!
|
1870
|
+
"int a;\n" +
|
1871
|
+
"};\n" +
|
1872
|
+
"\n" +
|
1873
|
+
"struct staticinlinestruct fubarstruct(struct my_struct *s);\n" + # Another normal function to screw with our parser
|
1874
|
+
"static inline struct staticinlinestruct inlinefubarfunction(struct my_struct *s)\n" +
|
1875
|
+
"{\n" +
|
1876
|
+
" return (struct staticinlinestruct)*s;\n" +
|
1877
|
+
"}\n" +
|
1878
|
+
"int fubar(struct my_struct *s);\n" + # Another normal function to screw with our parser
|
1879
|
+
"inline int stuff(int num)" +
|
1880
|
+
"{" +
|
1881
|
+
" int reg = 0x12;" +
|
1882
|
+
" if (num > 0)" +
|
1883
|
+
" {" +
|
1884
|
+
" reg |= (0x0Eu);" +
|
1885
|
+
" }" +
|
1886
|
+
" else" +
|
1887
|
+
" {" +
|
1888
|
+
" reg |= (0x07u);" +
|
1889
|
+
" }" +
|
1890
|
+
" return reg;" +
|
1891
|
+
"}" +
|
1892
|
+
"\n" +
|
1893
|
+
"int inline static dummy_func_2(int a, char b, float c) {" + # This is a sneaky one, inline static is placed AFTER the return value
|
1894
|
+
" c += 3.14;" +
|
1895
|
+
" b -= 32;" +
|
1896
|
+
" return a + (int)(b) + (int)c;" +
|
1897
|
+
"}" +
|
1898
|
+
"#endif _NOINCLUDES\n"
|
1899
|
+
|
1900
|
+
expected =
|
1901
|
+
"#ifndef _NOINCLUDES\n" +
|
1902
|
+
"#define _NOINCLUDES\n" +
|
1903
|
+
"#include \"unity.h\"\n" +
|
1904
|
+
"#include \"cmock.h\"\n" +
|
1905
|
+
"#include \"YetAnotherHeader.h\"\n" +
|
1906
|
+
"\n" +
|
1907
|
+
"/* Ignore the following warnings since we are copying code */\n" +
|
1908
|
+
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" +
|
1909
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" +
|
1910
|
+
"#pragma GCC diagnostic push\n" +
|
1911
|
+
"#endif\n" +
|
1912
|
+
"#if !defined(__clang__)\n" +
|
1913
|
+
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n" +
|
1914
|
+
"#endif\n" +
|
1915
|
+
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" +
|
1916
|
+
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" +
|
1917
|
+
"#endif\n" +
|
1918
|
+
"\n" +
|
1919
|
+
"struct my_struct {\n" +
|
1920
|
+
"int a;\n" +
|
1921
|
+
"int b;\n" +
|
1922
|
+
"int b;\n" +
|
1923
|
+
"char c;\n" +
|
1924
|
+
"};\n" +
|
1925
|
+
"int my_function(int a);\n" +
|
1926
|
+
"int my_better_function(struct my_struct *s);\n" +
|
1927
|
+
"int staticinlinebar(struct my_struct *s);\n" +
|
1928
|
+
"int staticinlinefunc(struct my_struct *s);\n" +
|
1929
|
+
"int bar(struct my_struct *s);\n" +
|
1930
|
+
"int inlinestaticfunc(int a);\n" +
|
1931
|
+
"int StaticInlineFunc(struct my_struct *s);\n" +
|
1932
|
+
"int StaticInlineBar(struct my_struct *s);\n" +
|
1933
|
+
"struct staticinlinestruct {\n" +
|
1934
|
+
"int a;\n" +
|
1935
|
+
"};\n" +
|
1936
|
+
"\n" +
|
1937
|
+
"struct staticinlinestruct fubarstruct(struct my_struct *s);\n" +
|
1938
|
+
"struct staticinlinestruct inlinefubarfunction(struct my_struct *s);\n" +
|
1939
|
+
"int fubar(struct my_struct *s);\n" +
|
1940
|
+
"int stuff(int num);\n" +
|
1941
|
+
"int dummy_func_2(int a, char b, float c);" +
|
1942
|
+
"#endif _NOINCLUDES\n"
|
1943
|
+
|
1944
|
+
assert_equal(expected, @parser.transform_inline_functions(source))
|
1945
|
+
end
|
1946
|
+
|
1947
|
+
it "Count number of pairs of braces in function succesfully" do
|
1948
|
+
source =
|
1949
|
+
"int foo(struct my_struct *s)\n" +
|
1950
|
+
"{\n" +
|
1951
|
+
" return get_member_a(s) + 42;\n" +
|
1952
|
+
"}\n"
|
1953
|
+
complex_source =
|
1954
|
+
"int bar(struct my_struct *s)\n" +
|
1955
|
+
"{\n" +
|
1956
|
+
"\tint a = 6;\n" +
|
1957
|
+
"\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
1958
|
+
"\t{\n" +
|
1959
|
+
"\t\tint a = 5;\n" +
|
1960
|
+
"\t\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
1961
|
+
"\t\t{\n" +
|
1962
|
+
"\t\t\tstruct my_struct a = {.nr = 1};\n" +
|
1963
|
+
"\t\t}\n" +
|
1964
|
+
"\t}\n" +
|
1965
|
+
"\treturn 42;\n" +
|
1966
|
+
"}\n"
|
1967
|
+
|
1968
|
+
assert_equal(1, @parser.count_number_of_pairs_of_braces_in_function(source))
|
1969
|
+
assert_equal(6, @parser.count_number_of_pairs_of_braces_in_function(complex_source))
|
1970
|
+
end
|
1971
|
+
|
1972
|
+
it "Count number of pairs of braces returns 0 if bad source is supplied" do
|
1973
|
+
bad_source_0 =
|
1974
|
+
"int foo(struct my_struct *s)\n" +
|
1975
|
+
"{\n" +
|
1976
|
+
" return get_member_a(s) + 42;\n" +
|
1977
|
+
"\n" # Missing closing brace
|
1978
|
+
bad_source_1 =
|
1979
|
+
"int bar(struct my_struct *s)\n" +
|
1980
|
+
"{\n" +
|
1981
|
+
"\tint a = 6;\n" +
|
1982
|
+
"\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
1983
|
+
"\t{\n" +
|
1984
|
+
"\t\tint a = 5;\n" +
|
1985
|
+
"\t\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
1986
|
+
"\t\t{\n" +
|
1987
|
+
"\t\t\n" + # Missing closing brace
|
1988
|
+
"\t}\n" +
|
1989
|
+
"\treturn 42;\n" +
|
1990
|
+
"}\n"
|
1991
|
+
bad_source_2 =
|
1992
|
+
"int foo(struct my_struct *s)\n" +
|
1993
|
+
"\n" # No braces in source
|
1994
|
+
|
1995
|
+
assert_equal(0, @parser.count_number_of_pairs_of_braces_in_function(bad_source_0))
|
1996
|
+
assert_equal(0, @parser.count_number_of_pairs_of_braces_in_function(bad_source_1))
|
1997
|
+
assert_equal(0, @parser.count_number_of_pairs_of_braces_in_function(bad_source_2))
|
1998
|
+
end
|
1999
|
+
|
1728
2000
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ceedling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.29.
|
4
|
+
version: 0.29.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Karlesky, Mark VanderVoord
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-11-
|
13
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- docs/CeedlingPacket.md
|
88
88
|
- docs/CeedlingPacket.odt
|
89
89
|
- docs/CeedlingPacket.pdf
|
90
|
+
- docs/CeedlingUpgrade.md
|
90
91
|
- docs/ThrowTheSwitchCodingStandard.md
|
91
92
|
- examples/blinky/project.yml
|
92
93
|
- examples/blinky/rakefile.rb
|
@@ -254,7 +255,6 @@ files:
|
|
254
255
|
- lib/ceedling/version.rb
|
255
256
|
- lib/ceedling/yaml_wrapper.rb
|
256
257
|
- license.txt
|
257
|
-
- out.fail
|
258
258
|
- plugins/beep/README.md
|
259
259
|
- plugins/beep/lib/beep.rb
|
260
260
|
- plugins/bullseye/assets/template.erb
|
@@ -675,6 +675,7 @@ files:
|
|
675
675
|
- vendor/cmock/test/system/test_compilation/callingconv.h
|
676
676
|
- vendor/cmock/test/system/test_compilation/config.yml
|
677
677
|
- vendor/cmock/test/system/test_compilation/const.h
|
678
|
+
- vendor/cmock/test/system/test_compilation/inline.h
|
678
679
|
- vendor/cmock/test/system/test_compilation/osek.h
|
679
680
|
- vendor/cmock/test/system/test_compilation/parsing.h
|
680
681
|
- vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml
|