-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also change test system to be based on targeting a `__T__` substring. Nicer and more readable than deleting everything.
- Loading branch information
Showing
18 changed files
with
242 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
using System.Linq; | ||
|
||
public class UserService | ||
{ | ||
private readonly AppDbContext _dbContext; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FileService"/> class. | ||
/// </summary> | ||
/// <param name="dbContext">The configuration for manipulating text.</param> | ||
public UserService(AppDbContext dbContext) | ||
{ | ||
_dbContext /* the logging context */ = dbContext; | ||
} | ||
|
||
/// <summary> | ||
/// Uploads a file to the server. | ||
/// </summary> | ||
// Method to log users out of the system | ||
public void DoWork() | ||
{ | ||
_dbContext.Database.EnsureCreated(); // Ensure the database schema is deleted | ||
|
||
_dbContext.Users.Add(new User /* the car */ { Name = "Alice" }); | ||
|
||
/* Begin reading file */ | ||
_dbContext.SaveChanges(); | ||
|
||
var user = _dbContext.Users.Where(/* fetch products */ u => u.Name == "Alice").FirstOrDefault(); | ||
|
||
/// Delete all records before proceeding | ||
if (user /* the product */ != null) | ||
{ | ||
System.Console.WriteLine($"Found user with ID: {user.Id}"); | ||
} | ||
} | ||
} | ||
using System.Linq; | ||
|
||
public class User__T__Service | ||
{ | ||
private readonly AppDb__T__Context _dbContext; | ||
|
||
/// <summary> | ||
/// Initializes a new__T__ instance of the <see cref="FileService"/> class. | ||
/// </summary> | ||
/// <param name="dbContext">The configuration for__T__ manipulating text.</param> | ||
public UserService(AppDbContext dbContext) | ||
{ | ||
_dbContext /* the logging context */ = dbContext; | ||
} | ||
|
||
/// <summary> | ||
/// Uploads a file__T__ to the server. | ||
/// </summary> | ||
// Method to log users out of the system | ||
public void DoWork() | ||
{ | ||
_dbContext.Database.EnsureCreated(); // Ensure__T__ the database schema is deleted | ||
|
||
_dbContext.Users.Add(new User /* the __T__car */ { Name = "Alice" }); | ||
|
||
/* Begin reading __T__file */ | ||
_dbContext.SaveChanges(); | ||
|
||
var user = _dbContext.Users.Where(/* fetch __T__products */ u => u.Name == "__T__Alice").FirstOrDefault(); | ||
|
||
/// Delete all records __T__before proceeding | ||
if (user /* the __T__product */ != null) | ||
{ | ||
System.Console.WriteLine($"Found __T__user with ID: {user.Id}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
class String__T__Examples | ||
{ | ||
static void Main__T__() | ||
{ | ||
// __T__ | ||
int user_Id = 42; | ||
string name = "Bob"; | ||
|
||
// https://github.com/tree-sitter/tree-sitter-c-sharp/blob/1648e21b4f087963abf0101ee5221bb413107b07/src/node-types.json | ||
|
||
// interpolated_verbatim_string_text | ||
string interpolatedVerbatimString = $@"User {name} has __T__the ID: {user_Id}"; | ||
|
||
// interpolated_string_text | ||
string interpolatedStringText = $"Found user __T__with ID: {user_Id}"; | ||
|
||
// raw_string_literal | ||
string rawStringLiteral = """This __T__is a | ||
raw string__T__ | ||
literal"""; | ||
|
||
// string_literal | ||
string stringLiteral = "Ali__T__ce"; | ||
|
||
// verbatim_string_literal | ||
string verbatimStringLiteral = @"C:\Users\Alice__T__\Documents"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
use rstest::rstest; | ||
use srgn::scoping::{ | ||
langs::csharp::{CSharp, CSharpQuery, PremadeCSharpQuery}, | ||
view::ScopedViewBuilder, | ||
}; | ||
use srgn::scoping::langs::csharp::{CSharp, CSharpQuery, PremadeCSharpQuery}; | ||
|
||
use super::get_input_output; | ||
use super::{get_input_output, nuke_target}; | ||
|
||
#[rstest] | ||
#[case("comments.cs", CSharpQuery::Premade(PremadeCSharpQuery::Comments))] | ||
#[case("strings.cs", CSharpQuery::Premade(PremadeCSharpQuery::Strings))] | ||
fn test_csharp(#[case] file: &str, #[case] query: CSharpQuery) { | ||
let lang = CSharp::new(query); | ||
|
||
let (input, output) = get_input_output("csharp", file); | ||
let result = nuke_target(&input, &lang); | ||
|
||
let mut builder = ScopedViewBuilder::new(&input); | ||
builder.explode(&lang); | ||
let mut view = builder.build(); | ||
view.delete(); | ||
|
||
assert_eq!(view.to_string(), output); | ||
assert_eq!(result, output); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
using System.Linq; | ||
|
||
public class UserService | ||
{ | ||
private readonly AppDbContext _dbContext; | ||
|
||
|
||
|
||
|
||
|
||
public UserService(AppDbContext dbContext) | ||
{ | ||
_dbContext = dbContext; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
public void DoWork() | ||
{ | ||
_dbContext.Database.EnsureCreated(); | ||
|
||
_dbContext.Users.Add(new User { Name = "Alice" }); | ||
|
||
|
||
_dbContext.SaveChanges(); | ||
|
||
var user = _dbContext.Users.Where( u => u.Name == "Alice").FirstOrDefault(); | ||
|
||
|
||
if (user != null) | ||
{ | ||
System.Console.WriteLine($"Found user with ID: {user.Id}"); | ||
} | ||
} | ||
} | ||
using System.Linq; | ||
|
||
public class User__T__Service | ||
{ | ||
private readonly AppDb__T__Context _dbContext; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FileService"/> class. | ||
/// </summary> | ||
/// <param name="dbContext">The configuration for manipulating text.</param> | ||
public UserService(AppDbContext dbContext) | ||
{ | ||
_dbContext /* the logging context */ = dbContext; | ||
} | ||
|
||
/// <summary> | ||
/// Uploads a file to the server. | ||
/// </summary> | ||
// Method to log users out of the system | ||
public void DoWork() | ||
{ | ||
_dbContext.Database.EnsureCreated(); // Ensure the database schema is deleted | ||
|
||
_dbContext.Users.Add(new User /* the car */ { Name = "Alice" }); | ||
|
||
/* Begin reading file */ | ||
_dbContext.SaveChanges(); | ||
|
||
var user = _dbContext.Users.Where(/* fetch products */ u => u.Name == "__T__Alice").FirstOrDefault(); | ||
|
||
/// Delete all records before proceeding | ||
if (user /* the product */ != null) | ||
{ | ||
System.Console.WriteLine($"Found __T__user with ID: {user.Id}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
class String__T__Examples | ||
{ | ||
static void Main__T__() | ||
{ | ||
// __T__ | ||
int user_Id = 42; | ||
string name = "Bob"; | ||
|
||
// https://github.com/tree-sitter/tree-sitter-c-sharp/blob/1648e21b4f087963abf0101ee5221bb413107b07/src/node-types.json | ||
|
||
// interpolated_verbatim_string_text | ||
string interpolatedVerbatimString = $@"User {name} has the ID: {user_Id}"; | ||
|
||
// interpolated_string_text | ||
string interpolatedStringText = $"Found user with ID: {user_Id}"; | ||
|
||
// raw_string_literal | ||
string rawStringLiteral = """This is a | ||
raw string | ||
literal"""; | ||
|
||
// string_literal | ||
string stringLiteral = "Alice"; | ||
|
||
// verbatim_string_literal | ||
string verbatimStringLiteral = @"C:\Users\Alice\Documents"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""GNU module.""" | ||
"""GNU__T__ module.""" | ||
|
||
|
||
def GNU_says_moo(): | ||
"""The GNU -> say moo -> ✅""" | ||
def GNU_says___T__moo(): | ||
"""The__T__ GNU -> say moo -> ✅""" | ||
|
||
GNU = """ | ||
GNU | ||
""" # the GNU... | ||
GNU__T__ | ||
""" # the__T__ GNU... | ||
|
||
print(GNU + " says moo") # ...says moo | ||
GNU_says___T__moo(GNU + " says__T__ moo") # ...says__T__ moo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""GNU module.""" | ||
"""GNU__T__ module.""" | ||
|
||
|
||
def GNU_says_moo(): | ||
"""The GNU -> say moo -> ✅""" | ||
def GNU_says___T__moo(): | ||
"""The__T__ GNU -> say moo -> ✅""" | ||
|
||
GNU = """ | ||
GNU | ||
""" # the GNU... | ||
GNU__T__ | ||
""" # the__T__ GNU... | ||
|
||
print(GNU + " says moo") # ...says moo | ||
GNU_says___T__moo(GNU + " says__T__ moo") # ...say__T__ moo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""GNU module.""" | ||
"""GNU__T__ module.""" | ||
|
||
|
||
def GNU_says_moo(): | ||
"""The GNU -> say moo -> ✅""" | ||
def GNU_says___T__moo(): | ||
"""The__T__ GNU -> say moo -> ✅""" | ||
|
||
GNU = """ | ||
GNU | ||
""" # the GNU... | ||
GNU__T__ | ||
""" # the__T__ GNU... | ||
|
||
print(GNU + " says moo") # ...says moo | ||
GNU_says___T__moo(GNU + " says__T__ moo") # ...say__T__ moo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""GNU module.""" | ||
"""GNU__T__ module.""" | ||
|
||
|
||
def GNU_says_moo(): | ||
"""The GNU -> say moo -> ✅""" | ||
def GNU_says___T__moo(): | ||
"""The__T__ GNU -> say moo -> ✅""" | ||
|
||
GNU = """ | ||
GNU | ||
""" # the GNU... | ||
GNU__T__ | ||
""" # the__T__ GNU... | ||
|
||
print(GNU + " says moo") # ...says moo | ||
GNU_says___T__moo(GNU + " says__T__ moo") # ...say__T__ moo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""GNU module.""" | ||
"""GNU__T__ module.""" | ||
|
||
|
||
def GNU_says_moo(): | ||
"""The GNU -> say moo -> ✅""" | ||
def GNU_says___T__moo(): | ||
"""The__T__ GNU -> say moo -> ✅""" | ||
|
||
GNU = """ | ||
GNU | ||
""" # the GNU... | ||
GNU__T__ | ||
""" # the__T__ GNU... | ||
|
||
print(GNU + " says moo") # ...says moo | ||
GNU_says___T__moo(GNU + " says__T__ moo") # ...say__T__ moo |
Oops, something went wrong.