Browse Source

Rename backend_js to backend_node

github-actions
Garrit Franke 2 years ago
parent
commit
164eba3404
  1. 4
      Cargo.toml
  2. 2
      src/generator/mod.rs
  3. 18
      src/tests/mod.rs
  4. 19
      src/tests/test_examples.rs

4
Cargo.toml

@ -8,9 +8,9 @@ edition = "2018"
[features]
backend_c = []
backend_js = []
backend_node = []
default = ["backend_js"]
default = ["backend_node"]
[dependencies]
structopt = "0.3.21"

2
src/generator/mod.rs

@ -31,7 +31,7 @@ pub fn generate(prog: Program) -> String {
c::CGenerator::generate(prog)
}
#[cfg(feature = "backend_js")]
#[cfg(feature = "backend_node")]
{
js::JsGenerator::generate(prog)
}

18
src/tests/mod.rs

@ -1 +1,19 @@
/**
* Copyright 2020 Garrit Franke
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// This test currently only runs on the node backend, and has to be disabled for the C backend
#[cfg(backend_node)]
mod test_examples;

19
src/tests/test_examples.rs

@ -45,14 +45,17 @@ fn test_examples() -> Result<(), Error> {
.success();
assert_eq!(success, true, "{:?}", &in_file);
let node_installed = Command::new("node").arg("-v").spawn()?.wait()?.success();
if node_installed {
let execution = Command::new("node")
.arg(out_file)
.spawn()?
.wait()?
.success();
assert_eq!(execution, true, "{:?}", &in_file)
#[cfg(backend_node)]
{
let node_installed = Command::new("node").arg("-v").spawn()?.wait()?.success();
if node_installed {
let execution = Command::new("node")
.arg(out_file)
.spawn()?
.wait()?
.success();
assert_eq!(execution, true, "{:?}", &in_file)
}
}
}
Ok(())

Loading…
Cancel
Save